LCOV - code coverage report
Current view: top level - src/materials - Q2PMaterial.C (source / functions) Hit Total Coverage
Test: idaholab/moose richards: #31405 (292dce) with base fef103 Lines: 33 35 94.3 %
Date: 2025-09-04 07:56:35 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 <cmath> // std::sinh and std::cosh
      11             : #include "Q2PMaterial.h"
      12             : 
      13             : registerMooseObject("RichardsApp", Q2PMaterial);
      14             : 
      15             : InputParameters
      16          73 : Q2PMaterial::validParams()
      17             : {
      18          73 :   InputParameters params = Material::validParams();
      19             : 
      20         146 :   params.addRequiredRangeCheckedParam<Real>(
      21             :       "mat_porosity",
      22             :       "mat_porosity>=0 & mat_porosity<=1",
      23             :       "The porosity of the material.  Should be between 0 and 1.  Eg, 0.1");
      24         146 :   params.addCoupledVar("por_change",
      25             :                        0,
      26             :                        "An auxillary variable describing porosity changes.  "
      27             :                        "Porosity = mat_porosity + por_change.  If this is not "
      28             :                        "provided, zero is used.");
      29         146 :   params.addRequiredParam<RealTensorValue>("mat_permeability", "The permeability tensor (m^2).");
      30         146 :   params.addCoupledVar("perm_change",
      31             :                        "A list of auxillary variable describing permeability "
      32             :                        "changes.  There must be 9 of these (in 3D), corresponding "
      33             :                        "to the xx, xy, xz, yx, yy, yz, zx, zy, zz components "
      34             :                        "respectively (in 3D).  Permeability = "
      35             :                        "mat_permeability*10^(perm_change).");
      36         146 :   params.addRequiredParam<RealVectorValue>(
      37             :       "gravity",
      38             :       "Gravitational acceleration (m/s^2) as a vector pointing downwards.  Eg (0,0,-10)");
      39          73 :   return params;
      40           0 : }
      41             : 
      42          55 : Q2PMaterial::Q2PMaterial(const InputParameters & parameters)
      43             :   : Material(parameters),
      44          55 :     _material_por(getParam<Real>("mat_porosity")),
      45          55 :     _por_change(coupledValue("por_change")),
      46          55 :     _por_change_old(isCoupled("por_change") ? coupledValueOld("por_change") : _zero),
      47         110 :     _material_perm(getParam<RealTensorValue>("mat_permeability")),
      48         110 :     _material_gravity(getParam<RealVectorValue>("gravity")),
      49          55 :     _porosity_old(declareProperty<Real>("porosity_old")),
      50          55 :     _porosity(declareProperty<Real>("porosity")),
      51          55 :     _permeability(declareProperty<RealTensorValue>("permeability")),
      52          55 :     _gravity(declareProperty<RealVectorValue>("gravity")),
      53         117 :     _perm_change(isCoupled("perm_change")
      54          55 :                      ? coupledValues("perm_change")
      55         110 :                      : std::vector<const VariableValue *>(LIBMESH_DIM * LIBMESH_DIM, &_zero))
      56             : {
      57          68 :   if (isCoupled("perm_change") && (coupledComponents("perm_change") != LIBMESH_DIM * LIBMESH_DIM))
      58           0 :     mooseError(LIBMESH_DIM * LIBMESH_DIM,
      59             :                " components of perm_change must be given to a Q2PMaterial.  You supplied ",
      60           1 :                coupledComponents("perm_change"),
      61             :                "\n");
      62          54 : }
      63             : 
      64             : void
      65       23762 : Q2PMaterial::computeQpProperties()
      66             : {
      67       23762 :   _porosity[_qp] = _material_por + _por_change[_qp];
      68       23762 :   _porosity_old[_qp] = _material_por + _por_change_old[_qp];
      69             : 
      70       23762 :   _permeability[_qp] = _material_perm;
      71       95048 :   for (const auto i : make_range(Moose::dim))
      72      285144 :     for (const auto j : make_range(Moose::dim))
      73      213858 :       _permeability[_qp](i, j) *= std::pow(10, (*_perm_change[LIBMESH_DIM * i + j])[_qp]);
      74             : 
      75       23762 :   _gravity[_qp] = _material_gravity;
      76       23762 : }

Generated by: LCOV version 1.14