Skip to content

Commit

Permalink
Merge branch 'main' into tulio/init_and_bndry
Browse files Browse the repository at this point in the history
  • Loading branch information
tulioricci authored Nov 14, 2023
2 parents 93ce35c + d70ac5e commit 04a05e0
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,16 @@ jobs:
- name: Run examples
run: |
set -x
MINIFORGE_INSTALL_DIR=.miniforge3
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
export XDG_CACHE_HOME=/tmp
mamba install vtk # needed for the accuracy comparison
[[ $(hostname) == "porter" ]] && export PYOPENCL_TEST="port:nv" && unset XDG_CACHE_HOME
# && export POCL_DEBUG=cuda
# This is only possible because actions run sequentially on porter
[[ $(hostname) == "porter" ]] && rm -rf /tmp/githubrunner/pocl-scratch && rm -rf /tmp/githubrunner/xdg-scratch
scripts/run-integrated-tests.sh --examples
doc:
Expand Down Expand Up @@ -195,8 +199,13 @@ jobs:
fetch-depth: '0'
- name: Prepare production environment
run: |
set -x
[[ $(uname) == Linux ]] && [[ $(hostname) != "porter" ]] && sudo apt-get update && sudo apt-get install -y openmpi-bin libopenmpi-dev
[[ $(uname) == Darwin ]] && brew upgrade && brew install mpich
# This is only possible because actions run sequentially on porter
[[ $(hostname) == "porter" ]] && rm -rf /tmp/githubrunner/pocl-scratch && rm -rf /tmp/githubrunner/xdg-scratch
MIRGEDIR=$(pwd)
cat scripts/production-testing-env.sh
. scripts/production-testing-env.sh
Expand Down
4 changes: 3 additions & 1 deletion examples/ablation-workshop.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ def get_species_source_terms(self, cv: ConservedVars, temperature: DOFArray):
raise NotImplementedError

def dependent_vars(self, cv: ConservedVars, temperature_seed=None,
smoothness_mu=None, smoothness_kappa=None, smoothness_beta=None):
smoothness_mu=None, smoothness_kappa=None,
smoothness_d=None, smoothness_beta=None):
raise NotImplementedError


Expand Down Expand Up @@ -756,6 +757,7 @@ def make_state(cv, temperature_seed, material_densities):
smoothness_mu=zeros,
smoothness_kappa=zeros,
smoothness_beta=zeros,
smoothness_d=zeros,
species_enthalpies=cv.species_mass, # empty array
)

