Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 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 "VariableGradientMaterial.h" 11 : 12 : registerMooseObject("PhaseFieldApp", VariableGradientMaterial); 13 : 14 : InputParameters 15 31 : VariableGradientMaterial::validParams() 16 : { 17 31 : InputParameters params = Material::validParams(); 18 31 : params.addClassDescription("Compute the norm of the gradient of a variable"); 19 62 : params.addCoupledVar("variable", "Variable to compute the gradient magnitude of"); 20 62 : params.addRequiredParam<MaterialPropertyName>( 21 : "prop", "Material property to store the gradient magnitude in"); 22 31 : return params; 23 0 : } 24 : 25 24 : VariableGradientMaterial::VariableGradientMaterial(const InputParameters & parameters) 26 : : Material(parameters), 27 24 : _grad(coupledGradient("variable")), 28 72 : _prop(declareProperty<Real>(getParam<MaterialPropertyName>("prop"))) 29 : { 30 24 : } 31 : 32 : void 33 500 : VariableGradientMaterial::computeQpProperties() 34 : { 35 500 : _prop[_qp] = _grad[_qp].norm(); 36 500 : }