www.mooseframework.org
VariableGradientMaterial.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 
11 
13 
16 {
18  params.addClassDescription("Compute the norm of the gradient of a variable");
19  params.addCoupledVar("variable", "Variable to compute the gradient magnitude of");
20  params.addRequiredParam<MaterialPropertyName>(
21  "prop", "Material property to store the gradient magnitude in");
22  return params;
23 }
24 
26  : Material(parameters),
27  _grad(coupledGradient("variable")),
28  _prop(declareProperty<Real>(getParam<MaterialPropertyName>("prop")))
29 {
30 }
31 
32 void
34 {
35  _prop[_qp] = _grad[_qp].norm();
36 }
void addRequiredParam(const std::string &name, const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
MaterialProperty< Real > & _prop
static InputParameters validParams()
void addCoupledVar(const std::string &name, const std::string &doc_string)
const VariableGradient & _grad
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
registerMooseObject("PhaseFieldApp", VariableGradientMaterial)
Set a material property to the norm of the gradient of a non-linear variable.
VariableGradientMaterial(const InputParameters &parameters)