Skip to content

Commit

Permalink
add a DEFAULT_INPUTS to each problem setup (#225)
Browse files Browse the repository at this point in the history
this allows us to run a problem without specifying an inputs file
  • Loading branch information
zingale authored Aug 31, 2024
1 parent ed25543 commit 771daa7
Show file tree
Hide file tree
Showing 42 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyro/advection/problems/smooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.smooth"


def init_data(my_data, rp):
""" initialize the smooth advection problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/advection/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pyro.mesh import patch

DEFAULT_INPUTS = None


def init_data(my_data, rp):
""" an init routine for unit testing """
Expand Down
2 changes: 2 additions & 0 deletions pyro/advection/problems/tophat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.tophat"


def init_data(myd, rp):
""" initialize the tophat advection problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/advection_fv4/problems/smooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import fv
from pyro.util import msg

DEFAULT_INPUTS = "inputs.smooth"


def init_data(my_data, rp):
""" initialize the smooth advection problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/advection_nonuniform/problems/slotted.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.slotted"


def init_data(my_data, rp):
""" initialize the slotted advection problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/advection_nonuniform/problems/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = None


def init_data(my_data, rp):
""" an init routine for unit testing """
Expand Down
2 changes: 2 additions & 0 deletions pyro/burgers/problems/converge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.converge.64"


def init_data(my_data, rp):
""" initialize the smooth burgers convergence problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/burgers/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.test"


def init_data(myd, rp):
""" initialize the burgers test problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/burgers/problems/tophat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.tophat"


def init_data(myd, rp):
""" initialize the tophat burgers problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/acoustic_pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import fv
from pyro.util import msg

DEFAULT_INPUTS = "inputs.acoustic_pulse"


def init_data(myd, rp):
"""initialize the acoustic_pulse problem. This comes from
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/advect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.advect.64"


def init_data(my_data, rp):
""" initialize a smooth advection problem for testing convergence """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.bubble"


def init_data(my_data, rp):
""" initialize the bubble problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/gresho.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.gresho"


def init_data(my_data, rp):
""" initialize the Gresho vortex problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/hse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.hse"


def init_data(my_data, rp):
""" initialize the HSE problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/kh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.kh"


def init_data(my_data, rp):
""" initialize the Kelvin-Helmholtz problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.logo"


def init_data(my_data, rp):
""" initialize the logo problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/quad.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.quad"


def init_data(my_data, rp):
""" initialize the quadrant problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/ramp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.ramp"


def init_data(my_data, rp):
""" initialize the double Mach reflection problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.rt"


def init_data(my_data, rp):
""" initialize the rt problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/rt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.rt2"


def init_data(my_data, rp):

Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/sedov.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.sedov"


def init_data(my_data, rp):
""" initialize the sedov problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/sod.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.sod.x"


def init_data(my_data, rp):
""" initialize the sod problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pyro.mesh import patch

DEFAULT_INPUTS = None


def init_data(my_data, rp):
""" an init routine for unit testing """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible_react/problems/flame.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.flame"


def init_data(my_data, rp):
""" initialize the sedov problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/compressible_react/problems/rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.rt"


def init_data(my_data, rp):
""" initialize the rt problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/diffusion/problems/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.gaussian"


def phi_analytic(dist, t, t_0, k, phi_1, phi_2):
""" the analytic solution to the Gaussian diffusion problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/diffusion/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pyro.mesh import patch

DEFAULT_INPUTS = None


def init_data(my_data, rp):
""" an init routine for unit testing """
Expand Down
2 changes: 2 additions & 0 deletions pyro/incompressible/problems/converge.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.converge.64"


def init_data(my_data, rp):
""" initialize the incompressible converge problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/incompressible/problems/shear.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.shear"


def init_data(my_data, rp):
""" initialize the incompressible shear problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/incompressible_viscous/problems/cavity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.cavity"


def init_data(my_data, rp):
""" initialize the lid-driven cavity """
Expand Down
2 changes: 2 additions & 0 deletions pyro/incompressible_viscous/problems/converge.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.converge.64"


def init_data(my_data, rp):
""" initialize the incompressible viscous converge problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/incompressible_viscous/problems/shear.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.shear"


def init_data(my_data, rp):
""" initialize the incompressible shear problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/lm_atm/problems/bubble.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.bubble"


def init_data(my_data, base, rp):
""" initialize the bubble problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/lm_atm/problems/gresho.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.gresho"


def init_data(my_data, base, rp):
""" initialize the Gresho vortex problem """
Expand Down
4 changes: 4 additions & 0 deletions pyro/pyro_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def initialize_problem(self, problem_name, inputs_file=None, inputs_dict=None,
self.rp.load_params(problem_defaults_file)

# now read in the inputs file
if inputs_file is None:
problem = importlib.import_module("pyro.{}.problems.{}".format(self.solver_name, problem_name))
inputs_file = problem.DEFAULT_INPUTS

if inputs_file is not None:
if not os.path.isfile(inputs_file):
# check if the param file lives in the solver's problems directory
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/acoustic_pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.acoustic_pulse"


def init_data(myd, rp):
"""initialize the acoustic_pulse problem. This comes from
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/advect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.advect"


def init_data(my_data, rp):
""" initialize a smooth advection problem for testing convergence """
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/dam.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.dam.x"


def init_data(my_data, rp):
""" initialize the dam problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/kh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.kh"


def init_data(my_data, rp):
""" initialize the Kelvin-Helmholtz problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.logo"


def init_data(my_data, rp):
""" initialize the sedov problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/quad.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from pyro.mesh import patch
from pyro.util import msg

DEFAULT_INPUTS = "inputs.quad"


def init_data(my_data, rp):
""" initialize the quadrant problem """
Expand Down
2 changes: 2 additions & 0 deletions pyro/swe/problems/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from pyro.mesh import patch

DEFAULT_INPTUS = None


def init_data(my_data, rp):
""" an init routine for unit testing """
Expand Down

0 comments on commit 771daa7

Please sign in to comment.