https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MollifiedLangmuirMaterial.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
11
13
16{
18
20 "one_over_desorption_time_const",
21 "Time constant for Langmuir desorption (gas moving from matrix to porespace). Units [s]");
23 "one_over_adsorption_time_const",
24 "Time constant for Langmuir adsorption (gas moving from porespace to matrix). Units [s].");
25 params.addRequiredParam<Real>("langmuir_density",
26 "This is (Langmuir volume)*(density of gas at standard temp and "
27 "pressure). Langmuir volume is measured in (gas volume)/(matrix "
28 "volume). (Methane density(101kPa, 20degC) = 0.655kg/m^3. "
29 "Methane density(101kPa, 0degC) = 0.715kg/m^3.) Units [kg/m^3]");
30 params.addRequiredParam<Real>("langmuir_pressure", "Langmuir pressure. Units Pa");
31 params.addRequiredCoupledVar("conc_var", "The concentration of gas variable");
32 params.addRequiredCoupledVar("pressure_var", "The gas porepressure variable");
33 params.addRangeCheckedParam<Real>("mollifier",
34 0.1,
35 "mollifier > 0",
36 "The reciprocal of time constants will be "
37 "one_over_time_const*tanh( |conc_var - "
38 "equilib_conc|/(mollifier*langmuir_density)). So for "
39 "mollifier very small you will get a stepchange between "
40 "desorption and adsorption, but for mollifier bigger you "
41 "will be a gradual change");
42 params.addClassDescription("Material type that holds info regarding MollifiedLangmuir desorption "
43 "from matrix to porespace and viceversa");
44 return params;
45}
46
48 : Material(parameters),
49 // coupledValue returns a reference (an alias) to a VariableValue, and the & turns it into a
50 // pointer
51 _one_over_de_time_const(coupledValue("one_over_desorption_time_const")),
52 _one_over_ad_time_const(coupledValue("one_over_adsorption_time_const")),
53
54 _langmuir_dens(getParam<Real>("langmuir_density")),
55 _langmuir_p(getParam<Real>("langmuir_pressure")),
56
57 _conc(coupledValue("conc_var")),
58 _pressure(coupledValue("pressure_var")),
59
60 _mollifier(getParam<Real>("mollifier")),
61
62 _mass_rate_from_matrix(declareProperty<Real>("mass_rate_from_matrix")),
63 _dmass_rate_from_matrix_dC(declareProperty<Real>("dmass_rate_from_matrix_dC")),
64 _dmass_rate_from_matrix_dp(declareProperty<Real>("dmass_rate_from_matrix_dp"))
65{
66}
67
68void
70{
71 Real equilib_conc = _langmuir_dens * (_pressure[_qp]) / (_langmuir_p + _pressure[_qp]);
72 Real dequilib_conc_dp =
74 _langmuir_dens * (_pressure[_qp]) / std::pow(_langmuir_p + _pressure[_qp], 2);
75
76 Real mol = std::tanh(std::abs(_conc[_qp] - equilib_conc) / (_mollifier * _langmuir_dens));
77 Real deriv_tanh =
78 1 - std::pow(std::tanh((_conc[_qp] - equilib_conc) / (_mollifier * _langmuir_dens)), 2);
79 if (_conc[_qp] < equilib_conc)
80 deriv_tanh *= -1;
81 Real dmol_dC = deriv_tanh / (_mollifier * _langmuir_dens);
82 Real dmol_dp = -dmol_dC * dequilib_conc_dp;
83
84 /*
85 Real de_plus_ad = _one_over_de_time_const[_qp] + _one_over_ad_time_const[_qp];
86 Real de_minus_ad = _one_over_de_time_const[_qp] - _one_over_ad_time_const[_qp];
87
88 Real one_over_tau = 0.5*de_plus_ad + 0.5*de_minus_ad*std::tanh( (_conc[_qp] -
89 equilib_conc)/(_mollifier*_langmuir_dens));
90 Real deriv_tanh = 1 - std::pow(std::tanh((_conc[_qp] -
91 equilib_conc)/(_mollifier*_langmuir_dens)), 2);
92 Real d_one_over_tau_dC = 0.5*de_minus_ad*deriv_tanh/(_mollifier*_langmuir_dens);
93 Real d_one_over_tau_dp = -0.5*de_minus_ad*dequilib_conc_dp*deriv_tanh/(_mollifier*_langmuir_dens);
94 */
95
96 // form the base rate and derivs without the appropriate time const
97 _mass_rate_from_matrix[_qp] = (_conc[_qp] - equilib_conc) * mol;
98 _dmass_rate_from_matrix_dC[_qp] = mol + (_conc[_qp] - equilib_conc) * dmol_dC;
99 _dmass_rate_from_matrix_dp[_qp] = -dequilib_conc_dp * mol + (_conc[_qp] - equilib_conc) * dmol_dp;
100
101 // multiply by the appropriate time const
102 if (_conc[_qp] > equilib_conc)
103 {
107 }
108 else
109 {
113 }
114}
registerMooseObject("ChemicalReactionsApp", MollifiedLangmuirMaterial)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
Holds Langmuir parameters associated with desorption Calculates mass-flow rates and derivatives there...
const Real _langmuir_dens
langmuir density
const VariableValue & _pressure
porespace pressure (or partial pressure if multiphase flow scenario)
const VariableValue & _one_over_de_time_const
reciprocal of desorption time constant
MaterialProperty< Real > & _dmass_rate_from_matrix_dp
derivative of mass flow rate wrt pressure
MaterialProperty< Real > & _mass_rate_from_matrix
mass flow rate from the matrix = mass flow rate to the porespace
MollifiedLangmuirMaterial(const InputParameters &parameters)
virtual void computeQpProperties() override
const VariableValue & _one_over_ad_time_const
reciprocal of adsorption time constant
static InputParameters validParams()
const Real _mollifier
mollifying parameter.
const Real _langmuir_p
langmuir pressure
const VariableValue & _conc
concentration of adsorbed fluid in matrix
MaterialProperty< Real > & _dmass_rate_from_matrix_dC
derivative of mass flow rate wrt concentration