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 24 of file MatReaction.h.

Constructor & Destructor Documentation

MatReaction::MatReaction ( const InputParameters &  parameters)

Definition at line 23 of file MatReaction.C.

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

Member Function Documentation

Real MatReaction::computeQpJacobian ( )
protectedvirtual

Definition at line 57 of file MatReaction.C.

58 {
59  if (_is_coupled)
60  return -_dLdop[_qp] * _v[_qp] * _phi[_j][_qp] * _test[_i][_qp];
61 
62  return -(_L[_qp] + _dLdop[_qp] * _v[_qp]) * _phi[_j][_qp] * _test[_i][_qp];
63 }
const MaterialProperty< Real > & _dLdop
Reaction rate derivative w.r.t. order parameter.
Definition: MatReaction.h:55
const bool _is_coupled
is the kernel used in a coupled form?
Definition: MatReaction.h:36
const MaterialProperty< Real > & _L
Reaction rate.
Definition: MatReaction.h:49
const VariableValue & _v
Definition: MatReaction.h:45
Real MatReaction::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 66 of file MatReaction.C.

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

Definition at line 51 of file MatReaction.C.

52 {
53  return -_L[_qp] * _test[_i][_qp] * _v[_qp];
54 }
const MaterialProperty< Real > & _L
Reaction rate.
Definition: MatReaction.h:49
const VariableValue & _v
Definition: MatReaction.h:45
void MatReaction::initialSetup ( )
virtual

Definition at line 45 of file MatReaction.C.

46 {
47  validateNonlinearCoupling<Real>("mob_name");
48 }

Member Data Documentation

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

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

Definition at line 64 of file MatReaction.h.

Referenced by computeQpOffDiagJacobian(), and MatReaction().

const MaterialProperty<Real>& MatReaction::_dLdop
protected

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

Definition at line 55 of file MatReaction.h.

Referenced by computeQpJacobian().

const MaterialProperty<Real>& MatReaction::_dLdv
protected

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

Definition at line 58 of file MatReaction.h.

Referenced by computeQpOffDiagJacobian().

VariableName MatReaction::_eta_name
protected

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

Definition at line 52 of file MatReaction.h.

const bool MatReaction::_is_coupled
protected

is the kernel used in a coupled form?

Definition at line 36 of file MatReaction.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

const MaterialProperty<Real>& MatReaction::_L
protected

Reaction rate.

Definition at line 49 of file MatReaction.h.

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

const unsigned int MatReaction::_nvar
protected

number of coupled variables

Definition at line 61 of file MatReaction.h.

Referenced by MatReaction().

const VariableValue& MatReaction::_v
protected

Definition at line 45 of file MatReaction.h.

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

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 44 of file MatReaction.h.

unsigned int MatReaction::_v_var
protected

Definition at line 46 of file MatReaction.h.

Referenced by computeQpOffDiagJacobian().


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