diff --git a/examples/thermally-coupled-mpi.py b/examples/thermally-coupled-mpi.py index e70675cff..e3b28fc55 100644 --- a/examples/thermally-coupled-mpi.py +++ b/examples/thermally-coupled-mpi.py @@ -97,6 +97,13 @@ def main(ctx_factory=cl.create_some_context, use_logmgr=True, 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() diff --git a/mirgecom/multiphysics/thermally_coupled_fluid_wall.py b/mirgecom/multiphysics/thermally_coupled_fluid_wall.py index b91839011..860270ee1 100644 --- a/mirgecom/multiphysics/thermally_coupled_fluid_wall.py +++ b/mirgecom/multiphysics/thermally_coupled_fluid_wall.py @@ -53,7 +53,6 @@ from grudge.trace_pair import ( TracePair, - inter_volume_trace_pairs ) from grudge.dof_desc import ( DISCR_TAG_BASE, @@ -661,6 +660,8 @@ def _kappa_inter_volume_trace_pairs( pairwise_kappa = { (fluid_dd, wall_dd): (fluid_kappa, wall_kappa)} + from grudge.trace_pair import \ + inter_volume_trace_pairs # pylint: disable=no-name-in-module return inter_volume_trace_pairs( dcoll, pairwise_kappa, comm_tag=_KappaInterVolTag) @@ -674,6 +675,8 @@ def _temperature_inter_volume_trace_pairs( pairwise_temperature = { (fluid_dd, wall_dd): (fluid_state.temperature, wall_temperature)} + from grudge.trace_pair import \ + inter_volume_trace_pairs # pylint: disable=no-name-in-module return inter_volume_trace_pairs( dcoll, pairwise_temperature, comm_tag=_TemperatureInterVolTag) @@ -687,6 +690,8 @@ def _grad_temperature_inter_volume_trace_pairs( pairwise_grad_temperature = { (fluid_dd, wall_dd): (fluid_grad_temperature, wall_grad_temperature)} + from grudge.trace_pair import \ + inter_volume_trace_pairs # pylint: disable=no-name-in-module return inter_volume_trace_pairs( dcoll, pairwise_grad_temperature, comm_tag=_GradTemperatureInterVolTag) diff --git a/mirgecom/simutil.py b/mirgecom/simutil.py index c4f28a331..9f44ad7de 100644 --- a/mirgecom/simutil.py +++ b/mirgecom/simutil.py @@ -78,7 +78,7 @@ from mirgecom.viscous import get_viscous_timestep from typing import List, Dict, Optional -from grudge.discretization import DiscretizationCollection, PartID +from grudge.discretization import DiscretizationCollection from grudge.dof_desc import DD_VOLUME_ALL from mirgecom.utils import normalize_boundaries import pyopencl as cl @@ -892,6 +892,9 @@ def partition_generator_func(mesh, tag_to_elements, num_ranks): if np.any(volume_index_per_element < 0): raise ValueError("Missing volume specification for some elements.") + from grudge.discretization import \ + PartID # pylint: disable=no-name-in-module + part_id_to_elements = { PartID(volumes[vol_idx], rank): np.where( diff --git a/test/test_multiphysics.py b/test/test_multiphysics.py index c9e7b8483..f7c5452ed 100644 --- a/test/test_multiphysics.py +++ b/test/test_multiphysics.py @@ -165,6 +165,11 @@ def get_rhs(t, u): def test_thermally_coupled_fluid_wall( actx_factory, order, use_overintegration, visualize=False): """Check the thermally-coupled fluid/wall interface.""" + try: + from grudge.discretization import PartID # noqa: F401 + except ImportError: + pytest.skip("Test requires a coupling-enabled branch of grudge.") + actx = actx_factory() from pytools.convergence import EOCRecorder