Skip to content

Commit

Permalink
Update materials initializer to handle IdealSingleGas in porous fluid
Browse files Browse the repository at this point in the history
  • Loading branch information
tulioricci committed Mar 11, 2024
1 parent aebbe35 commit 6db936f
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions mirgecom/materials/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,30 @@ def __call__(self, x_vec, wall_model):


class PorousWallInitializer:
"""Initializer for porous materials."""
"""State initializer for porous materials."""

def __init__(self, temperature, species, material_densities,
pressure=None, density=None):
def __init__(self, temperature, material_densities, species=None,
pressure=None, density=None, porous_region=None):
"""Initialize the object for porous materials.
Parameters
----------
porous_region:
Field describing the homogeneous fluid (0) and porous material (1)
portions of the flow. Only used for unified-domain solver without
explicit coupling.
"""
self._pres = pressure
self._mass = density
self._y = species
self._temp = temperature
self._wall_density = material_densities
self._porous_region = porous_region

if species is not None:
self._y = species
else:
import numpy as np
self._y = np.empty((0,), dtype=object)

def __call__(self, x_vec, gas_model):
"""Evaluate the wall+gas properties for porous materials.
Expand All @@ -93,10 +107,21 @@ def __call__(self, x_vec, gas_model):
"""
actx = x_vec[0].array_context
zeros = actx.np.zeros_like(x_vec[0])
ones = zeros + 1.0
dim = x_vec.shape[0]

temperature = self._temp + zeros

nspecies = len(self._y)
if nspecies > 0:
species_mass_frac = make_obj_array([self._y[i] + zeros
for i in range(nspecies)])
else:
species_mass_frac = self._y

porous_region = ones if self._porous_region is None else self._porous_region
wall_density = self._wall_density * porous_region

species_mass_frac = self._y + zeros

wall_density = self._wall_density + zeros
Expand Down

0 comments on commit 6db936f

Please sign in to comment.