www.mooseframework.org
PhaseNormalTensor.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 #include "PhaseNormalTensor.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Material>();
14  params.addClassDescription("Calculate normal tensor of a phase based on gradient");
15  params.addRequiredCoupledVar("phase", "Phase variable");
16  params.addRequiredParam<MaterialPropertyName>("normal_tensor_name", "Name of normal tensor");
17  return params;
18 }
19 
20 PhaseNormalTensor::PhaseNormalTensor(const InputParameters & parameters)
21  : DerivativeMaterialInterface<Material>(parameters),
22  _grad_u(coupledGradient("phase")),
23  _normal_tensor(
24  declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("normal_tensor_name")))
25 {
26 }
27 
28 void
30 {
31  _normal_tensor[_qp].zero();
32 }
33 
34 void
36 {
37  const Real magnitude = _grad_u[_qp].norm();
38 
39  if (magnitude > 0.0)
40  {
41  RealVectorValue vector = _grad_u[_qp] / magnitude;
42  _normal_tensor[_qp].vectorOuterProduct(vector, vector);
43  }
44  else
45  _normal_tensor[_qp].zero();
46 }
const VariableGradient & _grad_u
InputParameters validParams< PhaseNormalTensor >()
MaterialProperty< RankTwoTensor > & _normal_tensor
PhaseNormalTensor(const InputParameters &parameters)
virtual void computeQpProperties()
virtual void initQpStatefulProperties()