www.mooseframework.org
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ADTestDerivativeFunction< compute_stage > Class Template Reference

Material class that creates the math free energy and its derivatives for use with ADSplitCHParsed. More...

#include <ADTestDerivativeFunction.h>

Inheritance diagram for ADTestDerivativeFunction< compute_stage >:
[legend]

Public Member Functions

 ADTestDerivativeFunction (const InputParameters &parameters)
 

Protected Types

enum  FunctionEnum { FunctionEnum::F1, FunctionEnum::F2, FunctionEnum::F3 }
 

Protected Member Functions

virtual void computeQpProperties ()
 
 ADMaterialProperty (Real) &_prop_F
 function value More...
 

Protected Attributes

enum ADTestDerivativeFunction::FunctionEnum _function
 
std::vector< const ADVariableValue * > _op
 Coupled variable value for the order parameter. More...
 
const MaterialPropertyName _f_name
 property name More...
 
std::vector< ADMaterialProperty(Real) * > _prop_dFdop
 function value derivative More...
 
 usingMaterialMembers
 

Detailed Description

template<ComputeStage compute_stage>
class ADTestDerivativeFunction< compute_stage >

Material class that creates the math free energy and its derivatives for use with ADSplitCHParsed.

\( F = \frac14(1 + c)^2(1 - c)^2 \).

Definition at line 17 of file ADTestDerivativeFunction.h.

Member Enumeration Documentation

◆ FunctionEnum

template<ComputeStage compute_stage>
enum ADTestDerivativeFunction::FunctionEnum
strongprotected
Enumerator
F1 
F2 
F3 

Definition at line 35 of file ADTestDerivativeFunction.h.

36  {
37  F1,
38  F2,
39  F3
40  } _function;

Constructor & Destructor Documentation

◆ ADTestDerivativeFunction()

template<ComputeStage compute_stage>
ADTestDerivativeFunction< compute_stage >::ADTestDerivativeFunction ( const InputParameters &  parameters)

Definition at line 29 of file ADTestDerivativeFunction.C.

31  : ADMaterial<compute_stage>(parameters),
32  _function(getParam<MooseEnum>("function").template getEnum<FunctionEnum>()),
33  _op(coupledComponents("op")),
34  _f_name(getParam<MaterialPropertyName>("f_name")),
35  _prop_F(declareADProperty<Real>(_f_name)),
36  _prop_dFdop(coupledComponents("op"))
37 {
38  for (std::size_t i = 0; i < _op.size(); ++i)
39  {
40  _op[i] = &adCoupledValue("op", i);
41  _prop_dFdop[i] = &declareADProperty<Real>(
42  derivativePropertyNameFirst(_f_name, this->getVar("op", i)->name()));
43  }
44 
45  if (_function == FunctionEnum::F1 && _op.size() != 1)
46  paramError("op", "Specify exactly one variable to an F1 type function.");
47  if (_function == FunctionEnum::F2 && _op.size() != 2)
48  paramError("op", "Specify exactly two variables to an F2 type function.");
49  if (_function == FunctionEnum::F3 && _op.size() != 2)
50  paramError("op", "Specify exactly two variables to an F3 type function.");
51 }

Member Function Documentation

◆ ADMaterialProperty()

template<ComputeStage compute_stage>
ADTestDerivativeFunction< compute_stage >::ADMaterialProperty ( Real  ) &
protected

function value

◆ computeQpProperties()

template<ComputeStage compute_stage>
void ADTestDerivativeFunction< compute_stage >::computeQpProperties ( )
protectedvirtual

Definition at line 55 of file ADTestDerivativeFunction.C.

56 {
57  const ADReal & a = (*_op[0])[_qp];
58 
59  switch (_function)
60  {
61  case FunctionEnum::F1:
62  _prop_F[_qp] = 2.0 * a * a * (1.0 - a) * (1.0 - a) - 0.2 * a;
63  (*_prop_dFdop[0])[_qp] = 4.0 * a * a * (a - 1.0) + 4.0 * a * (1.0 - a) * (1.0 - a) - 0.2;
64  break;
65 
66  case FunctionEnum::F2:
67  {
68  const ADReal & b = (*_op[1])[_qp];
69  _prop_F[_qp] = 0.1 * a * a + b * b;
70  (*_prop_dFdop[0])[_qp] = 0.2 * a;
71  (*_prop_dFdop[1])[_qp] = 2.0 * b;
72  break;
73  }
74 
75  case FunctionEnum::F3:
76  {
77  const ADReal & b = (*_op[1])[_qp];
78  _prop_F[_qp] = a * b;
79  (*_prop_dFdop[0])[_qp] = b;
80  (*_prop_dFdop[1])[_qp] = a;
81  break;
82  }
83 
84  default:
85  mooseError("Invalid function enum value");
86  }
87 }

Member Data Documentation

◆ _f_name

template<ComputeStage compute_stage>
const MaterialPropertyName ADTestDerivativeFunction< compute_stage >::_f_name
protected

◆ _function

template<ComputeStage compute_stage>
enum ADTestDerivativeFunction::FunctionEnum ADTestDerivativeFunction< compute_stage >::_function
protected

◆ _op

template<ComputeStage compute_stage>
std::vector<const ADVariableValue *> ADTestDerivativeFunction< compute_stage >::_op
protected

Coupled variable value for the order parameter.

Definition at line 43 of file ADTestDerivativeFunction.h.

Referenced by ADTestDerivativeFunction< compute_stage >::ADTestDerivativeFunction().

◆ _prop_dFdop

template<ComputeStage compute_stage>
std::vector<ADMaterialProperty(Real) *> ADTestDerivativeFunction< compute_stage >::_prop_dFdop
protected

function value derivative

Definition at line 52 of file ADTestDerivativeFunction.h.

Referenced by ADTestDerivativeFunction< compute_stage >::ADTestDerivativeFunction().

◆ usingMaterialMembers

template<ComputeStage compute_stage>
ADTestDerivativeFunction< compute_stage >::usingMaterialMembers
protected

Definition at line 54 of file ADTestDerivativeFunction.h.


The documentation for this class was generated from the following files:
ADTestDerivativeFunction::FunctionEnum::F1
ADTestDerivativeFunction::_function
enum ADTestDerivativeFunction::FunctionEnum _function
ADTestDerivativeFunction::_prop_dFdop
std::vector< ADMaterialProperty(Real) * > _prop_dFdop
function value derivative
Definition: ADTestDerivativeFunction.h:52
ADTestDerivativeFunction::FunctionEnum::F2
name
const std::string name
Definition: Setup.h:21
ADTestDerivativeFunction::FunctionEnum::F3
ADTestDerivativeFunction::_op
std::vector< const ADVariableValue * > _op
Coupled variable value for the order parameter.
Definition: ADTestDerivativeFunction.h:43
ADTestDerivativeFunction::_f_name
const MaterialPropertyName _f_name
property name
Definition: ADTestDerivativeFunction.h:46