From 0238cbe73746c2fc3109a5456f581c621e8e302f Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Thu, 25 Jul 2024 17:15:24 -0500 Subject: [PATCH] refine error messages for advdiff-tpe and poiseuille-tpe --- examples/advdiff-tpe.py | 17 +++++++++-------- examples/poiseuille-tpe.py | 15 +++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/advdiff-tpe.py b/examples/advdiff-tpe.py index 1a64fbb3f..fdc7586c4 100644 --- a/examples/advdiff-tpe.py +++ b/examples/advdiff-tpe.py @@ -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() @@ -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})") diff --git a/examples/poiseuille-tpe.py b/examples/poiseuille-tpe.py index 814a9f5f7..a493f1268 100644 --- a/examples/poiseuille-tpe.py +++ b/examples/poiseuille-tpe.py @@ -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() @@ -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,