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

This class template implements a diffusion kernel with a mobility that can vary spatially and can depend on variables in the simulation. More...

#include <MatDiffusionBase.h>

Inheritance diagram for MatDiffusionBase< T >:
[legend]

Public Member Functions

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

Static Public Member Functions

static InputParameters validParams ()
 in class templates this function has to be a static member More...
 

Protected Member Functions

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

Protected Attributes

const MaterialProperty< T > & _D
 diffusion coefficient More...
 
const MaterialProperty< T > & _dDdc
 diffusion coefficient derivative w.r.t. the kernel variable More...
 
std::vector< const MaterialProperty< T > * > _dDdarg
 diffusion coefficient derivatives w.r.t. coupled variables More...
 
const bool _is_coupled
 is the kernel used in a coupled form? More...
 
unsigned int _conc_var
 int label for the Concentration More...
 
const VariableGradient & _grad_conc
 Gradient of the concentration. More...
 

Detailed Description

template<typename T>
class MatDiffusionBase< T >

This class template implements a diffusion kernel with a mobility that can vary spatially and can depend on variables in the simulation.

Two classes are derived from this template, MatDiffusion for isotropic diffusion and MatAnisoDiffusion for anisotropic diffusion.

Template Parameters
TType of the diffusion coefficient parameter. This can be Real for isotropic diffusion or RealTensorValue for the general anisotropic case.

Definition at line 24 of file MatDiffusionBase.h.

Constructor & Destructor Documentation

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

Definition at line 74 of file MatDiffusionBase.h.

75  : DerivativeMaterialInterface<JvarMapKernelInterface<Kernel>>(parameters),
76  _D(getMaterialProperty<T>("D_name")),
77  _dDdc(getMaterialPropertyDerivative<T>("D_name", _var.name())),
78  _dDdarg(_coupled_moose_vars.size()),
79  _is_coupled(isCoupled("conc")),
80  _conc_var(_is_coupled ? coupled("conc") : _var.number()),
81  _grad_conc(_is_coupled ? coupledGradient("conc") : _grad_u)
82 {
83  // fetch derivatives
84  for (unsigned int i = 0; i < _dDdarg.size(); ++i)
85  _dDdarg[i] = &getMaterialPropertyDerivative<T>("D_name", _coupled_moose_vars[i]->name());
86 }
const MaterialProperty< T > & _D
diffusion coefficient
const MaterialProperty< T > & _dDdc
diffusion coefficient derivative w.r.t. the kernel variable
const VariableGradient & _grad_conc
Gradient of the concentration.
unsigned int _conc_var
int label for the Concentration
std::vector< const MaterialProperty< T > * > _dDdarg
diffusion coefficient derivatives w.r.t. coupled variables
const bool _is_coupled
is the kernel used in a coupled form?

Member Function Documentation

template<typename T >
Real MatDiffusionBase< T >::computeQpCJacobian ( )
protectedvirtual

Definition at line 129 of file MatDiffusionBase.h.

Referenced by MatDiffusionBase< T >::computeQpJacobian(), and MatDiffusionBase< T >::computeQpOffDiagJacobian().

130 {
131  return _D[_qp] * _grad_phi[_j][_qp] * _grad_test[_i][_qp];
132 }
const MaterialProperty< T > & _D
diffusion coefficient
template<typename T >
Real MatDiffusionBase< T >::computeQpJacobian ( )
protectedvirtual

Definition at line 104 of file MatDiffusionBase.h.

105 {
106  Real sum = _phi[_j][_qp] * _dDdc[_qp] * _grad_conc[_qp] * _grad_test[_i][_qp];
107  if (!_is_coupled)
108  sum += computeQpCJacobian();
109 
110  return sum;
111 }
const MaterialProperty< T > & _dDdc
diffusion coefficient derivative w.r.t. the kernel variable
const VariableGradient & _grad_conc
Gradient of the concentration.
virtual Real computeQpCJacobian()
const bool _is_coupled
is the kernel used in a coupled form?
template<typename T >
Real MatDiffusionBase< T >::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 115 of file MatDiffusionBase.h.

116 {
117  // get the coupled variable jvar is referring to
118  const unsigned int cvar = mapJvarToCvar(jvar);
119 
120  Real sum = (*_dDdarg[cvar])[_qp] * _phi[_j][_qp] * _grad_conc[_qp] * _grad_test[_i][_qp];
121  if (_conc_var == jvar)
122  sum += computeQpCJacobian();
123 
124  return sum;
125 }
const VariableGradient & _grad_conc
Gradient of the concentration.
virtual Real computeQpCJacobian()
unsigned int _conc_var
int label for the Concentration
std::vector< const MaterialProperty< T > * > _dDdarg
diffusion coefficient derivatives w.r.t. coupled variables
template<typename T >
Real MatDiffusionBase< T >::computeQpResidual ( )
protectedvirtual

Definition at line 97 of file MatDiffusionBase.h.

98 {
99  return _D[_qp] * _grad_conc[_qp] * _grad_test[_i][_qp];
100 }
const MaterialProperty< T > & _D
diffusion coefficient
const VariableGradient & _grad_conc
Gradient of the concentration.
template<typename T >
void MatDiffusionBase< T >::initialSetup ( )
virtual

Definition at line 90 of file MatDiffusionBase.h.

91 {
92  validateNonlinearCoupling<Real>("D_name");
93 }
template<typename T >
InputParameters MatDiffusionBase< T >::validParams ( )
static

in class templates this function has to be a static member

Definition at line 61 of file MatDiffusionBase.h.

Referenced by validParams< MatAnisoDiffusion >(), and validParams< MatDiffusion >().

62 {
63  InputParameters params = ::validParams<Kernel>();
64  params.addParam<MaterialPropertyName>("D_name", "D", "The name of the diffusivity");
65  params.addCoupledVar("args", "Vector of arguments of the diffusivity");
66  params.addCoupledVar("conc",
67  "Coupled concentration variable for kernel to operate on; if this "
68  "is not specified, the kernel's nonlinear variable will be used as "
69  "usual");
70  return params;
71 }

Member Data Documentation

template<typename T>
unsigned int MatDiffusionBase< T >::_conc_var
protected

int label for the Concentration

Definition at line 53 of file MatDiffusionBase.h.

Referenced by MatDiffusionBase< T >::computeQpOffDiagJacobian().

template<typename T>
const MaterialProperty<T>& MatDiffusionBase< T >::_D
protected

diffusion coefficient

Definition at line 41 of file MatDiffusionBase.h.

Referenced by MatDiffusionBase< T >::computeQpCJacobian(), and MatDiffusionBase< T >::computeQpResidual().

template<typename T>
std::vector<const MaterialProperty<T> *> MatDiffusionBase< T >::_dDdarg
protected

diffusion coefficient derivatives w.r.t. coupled variables

Definition at line 47 of file MatDiffusionBase.h.

Referenced by MatDiffusionBase< T >::computeQpOffDiagJacobian(), and MatDiffusionBase< T >::MatDiffusionBase().

template<typename T>
const MaterialProperty<T>& MatDiffusionBase< T >::_dDdc
protected

diffusion coefficient derivative w.r.t. the kernel variable

Definition at line 44 of file MatDiffusionBase.h.

Referenced by MatDiffusionBase< T >::computeQpJacobian().

template<typename T>
const VariableGradient& MatDiffusionBase< T >::_grad_conc
protected
template<typename T>
const bool MatDiffusionBase< T >::_is_coupled
protected

is the kernel used in a coupled form?

Definition at line 50 of file MatDiffusionBase.h.

Referenced by MatDiffusionBase< T >::computeQpJacobian().


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