www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CHBulk< T > Class Template Referenceabstract

This is the Cahn-Hilliard equation base class that implements the bulk or local energy term of the equation. More...

#include <CHBulk.h>

Inheritance diagram for CHBulk< T >:
[legend]

Public Member Functions

 CHBulk (const InputParameters &parameters)
 
virtual void initialSetup ()
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Types

enum  PFFunctionType { Jacobian, Residual }
 

Protected Member Functions

virtual RealGradient precomputeQpResidual ()
 
virtual RealGradient precomputeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
virtual RealGradient computeGradDFDCons (PFFunctionType type)=0
 

Protected Attributes

const MaterialProperty< T > & _M
 Mobility. More...
 
const MaterialProperty< T > & _dMdc
 Mobility derivative w.r.t. concentration. More...
 
std::vector< const MaterialProperty< T > * > _dMdarg
 Mobility derivative w.r.t coupled variables. More...
 

Detailed Description

template<typename T>
class CHBulk< T >

This is the Cahn-Hilliard equation base class that implements the bulk or local energy term of the equation.

It is templated on the type of the mobility, which can be either a number (Real) or a tensor (RealValueTensor). See M.R. Tonks et al. / Computational Materials Science 51 (2012) 20-29 for more information. Note that the function computeGradDFDCons MUST be overridden in any kernel that inherits from CHBulk. Use CHMath as an example of how this works.

Definition at line 26 of file CHBulk.h.

Member Enumeration Documentation

◆ PFFunctionType

template<typename T>
enum CHBulk::PFFunctionType
protected
Enumerator
Jacobian 
Residual 

Definition at line 39 of file CHBulk.h.

40  {
41  Jacobian,
42  Residual
43  };

Constructor & Destructor Documentation

◆ CHBulk()

template<typename T >
CHBulk< T >::CHBulk ( const InputParameters &  parameters)

Definition at line 58 of file CHBulk.h.

59  : DerivativeMaterialInterface<JvarMapKernelInterface<KernelGrad>>(parameters),
60  _M(getMaterialProperty<T>("mob_name")),
61  _dMdc(getMaterialPropertyDerivative<T>("mob_name", _var.name()))
62 {
63  // Get number of coupled variables
64  unsigned int nvar = _coupled_moose_vars.size();
65 
66  // reserve space for derivatives
67  _dMdarg.resize(nvar);
68 
69  // Iterate over all coupled variables
70  for (unsigned int i = 0; i < nvar; ++i)
71  _dMdarg[i] = &getMaterialPropertyDerivative<T>("mob_name", _coupled_moose_vars[i]->name());
72 }
const MaterialProperty< T > & _M
Mobility.
Definition: CHBulk.h:48
const MaterialProperty< T > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:51
const std::string name
Definition: Setup.h:22
std::vector< const MaterialProperty< T > * > _dMdarg
Mobility derivative w.r.t coupled variables.
Definition: CHBulk.h:54

Member Function Documentation

◆ computeGradDFDCons()

template<typename T>
virtual RealGradient CHBulk< T >::computeGradDFDCons ( PFFunctionType  type)
protectedpure virtual

◆ computeQpOffDiagJacobian()

template<typename T >
Real CHBulk< T >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented in KKSCHBulk, CahnHilliardBase< T >, CahnHilliardBase< RealTensorValue >, and CahnHilliardBase< Real >.

Definition at line 111 of file CHBulk.h.

Referenced by CahnHilliardBase< Real >::computeQpOffDiagJacobian().

112 {
113  // get the coupled variable jvar is referring to
114  const unsigned int cvar = mapJvarToCvar(jvar);
115 
116  return (*_dMdarg[cvar])[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual) * _grad_test[_i][_qp];
117 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
std::vector< const MaterialProperty< T > * > _dMdarg
Mobility derivative w.r.t coupled variables.
Definition: CHBulk.h:54

◆ initialSetup()

template<typename T >
void CHBulk< T >::initialSetup ( )
virtual

Reimplemented in CahnHilliardBase< T >, CahnHilliardBase< RealTensorValue >, and CahnHilliardBase< Real >.

Definition at line 87 of file CHBulk.h.

88 {
89  validateNonlinearCoupling<Real>("mob_name");
90 }

◆ precomputeQpJacobian()

template<typename T >
RealGradient CHBulk< T >::precomputeQpJacobian ( )
protectedvirtual

Definition at line 101 of file CHBulk.h.

102 {
103  RealGradient grad_value = _M[_qp] * computeGradDFDCons(Jacobian) +
104  _dMdc[_qp] * _phi[_j][_qp] * computeGradDFDCons(Residual);
105 
106  return grad_value;
107 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< T > & _M
Mobility.
Definition: CHBulk.h:48
const MaterialProperty< T > & _dMdc
Mobility derivative w.r.t. concentration.
Definition: CHBulk.h:51

◆ precomputeQpResidual()

template<typename T >
RealGradient CHBulk< T >::precomputeQpResidual ( )
protectedvirtual

Definition at line 94 of file CHBulk.h.

95 {
96  return _M[_qp] * computeGradDFDCons(Residual);
97 }
virtual RealGradient computeGradDFDCons(PFFunctionType type)=0
const MaterialProperty< T > & _M
Mobility.
Definition: CHBulk.h:48

◆ validParams()

template<typename T >
InputParameters CHBulk< T >::validParams ( )
static

Definition at line 76 of file CHBulk.h.

Referenced by CahnHilliardBase< Real >::validParams(), validParams< CHBulkPFCTrad >(), validParams< CHMath >(), and validParams< KKSCHBulk >().

77 {
78  InputParameters params = ::validParams<KernelGrad>();
79  params.addClassDescription("Cahn-Hilliard base Kernel");
80  params.addParam<MaterialPropertyName>("mob_name", "M", "The mobility used with the kernel");
81  params.addCoupledVar("args", "Vector of arguments of the mobility");
82  return params;
83 }

Member Data Documentation

◆ _dMdarg

template<typename T>
std::vector<const MaterialProperty<T> *> CHBulk< T >::_dMdarg
protected

Mobility derivative w.r.t coupled variables.

Definition at line 54 of file CHBulk.h.

Referenced by CHBulk< Real >::CHBulk().

◆ _dMdc

template<typename T>
const MaterialProperty<T>& CHBulk< T >::_dMdc
protected

Mobility derivative w.r.t. concentration.

Definition at line 51 of file CHBulk.h.

◆ _M

template<typename T>
const MaterialProperty<T>& CHBulk< T >::_M
protected

Mobility.

Definition at line 48 of file CHBulk.h.


The documentation for this class was generated from the following file: