www.mooseframework.org
VariableGradientMaterial.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 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<Material>();
15  params.addCoupledVar("variable", "Variable to compute the gradient magnitude of");
16  params.addRequiredParam<MaterialPropertyName>(
17  "prop", "Material property to store the gradient magnitude in");
18  return params;
19 }
20 
21 VariableGradientMaterial::VariableGradientMaterial(const InputParameters & parameters)
22  : Material(parameters),
23  _grad(coupledGradient("variable")),
24  _prop(declareProperty<Real>(getParam<MaterialPropertyName>("prop")))
25 {
26 }
27 
28 void
30 {
31  _prop[_qp] = _grad[_qp].norm();
32 }
InputParameters validParams< VariableGradientMaterial >()
MaterialProperty< Real > & _prop
const VariableGradient & _grad
VariableGradientMaterial(const InputParameters &parameters)