LCOV - code coverage report
Current view: top level - src/materials - LangmuirMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose chemical_reactions: #31405 (292dce) with base fef103 Lines: 36 37 97.3 %
Date: 2025-09-04 07:52:33 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14