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 47 : VariableGradientMaterial::validParams() 16 : { 17 47 : InputParameters params = Material::validParams(); 18 47 : params.addClassDescription("Compute the norm of the gradient of a variable"); 19 94 : params.addCoupledVar("variable", "Variable to compute the gradient magnitude of"); 20 94 : params.addRequiredParam<MaterialPropertyName>( 21 : "prop", "Material property to store the gradient magnitude in"); 22 47 : return params; 23 0 : } 24 : 25 36 : VariableGradientMaterial::VariableGradientMaterial(const InputParameters & parameters) 26 : : Material(parameters), 27 36 : _grad(coupledGradient("variable")), 28 108 : _prop(declareProperty<Real>(getParam<MaterialPropertyName>("prop"))) 29 : { 30 36 : } 31 : 32 : void 33 600 : VariableGradientMaterial::computeQpProperties() 34 : { 35 600 : _prop[_qp] = _grad[_qp].norm(); 36 600 : }