Skip to content

Commit

Permalink
Merge branch 'illinois-ceesd:main' into update_get_box_mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
aakankshbhat authored Jul 31, 2023
2 parents 5d6c9ff + 77b45f6 commit 3c454f4
Show file tree
Hide file tree
Showing 49 changed files with 7,617 additions and 953 deletions.
10 changes: 5 additions & 5 deletions .ci-support/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

set -ex

myos=$(uname)
myarch=$(uname -m)

if [[ "$(uname)" = "Darwin" ]]; then
PLATFORM=MacOSX
brew update
brew install open-mpi
brew install octave
else
PLATFORM=Linux
if ! command -v mpicc &> /dev/null ;then
sudo apt-get update
sudo apt-get -y install libopenmpi-dev openmpi-bin
Expand All @@ -19,7 +20,7 @@ else
fi

MINIFORGE_INSTALL_DIR=.miniforge3
MINIFORGE_INSTALL_SH=Miniforge3-$PLATFORM-x86_64.sh
MINIFORGE_INSTALL_SH=Mambaforge-$myos-$myarch.sh
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/$MINIFORGE_INSTALL_SH"
rm -Rf "$MINIFORGE_INSTALL_DIR"
bash "$MINIFORGE_INSTALL_SH" -b -p "$MINIFORGE_INSTALL_DIR"
Expand All @@ -28,15 +29,14 @@ bash "$MINIFORGE_INSTALL_SH" -b -p "$MINIFORGE_INSTALL_DIR"
#PATH="$MINIFORGE_INSTALL_DIR/bin/:$PATH" conda update conda --yes --quiet
#PATH="$MINIFORGE_INSTALL_DIR/bin/:$PATH" conda update --all --yes --quiet

PATH="$MINIFORGE_INSTALL_DIR/bin:$PATH" conda env create --file conda-env.yml --name testing --quiet
$MINIFORGE_INSTALL_DIR/bin/mamba env create --file conda-env.yml --name testing

. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
conda list

# See https://github.com/conda-forge/qt-feedstock/issues/208
rm -rf $MINIFORGE_INSTALL_DIR/envs/testing/x86_64-conda-linux-gnu/sysroot

MINIFORGE_INSTALL_DIR=.miniforge3
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
pip install -r requirements.txt
python setup.py install
22 changes: 16 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ on:
branches: main
schedule:
- cron: '5 0 * * *'


# Cancel in progress CI runs when a new run targeting the same PR or branch/tag is triggered.
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
flake8:
Expand Down Expand Up @@ -116,17 +121,17 @@ jobs:
run: |
MINIFORGE_INSTALL_DIR=.miniforge3
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
conda install vtk # needed for the accuracy comparison
mamba install vtk # needed for the accuracy comparison
export XDG_CACHE_HOME=/tmp
[[ $(hostname) == "porter" ]] && export PYOPENCL_TEST="port:nv" && unset XDG_CACHE_HOME && conda install pocl-cuda
[[ $(hostname) == "porter" ]] && export PYOPENCL_TEST="port:nv" && unset XDG_CACHE_HOME
# && export POCL_DEBUG=cuda
scripts/run-integrated-tests.sh --lazy-accuracy
- name: Run examples
run: |
MINIFORGE_INSTALL_DIR=.miniforge3
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
export XDG_CACHE_HOME=/tmp
[[ $(hostname) == "porter" ]] && export PYOPENCL_TEST="port:nv" && unset XDG_CACHE_HOME && conda install pocl-cuda
[[ $(hostname) == "porter" ]] && export PYOPENCL_TEST="port:nv" && unset XDG_CACHE_HOME
# && export POCL_DEBUG=cuda
scripts/run-integrated-tests.sh --examples
Expand All @@ -142,12 +147,17 @@ jobs:
- name: Build docs
run: |
set -x
MINIFORGE_INSTALL_DIR=.miniforge3
. "$MINIFORGE_INSTALL_DIR/bin/activate" testing
sudo apt-get update
sudo apt-get install texlive-latex-extra latexmk
conda install sphinx graphviz 'docutils>=0.16'
mamba install sphinx graphviz 'docutils>=0.16'
# Work around "Not enough memory to run on this device." errors in CI:
mamba uninstall pocl
pip install sphinx-math-dollar sphinx-copybutton furo
cd doc
make html SPHINXOPTS="-W --keep-going -n"
Expand Down Expand Up @@ -179,7 +189,7 @@ jobs:
cd mirgecom/examples
python -m mpi4py ./pulse-mpi.py
y1:
production:
name: Production testing
runs-on: ${{ matrix.os }}
strategy:
Expand Down
1 change: 1 addition & 0 deletions .rtd-env-py3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
- islpy
- pip
- pyopencl
- scipy
- pip:
- "git+https://github.com/inducer/pymbolic.git#egg=pymbolic"
- "git+https://github.com/inducer/loopy.git#egg=loopy"
Expand Down
3 changes: 3 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -- Project information -----------------------------------------------------
import sys

