www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MatReaction Class Reference

This kernel adds to the residual a contribution of \( -L*v \) where \( L \) is a material property and \( v \) is a variable (nonlinear or coupled). More...

#include <MatReaction.h>

Inheritance diagram for MatReaction:
[legend]

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

const bool _is_coupled
 is the kernel used in a coupled form? More...
 
std::string _v_name
 Kernel variable (can be nonlinear or coupled variable) (For constrained Allen-Cahn problems, v = lambda where lambda is the Lagrange multiplier) More...
 
const VariableValue & _v
 
unsigned int _v_var
 
const MaterialProperty< Real > & _L
 Reaction rate. More...
 
VariableName _eta_name
 name of the order parameter (needed to retrieve the derivative material properties) More...
 
const MaterialProperty< Real > & _dLdop
 Reaction rate derivative w.r.t. order parameter. More...
 
const MaterialProperty< Real > & _dLdv
 Reaction rate derivative w.r.t. the variable being added by this kernel. More...
 
const unsigned int _nvar
 number of coupled variables More...
 
std::vector< const MaterialProperty< Real > * > _dLdarg
 Reaction rate derivatives w.r.t. other coupled variables. More...
 

Detailed Description

This kernel adds to the residual a contribution of \( -L*v \) where \( L \) is a material property and \( v \) is a variable (nonlinear or coupled).

Definition at line 27 of file MatReaction.h.

Constructor & Destructor Documentation

◆ MatReaction()

MatReaction::MatReaction ( const InputParameters &  parameters)

Definition at line 28 of file MatReaction.C.

