11 #include "libmesh/utility.h" 22 "Parameter 'a' in the van der Waals expression (P + n^2 a/V^2)(V - nb) = nRT. " 23 "Example for methane 0.2303 Pa m^6 mol^-2");
27 "Parameter 'b' in the van der Waals expression (P + n^2 a/V^2)(V - nb) = nRT. " 28 "Example for methane 4.31E-5 m^3/mol");
30 "temperature",
"temperature > 0",
"Temperature in Kelvin");
34 "Molar mass of the gas. Example for methane 16.04246E-3 kg/mol");
38 "For P<0 the density is not physically defined, " 39 "but numerically it is advantageous to define " 40 "it: density(P=-infinity) = " 41 "-infinity_ratio*molar_mass, and density tends " 42 "exponentially towards this value as P -> " 43 "-infinity. (Units are mol/m^3).");
50 _a(getParam<
Real>(
"a")),
51 _b(getParam<
Real>(
"b")),
52 _rt(getParam<
Real>(
"temperature") * 8.314472),
53 _molar_mass(getParam<
Real>(
"molar_mass")),
54 _infinity_ratio(getParam<
Real>(
"infinity_ratio")),
72 Utility::pow<2>(-2.0 - 18.0 *
y + 9.0 *
_rhs));
73 Real cr = std::cbrt(-2.0 + 9.0 *
_rhs - 18.0 *
y + sq);
75 x += std::cbrt(2.0) * (-1.0 + 3.0 *
_rhs + 3.0 *
y) / (3.0 * cr);
76 x -= cr / (3.0 * std::cbrt(2.0));
97 Utility::pow<2>(-2.0 - 18.0 *
y + 9.0 *
_rhs));
99 (4.0 * 3.0 * Utility::pow<2>(-1.0 + 3.0 *
y + 3.0 *
_rhs) * 3.0 * dy +
100 2.0 * (-2.0 - 18.0 *
y + 9.0 *
_rhs) * (-18.0 * dy));
101 Real cr = std::cbrt(-2.0 + 9.0 *
_rhs - 18.0 *
y + sq);
103 1.0 / 3.0 *
std::pow(-2.0 + 9.0 *
_rhs - 18.0 *
y + sq, -2.0 / 3.0) * (-18.0 * dy + dsq);
104 Real dx = std::cbrt(2.0) *
105 ((3.0 * dy) / (3.0 * cr) + (-1.0 + 3.0 *
_rhs + 3.0 *
y) / 3.0 * (-dcr / (cr * cr)));
106 dx -= dcr / (3.0 * std::cbrt(2.0));
121 Utility::pow<2>(-2.0 - 18.0 *
y + 9.0 *
_rhs));
122 Real dsq = 0.5 / sq *
123 (4.0 * 3.0 * Utility::pow<2>(-1.0 + 3.0 *
y + 3.0 *
_rhs) * 3.0 * dy +
124 2.0 * (-2.0 - 18.0 *
y + 9.0 *
_rhs) * (-18.0 * dy));
125 Real d2sq = -dsq * dsq / sq;
127 (4.0 * 3.0 * 2.0 * (-1.0 + 3.0 *
y + 3.0 *
_rhs) * 3.0 * dy * 3.0 * dy +
128 2.0 * (-18.0 * dy) * (-18.0 * dy));
129 Real cr = std::cbrt(-2.0 + 9.0 *
_rhs - 18.0 *
y + sq);
131 1.0 / 3.0 *
std::pow(-2.0 + 9.0 *
_rhs - 18.0 *
y + sq, -2.0 / 3.0) * (-18.0 * dy + dsq);
132 Real d2cr = 1.0 / 3.0 * (-2.0 / 3.0) *
std::pow(-2 + 9 *
_rhs - 18 *
y + sq, -5. / 3.) *
133 Utility::pow<2>(-18 * dy + dsq);
134 d2cr += 1.0 / 3.0 *
std::pow(-2 + 9 *
_rhs - 18 *
y + sq, -2. / 3.) * d2sq;
137 Real d2x = std::cbrt(2.0) *
138 (-(3.0 * dy) * dcr / (3.0 * cr * cr) + 3.0 * dy / 3.0 * (-dcr / (cr * cr)) +
139 (-1.0 + 3.0 *
_rhs + 3.0 *
y) / 3.0 *
140 (-d2cr / (cr * cr) + 2.0 * dcr * dcr / Utility::pow<3>(cr)));
141 d2x -= d2cr / (3.0 * std::cbrt(2.0));
Real density(Real p) const
fluid density as a function of porepressure
RichardsDensityVDW(const InputParameters ¶meters)
Real densityVDW(Real p) const
Density according to the van der Waals expression This is modified to yield density(p) as noted above...
Real _infinity_ratio
density at P=-infinity is _infinity_ratio*_molar_mass
static InputParameters validParams()
const std::vector< double > y
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
static InputParameters validParams()
const std::vector< double > x
registerMooseObject("RichardsApp", RichardsDensityVDW)
Real _slope0
(1/_molar_mass)*d(density)/dP at P=0
Real _vdw0
density at P=0 according to the van der Waals expression
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Density of a gas according to the van der Waals expression (P + n^2 a/V^2)(V - nb) = nRT How density ...
Real d2density(Real p) const
second derivative of fluid density wrt porepressure
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
Real _molar_mass
molar mass of gas
MooseUnits pow(const MooseUnits &, int)
Real ddensity(Real p) const
derivative of fluid density wrt porepressure