project = "mirgecom"
copyright = ("2020, University of Illinois Board of Trustees")
Expand Down Expand Up @@ -97,3 +98,5 @@
nitpick_ignore_regex = [
("py:class", r".*BoundaryDomainTag.*")
]

sys._BUILDING_SPHINX_DOCS = True
1 change: 1 addition & 0 deletions doc/discretization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ discussion. The following references are useful:
* Shock handling [Woodward_1984]_
* Artificial viscosity [Persson_2012]_
* Boundary Condtitions [Mengaldo_2014]_, and [Poinsot_1992]_
* Phenolics modeling [Lachaud_2014]_

*MIRGE-Com* currently employs a strategy akin to the BR1 algorithm outlined in
[Bassi_1997]_, but with thermal terms and chemical reaction sources as outlined in
Expand Down
2 changes: 2 additions & 0 deletions doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ References
`(DOI) <https://doi.org/10.1002/0471461296>`__
.. [Giles_1988] Michael Giles (1988), Non-Reflecting Boundary Conditions for the Euler \
Equations, CFDL-TR-88-1
.. [Lachaud_2014] Jean Lachaud and Nagi Mansour (2014), Porous-Material Analysis Toolbox Based
on OpenFOAM and Applications, Journal of Thermophysics and Heat Transfer 28 2
195 changes: 195 additions & 0 deletions doc/operators/composite_materials.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
Wall Degradation Modeling
=========================

Conserved Quantities
^^^^^^^^^^^^^^^^^^^^
.. autoclass:: mirgecom.wall_model.PorousFlowDependentVars

Equations of State
^^^^^^^^^^^^^^^^^^
.. autoclass:: mirgecom.wall_model.WallEOS
.. autoclass:: mirgecom.wall_model.WallDependentVars

Model-specific properties
^^^^^^^^^^^^^^^^^^^^^^^^^
The properties of the materials are defined in specific files. These files
are required by :class:`~mirgecom.wall_model.WallEOS`.

Carbon fiber
------------
.. automodule:: mirgecom.materials.carbon_fiber

TACOT
-----
.. automodule:: mirgecom.materials.tacot

Carbon Fiber Oxidation
^^^^^^^^^^^^^^^^^^^^^^

This section covers the response of carbon fiber when exposed to oxygen.
The carbon fibers are characterized as a highly porous material,
with void fraction $\approx 90\%$. As the material is exposed to the flow,
oxygen can diffuse inside the wall and result in oxidation, not only
limited to the surface but also as a volumetric process. For now, convection
inside the wall will be neglected and the species are only allowed to diffuse.

The temporal evolution of mass density is solved in
order to predict the material degradation. As the
:class:`~mirgecom.materials.carbon_fiber.Oxidation` progresses,
the temporal evolution of the fibers mass is given by

.. math ::
\frac{\partial \rho_s}{\partial t} = \dot{\omega_s} \mbox{ .}
This process creates gaseous species following

.. math ::
\frac{\partial \rho_g}{\partial t} = - \dot{\omega}_s \mbox{ ,}
where the
:attr:`~mirgecom.fluid.ConservedVars.mass`
is $\rho_g$. The source term indicates that the fibers become gas in order
to satisfy mass conservation.

The
:attr:`~mirgecom.fluid.ConservedVars.energy`
of the bulk material is given by

.. math::
\frac{\partial \rho_b e_b}{\partial t}
= \nabla \cdot \left( \bar{\boldsymbol{\kappa}} \nabla T
+ h_\alpha \mathbf{J}_{\alpha} \right)
\mbox{ .}
The first term on the RHS is modeled as an effective diffusive transfer
using Fourier's law, where the thermal conductivity is given by
$\bar{\boldsymbol{\kappa}}$.
The second term on the RHS is due to the species diffusion, where the
species specific enthalpy ${h}_{\alpha}$, and the species
diffusive flux vector $\mathbf{J}_{\alpha}$. The sub-index $b$ is the bulk
material consisting of both solid and gas phases, where

.. math::
\rho_b e_b = \epsilon_{g} \rho_g e_g + \epsilon_s \rho_s h_s \mbox{ .}
The internal energy of the gas is given by $e_g(T)$ and the solid
energy/enthalpy is $h_s(T)$.

From the conserved variables, it is possible to compute the oxidation
progress, denoted by
:attr:`~mirgecom.wall_model.WallDependentVars.tau`.
As a consequence, the instantaneous material properties will change due to
the mass loss.

The
:attr:`~mirgecom.eos.GasDependentVars.temperature`
is evaluated using Newton iteration based on both
:attr:`~mirgecom.eos.PyrometheusMixture.get_internal_energy` and
:attr:`~mirgecom.wall_model.WallEOS.enthalpy`,
as well as their respective derivatives, namely
:attr:`~mirgecom.eos.PyrometheusMixture.heat_capacity_cv` and
:attr:`~mirgecom.wall_model.WallEOS.heat_capacity`.
Note that :mod:`pyrometheus` is used to handle the species properties.

Composite Materials
^^^^^^^^^^^^^^^^^^^

