\(\rightarrow\) this also applies to other complex nonlinear equation systems.
There is a library of Components
,
FluidSystems
, BinaryCoefficients
available in
DuMux. Can be used as is or can be a good start for a user
implementation.
More resources can be found in the code documentation.
static Scalar gasHeatCapacity(Scalar temperature, Scalar pressure)
{
constexpr Scalar cpVapA = 19.25;
constexpr Scalar cpVapB = 0.05213;
constexpr Scalar cpVapC = 1.197e-5;
constexpr Scalar cpVapD = -1.132e-8;
return 1/molarMass()*(
cpVapA + temperature*(
cpVapB/2 + temperature*(cpVapC/3 + temperature*(cpVapD/4))
)
);
}
Express the thermodynamic relations between fluid quantities (e.g. calculation of density or viscosity based on composition; fugacity coefficient based on temperature and pressure…)
template <class FluidState>
static Scalar heatCapacity(const FluidState& fluidState, int phaseIdx)
{
const Scalar temperature = fluidState.temperature(phaseIdx);
const Scalar pressure = fluidState.pressure(phaseIdx);
if (phaseIdx == liquidPhaseIdx)
return H2O::liquidHeatCapacity(temperature, pressure); // neglect air
else if (phaseIdx == gasPhaseIdx)
return Air::gasHeatCapacity(temperature, pressure)
* fluidState.moleFraction(gasPhaseIdx, AirIdx)
+ H2O::gasHeatCapacity(temperature, pressure)
* fluidState.moleFraction(gasPhaseIdx, H2OIdx);
...
}
Contain data and equations required for binary mixtures, for instance, binary diffusion coefficients or coefficients needed for constitutive relationships (e.g. Henry coefficient)
template <class Scalar>
static Scalar gasDiffCoeff(Scalar temperature, Scalar pressure)
{
// _H2O_Air_
constexpr Scalar theta = 1.8;
constexpr Scalar Daw = 2.13e-5; /* reference value */
constexpr Scalar pg0 = 1.e5; /* reference pressure */
constexpr Scalar T0 = 273.15; /* reference temperature */
using std::pow;
return Daw*(pg0/pressure)*pow((temperature/T0), theta);
}
Express the thermodynamic properties of the solid matrix (e.g. calculation of the solid density and solid heat capacity based on the composition)
Specifying a solid system is only necessary if you work with a non-isothermal or mineralization model. If no solid system is specified in the problem file, the default is the inert solid phase with the constant component. For the constant component you can set properties in the input file.
\(\begin{equation} p_c = \frac{1}{\alpha}\left(S_e^{-1/m} -1\right)^{1/n} \end{equation}\)
\(\rightarrow\) the empirical parameters \(\alpha\) and \(n\) have to be specified
\(\begin{equation} p_c = p_d S_e^{-1/\lambda} \end{equation}\)
\(\rightarrow\) the empirical parameters \(p_d\) and \(\lambda\) have to be specified
Connect the thermodynamic relations expressed by fluid systems with the thermodynamic quantities stored by fluid states (e.g. mole fraction, density)
CompositionFromFugacities : takes all component fugacities, the temperature and pressure of a phase as input and calculates the phase composition
// Predefined fluid system for components water and air
#include <dumux/material/fluidsystems/h2oair.hh>
// H2OAir allows to customize the water phase. Here, we want
// to use tabulated H2O for fast evaluation of the properties.
#include <dumux/material/components/h2o.hh>
#include <dumux/material/components/tabulatedcomponent.hh>
FluidSystem
propertytemplate<class TypeTag>
struct FluidSystem<TypeTag, TTag::H2OAir>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Liquid = Components::TabulatedComponent<Components::H2O<Scalar>>;
using Policy = FluidSystems::H2OAirDefaultPolicy<
/*fastButSimplifiedRelations=*/true
>;
public:
using type = FluidSystems::H2OAir<
Scalar, Liquid, Policy, /*useKelvinVapourPressure*/true
>;
};
// The solid system
template<class TypeTag>
struct SolidSystem<TypeTag, TTag::ThermoChem>
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using ComponentOne = Components::ModifiedCaO<Scalar>;
using ComponentTwo = Components::CaO2H2<Scalar>;
using type = SolidSystems::CompositionalSolidPhase<
Scalar, ComponentOne, ComponentTwo
>;
};
Go to Fluidsystem exercise