www.mooseframework.org
LangmuirMaterial.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 #include "LangmuirMaterial.h"
8 #include "libmesh/utility.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<Material>();
15 
16  params.addRequiredCoupledVar(
17  "one_over_desorption_time_const",
18  "Time constant for Langmuir desorption (gas moving from matrix to porespace). Units [s]");
19  params.addRequiredCoupledVar(
20  "one_over_adsorption_time_const",
21  "Time constant for Langmuir adsorption (gas moving from porespace to matrix). Units [s].");
22  params.addRequiredParam<Real>("langmuir_density",
23  "This is (Langmuir volume)*(density of gas at standard temp and "
24  "pressure). Langmuir volume is measured in (gas volume)/(matrix "
25  "volume). (Methane density(101kPa, 20degC) = 0.655kg/m^3. "
26  "Methane density(101kPa, 0degC) = 0.715kg/m^3.) Units [kg/m^3]");
27  params.addRequiredParam<Real>("langmuir_pressure", "Langmuir pressure. Units Pa");
28  params.addRequiredCoupledVar("conc_var", "The concentration of gas variable");
29  params.addRequiredCoupledVar("pressure_var", "The gas porepressure variable");
30  params.addClassDescription("Material type that holds info regarding Langmuir desorption from "
31  "matrix to porespace and viceversa");
32  return params;
33 }
34 
35 LangmuirMaterial::LangmuirMaterial(const InputParameters & parameters)
36  : Material(parameters),
37  // coupledValue returns a reference (an alias) to a VariableValue, and the & turns it into a
38  // pointer
39  _one_over_de_time_const(&coupledValue("one_over_desorption_time_const")),
40  _one_over_ad_time_const(&coupledValue("one_over_adsorption_time_const")),
41 
42  _langmuir_dens(getParam<Real>("langmuir_density")),
43  _langmuir_p(getParam<Real>("langmuir_pressure")),
44 
45  _conc(&coupledValue("conc_var")),
46  _pressure(&coupledValue("pressure_var")),
47 
48  _mass_rate_from_matrix(declareProperty<Real>("mass_rate_from_matrix")),
49  _dmass_rate_from_matrix_dC(declareProperty<Real>("dmass_rate_from_matrix_dC")),
50  _dmass_rate_from_matrix_dp(declareProperty<Real>("dmass_rate_from_matrix_dp"))
51 {
52 }
53 
54 void
56 {
57  Real equilib_conc = _langmuir_dens * ((*_pressure)[_qp]) / (_langmuir_p + (*_pressure)[_qp]);
58  Real dequilib_conc_dp =
59  _langmuir_dens / (_langmuir_p + (*_pressure)[_qp]) -
60  _langmuir_dens * ((*_pressure)[_qp]) / Utility::pow<2>(_langmuir_p + (*_pressure)[_qp]);
61 
62  // form the base rate and derivs without the appropriate time const
63  _mass_rate_from_matrix[_qp] = (*_conc)[_qp] - equilib_conc;
64  _dmass_rate_from_matrix_dC[_qp] = 1.0;
65  _dmass_rate_from_matrix_dp[_qp] = -dequilib_conc_dp;
66 
67  // multiply by the appropriate time const
68  if ((*_conc)[_qp] > equilib_conc)
69  {
70  _mass_rate_from_matrix[_qp] *= (*_one_over_de_time_const)[_qp];
71  _dmass_rate_from_matrix_dC[_qp] *= (*_one_over_de_time_const)[_qp];
72  _dmass_rate_from_matrix_dp[_qp] *= (*_one_over_de_time_const)[_qp];
73  }
74  else
75  {
76  _mass_rate_from_matrix[_qp] *= (*_one_over_ad_time_const)[_qp];
77  _dmass_rate_from_matrix_dC[_qp] *= (*_one_over_ad_time_const)[_qp];
78  _dmass_rate_from_matrix_dp[_qp] *= (*_one_over_ad_time_const)[_qp];
79  }
80 }
const Real _langmuir_p
langmuir pressure
const VariableValue * _pressure
porespace pressure (or partial pressure if multiphase flow scenario)
LangmuirMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _mass_rate_from_matrix
mass flow rate from the matrix = mass flow rate to the porespace
virtual void computeQpProperties() override
const Real _langmuir_dens
langmuir density
InputParameters validParams< LangmuirMaterial >()
MaterialProperty< Real > & _dmass_rate_from_matrix_dp
derivative of mass flow rate wrt pressure
const VariableValue * _conc
concentration of adsorbed fluid in matrix
MaterialProperty< Real > & _dmass_rate_from_matrix_dC
derivative of mass flow rate wrt concentration