This section covers the response of composite materials made of phenolic
resin and carbon fibers.
The carbon fibers are characterized as a highly porous material,
with void fraction $\approx 90\%$. Phenolic resins are added to rigidize
the fibers by permeating the material and filling partially the gaps between
fibers. As the material is heated up by the flow, the resin pyrolysis, i.e.,
it degrades and produces gaseous species.

The temporal evolution of wall density is solved in
order to predict the material degradation. As the
:class:`~mirgecom.materials.tacot.Pyrolysis` progresses, the mass of each
$i$ constituents of the resin, denoted by
:attr:`~mirgecom.wall_model.PorousFlowDependentVars.material_densities`,
is calculated as

.. math ::
\frac{\partial \rho_i}{\partial t} = \dot{\omega}_i \mbox{ .}
This process creates gaseous species following

.. math ::
\frac{\partial \rho_g}{\partial t} + \nabla \cdot \rho_g \mathbf{u} =
- \sum_i \dot{\omega}_i \mbox{ ,}
where the
:attr:`~mirgecom.fluid.ConservedVars.mass`
is $\rho_g$. The source term indicates that all solid resin must become
gas in order to satisfy mass conservation. Lastly, the gas velocity
$\mathbf{u}$ is obtained by Darcy's law, given by

.. math::
\mathbf{u} = \frac{\mathbf{K}}{\mu \epsilon} \cdot \nabla P \mbox{ .}
In this equation, $\mathbf{K}$ is the second-order permeability tensor,
$\mu$ is the gas viscosity, $\epsilon$ is the void fraction and $P$ is
the gas pressure.

The
:attr:`~mirgecom.fluid.ConservedVars.energy`
of the bulk material is given by

.. math::
\frac{\partial \rho_b e_b}{\partial t}
+ \nabla \cdot (\epsilon_{g} \rho_g h_g \mathbf{u})
= \nabla \cdot \left( \bar{\boldsymbol{\kappa}} \nabla T \right)
+ \mu \epsilon_{g}^2 (\bar{\mathbf{K}}^{-1} \cdot \vec{v} ) \cdot \vec{v}
\mbox{ .}
The first term on the RHS is modeled as an effective diffusive transfer
using Fourier's law, where the thermal conductivity is given by
$\bar{\boldsymbol{\kappa}}$. The second term on the RHS account for the
viscous dissipation in the Darcy's flow. The sub-index $b$ is the bulk
material consisting of both solid and gas phases, where

.. math::
\rho_b e_b = \epsilon_{g} \rho_g e_g + \epsilon_s \rho_s e_s \mbox{ .}
The energy of the gas is given by $e_g(T) = h_g(T) - \frac{P}{\rho_g}$,
where $h_g$ is its enthalpy.

From the conserved variables, it is possible to compute the decomposition
status, denoted by
:attr:`~mirgecom.wall_model.WallDependentVars.tau`.
This yields the proportion of virgin (unpyrolyzed material) to char (fully
pyrolyzed) and, consequently, the different thermophysicochemical
properties of the solid phase. Thus, the instantaneous material properties
depend on the current state of the material, as well as the
:attr:`~mirgecom.eos.GasDependentVars.temperature`.
It is evaluated using Newton iteration based on both
:attr:`~mirgecom.materials.tacot.GasProperties.enthalpy` (tabulated
data) or
:attr:`~mirgecom.eos.PyrometheusMixture.get_internal_energy` (Pyrometheus)
and
:attr:`~mirgecom.wall_model.WallEOS.enthalpy`,
as well as their respective derivatives, namely
:attr:`~mirgecom.materials.tacot.GasProperties.heat_capacity` and
:attr:`~mirgecom.wall_model.WallEOS.heat_capacity`.

In *MIRGE-Com*, the solid properties are obtained by fitting polynomials
to tabulated data for easy evaluation of the properties based on the
temperature. The complete list of properties can be find, for instance, in
:mod:`~mirgecom.materials.tacot`.
Different materials can be incorporated as separated files.

The
:class:`~mirgecom.materials.tacot.GasProperties` are obtained based on
tabulated data, assuming chemical equilibrium, and evaluated with splines
for interpolation of the entries. However, the data is currently obtained
by PICA.

.. important ::
The current implementation follows the description of [Lachaud_2014]_
for type 2 code. Additional details, extensive formulation and references
are provided in https://github.com/illinois-ceesd/phenolics-notes
Helper Functions
----------------
.. autofunction:: mirgecom.multiphysics.phenolics.initializer
1 change: 1 addition & 0 deletions doc/operators/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Operators
artificial_viscosity
gas-dynamics
thermally_coupled
composite_materials
1 change: 1 addition & 0 deletions doc/support/tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Random Pile'o'Tools

.. automodule:: mirgecom.simutil
.. automodule:: mirgecom.utils
.. automodule:: mirgecom.array_context
1 change: 1 addition & 0 deletions examples/ablation-workshop-mpi-lazy.py
Loading

0 comments on commit 3c454f4

Please sign in to comment.