pyro package#

pyro is a python hydrodynamics code designed for teaching and prototyping new methods.

Subpackages#

Submodules#

pyro.plot module#

pyro.plot.get_args()[source]#
pyro.plot.makeplot(plotfile_name, outfile, width, height)[source]#

plot the data in a plotfile using the solver’s vis() method

pyro.pyro_sim module#

class pyro.pyro_sim.Pyro(solver_name, *, from_commandline=False)[source]#

Bases: object

The main driver to run pyro.

add_problem(name, problem_func, *, problem_params=None)[source]#

Add a problem setup for this solver.

Parameters:
namestr

The descriptive name of the problem

problem_funcfunction

The function to initialize the state data

problem_paramsdict

A dictionary of runtime parameters needed for the problem setup

get_grid()[source]#

Return the underlying grid object for the simulation

get_sim()[source]#

Return the Simulation object

get_var(v)[source]#

Alias for the data’s get_var routine, returns the simulation data given the variable name v.

initialize_problem(problem_name, *, inputs_file=None, inputs_dict=None)[source]#

Initialize the specific problem

Parameters:
problem_namestr

Name of the problem

inputs_filestr

Filename containing problem’s runtime parameters

inputs_dictdict

Dictionary containing extra runtime parameters

run_sim()[source]#

Evolve entire simulation

single_step()[source]#

Do a single step

class pyro.pyro_sim.PyroBenchmark(solver_name, *, comp_bench=False, reset_bench_on_fail=False, make_bench=False)[source]#

Bases: Pyro

A subclass of Pyro for benchmarking. Inherits everything from pyro, but adds benchmarking routines.

compare_to_benchmark(rtol)[source]#

Are we comparing to a benchmark?

run_sim(rtol=1e-12)[source]#

Evolve entire simulation and compare to benchmark at the end.

store_as_benchmark()[source]#

Are we storing a benchmark?

pyro.pyro_sim.main()[source]#
pyro.pyro_sim.parse_args()[source]#

Parse the runtime parameters

pyro.simulation_null module#

class pyro.simulation_null.NullSimulation(solver_name, problem_name, problem_func, rp, *, problem_finalize_func=None, problem_source_func=None, timers=None, data_class=<class 'pyro.mesh.patch.CellCenterData2d'>)[source]#

Bases: object

compute_timestep()[source]#

a generic wrapper for computing the timestep that respects the driver parameters on timestepping

do_output()[source]#

is it time to output?

dovis()[source]#
evolve()[source]#
finalize()[source]#

Do any final clean-ups for the simulation and call the problem’s finalize() method.

finished()[source]#

is the simulation finished based on time or the number of steps

initialize()[source]#
method_compute_timestep()[source]#

the method-specific timestep code

preevolve()[source]#

Do any necessary evolution before the main evolve loop. This is not needed for advection

read_extras(f)[source]#

read in any simulation-specific data from an h5py file object f

write(filename)[source]#

Output the state of the simulation to an HDF5 file for plotting

write_extras(f)[source]#

write out any extra simulation-specific stuff

pyro.simulation_null.bc_setup(rp)[source]#
pyro.simulation_null.grid_setup(rp, ng=1)[source]#

pyro.test module#

class pyro.test.PyroTest(solver, problem, inputs, options)[source]#

Bases: object

pyro.test.avoid_interleaved_output(nproc)[source]#

Collect all the printed output and print it all at once to avoid interleaving.

pyro.test.do_tests(out_file, reset_fails=False, store_all_benchmarks=False, single=None, solver=None, rtol=1e-12, nproc=1)[source]#
pyro.test.main()[source]#
pyro.test.run_test(t, reset_fails, store_all_benchmarks, rtol, nproc)[source]#
pyro.test.run_test_star(args)[source]#

multiprocessing doesn’t like lambdas, so this needs to be a full function