Expand Down
10 changes: 10 additions & 0 deletions mirgecom/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ class GasDependentVars:
.. attribute:: smoothness_mu
.. attribute:: smoothness_kappa
.. attribute:: smoothness_beta
.. attribute:: smoothness_d
"""

temperature: DOFArray
pressure: DOFArray
speed_of_sound: DOFArray
smoothness_mu: DOFArray
smoothness_kappa: DOFArray
smoothness_d: DOFArray
smoothness_beta: DOFArray


Expand Down Expand Up @@ -180,6 +182,7 @@ def dependent_vars(
temperature_seed: Optional[DOFArray] = None,
smoothness_mu: Optional[DOFArray] = None,
smoothness_kappa: Optional[DOFArray] = None,
smoothness_d: Optional[DOFArray] = None,
smoothness_beta: Optional[DOFArray] = None) -> GasDependentVars:
"""Get an agglomerated array of the dependent variables.
Expand All @@ -195,6 +198,8 @@ def dependent_vars(
smoothness_mu = zeros
if smoothness_kappa is None:
smoothness_kappa = zeros
if smoothness_d is None:
smoothness_d = zeros
if smoothness_beta is None:
smoothness_beta = zeros

Expand All @@ -204,6 +209,7 @@ def dependent_vars(
speed_of_sound=self.sound_speed(cv, temperature),
smoothness_mu=smoothness_mu,
smoothness_kappa=smoothness_kappa,
smoothness_d=smoothness_d,
smoothness_beta=smoothness_beta
)

Expand Down Expand Up @@ -258,6 +264,7 @@ def dependent_vars(
temperature_seed: Optional[DOFArray] = None,
smoothness_mu: Optional[DOFArray] = None,
smoothness_kappa: Optional[DOFArray] = None,
smoothness_d: Optional[DOFArray] = None,
smoothness_beta: Optional[DOFArray] = None) -> MixtureDependentVars:
"""Get an agglomerated array of the dependent variables.
Expand All @@ -273,6 +280,8 @@ def dependent_vars(
smoothness_mu = zeros
if smoothness_kappa is None:
smoothness_kappa = zeros
if smoothness_d is None:
smoothness_d = zeros
if smoothness_beta is None:
smoothness_beta = zeros

Expand All @@ -283,6 +292,7 @@ def dependent_vars(
species_enthalpies=self.species_enthalpies(cv, temperature),
smoothness_mu=smoothness_mu,
smoothness_kappa=smoothness_kappa,
smoothness_d=smoothness_d,
smoothness_beta=smoothness_beta
)

Expand Down
44 changes: 43 additions & 1 deletion mirgecom/gas_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class FluidState:
.. autoattribute:: temperature
.. autoattribute:: smoothness_mu
.. autoattribute:: smoothness_kappa
.. autoattribute:: smoothness_d
.. autoattribute:: smoothness_beta
.. autoattribute:: velocity
.. autoattribute:: speed
Expand Down Expand Up @@ -169,6 +170,11 @@ def smoothness_kappa(self):
"""Return the smoothness_kappa field."""
return self.dv.smoothness_kappa

@property
def smoothness_d(self):
"""Return the smoothness_d field."""
return self.dv.smoothness_d

@property
def smoothness_beta(self):
"""Return the smoothness_beta field."""
Expand Down Expand Up @@ -297,6 +303,7 @@ def make_fluid_state(cv, gas_model,
temperature_seed=None,
smoothness_mu=None,
smoothness_kappa=None,
smoothness_d=None,
smoothness_beta=None,
material_densities=None,
limiter_func=None, limiter_dd=None):
Expand Down Expand Up @@ -328,6 +335,11 @@ def make_fluid_state(cv, gas_model,
Optional array containing the smoothness parameter for extra thermal
conductivity in the artificial viscosity.
smoothness_d: :class:`~meshmode.dof_array.DOFArray`
Optional array containing the smoothness parameter for extra species
diffusivity in the artificial viscosity.
smoothness_beta: :class:`~meshmode.dof_array.DOFArray`
Optional array containing the smoothness parameter for extra bulk
Expand Down Expand Up @@ -357,6 +369,8 @@ def make_fluid_state(cv, gas_model,
is None else smoothness_kappa)
smoothness_beta = (actx.np.zeros_like(cv.mass) if smoothness_beta
is None else smoothness_beta)
smoothness_d = (actx.np.zeros_like(cv.mass) if smoothness_d
is None else smoothness_d)

if isinstance(gas_model, GasModel):
temperature = gas_model.eos.temperature(cv=cv,
Expand All @@ -373,6 +387,7 @@ def make_fluid_state(cv, gas_model,
speed_of_sound=gas_model.eos.sound_speed(cv, temperature),
smoothness_mu=smoothness_mu,
smoothness_kappa=smoothness_kappa,
smoothness_d=smoothness_d,
smoothness_beta=smoothness_beta
)

Expand All @@ -384,6 +399,7 @@ def make_fluid_state(cv, gas_model,
speed_of_sound=dv.speed_of_sound,
smoothness_mu=dv.smoothness_mu,
smoothness_kappa=dv.smoothness_kappa,
smoothness_d=dv.smoothness_d,
smoothness_beta=dv.smoothness_beta,
species_enthalpies=gas_model.eos.species_enthalpies(cv, temperature)
)
Expand Down Expand Up @@ -428,6 +444,7 @@ def make_fluid_state(cv, gas_model,
speed_of_sound=gas_model.eos.sound_speed(cv, temperature),
smoothness_mu=smoothness_mu,
smoothness_kappa=smoothness_kappa,
smoothness_d=smoothness_d,
smoothness_beta=smoothness_beta,
species_enthalpies=gas_model.eos.species_enthalpies(cv, temperature),
)
Expand Down Expand Up @@ -507,6 +524,10 @@ def project_fluid_state(dcoll, src, tgt, state, gas_model, limiter_func=None,
if state.dv.smoothness_kappa is not None:
smoothness_kappa = op.project(dcoll, src, tgt, state.dv.smoothness_kappa)

smoothness_d = None
if state.dv.smoothness_d is not None:
smoothness_d = op.project(dcoll, src, tgt, state.dv.smoothness_d)

smoothness_beta = None
if state.dv.smoothness_beta is not None:
smoothness_beta = op.project(dcoll, src, tgt, state.dv.smoothness_beta)
Expand All @@ -519,6 +540,7 @@ def project_fluid_state(dcoll, src, tgt, state, gas_model, limiter_func=None,
temperature_seed=temperature_seed,
smoothness_mu=smoothness_mu,
smoothness_kappa=smoothness_kappa,
smoothness_d=smoothness_d,
smoothness_beta=smoothness_beta,
material_densities=material_densities,
limiter_func=limiter_func, limiter_dd=tgt)
Expand All @@ -535,6 +557,7 @@ def make_fluid_state_trace_pairs(cv_pairs, gas_model,
temperature_seed_pairs=None,
smoothness_mu_pairs=None,
smoothness_kappa_pairs=None,
smoothness_d_pairs=None,
smoothness_beta_pairs=None,
material_densities_pairs=None,
limiter_func=None):
Expand Down Expand Up @@ -579,6 +602,8 @@ def make_fluid_state_trace_pairs(cv_pairs, gas_model,
smoothness_mu_pairs = [None] * len(cv_pairs)
if smoothness_kappa_pairs is None:
smoothness_kappa_pairs = [None] * len(cv_pairs)
if smoothness_d_pairs is None:
smoothness_d_pairs = [None] * len(cv_pairs)
if smoothness_beta_pairs is None:
smoothness_beta_pairs = [None] * len(cv_pairs)
if material_densities_pairs is None:
Expand All @@ -590,6 +615,7 @@ def make_fluid_state_trace_pairs(cv_pairs, gas_model,
temperature_seed=_getattr_ish(tseed_pair, "int"),
smoothness_mu=_getattr_ish(smoothness_mu_pair, "int"),
smoothness_kappa=_getattr_ish(smoothness_kappa_pair, "int"),
smoothness_d=_getattr_ish(smoothness_d_pair, "int"),
smoothness_beta=_getattr_ish(smoothness_beta_pair, "int"),
material_densities=_getattr_ish(material_densities_pair, "int"),
limiter_func=limiter_func, limiter_dd=cv_pair.dd),
Expand All @@ -598,17 +624,19 @@ def make_fluid_state_trace_pairs(cv_pairs, gas_model,
temperature_seed=_getattr_ish(tseed_pair, "ext"),
smoothness_mu=_getattr_ish(smoothness_mu_pair, "ext"),
smoothness_kappa=_getattr_ish(smoothness_kappa_pair, "ext"),
smoothness_d=_getattr_ish(smoothness_d_pair, "ext"),
smoothness_beta=_getattr_ish(smoothness_beta_pair, "ext"),
material_densities=_getattr_ish(material_densities_pair, "ext"),
limiter_func=limiter_func, limiter_dd=cv_pair.dd))
for cv_pair,
tseed_pair,
smoothness_mu_pair,
smoothness_kappa_pair,
smoothness_d_pair,
smoothness_beta_pair,
material_densities_pair in zip(
cv_pairs, temperature_seed_pairs,
smoothness_mu_pairs, smoothness_kappa_pairs,
smoothness_mu_pairs, smoothness_kappa_pairs, smoothness_d_pairs,
smoothness_beta_pairs, material_densities_pairs)]


Expand All @@ -628,6 +656,10 @@ class _FluidSmoothnessKappaTag:
pass


class _FluidSmoothnessDiffTag:
pass


class _FluidSmoothnessBetaTag:
pass

Expand Down Expand Up @@ -758,6 +790,14 @@ def make_operator_fluid_states(
dcoll, volume_state.smoothness_kappa, volume_dd=dd_vol,
tag=(_FluidSmoothnessKappaTag, comm_tag))]

smoothness_d_interior_pairs = None
if volume_state.smoothness_d is not None:
smoothness_d_interior_pairs = [
interp_to_surf_quad(tpair=tpair)
for tpair in interior_trace_pairs(
dcoll, volume_state.smoothness_d, volume_dd=dd_vol,
tag=(_FluidSmoothnessDiffTag, comm_tag))]

smoothness_beta_interior_pairs = None
if volume_state.smoothness_beta is not None:
smoothness_beta_interior_pairs = [
Expand All @@ -780,6 +820,7 @@ def make_operator_fluid_states(
temperature_seed_pairs=tseed_interior_pairs,
smoothness_mu_pairs=smoothness_mu_interior_pairs,
smoothness_kappa_pairs=smoothness_kappa_interior_pairs,
smoothness_d_pairs=smoothness_d_interior_pairs,
smoothness_beta_pairs=smoothness_beta_interior_pairs,
material_densities_pairs=material_densities_interior_pairs,
limiter_func=limiter_func)
Expand Down Expand Up @@ -874,6 +915,7 @@ def replace_fluid_state(
temperature_seed=new_tseed,
smoothness_mu=state.smoothness_mu,
smoothness_kappa=state.smoothness_kappa,
smoothness_d=state.smoothness_d,
smoothness_beta=state.smoothness_beta,
material_densities=material_densities,
limiter_func=limiter_func,
Expand Down
Loading

0 comments on commit 04a05e0

Please sign in to comment.