Skip to content

Commit

Permalink
Merge branch 'entropy-stable-dg' into tulio/radiation_feeder
Browse files Browse the repository at this point in the history
  • Loading branch information
majosm committed Jul 7, 2023
2 parents a2f5287 + ca3a5b0 commit 441dc49
Show file tree
Hide file tree
Showing 5 changed files with 726 additions and 374 deletions.
28 changes: 8 additions & 20 deletions examples/thermally-coupled-mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import logging
from mirgecom.mpi import mpi_entry_point
import numpy as np
from functools import partial, update_wrapper
from functools import partial
from pytools.obj_array import make_obj_array

from meshmode.mesh import BTAG_ALL, BTAG_NONE # noqa
Expand All @@ -41,9 +41,7 @@
DISCR_TAG_QUAD,
DOFDesc,
)
from mirgecom.diffusion import (
NeumannDiffusionBoundary,
)
from mirgecom.diffusion import NeumannDiffusionBoundary
from mirgecom.discretization import create_discretization_collection
from mirgecom.simutil import (
get_sim_timestep,
Expand All @@ -60,7 +58,7 @@
from mirgecom.fluid import make_conserved
from mirgecom.gas_model import (
GasModel,
make_fluid_state
make_fluid_state,
)
from logpyle import IntervalTimer, set_dt
from mirgecom.euler import extract_vars_for_logging
Expand All @@ -71,9 +69,8 @@
logmgr_add_device_memory_usage,
set_sim_state
)
from mirgecom.navierstokes import ns_operator
from mirgecom.multiphysics.thermally_coupled_fluid_wall import (
coupled_ns_heat_operator,
basic_coupled_ns_heat_operator as coupled_ns_heat_operator,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -103,15 +100,6 @@ def main(actx_class, use_esdg=False, use_overintegration=False,
logmgr = initialize_logmgr(True,
filename=f"{casename}.sqlite", mode="wu", mpi_comm=comm)

from mirgecom.inviscid import inviscid_facial_flux_rusanov
from mirgecom.viscous import viscous_facial_flux_harmonic
inviscid_numerical_flux_func = inviscid_facial_flux_rusanov
viscous_numerical_flux_func = viscous_facial_flux_harmonic
ns_op = partial(ns_operator, use_esdg=use_esdg,
inviscid_numerical_flux_func=inviscid_numerical_flux_func,
viscous_numerical_flux_func=viscous_numerical_flux_func)
update_wrapper(ns_op, ns_operator)

from mirgecom.array_context import initialize_actx, actx_class_is_profiling
actx = initialize_actx(actx_class, comm)
queue = getattr(actx, "queue", None)
Expand Down Expand Up @@ -507,17 +495,17 @@ def my_post_step(step, t, dt, state):
def my_rhs(t, state, return_gradients=False):
fluid_state = make_fluid_state(cv=state[0], gas_model=gas_model)
wall_temperature = state[1]

ns_heat_result = coupled_ns_heat_operator(
dcoll,
gas_model,
dd_vol_fluid, dd_vol_wall,
fluid_boundaries, wall_boundaries,
fluid_state,
wall_kappa, wall_temperature,
fluid_state, wall_kappa, wall_temperature,
time=t,
return_gradients=return_gradients,
quadrature_tag=quadrature_tag,
ns_operator=ns_op)
use_esdg=use_esdg,
return_gradients=return_gradients)

if return_gradients:
(
Expand Down
1 change: 0 additions & 1 deletion mirgecom/boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,6 @@ def __init__(self, wall_temperature=300):
def temperature_bc(self, dcoll, dd_bdry, state_minus, **kwargs):
"""Get temperature value used in grad(T)."""
actx = state_minus.array_context
# why this? self._wall_temp should be a single scalar right?
wall_temp = project_from_base(dcoll, dd_bdry, self._wall_temp)
return actx.np.zeros_like(state_minus.temperature) + wall_temp

Expand Down
34 changes: 34 additions & 0 deletions mirgecom/multiphysics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,38 @@

__doc__ = """
.. automodule:: mirgecom.multiphysics.thermally_coupled_fluid_wall
.. autofunction:: make_interface_boundaries
"""


def make_interface_boundaries(bdry_factories, inter_volume_tpairs):
"""
Create volume-pairwise interface boundaries from inter-volume data.
Return a :class:`dict` mapping a (directional) pair of
:class:`grudge.dof_desc.DOFDesc` *(other_vol_dd, self_vol_dd)* representing
neighboring volumes to a :class:`dict` of boundary objects. Specifically,
*interface_boundaries[other_vol_dd, self_vol_dd]* maps each interface boundary
:class:`~grudge.dof_desc.DOFDesc` to a boundary object.
Parameters
----------
bdry_factories
Mapping from directional volume :class:`~grudge.dof_desc.DOFDesc` pair to
a function that takes a :class:`grudge.trace_pair.TracePair` and returns
an interface boundary object.
inter_volume_tpairs
Mapping from directional volume :class:`~grudge.dof_desc.DOFDesc` pair to
a :class:`list` of :class:`grudge.trace_pair.TracePair` (as is returned by
:func:`grudge.trace_pair.inter_volume_trace_pairs`).
"""
return {
vol_dd_pair: {
tpair.dd: bdry_factories[vol_dd_pair](tpair)
for tpair in tpairs}
for vol_dd_pair, tpairs in inter_volume_tpairs.items()}
Loading

0 comments on commit 441dc49

Please sign in to comment.