From 05b26432a69b82927d57e406dbb18d054ced9959 Mon Sep 17 00:00:00 2001 From: Mike Campbell Date: Fri, 6 Sep 2024 23:17:01 -0500 Subject: [PATCH] Fix up wall_model 1 --- mirgecom/wall_model.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mirgecom/wall_model.py b/mirgecom/wall_model.py index 7011ad3ca..ee9c2f744 100644 --- a/mirgecom/wall_model.py +++ b/mirgecom/wall_model.py @@ -152,7 +152,7 @@ def density(self) -> DOFArray: """Return the wall density for all components.""" return self._density_func() - def heat_capacity(self, temperature: DOFArray = None) -> DOFArray: + def heat_capacity(self, temperature: Optional[DOFArray] = None) -> DOFArray: """Return the wall heat_capacity for all components.""" return self._heat_capacity_func(temperature) @@ -161,7 +161,7 @@ def enthalpy(self, temperature: DOFArray) -> DOFArray: return self._enthalpy_func(temperature) def thermal_diffusivity(self, mass: DOFArray, temperature: DOFArray, - thermal_conductivity: DOFArray = None) -> DOFArray: + thermal_conductivity: Optional[DOFArray] = None) -> DOFArray: """Return the wall thermal diffusivity for all components.""" if thermal_conductivity is None: thermal_conductivity = self.thermal_conductivity(temperature) @@ -172,7 +172,7 @@ def thermal_conductivity(self, temperature: DOFArray) -> DOFArray: return self._thermal_conductivity_func(temperature) def get_temperature(self, wv: SolidWallConservedVars, - tseed: DOFArray = None, niter: int = 3) -> DOFArray: + tseed: Optional[DOFArray] = None, niter: int = 3) -> DOFArray: """Evaluate the temperature based on the energy.""" if tseed is not None: temp = tseed*1.0 @@ -185,7 +185,8 @@ def get_temperature(self, wv: SolidWallConservedVars, return wv.energy/(self.density()*self.heat_capacity()) def dependent_vars(self, wv: SolidWallConservedVars, - tseed: DOFArray = None, niter: int = 3) -> SolidWallDependentVars: + tseed: Optional[DOFArray] = None, + niter: int = 3) -> SolidWallDependentVars: """Return solid wall dependent variables.""" temperature = self.get_temperature(wv, tseed, niter) kappa = self.thermal_conductivity(temperature) @@ -315,14 +316,14 @@ def bulk_viscosity(self, cv: ConservedVars, dv: GasDependentVars, def volume_viscosity(self, cv: ConservedVars, dv: GasDependentVars, wv: PorousWallVars, eos: GasEOS) -> DOFArray: r"""Get the 2nd viscosity coefficent, $\lambda$.""" - return (self.bulk_viscosity(cv, dv, wv, eos) - - 2./3. * self.viscosity(cv, dv, wv, eos)) + return (self.bulk_viscosity(cv, dv, wv, eos) # type: ignore + - 2./3. * self.viscosity(cv, dv, wv, eos)) # type: ignore def viscosity(self, cv: ConservedVars, dv: GasDependentVars, wv: PorousWallVars, eos: GasEOS) -> DOFArray: """Viscosity of the gas through the porous wall.""" - return 1.0/wv.void_fraction*( - self.base_transport.viscosity(cv, dv, eos)) + return 1.0/wv.void_fraction*( # type: ignore + self.base_transport.viscosity(cv, dv, eos)) # type: ignore def thermal_conductivity(self, cv: ConservedVars, dv: GasDependentVars, wv: PorousWallVars, eos: GasEOS, @@ -340,12 +341,13 @@ def thermal_conductivity(self, cv: ConservedVars, dv: GasDependentVars, """ kappa_s = wall_eos.thermal_conductivity(dv.temperature, wv.tau) kappa_g = self.base_transport.thermal_conductivity(cv, dv, eos) - return (wv.density*kappa_s + cv.mass*kappa_g)/(cv.mass + wv.density) + return (wv.density*kappa_s + cv.mass*kappa_g)/(cv.mass + wv.density)\ + # type: ignore def species_diffusivity(self, cv: ConservedVars, dv: GasDependentVars, - wv: PorousWallVars, eos: GasEOS) -> DOFArray: + wv: PorousWallVars, eos: GasEOS) -> np.ndarray: """Mass diffusivity of gaseous species through the porous wall.""" - return 1.0/wv.tortuosity*( + return 1.0/wv.tortuosity*( # type: ignore self.base_transport.species_diffusivity(cv, dv, eos)) def transport_vars(self, cv: ConservedVars, dv: GasDependentVars, @@ -355,8 +357,8 @@ def transport_vars(self, cv: ConservedVars, dv: GasDependentVars, return GasTransportVars( bulk_viscosity=self.bulk_viscosity(cv, dv, wv, eos), viscosity=self.viscosity(cv, dv, wv, eos), - thermal_conductivity=self.thermal_conductivity(cv, dv, wv, eos, - wall_eos), + thermal_conductivity=self.thermal_conductivity( # type: ignore + cv, dv, wv, eos, wall_eos), species_diffusivity=self.species_diffusivity(cv, dv, wv, eos) )