From fad3b8bc0ec6861898be22f60ea99a8c2cf07fe0 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Mon, 17 Jul 2023 13:26:05 -0500 Subject: [PATCH 1/3] use zeros_like in boundary.py --- mirgecom/boundary.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mirgecom/boundary.py b/mirgecom/boundary.py index 8be93f6ab..69368f49d 100644 --- a/mirgecom/boundary.py +++ b/mirgecom/boundary.py @@ -1196,7 +1196,8 @@ def farfield_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): def temperature_bc(self, dcoll, dd_bdry, state_minus, **kwargs): """Return farfield temperature for use in grad(temperature).""" - return 0*state_minus.temperature + self._temperature + actx = state_minus.array_context + return actx.np.zeros_like(state_minus.temperature) + self._temperature class PressureOutflowBoundary(PrescribedFluidBoundary): @@ -1332,7 +1333,7 @@ def outflow_state_for_diffusion(self, dcoll, dd_bdry, gas_model, gamma = gas_model.eos.gamma(state_minus.cv, state_minus.temperature) # evaluate internal energy based on prescribed pressure - pressure_plus = self._pressure + 0.0*state_minus.pressure + pressure_plus = self._pressure + actx.np.zeros_like(state_minus.pressure) if state_minus.is_mixture: gas_const = gas_model.eos.gas_const(state_minus.cv) temp_plus = ( @@ -1442,7 +1443,7 @@ def inflow_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): actx = state_minus.array_context nhat = actx.thaw(dcoll.normal(dd_bdry)) - ones = 0.0*nhat[0] + 1.0 + ones = actx.np.zeros_like(state_minus.temperature) + 1. free_stream_state = self.free_stream_state_func( dcoll, dd_bdry, gas_model, state_minus, **kwargs) @@ -1541,8 +1542,7 @@ def outflow_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): """ actx = state_minus.array_context nhat = actx.thaw(dcoll.normal(dd_bdry)) - - ones = 0.0*nhat[0] + 1.0 + ones = actx.zeros_like(state_minus.temperature) + 1. free_stream_state = self.free_stream_state_func( dcoll, dd_bdry, gas_model, state_minus, **kwargs) @@ -1638,8 +1638,9 @@ 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 wall_temp = project_from_base(dcoll, dd_bdry, self._wall_temp) - return 0*state_minus.temperature + wall_temp + return actx.np.zeros_like(state_minus.temperature) + wall_temp def state_bc(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): """Return BC fluid state.""" @@ -1734,8 +1735,9 @@ 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 wall_temp = project_from_base(dcoll, dd_bdry, self._wall_temp) - return 0*state_minus.temperature + wall_temp + return actx.np.zeros_like(state_minus.temperature) + wall_temp def state_bc(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): """Return BC fluid state.""" From 8540374636c6a9873b60d17edc7a03a8fe4cca0c Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Mon, 17 Jul 2023 17:50:00 -0500 Subject: [PATCH 2/3] actx. -> actx.np. --- mirgecom/boundary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirgecom/boundary.py b/mirgecom/boundary.py index 69368f49d..d759cb704 100644 --- a/mirgecom/boundary.py +++ b/mirgecom/boundary.py @@ -1542,7 +1542,7 @@ def outflow_state(self, dcoll, dd_bdry, gas_model, state_minus, **kwargs): """ actx = state_minus.array_context nhat = actx.thaw(dcoll.normal(dd_bdry)) - ones = actx.zeros_like(state_minus.temperature) + 1. + ones = actx.np.zeros_like(state_minus.temperature) + 1. free_stream_state = self.free_stream_state_func( dcoll, dd_bdry, gas_model, state_minus, **kwargs) From 913e9f325871c1378b2ef5fe39b25388cbab97f1 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Mon, 17 Jul 2023 17:58:02 -0500 Subject: [PATCH 3/3] undo addition of radiation to deprecated operators --- .../thermally_coupled_fluid_wall.py | 56 +------------------ 1 file changed, 2 insertions(+), 54 deletions(-) diff --git a/mirgecom/multiphysics/thermally_coupled_fluid_wall.py b/mirgecom/multiphysics/thermally_coupled_fluid_wall.py index 21beb8fea..000795b77 100644 --- a/mirgecom/multiphysics/thermally_coupled_fluid_wall.py +++ b/mirgecom/multiphysics/thermally_coupled_fluid_wall.py @@ -1274,20 +1274,12 @@ def coupled_grad_t_operator( If `True`, interface boundaries on the fluid side will be treated as no-slip walls. If `False` they will be treated as slip walls. - interface_radiation: bool - - If `True`, interface includes a radiation sink term in the heat flux. See - :class:`~mirgecom.multiphysics.thermally_coupled_fluid_wall.InterfaceWallRadiationBoundary` - for details. Additional arguments *wall_emissivity*, *sigma*, and - *ambient_temperature* are required if enabled and *wall_grad_temperature* - is not `None`. - use_kappa_weighted_grad_flux_in_fluid: bool Indicates whether the temperature gradient flux on the fluid side of the interface should be computed using a simple average of temperatures or by weighting the temperature from each side by its respective thermal - conductivity. Not used if *interface_radiation* is `True`. + conductivity. quadrature_tag: @@ -1349,7 +1341,6 @@ def coupled_grad_t_operator( fluid_state, wall_kappa, wall_temperature, fluid_boundaries, wall_boundaries, interface_noslip=interface_noslip, - interface_radiation=interface_radiation, quadrature_tag=quadrature_tag) else: fluid_all_boundaries_no_grad = _fluid_all_boundaries_no_grad @@ -1378,11 +1369,7 @@ def coupled_ns_heat_operator( *, time=0., interface_noslip=True, - interface_radiation=False, use_kappa_weighted_grad_flux_in_fluid=None, - wall_emissivity=None, - sigma=None, - ambient_temperature=None, wall_penalty_amount=None, quadrature_tag=DISCR_TAG_BASE, limiter_func=None, @@ -1454,37 +1441,12 @@ def coupled_ns_heat_operator( If `True`, interface boundaries on the fluid side will be treated as no-slip walls. If `False` they will be treated as slip walls. - interface_radiation: bool - - If `True`, interface includes a radiation sink term in the heat flux. See - :class:`~mirgecom.multiphysics.thermally_coupled_fluid_wall.InterfaceWallRadiationBoundary` - for details. Additional arguments *wall_emissivity*, *sigma*, and - *ambient_temperature* are required if enabled. - use_kappa_weighted_grad_flux_in_fluid: bool Indicates whether the temperature gradient flux on the fluid side of the interface should be computed using a simple average of temperatures or by weighting the temperature from each side by its respective thermal - conductivity. Not used if *interface_radiation* is `True`. - - wall_emissivity: float or :class:`meshmode.dof_array.DOFArray` - - Emissivity of the wall material. - - sigma: float - - Stefan-Boltzmann constant. - - ambient_temperature: :class:`meshmode.dof_array.DOFArray` - - Ambient temperature of the environment. - - wall_penalty_amount: float - - Coefficient $c$ for the interior penalty on the heat flux. See - :class:`~mirgecom.multiphysics.thermally_coupled_fluid_wall.InterfaceFluidBoundary` - for details. Not used if *interface_radiation* is `True`. + conductivity. wall_penalty_amount: float @@ -1522,15 +1484,6 @@ def coupled_ns_heat_operator( ":func:`add_interface_boundaries` and include them when calling the " "individual operators instead.", DeprecationWarning, stacklevel=2) - if interface_radiation: - if ( - wall_emissivity is None - or sigma is None - or ambient_temperature is None): - raise TypeError( - "Arguments 'wall_emissivity', 'sigma' and 'ambient_temperature'" - "are required if using surface radiation.") - if use_kappa_weighted_grad_flux_in_fluid is None: warn( "Default value of use_kappa_weighted_grad_flux_in_fluid has changed " @@ -1565,7 +1518,6 @@ def coupled_ns_heat_operator( fluid_state, wall_kappa, wall_temperature, fluid_boundaries, wall_boundaries, interface_noslip=interface_noslip, - interface_radiation=interface_radiation, quadrature_tag=quadrature_tag) # Get the operator fluid states @@ -1600,10 +1552,6 @@ def coupled_ns_heat_operator( fluid_grad_temperature, wall_grad_temperature, fluid_boundaries, wall_boundaries, interface_noslip=interface_noslip, - interface_radiation=interface_radiation, - wall_emissivity=wall_emissivity, - sigma=sigma, - ambient_temperature=ambient_temperature, wall_penalty_amount=wall_penalty_amount, quadrature_tag=quadrature_tag)