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