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 
22 template <>
23 InputParameters
25 {
26  InputParameters params = validParams<RichardsDensity>();
27  params.addParam<Real>(
28  "p_unit",
29  1,
30  "Set to 1 for pressure measured in Pascals. Set to 1E6 for pressure measured in MPa. Etc.");
31  params.addClassDescription("Methane density (kg/m^3) at 20degC. Pressure is assumed to be "
32  "measured in Pascals. NOTE: this expression is only valid to about "
33  "P=20MPa. Use van der Waals (RichardsDensityVDW) for higher "
34  "pressures.");
35  return params;
36 }
37 
39  : RichardsDensity(parameters), _p_unit(getParam<Real>("p_unit"))
40 {
41 }
42 
43 Real
45 {
46  if (p >= 0)
47  return 0.00654576947608E-3 * p * _p_unit + 1.04357716547E-13 * std::pow(p * _p_unit, 2);
48  else
49  return 0.1 * (std::exp(6.54576947608E-5 * p * _p_unit) - 1);
50 }
51 
52 Real
54 {
55  if (p >= 0)
56  return (0.00654576947608E-3 + 2.08715433094E-13 * p * _p_unit) * _p_unit;
57  else
58  return 0.1 * 6.54576947608E-5 * _p_unit * std::exp(6.54576947608E-5 * p * _p_unit);
59 }
60 
61 Real
63 {
64  if (p >= 0)
65  return 2.08715433094E-13 * std::pow(_p_unit, 2);
66  else
67  return 0.1 * std::pow(6.54576947608E-5 * _p_unit, 2) * std::exp(6.54576947608E-5 * p * _p_unit);
68 }
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
RichardsDensityMethane20degC::density
Real density(Real p) const
fluid density as a function of porepressure
Definition: RichardsDensityMethane20degC.C:44
RichardsDensityMethane20degC::RichardsDensityMethane20degC
RichardsDensityMethane20degC(const InputParameters &parameters)
Definition: RichardsDensityMethane20degC.C:38
validParams< RichardsDensityMethane20degC >
InputParameters validParams< RichardsDensityMethane20degC >()
Definition: RichardsDensityMethane20degC.C:24
RichardsDensityMethane20degC::_p_unit
Real _p_unit
Unit of measurement for pressure (should be 1 for pressure in Pa, 1E6 for pressure in MPa,...
Definition: RichardsDensityMethane20degC.h:55
registerMooseObject
registerMooseObject("RichardsApp", RichardsDensityMethane20degC)
RichardsDensityMethane20degC::ddensity
Real ddensity(Real p) const
derivative of fluid density wrt porepressure
Definition: RichardsDensityMethane20degC.C:53
RichardsDensityMethane20degC::d2density
Real d2density(Real p) const
second derivative of fluid density wrt porepressure
Definition: RichardsDensityMethane20degC.C:62
RichardsDensityMethane20degC.h
validParams< RichardsDensity >
InputParameters validParams< RichardsDensity >()
Definition: RichardsDensity.C:16
RichardsDensity
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
Definition: RichardsDensity.h:24
RichardsDensityMethane20degC
Methane density - a quadratic fit to expressions in: "Results of (pressure, density,...
Definition: RichardsDensityMethane20degC.h:30