handbook: finalize fluid frameworks chapter

(at least for Dumux 2.1)
This commit is contained in:
Andreas Lauser 2012-02-08 14:54:10 +00:00 committed by Andreas Lauser
parent d3f2bdb3e6
commit 5efb7f0256
2 changed files with 231 additions and 221 deletions

View File

@ -43,17 +43,20 @@
\usepackage{rotating} \usepackage{rotating}
\usepackage{subfig} \usepackage{subfig}
\ifpdf
\usepackage{auto-pst-pdf}
\fi
\usepackage{pstricks}
\usepackage[normalem]{ulem} \usepackage[normalem]{ulem}
\usepackage{tabularx} \usepackage{tabularx}
\usepackage{graphics} \usepackage{graphics}
\usepackage{pstricks}
\newcommand{\snakeline}{% \newcommand{\snakeline}{%
% {\uwave{\makebox[\linewidth]{\mbox{}}}} % {\uwave{\makebox[\linewidth]{\mbox{}}}}
\uwave{\mbox{}} \uwave{\mbox{}}
} }
\usepackage{layout} \usepackage{layout}
%\usepackage{ngerman} %\usepackage{ngerman}
\usepackage[english]{babel} \usepackage[english]{babel}

View File

@ -37,23 +37,24 @@ The \Dumux fluid framework currently features the following concepts
parameters depending on the quantities which changed since the last parameters depending on the quantities which changed since the last
update. update.
\item[Constraint solver:] Constraint solvers are auxiliary tools to \item[Constraint solver:] Constraint solvers are auxiliary tools to
make sure that a fluid state adheres to some thermodynamic make sure that a fluid state is consistent with some thermodynamic
constraints. All constraint solvers specify a well defined set of constraints. All constraint solvers specify a well defined set of
input variables make sure that the resulting fluid state is input variables and make sure that the resulting fluid state is
consistent with a given set of thermodynamic equations. See section consistent with a given set of thermodynamic equations. See section
\ref{sec:constraint_solvers} for a detailed description of the \ref{sec:constraint_solvers} for a detailed description of the
constraint solvers which are currently available in \Dumux. constraint solvers which are currently available in \Dumux.
\item[Equation of state:] Equations of state (EOS) are auxiliary \item[Equation of state:] Equations of state (EOS) are auxiliary
classes which provide relations between a fluid phase's temperature, classes which provide relations between a fluid phase's temperature,
pressure and density. Since these classes are only used internally pressure, composition and density. Since these classes are only used
in fluid systems, their programming intereface is currently ad-hoc. internally in fluid systems, their programming interface is
currently ad-hoc.
\item[Component:] Components are fluid systems which provide the \item[Component:] Components are fluid systems which provide the
thermodynamic relations for the liquid and gas phase of a single thermodynamic relations for the liquid and gas phase of a single
chemical species or a fixed mixture of species. Their main purpose chemical species or a fixed mixture of species. Their main purpose
is to provide a convenient way to access these quantities from is to provide a convenient way to access these quantities from
full-fledged fluid systems. Components are not supposed to be used full-fledged fluid systems. Components are not supposed to be used
by models directly. by models directly.
\item[Binary coefficient:] Binary coefficients express the relations \item[Binary coefficient:] Binary coefficients describe the relations
of a mixture of two components. Typical binary coefficients are of a mixture of two components. Typical binary coefficients are
\textsc{Henry} coefficients or binary molecular diffusion \textsc{Henry} coefficients or binary molecular diffusion
coefficients. So far, the programming interface for accessing binary coefficients. So far, the programming interface for accessing binary
@ -63,91 +64,94 @@ The \Dumux fluid framework currently features the following concepts
\section{Fluid States} \section{Fluid States}
Fluid state objects express the complete thermodynamic state of a Fluid state objects express the complete thermodynamic state of a
system at a given spatial and temporal position. {\bf All} fluid system at a given spatial and temporal position.
states {\bf must} export the following constants:
\subsection{Exported Constants}
{\bf All} fluid states {\bf must} export the following constants:
\begin{description} \begin{description}
\item[numPhases:] The number of fluid phases considered. \item[numPhases:] The number of fluid phases considered.
\item[numComponents:] The number of considered chemical \item[numComponents:] The number of considered chemical
species or pseudo-species. species or pseudo-species.
\end{description} \end{description}
\subsection{Accessible Thermodynamic Quantities}
Also, {\bf all} fluid states {\bf must} provide the following methods: Also, {\bf all} fluid states {\bf must} provide the following methods:
\begin{description} \begin{description}
\item[temperature():] The absolute temperature $T_\alpha$ of \item[temperature():] The absolute temperature $T_\alpha$ of
a fluid phase $\alpha$. a fluid phase $\alpha$.
\item[pressure():] The absolute pressure $p_\alpha$ of a \item[pressure():] The absolute pressure $p_\alpha$ of a
fluid phase $\alpha$. fluid phase $\alpha$.
\item[saturation():] The saturation $S_\alpha$ of a fluid \item[saturation():] The saturation $S_\alpha$ of a fluid phase
phase $\alpha$. The saturation is defined as the pore space occupied by the $\alpha$. The saturation is defined as the pore space occupied by
fluid divided by the total pore space: the fluid divided by the total pore space:
\[ \[
\saturation_\alpha := \frac{\porosity \mathcal{V}_\alpha}{\porosity \mathcal{V}} \saturation_\alpha := \frac{\porosity \mathcal{V}_\alpha}{\porosity \mathcal{V}}
\] \]
\item[moleFraction():] Returns the molar fraction \item[moleFraction():] Returns the molar fraction $x^\kappa_\alpha$ of
$x^\kappa_\alpha$ of a component $\kappa$ in a fluid phase the component $\kappa$ in fluid phase $\alpha$. The molar fraction
$\alpha$. The molar fraction $x^\kappa_\alpha$ is defined as the number $x^\kappa_\alpha$ is defined as the ratio of the number of molecules
of molecules of a component in a mixture divided by the total number of component $\kappa$ and the total number of molecules of the phase
of molecules in the fluid. $\alpha$.
\item[moleFraction():] Returns the mass fraction \item[moleFraction():] Returns the mass fraction $X^\kappa_\alpha$ of
$X^\kappa_\alpha$ of a component $\kappa$ in a fluid phase component $\kappa$ in fluid phase $\alpha$. The mass fraction
$\alpha$. The mass fraction $X^\kappa_\alpha$ is defined as the $X^\kappa_\alpha$ is defined as the weight of all molecules of a
weight of a component in a mixture divided by the total mass of the component divided by the total mass of the fluid phase. It is
fluid. It is related with the component's mole fraction by means of related with the component's mole fraction by means of the relation
the relation
\[ \[
X^\kappa_\alpha = x^\kappa_\alpha \frac{M^\kappa}{\overline M_\alpha}\;, X^\kappa_\alpha = x^\kappa_\alpha \frac{M^\kappa}{\overline M_\alpha}\;,
\] \]
where $M^\kappa$ is the molar mass of component $\kappa$ and where $M^\kappa$ is the molar mass of component $\kappa$ and
$\overline M_\alpha$ is the mean molar mass of a molecule of phase $\overline M_\alpha$ is the mean molar mass of a molecule of phase
$\alpha$. $\alpha$.
\item[averageMolarMass():] Returns $\overline M_\alpha$, the \item[averageMolarMass():] Returns $\overline M_\alpha$, the mean
mean molar mass of a molecule of phase $\alpha$. For a mixture of $N molar mass of a molecule of phase $\alpha$. For a mixture of $N > 0$
> 0$ components, $\overline M_\alpha$ is defined as components, $\overline M_\alpha$ is defined as
\[ \[
\overline M_\alpha = \sum_{\kappa=1}^{N} x^\kappa_\alpha M^\kappa \overline M_\alpha = \sum_{\kappa=1}^{N} x^\kappa_\alpha M^\kappa
\] \]
\item[density():] Returns the density $\rho_\alpha$ of a \item[density():] Returns the density $\rho_\alpha$ of the fluid phase
fluid phase $\alpha$. $\alpha$.
\item[molarDensity():] Returns the molar density \item[molarDensity():] Returns the molar density $\rho_{mol,\alpha}$
$\rho_{mol,\alpha}$ of a fluid phase $\alpha$. The molar density can of a fluid phase $\alpha$. The molar density is defined by the mass
be defined using the mass density $\rho_\alpha$ and the mean molar mass $\overline M_\alpha$ by density $\rho_\alpha$ and the mean molar mass $\overline M_\alpha$:
\[ \[
\rho_{mol,\alpha} = \frac{\rho_\alpha}{\overline M_\alpha} \;. \rho_{mol,\alpha} = \frac{\rho_\alpha}{\overline M_\alpha} \;.
\] \]
\item[molarVolume():] Returns the molar volume \item[molarVolume():] Returns the molar volume $v_{mol,\alpha}$ of a
$V_{mol,\alpha}$ of a fluid phase $\alpha$. This quantity is just fluid phase $\alpha$. This quantity is the inverse of the molar
the inverse of the molar density. density.
\item[molarity():] Returns the molar concentration \item[molarity():] Returns the molar concentration $c^\kappa_\alpha$
$c^\kappa_\alpha$ of component $\kappa$ in fluid of component $\kappa$ in fluid phase $\alpha$.
phase $\alpha$. \item[fugacity():] Returns the fugacity $f^\kappa_\alpha$ of component
\item[fugacity():] Returns the fugacity $f^\kappa_\alpha$ of $\kappa$ in fluid phase $\alpha$. The fugacity is defined as
component $\kappa$ in fluid phase $\alpha$. The fugacity is defined
as
\[ \[
f_\alpha^\kappa := \Phi^\kappa_\alpha x^\kappa_\alpha p_\alpha \;, f_\alpha^\kappa := \Phi^\kappa_\alpha x^\kappa_\alpha p_\alpha \;,
\] \]
where $\Phi^\kappa_\alpha$ is the {\em fugacity where $\Phi^\kappa_\alpha$ is the {\em fugacity
coefficient}~\cite{reid1987}. The physical meaning of coefficient}~\cite{reid1987}. The physical meaning of fugacity
fugacity becomes clear from the equation becomes clear from the equation
\[ \[
f_\alpha^\kappa = p_\alpha \exp\left\{\frac{\zeta^\kappa_\alpha}{R T_\alpha} \right\} \;, f_\alpha^\kappa = p_\alpha \exp\left\{\frac{\zeta^\kappa_\alpha}{R T_\alpha} \right\} \;,
\] \]
where $\zeta^\kappa_\alpha$ represents the $\kappa$'s chemical where $\zeta^\kappa_\alpha$ represents the $\kappa$'s chemical
potential in phase $\alpha$, $R$ stands for the potential in phase $\alpha$, $R$ stands for the ideal gas constant,
ideal gas constant, and $T_\alpha$ for the absolute and $T_\alpha$ for the absolute temperature of phase
temperature phase $\alpha$. Assuming thermal equilibrium, there is a $\alpha$. Assuming thermal equilibrium, there is a one-to-one
one-to-one mapping between a component's chemical potential mapping between a component's chemical potential
$\zeta^\kappa_\alpha$ and its fugacity $f^\kappa_\alpha$. In this $\zeta^\kappa_\alpha$ and its fugacity $f^\kappa_\alpha$. In this
case chemical equilibrium can thus be expressed by case chemical equilibrium can thus be expressed by
\[ \[
f^\kappa = f^\kappa_\alpha = f^\kappa_\beta \forall \alpha, \beta f^\kappa := f^\kappa_\alpha = f^\kappa_\beta\quad\forall \alpha, \beta
\] \]
\item[fugacityCoefficient():] Returns the fugacity coefficient $\Phi^\kappa_\alpha$ of \item[fugacityCoefficient():] Returns the fugacity coefficient
component $\kappa$ in fluid phase $\alpha$. $\Phi^\kappa_\alpha$ of component $\kappa$ in fluid phase $\alpha$.
\item[enthalpy():] Returns specific enthalpy $h_\alpha$ of a \item[enthalpy():] Returns specific enthalpy $h_\alpha$ of a fluid
fluid phase $\alpha$. phase $\alpha$.
\item[internalEnergy():] Returns specific internal energy $u_\alpha$ of a \item[internalEnergy():] Returns specific internal energy $u_\alpha$
fluid phase $\alpha$. The specific internal energy is defined by the relation of a fluid phase $\alpha$. The specific internal energy is defined
by the relation
\[ \[
u_\alpha = h_\alpha - \frac{p_\alpha}{\rho_\alpha} u_\alpha = h_\alpha - \frac{p_\alpha}{\rho_\alpha}
\] \]
@ -155,36 +159,35 @@ Also, {\bf all} fluid states {\bf must} provide the following methods:
$\mu_\alpha$ of fluid phase $\alpha$. $\mu_\alpha$ of fluid phase $\alpha$.
\end{description} \end{description}
Currently, the following fluid states are available in \Dumux: \subsection{Available Fluid States}
Currently, the following fluid states are provided by \Dumux:
\begin{description} \begin{description}
\item[NonEquilibriumFluidState:] This is the most general \item[NonEquilibriumFluidState:] This is the most general fluid state
fluid state supplied. It does not assume thermodynamic equilibrium supplied. It does not assume thermodynamic equilibrium and thus
and this stores all phase compositions (using mole fractions) and stores all phase compositions (using mole fractions), fugacity
fugacity coefficients, as well as all phase temperatures, pressures, coefficients, phase temperatures, phase pressures, saturations and
saturations and enthalpies. specific enthalpies.
\item[CompositionalFluidState:] The \item[CompositionalFluidState:] This fluid state is very similar to
\texttt{Non\-Equilibrium\-Fluid\-State} with the difference the \texttt{Non\-Equilibrium\-Fluid\-State} with the difference that
\texttt{Compositional\-Fluid\-State} is similar to the difference that the \texttt{Compositional\-Fluid\-State} assumes thermodynamic
is assumes thermodynamic equilibrium. In the context of multi-phase equilibrium. In the context of multi-phase flow in porous media,
flow in porous media, this means that only a single temperature this means that only a single temperature needs to be stored.
needs to be stored. \item[ImmisicibleFluidState:] This fluid state assumes that the fluid
\item[ImmisicibleFluidState:] This fluid state assumes that phases are immiscible, which implies that the phase compositions and
the fluid phases are immiscible, which implies that the phase the fugacity coefficients do not need to be stored explicitly.
compositions and the fugacity coefficients do not need to be stored \item[PressureOverlayFluidState:] This is a so-called {\em overlay}
explicitly. fluid state. It allows to set the pressure of all fluid phases but
\item[PressureOverlayFluidState:] This is a so-called {\em forwards everything else to another fluid state.
overlay} fluid state. It allows to set the pressure of all fluid \item[SaturationOverlayFluidState:] This fluid state is like the
phases but forwards everything else to an other fluid state. \texttt{PressureOverlayFluidState}, except that the phase
\item[SaturationOverlayFluidState:] This fluid state is like
the \texttt{PressureOverlayFluidState}, except that the phase
saturations are settable instead of the phase pressures. saturations are settable instead of the phase pressures.
\item[TempeatureOverlayFluidState:] This fluid state is like \item[TempeatureOverlayFluidState:] This fluid state is like the
the \texttt{PressureOverlayFluidState}, except that the temperature \texttt{PressureOverlayFluidState}, except that the temperature is
is settable instead of the phase pressures. Note that this overlay settable instead of the phase pressures. Note that this overlay
state assumes thermal equilibrium regardless of underlying fluid state assumes thermal equilibrium regardless of underlying fluid
state. state.
\item[CompositionOverlayFluidState:] This fluid state is like \item[CompositionOverlayFluidState:] This fluid state is like the
the \texttt{PressureOverlayFluidState}, except that the phase \texttt{PressureOverlayFluidState}, except that the phase
composition is settable (in terms of mole fractions) instead of the composition is settable (in terms of mole fractions) instead of the
phase pressures. phase pressures.
\end{description} \end{description}
@ -197,41 +200,38 @@ quantities of a fluid state.
\subsection{Parameter Caches} \subsection{Parameter Caches}
All fluid systems must export a type for their \texttt{ParameterCache} All fluid systems must export a type for their \texttt{ParameterCache}
objects which caches parameters which are expensive to compute and are objects. Parameter caches can be used to cache parameter that are
required in multiple thermodynamic relations. For fluid systems which expensive to compute and are required in multiple thermodynamic
do not require to cache parameters, \Dumux provides a relations. For fluid systems which do need to cache parameters,
\texttt{NullParameterCache} class. \Dumux provides a \texttt{NullParameterCache} class.
The parameters stored by parameter cache objects are specific to the The actual quantities stored by parameter cache objects are specific
fluid system and no assumptions on what they provide can be made to the fluid system and no assumptions on what they provide should be
outside of their fluid system. Parameter cache objects provide a made outside of their fluid system. Parameter cache objects provide a
well-defined set of methods to make them coherent with a given fluid well-defined set of methods to make them coherent with a given fluid
state, though. Parameter cache objects must at least provide the state, though. These update are:
following update methods
\begin{description} \begin{description}
\item[updateAll(fluidState, except):] Update all cached quantities in \item[updateAll(fluidState, except):] Update all cached quantities for
all phases. The \texttt{except} argument contains a bit field of the all phases. The \texttt{except} argument contains a bit field of the
quantities which have not changed since the last call to a quantities which have not been modified since the last call to a
\texttt{update()} method. \texttt{update()} method.
\item[updateAllPresures(fluidState):] \item[updateAllPresures(fluidState):] Update all cached quantities
Update all cached quantities which depend on pressure for which depend on the pressure of any fluid phase.
all phases. \item[updateAllTemperatures(fluidState):] Update all cached quantities
\item[updateAllTemperatures(fluidState):] which depend on temperature of any fluid phase.
Update all cached quantities which depend on temperature for \item[updatePhase(fluidState, phaseIdx, except):] Update all cached
all phases. quantities for a given phase. The quantities specified by the
\item[updatePhase(fluidState, phaseIdx, except):] Update all cached \texttt{except} bit field have not been modified since the last call
quantities for a given phase. The quantities specified by the to an \texttt{update()} method.
\texttt{except} bit field have not been modified since the last \item[updateTemperature(fluidState, phaseIdx):] Update all cached
call to an \texttt{update()} method. quantities which depend on the temperature of a given phase.
\item[updateTemperature(fluidState, phaseIdx):] Update all cached \item[updatePressure(fluidState, phaseIdx):] Update all cached
quantities which depend on the temperature of a given phase. quantities which depend on the pressure of a given phase.
\item[updatePressure(fluidState, phaseIdx):] Update all cached \item[updateComposition(fluidState, phaseIdx):] Update all cached
quantities which depend on the pressure of a given phase. quantities which depend on the composition of a given phase.
\item[updateComposition(fluidState, phaseIdx):] Update all cached \item[updateSingleMoleFraction(fluidState, phaseIdx, compIdx):] Update
quantities which depend on the composition of a given phase. all cached quantities which depend on the value of the mole fraction
\item[updateSingleMoleFraction(fluidState, phaseIdx, compIdx):] of a component in a phase.
Update all cached quantities which depend on the value of a mole
fraction of a given components of a given phase.
\end{description} \end{description}
Note, that the parameter cache interface only guarantees that if a Note, that the parameter cache interface only guarantees that if a
more specialized \texttt{update()} method is called, it is not slower more specialized \texttt{update()} method is called, it is not slower
@ -242,9 +242,9 @@ general \texttt{update()} method once than multiple calls to
specialized \texttt{update()} methods. specialized \texttt{update()} methods.
To make usage of parameter caches easier for the case where all cached To make usage of parameter caches easier for the case where all cached
quantities ought to be re-calculated if the respective phase was quantities ought to be re-calculated if a quantity of a phase was
changed, it is possible to just define the \texttt{updatePhase()} changed, it is possible to only define the \texttt{updatePhase()}
method and derive a parameter cache from method and derive the parameter cache from
\texttt{Dumux::ParameterCacheBase}. \texttt{Dumux::ParameterCacheBase}.
\subsection{Exported Constants and Capabilities} \subsection{Exported Constants and Capabilities}
@ -254,49 +254,54 @@ fluid systems need to export the following constants and auxiliary
methods: methods:
\begin{description} \begin{description}
\item[numPhases:] The number of considered fluid phases. \item[numPhases:] The number of considered fluid phases.
\item[numComponents:] The number of considered chemical (pseudo-) species. \item[numComponents:] The number of considered chemical (pseudo-)
\item[init():] Initialize the fluid system. This is usually species.
used tabulated to tabulate some quantities \item[init():] Initialize the fluid system. This is usually used to
\item[phaseName():] Given the index of a fluid phase, return a tabulate some quantities
human-readable string as its name. \item[phaseName():] Given the index of a fluid phase, return its name
\item[componentName():] Given the index of a component, as human-readable string.
return a human-readable string as its name. \item[componentName():] Given the index of a component, return its
\item[isLiquid():] Return whether the phase is a liquid, given the index of a phase. name as human-readable string.
\item[isIdealMixture():] Return whether the phase is an ideal \item[isLiquid():] Return whether the phase is a liquid, given the
mixture, given the index of a phase. In the context of the \Dumux index of a phase.
fluid framework a phase $\alpha$ is an ideal mixture if, and only if \item[isIdealMixture():] Return whether the phase is an ideal mixture,
all its fugacity coefficients $\Phi^\kappa_\alpha$ do not depend on given the phase index. In the context of the \Dumux fluid
the phase composition. (Although they might very well depend on framework a phase $\alpha$ is an ideal mixture if, and only if, all
its fugacity coefficients $\Phi^\kappa_\alpha$ do not depend on the
phase composition. (Although they might very well depend on
temperature and pressure.) temperature and pressure.)
\item[isIdealGas():] Return whether a phase $\alpha$ is an ideal \item[isIdealGas():] Return whether a phase $\alpha$ is an ideal gas,
gas, i.e. it adheres to the relation i.e. it adheres to the relation
\[ \[
p_\alpha V_{mol,\alpha} = R T_\alpha \;, p_\alpha v_{mol,\alpha} = R T_\alpha \;,
\] \]
with $R$ being the ideal gas constant. with $R$ being the ideal gas constant.
\item[isCompressible():] Return whether a phase $\alpha$ is \item[isCompressible():] Return whether a phase $\alpha$ is
compressible, i.e. its density depends on pressure $p_\alpha$. compressible, i.e. its density depends on pressure $p_\alpha$.
\item[molarMass():] Given a component index, return the molar \item[molarMass():] Given a component index, return the molar mass of
mass of the corresponding component. the corresponding component.
\end{description} \end{description}
\subsection{Thermodynamic Relations} \subsection{Thermodynamic Relations}
Fluid systems have been explicitly designed to provide as few Fluid systems have been explicitly designed to provide as few
thermodynamic relations as necessary. A full-fledged fluid system thus thermodynamic relations as possible. A full-fledged fluid system thus
only needs to provide the following thermodynamic relations: only needs to provide the following thermodynamic relations:
\begin{description} \begin{description}
\item[density():] Given a fluid state, an up-to-date parameter \item[density():] Given a fluid state, an up-to-date parameter cache
cache and a phase index, return the mass density $\rho_\alpha$ of the phase. and a phase index, return the mass density $\rho_\alpha$ of the
\item[fugacityCoefficient:] Given a fluid state, an up-to-date phase.
\item[fugacityCoefficient():] Given a fluid state, an up-to-date
parameter cache as well as a phase and a component index, return the parameter cache as well as a phase and a component index, return the
fugacity coefficient $\Phi^\kappa_\alpha$ of a the component for the phase. fugacity coefficient $\Phi^\kappa_\alpha$ of a the component for the
\item[viscosity():] Given a fluid state, an up-to-date parameter phase.
cache and a phase index, return the dynamic viscosity $\mu_\alpha$ of the phase. \item[viscosity():] Given a fluid state, an up-to-date parameter cache
\item[diffusionCoefficient():] Given a fluid state, an and a phase index, return the dynamic viscosity $\mu_\alpha$ of the
up-to-date parameter cache and a phase index, return the dynamic phase.
viscosity of the phase, calculate the molecular diffusion \item[diffusionCoefficient():] Given a fluid state, an up-to-date
coefficient for a component in a fluid phase parameter cache, a phase and a component index, return the calculate
the molecular diffusion coefficient for the component in the fluid
phase.
Molecular diffusion of a component $\kappa$ in phase $\alpha$ is Molecular diffusion of a component $\kappa$ in phase $\alpha$ is
caused by a gradient of the chemical potential and follows the law caused by a gradient of the chemical potential and follows the law
@ -304,36 +309,36 @@ only needs to provide the following thermodynamic relations:
J^\kappa_\alpha = - D^\kappa_\alpha\ \mathbf{grad} \zeta^\kappa_\alpha\;, J^\kappa_\alpha = - D^\kappa_\alpha\ \mathbf{grad} \zeta^\kappa_\alpha\;,
\] \]
where $\zeta^\kappa_\alpha$ is the component's chemical potential, where $\zeta^\kappa_\alpha$ is the component's chemical potential,
$D^\kappa_\alpha$ is the diffusion coefficient and $J^\kappa_\alpha$ is the $D^\kappa_\alpha$ is the diffusion coefficient and $J^\kappa_\alpha$
diffusive flux. $\zeta^\kappa_\alpha$ is connected to the is the diffusive flux. $\zeta^\kappa_\alpha$ is connected to the
component's fugacity $f^\kappa_\alpha$ by the relation component's fugacity $f^\kappa_\alpha$ by the relation
\[ \[
\zeta^\kappa_\alpha = \zeta^\kappa_\alpha =
R T_\alpha \mathrm{ln} \frac{f^\kappa_\alpha}{p_\alpha} \;. R T_\alpha \mathrm{ln} \frac{f^\kappa_\alpha}{p_\alpha} \;.
\] \]
\item[binaryDiffusionCoefficient():] Given a fluid state, an \item[binaryDiffusionCoefficient():] Given a fluid state, an
up-to-date parameter cache, a phase index and two up-to-date parameter cache, a phase index and two component indices,
component indices return the binary diffusion coefficient for return the binary diffusion coefficient for the binary mixture. This
components for the binary mixture. This method is less general than method is less general than \texttt{diffusionCoefficient} method,
\texttt{diffusionCoefficient} method, but usually only binary but relations can only be found for binary diffusion coefficients in
diffusion coefficients can be found in the literature. the literature.
\item[enthalpy():] Given a fluid state, an up-to-date parameter \item[enthalpy():] Given a fluid state, an up-to-date parameter cache
cache and a phase index, this method represents the specific and a phase index, this method calulates the specific enthalpy
enthalpy $h_\alpha$ of the phase. $h_\alpha$ of the phase.
\item[thermalConductivity:] Given a fluid state, an \item[thermalConductivity:] Given a fluid state, an up-to-date
up-to-date parameter cache and a phase index, this method expresses parameter cache and a phase index, this method returns the thermal
the thermal conductivity $\lambda_\alpha$ of the fluid phase. The conductivity $\lambda_\alpha$ of the fluid phase. The thermal
thermal conductivity is defined by means of the relation conductivity is defined by means of the relation
\[ \[
\dot Q = \lambda_\alpha \mathbf{grad} T_\alpha \;, \dot Q = \lambda_\alpha \mathbf{grad}\;T_\alpha \;,
\] \]
where $\dot Q$ is the heat flux caused by a temperature gradient where $\dot Q$ is the heat flux caused by the temperature gradient
$\mathbf{grad} T_\alpha$. $\mathbf{grad}\;T_\alpha$.
\item[heatCapacity():] Given a fluid state, an up-to-date \item[heatCapacity():] Given a fluid state, an up-to-date parameter
parameter cache and a phase index, this method represents the cache and a phase index, this method computes the isobaric heat
isobaric heat capacity $c_{p,\alpha}$ of the fluid phase. The capacity $c_{p,\alpha}$ of the fluid phase. The isobaric heat
isobaric heat capacity is defined as the partial derivative of the capacity is defined as the partial derivative of the specific
specific enthalpy $h_\alpha$ to the fluid pressure: enthalpy $h_\alpha$ to the fluid pressure:
\[ \[
c_{p,\alpha} = \frac{\partial h_\alpha}{\partial p_\alpha} c_{p,\alpha} = \frac{\partial h_\alpha}{\partial p_\alpha}
\] \]
@ -342,58 +347,59 @@ only needs to provide the following thermodynamic relations:
Fluid systems may chose not to implement some of these methods and Fluid systems may chose not to implement some of these methods and
throw a \texttt{Dune::NotImplemented} exception instead. Obviously, throw a \texttt{Dune::NotImplemented} exception instead. Obviously,
such fluid systems cannot be used in conjunction with models that such fluid systems cannot be used for models that depend on those
depend on those methods. methods.
\subsection{Available Fluid Systems} \subsection{Available Fluid Systems}
Currently, the following fluid states are available in \Dumux:
Currently, the following fluid systems are available in \Dumux:
\begin{description} \begin{description}
\item[Dumux::FluidSystems::TwoPImmiscible:] A two-phase fluid \item[Dumux::FluidSystems::TwoPImmiscible:] A two-phase fluid system
system featuring which assumes immiscibility of the fluid which assumes immiscibility of the fluid phases. The fluid phases
phases. The fluid phases are thus specified by means of their are thus completely specified by means of their constituting
constituting components. This fluid system is intended to be used components. This fluid system is intended to be used with models
with models that assume immiscibility. that assume immiscibility.
\item[Dumux::FluidSystems::H2ON2:] A two-phase fluid system \item[Dumux::FluidSystems::H2ON2:] A two-phase fluid system featuring
featuring the gas and liquid phases and distilled water ($H_2O$) and gas and liquid phases and distilled water ($H_2O$) and pure
pure molecular Nitrogen ($N_2$) as components. molecular Nitrogen ($N_2$) as components.
\item[Dumux::FluidSystems::H2OAir:] A two-phase fluid system \item[Dumux::FluidSystems::H2OAir:] A two-phase fluid system
featuring the gas and liquid phases and distilled water ($H_2O$) and featuring gas and liquid phases and distilled water ($H_2O$) and
air (Pseudo component composed of $79\%\;N_2$, $20\%\;O_2$ and air (Pseudo component composed of $79\%\;N_2$, $20\%\;O_2$ and
$1\%\;Ar$) as components. $1\%\;Ar$) as components.
\item[Dumux::FluidSystems::H2OAirMesitylene:] A three-phase fluid \item[Dumux::FluidSystems::H2OAirMesitylene:] A three-phase fluid
system featuring the gas, NAPL and water phases and distilled water system featuring gas, NAPL and water phases and distilled water, air
($H_2O$) and air and Mesitylene ($C_6H_3(CH_3)_3$) as components. This fluid and Mesitylene ($C_6H_3(CH_3)_3$) as components. This fluid system
system assumes all phases to be ideal mixtures. assumes all phases to be ideal mixtures.
\item[Dumux::FluidSystems::H2OAirXylene:] A three-phase fluid \item[Dumux::FluidSystems::H2OAirXylene:] A three-phase fluid system
system featuring the gas, NAPL and water phases and distilled water featuring gas, NAPL and water as phases and distilled water, air and
($H_2O$) and air and Xylene ($C_8H_{10}$) as components. This fluid Xylene ($C_8H_{10}$) as components. This fluid system assumes all
system assumes all phases to be ideal mixtures. phases to be ideal mixtures.
\item[Dumux::FluidSystems::Spe5:] A three-phase fluid system \item[Dumux::FluidSystems::Spe5:] A three-phase fluid system featuring
featuring the gas, oil and water as phases and the seven components gas, oil and water as phases and the seven components distilled
distilled water ($H_2O$), Methane ($C_1$), Propane ($C_3$), Pentane water, Methane ($C_1$), Propane ($C_3$), Pentane ($C_5$), Heptane
($C_5$), Heptane ($C_7$), Decane ($C_{10}$), Pentadecane ($C_7$), Decane ($C_{10}$), Pentadecane ($C_{15}$) and Icosane
($C_{15}$) and Icosane ($C_{20}$). For the water phase the IAPWS-97 ($C_{20}$). For the water phase the IAPWS-97 formulation is used as
formulation is used as equation of state, while for the gas and oil equation of state, while for the gas and oil phases a
phases a \textsc{Peng}-\textsc{Robinson} equation of state with \textsc{Peng}-\textsc{Robinson} equation of state with slightly
slightly modified parameters is used. This fluid system is highly modified parameters is used. This fluid system is highly non-linear,
non-linear, and the gas and oil phases can also not be considered as and the gas and oil phases also cannot be considered ideal
ideal mixtures\cite{SPE5}. mixtures\cite{SPE5}.
\end{description} \end{description}
\section{Constraint Solvers} \section{Constraint Solvers}
\label{sec:constraint_solvers} \label{sec:constraint_solvers}
Constraint solvers connect the thermodynamic relations of expressed by Constraint solvers connect the thermodynamic relations expressed by
fluid systems with the thermodynamic quantities stored by fluid fluid systems with the thermodynamic quantities stored by fluid
states. Using them is not mandatory for models, but given the fact states. Using them is not mandatory for models, but given the fact
that some thermodynamic constraints can be quite complex to solve, that some thermodynamic constraints can be quite complex to solve,
sharing this code between models makes a lot of sense. Currently, sharing this code between models makes sense. Currently, \Dumux
\Dumux provides the following constraint solvers: provides the following constraint solvers:
\begin{description} \begin{description}
\item[CompositionFromFugacities:] This constraint takes all \item[CompositionFromFugacities:] This constraint solver takes all
component fugacities, the temperature and pressure of a phase as component fugacities, the temperature and pressure of a phase as
input and calculates the composition of the fluid. This means that input and calculates the composition of the fluid phase. This means
the thermodynamic constraints used by this solver are that the thermodynamic constraints used by this solver are
\[ \[
f^\kappa = \Phi^\kappa_\alpha(\{x^\beta_\alpha \}, T_\alpha, p_\alpha) p_\alpha x^\kappa_\alpha\;, f^\kappa = \Phi^\kappa_\alpha(\{x^\beta_\alpha \}, T_\alpha, p_\alpha) p_\alpha x^\kappa_\alpha\;,
\] \]
@ -408,19 +414,19 @@ sharing this code between models makes a lot of sense. Currently,
\end{eqnarray*} \end{eqnarray*}
where $p_{c\beta\alpha}$ is the capillary pressure between the where $p_{c\beta\alpha}$ is the capillary pressure between the
fluid phases $\beta$ and $\alpha$. fluid phases $\beta$ and $\alpha$.
\item[NcpFlash:] This is a so-called flash solver. A flash \item[NcpFlash:] This is a so-called flash solver. A flash solver
solver takes the total mass of all components per volume unit as takes the total mass of all components per volume unit and the phase
input and calculates all phase temperatures, pressures, saturations temperatures as input and calculates all phase pressures,
and pressures. This flash solver works for an arbitrary number of saturations and compositions. This flash solver works for an
phases $M > 0$ and components $N \geq M - 1$. In this case, arbitrary number of phases $M > 0$ and components $N \geq M - 1$. In
the unknowns are the following: this case, the unknown quantities are the following:
\begin{itemize} \begin{itemize}
\item $M$ pressures $p_\alpha$ \item $M$ pressures $p_\alpha$
\item $M$ saturations $\saturation_\alpha$ \item $M$ saturations $\saturation_\alpha$
\item $M\cdot N$ mole fractions $x^\kappa_\alpha$ \item $M\cdot N$ mole fractions $x^\kappa_\alpha$
\end{itemize} \end{itemize}
This sums up to $M\cdot(N + 2)$. The equations side of things, can This sums up to $M\cdot(N + 2)$. The equations side of things
offer the following: provides:
\begin{itemize} \begin{itemize}
\item $(M - 1)\cdot N$ equations stemming from the fact that the \item $(M - 1)\cdot N$ equations stemming from the fact that the
fugacity of any component is the same in all phases, i.e. fugacity of any component is the same in all phases, i.e.
@ -428,35 +434,36 @@ sharing this code between models makes a lot of sense. Currently,
f^\kappa_\alpha = f^\kappa_\beta f^\kappa_\alpha = f^\kappa_\beta
\] \]
holds for all phases $\alpha, \beta$ and all components $\kappa$. holds for all phases $\alpha, \beta$ and all components $\kappa$.
\item $1$ equation originating from the closure condition of the saturations: \item $1$ equation comes from the fact that the whole pore space is
filled by some fluid, i.e.
\[ \[
\sum_{\alpha=1}^M \saturation_\alpha = 1 \sum_{\alpha=1}^M \saturation_\alpha = 1
\] \]
\item $M - 1$ constraints are defined by the capillary pressures: \item $M - 1$ constraints are given by the capillary pressures:
\[ \[
p_\beta = p_\alpha + p_{c\beta\alpha} \;, p_\beta = p_\alpha + p_{c\beta\alpha} \;,
\] \]
for all phases $\alpha$, $\beta$ for all phases $\alpha$, $\beta$
\item $N$ constraints come the fact that the total mass of each \item $N$ constraints come the fact that the total mass of each
component is given: component is given:
\[ \[
c^\kappa_{tot} = sum_{\alpha=1}^M \rho_{mol,\alpha} x_\alpha^\kappa = const c^\kappa_{tot} = \sum_{\alpha=1}^M x_\alpha^\kappa\;\rho_{mol,\alpha} = const
\] \]
\item And finally $M$ model constraints. This solver uses NCP \item And finally $M$ model assumptions are used. This solver uses
constraints as proposed in~\cite{LHHW2011}: the NCP constraints proposed in~\cite{LHHW2011}:
\[ \[
0 = \mathrm{min}\{\saturation_\alpha, 1 - \sum_{\kappa=1}^N x_\alpha^\kappa\} 0 = \mathrm{min}\{\saturation_\alpha, 1 - \sum_{\kappa=1}^N x_\alpha^\kappa\}
\] \]
\end{itemize} \end{itemize}
The number of equations also sums up to $M\cdot(N + 2)$. Thus, the
The number of equation also sums up to $M\cdot(N + 2)$. And the system system of equations is closed.
of equations is closed. \item[ImmiscibleFlash:] This is a flash solver assuming immiscibility
\item[ImmiscibleFlash:] This is a flash solver assuming of the phases. It is similar to the \texttt{NcpFlash} solver but a
immiscibility of the phases. It is similar to the \texttt{NcpFlash} lot simpler.
solver but a lot simpler. \item[MiscibleMultiphaseComposition:] This solver calculates the
\item[MiscibleMultiphaseComposition:] This solver calculates composition of all phases provided that each of the phases is
the composition of all phases provided that each of them is potentially present. Currently, this solver does not support
present. Currently, this solver does not support non-ideal mixtures. non-ideal mixtures.
\end{description} \end{description}
%%% Local Variables: %%% Local Variables: