Skip to content

Commit

Permalink
Fix up wall_model 1
Browse files Browse the repository at this point in the history
  • Loading branch information
MTCam committed Sep 7, 2024
1 parent 7800e67 commit 05b2643
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions mirgecom/wall_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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)
)

Expand Down

0 comments on commit 05b2643

Please sign in to comment.