www.mooseframework.org
RichardsDensityMethane20degC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // Methane density - a quadratic fit to expressions in:
11 // "Results of (pressure, density, temperature) measurements on methane and on nitrogen in the
12 // temperature range from 273.15K to 323.15K at pressures up to 12MPa using new apparatus for
13 // accurate gas-density"
14 //
15 // This is only valid for p>=0, which is the physical region. I extend to the p>0 domain with an
16 // exponential, which will probably be sampled as the newton interative process converges towards
17 // the solution.
19 
21 
24 {
26  params.addParam<Real>(
27  "p_unit",
28  1,
29  "Set to 1 for pressure measured in Pascals. Set to 1E6 for pressure measured in MPa. Etc.");
30  params.addClassDescription("Methane density (kg/m^3) at 20degC. Pressure is assumed to be "
31  "measured in Pascals. NOTE: this expression is only valid to about "
32  "P=20MPa. Use van der Waals (RichardsDensityVDW) for higher "
33  "pressures.");
34  return params;
35 }
36 
38  : RichardsDensity(parameters), _p_unit(getParam<Real>("p_unit"))
39 {
40 }
41 
42 Real
44 {
45  if (p >= 0)
46  return 0.00654576947608E-3 * p * _p_unit + 1.04357716547E-13 * std::pow(p * _p_unit, 2);
47  else
48  return 0.1 * (std::exp(6.54576947608E-5 * p * _p_unit) - 1);
49 }
50 
51 Real
53 {
54  if (p >= 0)
55  return (0.00654576947608E-3 + 2.08715433094E-13 * p * _p_unit) * _p_unit;
56  else
57  return 0.1 * 6.54576947608E-5 * _p_unit * std::exp(6.54576947608E-5 * p * _p_unit);
58 }
59 
60 Real
62 {
63  if (p >= 0)
64  return 2.08715433094E-13 * std::pow(_p_unit, 2);
65  else
66  return 0.1 * std::pow(6.54576947608E-5 * _p_unit, 2) * std::exp(6.54576947608E-5 * p * _p_unit);
67 }
Real ddensity(Real p) const
derivative of fluid density wrt porepressure
Methane density - a quadratic fit to expressions in: "Results of (pressure, density, temperature) measurements on methane and on nitrogen in the temperature range from 273.15K to 323.15K at pressures up to 12MPa using new apparatus for accurate gas-density" This is only valid for p>=0, which is the physical region.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
registerMooseObject("RichardsApp", RichardsDensityMethane20degC)
Real _p_unit
Unit of measurement for pressure (should be 1 for pressure in Pa, 1E6 for pressure in MPa...
Real density(Real p) const
fluid density as a function of porepressure
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
RichardsDensityMethane20degC(const InputParameters &parameters)
MooseUnits pow(const MooseUnits &, int)
Real d2density(Real p) const
second derivative of fluid density wrt porepressure