www.mooseframework.org
RichardsDensityMethane20degC.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 // Methane density - a quadratic fit to expressions in:
9 // "Results of (pressure, density, temperature) measurements on methane and on nitrogen in the
10 // temperature range from 273.15K to 323.15K at pressures up to 12MPa using new apparatus for
11 // accurate gas-density"
12 //
13 // This is only valid for p>=0, which is the physical region. I extend to the p>0 domain with an
14 // exponential, which will probably be sampled as the newton interative process converges towards
15 // the solution.
17 
18 template <>
19 InputParameters
21 {
22  InputParameters params = validParams<RichardsDensity>();
23  params.addParam<Real>(
24  "p_unit",
25  1,
26  "Set to 1 for pressure measured in Pascals. Set to 1E6 for pressure measured in MPa. Etc.");
27  params.addClassDescription("Methane density (kg/m^3) at 20degC. Pressure is assumed to be "
28  "measured in Pascals. NOTE: this expression is only valid to about "
29  "P=20MPa. Use van der Waals (RichardsDensityVDW) for higher "
30  "pressures.");
31  return params;
32 }
33 
35  : RichardsDensity(parameters), _p_unit(getParam<Real>("p_unit"))
36 {
37 }
38 
39 Real
41 {
42  if (p >= 0)
43  return 0.00654576947608E-3 * p * _p_unit + 1.04357716547E-13 * std::pow(p * _p_unit, 2);
44  else
45  return 0.1 * (std::exp(6.54576947608E-5 * p * _p_unit) - 1);
46 }
47 
48 Real
50 {
51  if (p >= 0)
52  return (0.00654576947608E-3 + 2.08715433094E-13 * p * _p_unit) * _p_unit;
53  else
54  return 0.1 * 6.54576947608E-5 * _p_unit * std::exp(6.54576947608E-5 * p * _p_unit);
55 }
56 
57 Real
59 {
60  if (p >= 0)
61  return 2.08715433094E-13 * std::pow(_p_unit, 2);
62  else
63  return 0.1 * std::pow(6.54576947608E-5 * _p_unit, 2) * std::exp(6.54576947608E-5 * p * _p_unit);
64 }
Real d2density(Real p) const
second derivative of fluid density wrt porepressure
InputParameters validParams< RichardsDensityMethane20degC >()
Real _p_unit
Unit of measurement for pressure (should be 1 for pressure in Pa, 1E6 for pressure in MPa...
Real ddensity(Real p) const
derivative of fluid density wrt porepressure
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Real density(Real p) const
fluid density as a function of porepressure
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
RichardsDensityMethane20degC(const InputParameters &parameters)
InputParameters validParams< RichardsDensity >()