www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SplitCHWResBase< T > Class Template Reference

SplitCHWresBase implements the residual for the chemical potential in the split form of the Cahn-Hilliard equation in a general way that can be templated to a scalar or tensor mobility. More...

#include <SplitCHWResBase.h>

Inheritance diagram for SplitCHWResBase< T >:
[legend]

Public Member Functions

 SplitCHWResBase (const InputParameters &parameters)
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpWJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

const MaterialPropertyName _mob_name
 
const MaterialProperty< T > & _mob
 
const bool _is_coupled
 is the kernel used in a coupled form? More...
 
unsigned int _w_var
 int label for the chemical potential More...
 
const VariableGradient & _grad_w
 Variable value for the chemical potential. More...
 
std::vector< const MaterialProperty< T > * > _dmobdarg
 derivatives of the mobility More...
 

Detailed Description

template<typename T>
class SplitCHWResBase< T >

SplitCHWresBase implements the residual for the chemical potential in the split form of the Cahn-Hilliard equation in a general way that can be templated to a scalar or tensor mobility.

Definition at line 18 of file SplitCHWResBase.h.

Constructor & Destructor Documentation

◆ SplitCHWResBase()

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

Definition at line 58 of file SplitCHWResBase.h.

59  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
60  _mob_name(getParam<MaterialPropertyName>("mob_name")),
61  _mob(getMaterialProperty<T>("mob_name")),
62  _is_coupled(isCoupled("w")),
63  _w_var(_is_coupled ? coupled("w") : _var.number()),
64  _grad_w(_is_coupled ? coupledGradient("w") : _grad_u)
65 {
66  // Get number of coupled variables
67  unsigned int nvar = _coupled_moose_vars.size();
68 
69  // reserve space for derivatives
70  _dmobdarg.resize(nvar);
71 
72  // Iterate over all coupled variables
73  for (unsigned int i = 0; i < nvar; ++i)
74  _dmobdarg[i] = &getMaterialPropertyDerivative<T>(_mob_name, _coupled_moose_vars[i]->name());
75 }

Member Function Documentation

◆ computeQpJacobian()

template<typename T >
Real SplitCHWResBase< T >::computeQpJacobian ( )
protectedvirtual

Definition at line 86 of file SplitCHWResBase.h.

87 {
88  return (_is_coupled && _w_var != _var.number()) ? 0.0 : computeQpWJacobian();
89 }

◆ computeQpOffDiagJacobian()

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

Definition at line 100 of file SplitCHWResBase.h.

101 {
102  // c Off-Diagonal Jacobian
103  if (_w_var == jvar)
104  return computeQpWJacobian();
105 
106  // get the coupled variable jvar is referring to
107  const unsigned int cvar = mapJvarToCvar(jvar);
108 
109  return (*_dmobdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_w[_qp] * _grad_test[_i][_qp];
110 }

◆ computeQpResidual()

template<typename T >
Real SplitCHWResBase< T >::computeQpResidual ( )
protectedvirtual

Definition at line 79 of file SplitCHWResBase.h.

80 {
81  return _mob[_qp] * _grad_w[_qp] * _grad_test[_i][_qp];
82 }

◆ computeQpWJacobian()

template<typename T >
Real SplitCHWResBase< T >::computeQpWJacobian ( )
protectedvirtual

Definition at line 93 of file SplitCHWResBase.h.

94 {
95  return _mob[_qp] * _grad_phi[_j][_qp] * _grad_test[_i][_qp];
96 }

Member Data Documentation

◆ _dmobdarg

template<typename T>
std::vector<const MaterialProperty<T> *> SplitCHWResBase< T >::_dmobdarg
protected

derivatives of the mobility

Definition at line 54 of file SplitCHWResBase.h.

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

◆ _grad_w

template<typename T>
const VariableGradient& SplitCHWResBase< T >::_grad_w
protected

Variable value for the chemical potential.

Definition at line 51 of file SplitCHWResBase.h.

◆ _is_coupled

template<typename T>
const bool SplitCHWResBase< T >::_is_coupled
protected

is the kernel used in a coupled form?

Definition at line 45 of file SplitCHWResBase.h.

◆ _mob

template<typename T>
const MaterialProperty<T>& SplitCHWResBase< T >::_mob
protected

Definition at line 42 of file SplitCHWResBase.h.

◆ _mob_name

template<typename T>
const MaterialPropertyName SplitCHWResBase< T >::_mob_name
protected

Definition at line 41 of file SplitCHWResBase.h.

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

◆ _w_var

template<typename T>
unsigned int SplitCHWResBase< T >::_w_var
protected

int label for the chemical potential

Definition at line 48 of file SplitCHWResBase.h.


The documentation for this class was generated from the following file:
SplitCHWResBase::computeQpWJacobian
virtual Real computeQpWJacobian()
Definition: SplitCHWResBase.h:93
SplitCHWResBase::_w_var
unsigned int _w_var
int label for the chemical potential
Definition: SplitCHWResBase.h:48
SplitCHWResBase::_mob_name
const MaterialPropertyName _mob_name
Definition: SplitCHWResBase.h:41
SplitCHWResBase::_dmobdarg
std::vector< const MaterialProperty< T > * > _dmobdarg
derivatives of the mobility
Definition: SplitCHWResBase.h:54
SplitCHWResBase::_mob
const MaterialProperty< T > & _mob
Definition: SplitCHWResBase.h:42
name
const std::string name
Definition: Setup.h:21
SplitCHWResBase::_is_coupled
const bool _is_coupled
is the kernel used in a coupled form?
Definition: SplitCHWResBase.h:45
SplitCHWResBase::_grad_w
const VariableGradient & _grad_w
Variable value for the chemical potential.
Definition: SplitCHWResBase.h:51