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 }
 

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 18 of file ADTestDerivativeFunction.h.

Member Enumeration Documentation

◆ FunctionEnum

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

Definition at line 36 of file ADTestDerivativeFunction.h.

37  {
38  F1,
39  F2
40  } _function;
enum ADTestDerivativeFunction::FunctionEnum _function

Constructor & Destructor Documentation

◆ ADTestDerivativeFunction()

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

Definition at line 27 of file ADTestDerivativeFunction.C.

29  : ADMaterial<compute_stage>(parameters),
30  _function(adGetParam<MooseEnum>("function").template getEnum<FunctionEnum>()),
31  _op(coupledComponents("op")),
32  _f_name(adGetParam<MaterialPropertyName>("f_name")),
33  _prop_F(adDeclareADProperty<Real>(_f_name)),
34  _prop_dFdop(coupledComponents("op"))
35 {
36  for (std::size_t i = 0; i < _op.size(); ++i)
37  {
38  _op[i] = &adCoupledValue("op", i);
39  _prop_dFdop[i] = &adDeclareADProperty<Real>(
40  derivativePropertyNameFirst(_f_name, this->getVar("op", i)->name()));
41  }
42 
43  if (_function == FunctionEnum::F1 && _op.size() != 1)
44  paramError("op", "Specify exactly one variable to an F1 type function.");
45  if (_function == FunctionEnum::F2 && _op.size() != 2)
46  paramError("op", "Specify exactly two variables to an F2 type function.");
47 }
std::vector< ADMaterialProperty(Real) * > _prop_dFdop
function value derivative
enum ADTestDerivativeFunction::FunctionEnum _function
const std::string name
Definition: Setup.h:22
std::vector< const ADVariableValue * > _op
Coupled variable value for the order parameter.
const MaterialPropertyName _f_name
property name

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 51 of file ADTestDerivativeFunction.C.

52 {
53  const ADReal & a = (*_op[0])[_qp];
54 
55  switch (_function)
56  {
57  case FunctionEnum::F1:
58  _prop_F[_qp] = 2.0 * a * a * (1.0 - a) * (1.0 - a) - 0.2 * a;
59  (*_prop_dFdop[0])[_qp] = 4.0 * a * a * (a - 1.0) + 4.0 * a * (1.0 - a) * (1.0 - a) - 0.2;
60  break;
61 
62  case FunctionEnum::F2:
63  {
64  const ADReal & b = (*_op[1])[_qp];
65  _prop_F[_qp] = 0.1 * a * a + b * b;
66  (*_prop_dFdop[0])[_qp] = 0.2 * a;
67  (*_prop_dFdop[1])[_qp] = 2.0 * b;
68  break;
69  }
70 
71  default:
72  mooseError("Invalid function enum value");
73  }
74 }
std::vector< ADMaterialProperty(Real) * > _prop_dFdop
function value derivative
enum ADTestDerivativeFunction::FunctionEnum _function
std::vector< const ADVariableValue * > _op
Coupled variable value for the order parameter.

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: