www.mooseframework.org
Q2PMaterial.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 #include <cmath> // std::sinh and std::cosh
11 #include "Q2PMaterial.h"
12 
13 registerMooseObject("RichardsApp", Q2PMaterial);
14 
17 {
19 
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  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  params.addRequiredParam<RealTensorValue>("mat_permeability", "The permeability tensor (m^2).");
30  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).");
37  "gravity",
38  "Gravitational acceleration (m/s^2) as a vector pointing downwards. Eg (0,0,-10)");
39  return params;
40 }
41 
43  : Material(parameters),
44  _material_por(getParam<Real>("mat_porosity")),
45  _por_change(coupledValue("por_change")),
46  _por_change_old(isCoupled("por_change") ? coupledValueOld("por_change") : _zero),
47  _material_perm(getParam<RealTensorValue>("mat_permeability")),
48  _material_gravity(getParam<RealVectorValue>("gravity")),
49  _porosity_old(declareProperty<Real>("porosity_old")),
50  _porosity(declareProperty<Real>("porosity")),
51  _permeability(declareProperty<RealTensorValue>("permeability")),
52  _gravity(declareProperty<RealVectorValue>("gravity")),
53  _perm_change(isCoupled("perm_change")
54  ? coupledValues("perm_change")
55  : std::vector<const VariableValue *>(LIBMESH_DIM * LIBMESH_DIM, &_zero))
56 {
57  if (isCoupled("perm_change") && (coupledComponents("perm_change") != LIBMESH_DIM * LIBMESH_DIM))
58  mooseError(LIBMESH_DIM * LIBMESH_DIM,
59  " components of perm_change must be given to a Q2PMaterial. You supplied ",
60  coupledComponents("perm_change"),
61  "\n");
62 }
63 
64 void
66 {
69 
71  for (const auto i : make_range(Moose::dim))
72  for (const auto j : make_range(Moose::dim))
73  _permeability[_qp](i, j) *= std::pow(10, (*_perm_change[LIBMESH_DIM * i + j])[_qp]);
74 
76 }
virtual void computeQpProperties()
Definition: Q2PMaterial.C:65
virtual bool isCoupled(const std::string &var_name, unsigned int i=0) const
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
const std::vector< const VariableValue * > _perm_change
Definition: Q2PMaterial.h:46
const VariableValue & _por_change_old
Definition: Q2PMaterial.h:32
MaterialProperty< Real > & _porosity
Definition: Q2PMaterial.h:42
static constexpr std::size_t dim
const VariableValue & _por_change
porosity changes. if not entered they default to zero
Definition: Q2PMaterial.h:31
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
Q2PMaterial(const InputParameters &parameters)
Definition: Q2PMaterial.C:42
TensorValue< Real > RealTensorValue
Real _material_por
porosity as entered by the user
Definition: Q2PMaterial.h:28
static InputParameters validParams()
registerMooseObject("RichardsApp", Q2PMaterial)
void addCoupledVar(const std::string &name, const std::string &doc_string)
OutputTools< Real >::VariableValue VariableValue
unsigned int coupledComponents(const std::string &var_name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialProperty< RealTensorValue > & _permeability
Definition: Q2PMaterial.h:43
MaterialProperty< RealVectorValue > & _gravity
Definition: Q2PMaterial.h:44
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
RealVectorValue _material_gravity
gravity as entered by user
Definition: Q2PMaterial.h:38
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
static InputParameters validParams()
Definition: Q2PMaterial.C:16
MaterialProperty< Real > & _porosity_old
material properties
Definition: Q2PMaterial.h:41
MooseUnits pow(const MooseUnits &, int)
Q2P Material.
Definition: Q2PMaterial.h:19
RealTensorValue _material_perm
permeability as entered by the user
Definition: Q2PMaterial.h:35