www.mooseframework.org
Q2PMaterial.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 
8 #include <cmath> // std::sinh and std::cosh
9 #include "Q2PMaterial.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<Material>();
16 
17  params.addRequiredRangeCheckedParam<Real>(
18  "mat_porosity",
19  "mat_porosity>=0 & mat_porosity<=1",
20  "The porosity of the material. Should be between 0 and 1. Eg, 0.1");
21  params.addCoupledVar("por_change",
22  0,
23  "An auxillary variable describing porosity changes. "
24  "Porosity = mat_porosity + por_change. If this is not "
25  "provided, zero is used.");
26  params.addRequiredParam<RealTensorValue>("mat_permeability", "The permeability tensor (m^2).");
27  params.addCoupledVar("perm_change",
28  "A list of auxillary variable describing permeability "
29  "changes. There must be 9 of these (in 3D), corresponding "
30  "to the xx, xy, xz, yx, yy, yz, zx, zy, zz components "
31  "respectively (in 3D). Permeability = "
32  "mat_permeability*10^(perm_change).");
33  params.addRequiredParam<RealVectorValue>(
34  "gravity",
35  "Gravitational acceleration (m/s^2) as a vector pointing downwards. Eg (0,0,-10)");
36  return params;
37 }
38 
39 Q2PMaterial::Q2PMaterial(const InputParameters & parameters)
40  : Material(parameters),
41  _material_por(getParam<Real>("mat_porosity")),
42  _por_change(coupledValue("por_change")),
43  _por_change_old(isCoupled("por_change") ? coupledValueOld("por_change") : _zero),
44  _material_perm(getParam<RealTensorValue>("mat_permeability")),
45  _material_gravity(getParam<RealVectorValue>("gravity")),
46  _porosity_old(declareProperty<Real>("porosity_old")),
47  _porosity(declareProperty<Real>("porosity")),
48  _permeability(declareProperty<RealTensorValue>("permeability")),
49  _gravity(declareProperty<RealVectorValue>("gravity"))
50 {
51  if (isCoupled("perm_change") && (coupledComponents("perm_change") != LIBMESH_DIM * LIBMESH_DIM))
52  mooseError(LIBMESH_DIM * LIBMESH_DIM,
53  " components of perm_change must be given to a Q2PMaterial. You supplied ",
54  coupledComponents("perm_change"),
55  "\n");
56 
57  _perm_change.resize(LIBMESH_DIM * LIBMESH_DIM);
58  for (unsigned int i = 0; i < LIBMESH_DIM * LIBMESH_DIM; ++i)
59  _perm_change[i] = (isCoupled("perm_change") ? &coupledValue("perm_change", i)
60  : &_zero); // coupledValue returns a reference (an
61  // alias) to a VariableValue, and the &
62  // turns it into a pointer
63 }
64 
65 void
67 {
68  _porosity[_qp] = _material_por + _por_change[_qp];
70 
72  for (unsigned int i = 0; i < LIBMESH_DIM; i++)
73  for (unsigned int j = 0; j < LIBMESH_DIM; j++)
74  _permeability[_qp](i, j) *= std::pow(10, (*_perm_change[LIBMESH_DIM * i + j])[_qp]);
75 
77 }
virtual void computeQpProperties()
Definition: Q2PMaterial.C:66
const VariableValue & _por_change_old
Definition: Q2PMaterial.h:33
MaterialProperty< Real > & _porosity
Definition: Q2PMaterial.h:43
const VariableValue & _por_change
porosity changes. if not entered they default to zero
Definition: Q2PMaterial.h:32
Q2PMaterial(const InputParameters &parameters)
Definition: Q2PMaterial.C:39
Real _material_por
porosity as entered by the user
Definition: Q2PMaterial.h:29
InputParameters validParams< Q2PMaterial >()
Definition: Q2PMaterial.C:13
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
MaterialProperty< RealTensorValue > & _permeability
Definition: Q2PMaterial.h:44
MaterialProperty< RealVectorValue > & _gravity
Definition: Q2PMaterial.h:45
RealVectorValue _material_gravity
gravity as entered by user
Definition: Q2PMaterial.h:39
MaterialProperty< Real > & _porosity_old
material properties
Definition: Q2PMaterial.h:42
RealTensorValue _material_perm
permeability as entered by the user
Definition: Q2PMaterial.h:36
std::vector< const VariableValue * > _perm_change
Definition: Q2PMaterial.h:47