29  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
30  _is_coupled(isCoupled("v")),
31  _v_name(_is_coupled ? getVar("v", 0)->name() : _var.name()),
32  _v(_is_coupled ? coupledValue("v") : _u),
33  _v_var(_is_coupled ? coupled("v") : _var.number()),
34  _L(getMaterialProperty<Real>("mob_name")),
35  _eta_name(_var.name()),
36  _dLdop(getMaterialPropertyDerivative<Real>("mob_name", _eta_name)),
37  _dLdv(getMaterialPropertyDerivative<Real>("mob_name", _v_name)),
38  _nvar(_coupled_moose_vars.size()),
39  _dLdarg(_nvar)
40 {
41  // Get reaction rate derivatives
42  for (unsigned int i = 0; i < _nvar; ++i)
43  {
44  MooseVariableFEBase * ivar = _coupled_moose_vars[i];
45  _dLdarg[i] = &getMaterialPropertyDerivative<Real>("mob_name", ivar->name());
46  }
47 }
const unsigned int _nvar
number of coupled variables
Definition: MatReaction.h:64
unsigned int _v_var
Definition: MatReaction.h:49
const std::string name
Definition: Setup.h:22
const MaterialProperty< Real > & _dLdv
Reaction rate derivative w.r.t. the variable being added by this kernel.
Definition: MatReaction.h:61
std::string _v_name
Kernel variable (can be nonlinear or coupled variable) (For constrained Allen-Cahn problems...
Definition: MatReaction.h:47
const MaterialProperty< Real > & _dLdop
Reaction rate derivative w.r.t. order parameter.
Definition: MatReaction.h:58
const bool _is_coupled
is the kernel used in a coupled form?
Definition: MatReaction.h:39
std::vector< const MaterialProperty< Real > * > _dLdarg
Reaction rate derivatives w.r.t. other coupled variables.
Definition: MatReaction.h:67
VariableName _eta_name
name of the order parameter (needed to retrieve the derivative material properties) ...
Definition: MatReaction.h:55
const MaterialProperty< Real > & _L
Reaction rate.
Definition: MatReaction.h:52
const VariableValue & _v
Definition: MatReaction.h:48

Member Function Documentation

◆ computeQpJacobian()

Real MatReaction::computeQpJacobian ( )
protectedvirtual

Definition at line 62 of file MatReaction.C.

63 {
64  if (_is_coupled)
65  return -_dLdop[_qp] * _v[_qp] * _phi[_j][_qp] * _test[_i][_qp];
66 
67  return -(_L[_qp] + _dLdop[_qp] * _v[_qp]) * _phi[_j][_qp] * _test[_i][_qp];
68 }
const MaterialProperty< Real > & _dLdop
Reaction rate derivative w.r.t. order parameter.
Definition: MatReaction.h:58
const bool _is_coupled
is the kernel used in a coupled form?
Definition: MatReaction.h:39
const MaterialProperty< Real > & _L
Reaction rate.
Definition: MatReaction.h:52
const VariableValue & _v
Definition: MatReaction.h:48

◆ computeQpOffDiagJacobian()

Real MatReaction::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 71 of file MatReaction.C.

72 {
73  // first handle the case where jvar is a coupled variable v being added to residual
74  // the first term in the sum just multiplies by L which is always needed
75  // the second term accounts for cases where L depends on v
76  if ((jvar == _v_var) && _is_coupled)
77  return -(_L[_qp] + _dLdv[_qp] * _v[_qp]) * _test[_i][_qp] * _phi[_j][_qp];
78 
79  // for all other vars get the coupled variable jvar is referring to
80  const unsigned int cvar = mapJvarToCvar(jvar);
81 
82  return -(*_dLdarg[cvar])[_qp] * _v[_qp] * _test[_i][_qp] * _phi[_j][_qp];
83 }
unsigned int _v_var
Definition: MatReaction.h:49
const MaterialProperty< Real > & _dLdv
Reaction rate derivative w.r.t. the variable being added by this kernel.
Definition: MatReaction.h:61
const bool _is_coupled
is the kernel used in a coupled form?
Definition: MatReaction.h:39
std::vector< const MaterialProperty< Real > * > _dLdarg
Reaction rate derivatives w.r.t. other coupled variables.
Definition: MatReaction.h:67
const MaterialProperty< Real > & _L
Reaction rate.
Definition: MatReaction.h:52
const VariableValue & _v
Definition: MatReaction.h:48

◆ computeQpResidual()

Real MatReaction::computeQpResidual ( )
protectedvirtual

Definition at line 56 of file MatReaction.C.

57 {
58  return -_L[_qp] * _test[_i][_qp] * _v[_qp];
59 }
const MaterialProperty< Real > & _L
Reaction rate.
Definition: MatReaction.h:52
const VariableValue & _v
Definition: MatReaction.h:48

◆ initialSetup()

void MatReaction::initialSetup ( )
virtual

Definition at line 50 of file MatReaction.C.

51 {
52  validateNonlinearCoupling<Real>("mob_name");
53 }

Member Data Documentation

◆ _dLdarg

std::vector<const MaterialProperty<Real> *> MatReaction::_dLdarg
protected

Reaction rate derivatives w.r.t. other coupled variables.

Definition at line 67 of file MatReaction.h.

Referenced by computeQpOffDiagJacobian(), and MatReaction().

◆ _dLdop

const MaterialProperty<Real>& MatReaction::_dLdop
protected

Reaction rate derivative w.r.t. order parameter.

Definition at line 58 of file MatReaction.h.

Referenced by computeQpJacobian().

◆ _dLdv

const MaterialProperty<Real>& MatReaction::_dLdv
protected

Reaction rate derivative w.r.t. the variable being added by this kernel.

Definition at line 61 of file MatReaction.h.

Referenced by computeQpOffDiagJacobian().

◆ _eta_name

VariableName MatReaction::_eta_name
protected

name of the order parameter (needed to retrieve the derivative material properties)

Definition at line 55 of file MatReaction.h.

◆ _is_coupled

const bool MatReaction::_is_coupled
protected

is the kernel used in a coupled form?

Definition at line 39 of file MatReaction.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

◆ _L

const MaterialProperty<Real>& MatReaction::_L
protected

Reaction rate.

Definition at line 52 of file MatReaction.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _nvar

const unsigned int MatReaction::_nvar
protected

number of coupled variables

Definition at line 64 of file MatReaction.h.

Referenced by MatReaction().

◆ _v

const VariableValue& MatReaction::_v
protected

Definition at line 48 of file MatReaction.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _v_name

std::string MatReaction::_v_name
protected

Kernel variable (can be nonlinear or coupled variable) (For constrained Allen-Cahn problems, v = lambda where lambda is the Lagrange multiplier)

Definition at line 47 of file MatReaction.h.

◆ _v_var

unsigned int MatReaction::_v_var
protected

Definition at line 49 of file MatReaction.h.

Referenced by computeQpOffDiagJacobian().


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