Skip to content

Commit

Permalink
refine error messages for advdiff-tpe and poiseuille-tpe
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Jul 25, 2024
1 parent e873f88 commit 0238cbe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
17 changes: 9 additions & 8 deletions examples/advdiff-tpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ def main(actx_class, use_overintegration=False, use_esdg=False,
if casename is None:
casename = "mirgecom"

try:
from grudge.discretization import PartID # noqa: F401
except ImportError:
from warnings import warn
warn("This example requires a coupling-enabled branch of grudge; exiting.")
return

from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
Expand Down Expand Up @@ -205,7 +198,15 @@ def vol_max(x):
return actx.to_numpy(nodal_max(dcoll, "vol", x))[()]

from grudge.dt_utils import characteristic_lengthscales
dx = characteristic_lengthscales(actx, dcoll)

try:
dx = characteristic_lengthscales(actx, dcoll)
except NotImplementedError:
from warnings import warn
warn("This example requires https://github.com/inducer/grudge/pull/338 . "
"Exiting.")
return

dx_min, dx_max = vol_min(dx), vol_max(dx)

print(f"DX: ({dx_min}, {dx_max})")
Expand Down
15 changes: 7 additions & 8 deletions examples/poiseuille-tpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ def main(actx_class, use_esdg=False, use_overintegration=False,
if casename is None:
casename = "mirgecom"

try:
from grudge.discretization import PartID # noqa: F401
except ImportError:
from warnings import warn
warn("This example requires a coupling-enabled branch of grudge; exiting.")
return

from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
Expand Down Expand Up @@ -433,8 +426,14 @@ def my_rhs(t, state):
from mirgecom.simutil import force_evaluation
current_state = force_evaluation(actx, current_state)

current_dt = get_sim_timestep(dcoll, current_state, current_t, current_dt,
try:
current_dt = get_sim_timestep(dcoll, current_state, current_t, current_dt,
current_cfl, t_final, constant_cfl)
except NotImplementedError:
from warnings import warn
warn("This example requires https://github.com/inducer/grudge/pull/338 . "
"Exiting.")
return

current_step, current_t, current_cv = \
advance_state(rhs=my_rhs, timestepper=timestepper,
Expand Down

0 comments on commit 0238cbe

Please sign in to comment.