From b50e3e87ef526e231199521009897424a34a1aa3 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Wed, 29 Mar 2023 14:20:59 -0500 Subject: [PATCH] changing smoothness to smoothness_mu, preparing for additional smoothness variables --- mirgecom/boundary.py | 26 ++++++++++----------- mirgecom/eos.py | 24 +++++++++---------- mirgecom/gas_model.py | 54 +++++++++++++++++++++---------------------- mirgecom/transport.py | 6 ++--- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/mirgecom/boundary.py b/mirgecom/boundary.py index a2d25bc83..8126504c3 100644 --- a/mirgecom/boundary.py +++ b/mirgecom/boundary.py @@ -631,7 +631,7 @@ def adiabatic_slip_wall_state( """ return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) """ return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature) @@ -666,7 +666,7 @@ def inviscid_wall_flux(self, dcoll, dd_bdry, gas_model, state_minus, """ wall_state = make_fluid_state(cv=wall_cv, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) """ wall_state = make_fluid_state(cv=wall_cv, gas_model=gas_model, temperature_seed=state_minus.temperature) @@ -826,7 +826,7 @@ def adiabatic_noslip_state( species_mass=state_minus.species_mass_density) return make_fluid_state(cv=cv, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def adiabatic_noslip_grad_av(self, grad_av_minus, **kwargs): """Get the exterior solution on the boundary for artificial viscosity.""" @@ -879,7 +879,7 @@ def isothermal_noslip_state( tseed = state_minus.temperature if state_minus.is_mixture else None return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=tseed, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def temperature_bc(self, state_minus, **kwargs): r"""Get temperature value to weakly prescribe wall bc. @@ -958,7 +958,7 @@ def farfield_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): return make_fluid_state(cv=cv_infinity, gas_model=gas_model, temperature_seed=free_stream_temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def temperature_bc(self, state_minus, **kwargs): """Return farfield temperature for use in grad(temperature).""" @@ -1080,7 +1080,7 @@ def outflow_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): return make_fluid_state(cv=cv_outflow, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def outflow_state_for_diffusion(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): @@ -1263,7 +1263,7 @@ def inflow_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): return make_fluid_state(cv=boundary_cv, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) class RiemannOutflowBoundary(PrescribedFluidBoundary): @@ -1412,7 +1412,7 @@ def isothermal_wall_state( ) return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def inviscid_wall_flux(self, dcoll, dd_bdry, gas_model, state_minus, numerical_flux_func=inviscid_facial_flux_rusanov, **kwargs): @@ -1426,7 +1426,7 @@ def inviscid_wall_flux(self, dcoll, dd_bdry, gas_model, state_minus, species_mass=state_minus.species_mass_density) wall_state = make_fluid_state(cv=wall_cv, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) state_pair = TracePair(dd_bdry, interior=state_minus, exterior=wall_state) @@ -1526,7 +1526,7 @@ def adiabatic_wall_state_for_advection(self, dcoll, dd_bdry, gas_model, ) return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def adiabatic_wall_state_for_diffusion(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): @@ -1540,7 +1540,7 @@ def adiabatic_wall_state_for_diffusion(self, dcoll, dd_bdry, gas_model, ) return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def inviscid_wall_flux(self, dcoll, dd_bdry, gas_model, state_minus, numerical_flux_func=inviscid_facial_flux_rusanov, **kwargs): @@ -1669,7 +1669,7 @@ def adiabatic_wall_state_for_advection(self, dcoll, dd_bdry, gas_model, ) return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def adiabatic_wall_state_for_diffusion(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): @@ -1696,7 +1696,7 @@ def adiabatic_wall_state_for_diffusion(self, dcoll, dd_bdry, gas_model, ) return make_fluid_state(cv=cv_plus, gas_model=gas_model, temperature_seed=state_minus.temperature, - smoothness=state_minus.smoothness) + smoothness_mu=state_minus.smoothness_mu) def inviscid_wall_flux(self, dcoll, dd_bdry, gas_model, state_minus, numerical_flux_func=inviscid_facial_flux_rusanov, **kwargs): diff --git a/mirgecom/eos.py b/mirgecom/eos.py index abf0de2de..295319c69 100644 --- a/mirgecom/eos.py +++ b/mirgecom/eos.py @@ -75,13 +75,13 @@ class GasDependentVars: .. attribute:: temperature .. attribute:: pressure .. attribute:: speed_of_sound - .. attribute:: smoothness + .. attribute:: smoothness_mu """ temperature: DOFArray pressure: DOFArray speed_of_sound: DOFArray - smoothness: DOFArray + smoothness_mu: DOFArray @dataclass_array_container @@ -171,7 +171,7 @@ def get_internal_energy(self, temperature, species_mass_fractions=None): def dependent_vars( self, cv: ConservedVars, temperature_seed: Optional[DOFArray] = None, - smoothness: Optional[DOFArray] = None) -> GasDependentVars: + smoothness_mu: Optional[DOFArray] = None) -> GasDependentVars: """Get an agglomerated array of the dependent variables. Certain implementations of :class:`GasEOS` (e.g. :class:`MixtureEOS`) @@ -180,15 +180,15 @@ def dependent_vars( """ temperature = self.temperature(cv, temperature_seed) # MJA, it doesn't appear that we can have a None field embedded inside DV, - # make a dummy smoothness in this case - if smoothness is None: - smoothness = 0. * cv.mass + # make a dummy smoothness_mu in this case + if smoothness_mu is None: + smoothness_mu = 0. * cv.mass return GasDependentVars( temperature=temperature, pressure=self.pressure(cv, temperature), speed_of_sound=self.sound_speed(cv, temperature), - smoothness=smoothness + smoothness_mu=smoothness_mu ) @@ -240,7 +240,7 @@ def get_species_source_terms(self, cv: ConservedVars, temperature: DOFArray): def dependent_vars( self, cv: ConservedVars, temperature_seed: Optional[DOFArray] = None, - smoothness: Optional[DOFArray] = None) -> MixtureDependentVars: + smoothness_mu: Optional[DOFArray] = None) -> MixtureDependentVars: """Get an agglomerated array of the dependent variables. Certain implementations of :class:`GasEOS` (e.g. :class:`MixtureEOS`) @@ -249,16 +249,16 @@ def dependent_vars( """ temperature = self.temperature(cv, temperature_seed) # MJA, it doesn't appear that we can have a None field embedded inside DV, - # make a dummy smoothness in this case - if smoothness is None: - smoothness = 0. * cv.mass + # make a dummy smoothness_mu in this case + if smoothness_mu is None: + smoothness_mu = 0. * cv.mass return MixtureDependentVars( temperature=temperature, pressure=self.pressure(cv, temperature), speed_of_sound=self.sound_speed(cv, temperature), species_enthalpies=self.species_enthalpies(cv, temperature), - smoothness=smoothness + smoothness_mu=smoothness_mu ) diff --git a/mirgecom/gas_model.py b/mirgecom/gas_model.py index 198793211..4512d4b84 100644 --- a/mirgecom/gas_model.py +++ b/mirgecom/gas_model.py @@ -111,7 +111,7 @@ class FluidState: .. autoattribute:: nspecies .. autoattribute:: pressure .. autoattribute:: temperature - .. autoattribute:: smoothness + .. autoattribute:: smoothness_mu .. autoattribute:: velocity .. autoattribute:: speed .. autoattribute:: wavespeed @@ -153,9 +153,9 @@ def temperature(self): return self.dv.temperature @property - def smoothness(self): - """Return the smoothness field.""" - return self.dv.smoothness + def smoothness_mu(self): + """Return the smoothness_mu field.""" + return self.dv.smoothness_mu @property def mass_density(self): @@ -263,7 +263,7 @@ def species_diffusivity(self): return self.tv.species_diffusivity -def make_fluid_state(cv, gas_model, temperature_seed=None, smoothness=None, +def make_fluid_state(cv, gas_model, temperature_seed=None, smoothness_mu=None, limiter_func=None, limiter_dd=None): """Create a fluid state from the conserved vars and physical gas model. @@ -301,14 +301,14 @@ def make_fluid_state(cv, gas_model, temperature_seed=None, smoothness=None, dd=limiter_dd) # FIXME work-around for now - if smoothness is None: - smoothness = cv.mass*0.0 + if smoothness_mu is None: + smoothness_mu = cv.mass*0.0 dv = GasDependentVars( temperature=temperature, pressure=pressure, speed_of_sound=gas_model.eos.sound_speed(cv, temperature), - smoothness=smoothness + smoothness_mu=smoothness_mu ) from mirgecom.eos import MixtureEOS, MixtureDependentVars @@ -317,7 +317,7 @@ def make_fluid_state(cv, gas_model, temperature_seed=None, smoothness=None, temperature=dv.temperature, pressure=dv.pressure, speed_of_sound=dv.speed_of_sound, - smoothness=dv.smoothness, + smoothness_mu=dv.smoothness_mu, species_enthalpies=gas_model.eos.species_enthalpies(cv, temperature)) if gas_model.transport is not None: @@ -375,12 +375,12 @@ def project_fluid_state(dcoll, src, tgt, state, gas_model, limiter_func=None): if state.is_mixture: temperature_seed = op.project(dcoll, src, tgt, state.dv.temperature) - smoothness = None - if state.dv.smoothness is not None: - smoothness = op.project(dcoll, src, tgt, state.dv.smoothness) + smoothness_mu = None + if state.dv.smoothness_mu is not None: + smoothness_mu = op.project(dcoll, src, tgt, state.dv.smoothness_mu) return make_fluid_state(cv=cv_sd, gas_model=gas_model, - temperature_seed=temperature_seed, smoothness=smoothness, + temperature_seed=temperature_seed, smoothness_mu=smoothness_mu, limiter_func=limiter_func, limiter_dd=tgt) @@ -392,7 +392,7 @@ def _getattr_ish(obj, name): def make_fluid_state_trace_pairs(cv_pairs, gas_model, temperature_seed_pairs=None, - smoothness_pairs=None, limiter_func=None): + smoothness_mu_pairs=None, limiter_func=None): """Create a fluid state from the conserved vars and equation of state. This routine helps create a thermally consistent fluid state out of a collection @@ -430,21 +430,21 @@ def make_fluid_state_trace_pairs(cv_pairs, gas_model, temperature_seed_pairs=Non from grudge.trace_pair import TracePair if temperature_seed_pairs is None: temperature_seed_pairs = [None] * len(cv_pairs) - if smoothness_pairs is None: - smoothness_pairs = [None] * len(cv_pairs) + if smoothness_mu_pairs is None: + smoothness_mu_pairs = [None] * len(cv_pairs) return [TracePair( cv_pair.dd, interior=make_fluid_state(cv_pair.int, gas_model, temperature_seed=_getattr_ish(tseed_pair, "int"), - smoothness=_getattr_ish(smoothness_pair, "int"), + smoothness_mu=_getattr_ish(smoothness_mu_pair, "int"), limiter_func=limiter_func, limiter_dd=cv_pair.dd), exterior=make_fluid_state(cv_pair.ext, gas_model, temperature_seed=_getattr_ish(tseed_pair, "ext"), - smoothness=_getattr_ish(smoothness_pair, "ext"), + smoothness_mu=_getattr_ish(smoothness_mu_pair, "ext"), limiter_func=limiter_func, limiter_dd=cv_pair.dd)) - for cv_pair, tseed_pair, smoothness_pair in zip(cv_pairs, + for cv_pair, tseed_pair, smoothness_mu_pair in zip(cv_pairs, temperature_seed_pairs, - smoothness_pairs)] + smoothness_mu_pairs)] class _FluidCVTag: @@ -455,7 +455,7 @@ class _FluidTemperatureTag: pass -class _FluidSmoothnessTag: +class _FluidSmoothnessMuTag: pass @@ -563,18 +563,18 @@ def make_operator_fluid_states( dcoll, volume_state.temperature, volume_dd=dd_vol, comm_tag=(_FluidTemperatureTag, comm_tag))] - smoothness_interior_pairs = None - if volume_state.smoothness is not None: - smoothness_interior_pairs = [ + smoothness_mu_interior_pairs = None + if volume_state.smoothness_mu is not None: + smoothness_mu_interior_pairs = [ interp_to_surf_quad(tpair=tpair) for tpair in interior_trace_pairs( - dcoll, volume_state.smoothness, volume_dd=dd_vol, - tag=(_FluidSmoothnessTag, comm_tag))] + dcoll, volume_state.smoothness_mu, volume_dd=dd_vol, + tag=(_FluidSmoothnessMuTag, comm_tag))] interior_boundary_states_quad = \ make_fluid_state_trace_pairs(cv_interior_pairs, gas_model, tseed_interior_pairs, - smoothness_interior_pairs, + smoothness_mu_interior_pairs, limiter_func=limiter_func) # Interpolate the fluid state to the volume quadrature grid diff --git a/mirgecom/transport.py b/mirgecom/transport.py index b8690c490..a7c51310b 100644 --- a/mirgecom/transport.py +++ b/mirgecom/transport.py @@ -359,7 +359,7 @@ def viscosity(self, cv: ConservedVars, # type: ignore[override] dv: GasDependentVars, eos: GasEOS) -> DOFArray: r"""Get the gas dynamic viscosity, $\mu$.""" - return (dv.smoothness*self.av_viscosity(cv, dv, eos) + return (dv.smoothness_mu*self.av_viscosity(cv, dv, eos) + self._physical_transport.viscosity(cv, dv)) def volume_viscosity(self, cv: ConservedVars, # type: ignore[override] @@ -371,7 +371,7 @@ def volume_viscosity(self, cv: ConservedVars, # type: ignore[override] $\lambda = \left(\mu_{B} - \frac{2\mu}{3}\right)$ """ - return (dv.smoothness*self.av_viscosity(cv, dv, eos) + return (dv.smoothness_mu*self.av_viscosity(cv, dv, eos) + self._physical_transport.volume_viscosity(cv, dv)) def thermal_conductivity(self, cv: ConservedVars, # type: ignore[override] @@ -379,7 +379,7 @@ def thermal_conductivity(self, cv: ConservedVars, # type: ignore[override] eos: GasEOS) -> DOFArray: r"""Get the gas thermal_conductivity, $\kappa$.""" mu = self.av_viscosity(cv, dv, eos) - av_kappa = (dv.smoothness*mu + av_kappa = (dv.smoothness_mu*mu * eos.heat_capacity_cp(cv, dv.temperature)/self._av_prandtl) return av_kappa + self._physical_transport.thermal_conductivity( cv, dv, eos)