Skip to content

Commit 9a8ca26

Browse files
authored
fix some docs and the io.read solver detection (#127)
1 parent bfed02d commit 9a8ca26

4 files changed

Lines changed: 23 additions & 22 deletions

File tree

docs/source/mesh_basics.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ We import the basic mesh functionality as:
2222

2323
.. code-block:: python
2424
25-
import mesh.patch as patch
26-
import mesh.fv as fv
27-
import mesh.boundary as bnd
28-
import mesh.array_indexer as ai
25+
import pyro.mesh.patch as patch
26+
import pyro.mesh.fv as fv
27+
import pyro.mesh.boundary as bnd
28+
import pyro.mesh.array_indexer as ai
2929
3030
There are several main objects in the patch class that we interact with:
3131

docs/source/output.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ the ghost cells).
4848
.. code-block:: python
4949
5050
import matplotlib.pyplot as plt
51-
import util_pyro.io as io
51+
import pyro.util.io_pyro as io
5252
sim = io.read("sedov_unsplit_0000.h5")
5353
dens = sim.cc_data.get_var("density")
5454
plt.plot(dens.g.x, dens[:,dens.g.ny//2])

docs/source/running.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
Running
22
=======
33

4-
Pyro can be run in two ways: either from the commandline, using the ``pyro_sim.py``
5-
script and passing in the solver, problem and inputs as arguments, or by using
6-
the :func:`Pyro <pyro.pyro_sim.pyro>` class.
4+
Pyro can be run in two ways: either from the commandline, using the
5+
``pyro_sim.py`` script (this will be installed into your search path)
6+
and passing in the solver, problem and inputs as arguments, or by
7+
using the :func:`Pyro <pyro.pyro_sim.Pyro>` class.
78

89
Commandline
910
------------
@@ -18,7 +19,7 @@ For example, to run the Sedov problem with the compressible solver we would do:
1819

1920
.. prompt:: bash
2021

21-
./pyro_sim.py compressible sedov inputs.sedov
22+
pyro_sim.py compressible sedov inputs.sedov
2223

2324
This knows to look for ``inputs.sedov`` in ``compressible/problems/``
2425
(alternately, you can specify the full path for the inputs file).
@@ -27,15 +28,15 @@ To run the smooth Gaussian advection problem with the advection solver, we would
2728

2829
.. prompt:: bash
2930

30-
./pyro_sim.py advection smooth inputs.smooth
31+
pyro_sim.py advection smooth inputs.smooth
3132

3233
Any runtime parameter can also be specified on the command line, after
3334
the inputs file. For example, to disable runtime visualization for the
3435
above run, we could do:
3536

3637
.. prompt:: bash
3738

38-
./pyro_sim.py advection smooth inputs.smooth vis.dovis=0
39+
pyro_sim.py advection smooth inputs.smooth vis.dovis=0
3940

4041

4142
.. note::
@@ -63,11 +64,11 @@ Kelvin-Helmholtz problem ``kh``, we would do the following:
6364

6465
.. code-block:: python
6566
66-
from pyro import Pyro
67-
pyro = Pyro("compressible")
68-
pyro.initialize_problem(problem_name="kh",
69-
inputs_file="inputs.kh")
70-
pyro.run_sim()
67+
from pyro.pyro_sim import Pyro
68+
p = Pyro("compressible")
69+
p.initialize_problem(problem_name="kh",
70+
inputs_file="inputs.kh")
71+
p.run_sim()
7172
7273
Instead of using an inputs file to define the problem parameters, we can define a
7374
dictionary of parameters and pass them into the :func:`initialize_problem
@@ -79,9 +80,9 @@ visualization for the previous example, we would do:
7980
.. code-block:: python
8081
8182
parameters = {"vis.dovis":0}
82-
pyro.initialize_problem(problem_name="kh",
83-
inputs_file="inputs.kh",
84-
inputs_dict=parameters)
83+
p.initialize_problem(problem_name="kh",
84+
inputs_file="inputs.kh",
85+
inputs_dict=parameters)
8586
8687
It's possible to evolve the simulation forward timestep by timestep manually using
8788
the :func:`single_step <pyro.pyro_sim.Pyro.single_step>` function (rather than allowing
@@ -90,7 +91,7 @@ simulation forward by a single step, we'd run
9091

9192
.. code-block:: python
9293
93-
pyro.single_step()
94+
p.single_step()
9495
9596
This will fill the boundary conditions, compute the timestep ``dt``, evolve a
9697
single timestep and do output/visualization (if required).

pyro/util/io_pyro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def read(filename):
6262
bc_solver = "compressible"
6363
else:
6464
bc_solver = solver_name
65-
bcmod = importlib.import_module("{}.{}".format(bc_solver, "BC"))
65+
bcmod = importlib.import_module(f"pyro.{bc_solver}.BC")
6666
for name in custom_bcs:
6767
bnd.define_bc(name, bcmod.user, is_solid=custom_bcs[name])
6868

@@ -107,7 +107,7 @@ def read(filename):
107107
my_particles = None
108108

109109
if solver_name is not None:
110-
solver = importlib.import_module(solver_name)
110+
solver = importlib.import_module(f"pyro.{solver_name}")
111111

112112
sim = solver.Simulation(solver_name, problem_name, None)
113113
sim.n = n

0 commit comments

Comments
 (0)