Skip to content

Commit

Permalink
make compatible with non-coupling-enabled versions of grudge
Browse files Browse the repository at this point in the history
  • Loading branch information
majosm committed May 10, 2023
1 parent 07c324c commit 40b161e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
7 changes: 7 additions & 0 deletions examples/thermally-coupled-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 6 additions & 1 deletion mirgecom/multiphysics/thermally_coupled_fluid_wall.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@

from grudge.trace_pair import (
TracePair,
inter_volume_trace_pairs
)
from grudge.dof_desc import (
DISCR_TAG_BASE,
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion mirgecom/simutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
5 changes: 5 additions & 0 deletions test/test_multiphysics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40b161e

Please sign in to comment.