https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MatDiffusionBaseTempl< T, is_ad > 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 MatDiffusionBaseTempl< T, is_ad >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 
typedef std::vector< intJvarMap
 

Public Member Functions

 MatDiffusionBaseTempl (const InputParameters &parameters)
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 Fetch a material property if it exists, otherwise return getZeroMaterialProperty. More...
 
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 Fetch a material property by name if it exists, otherwise return getZeroMaterialProperty. More...
 
void validateDerivativeMaterialPropertyBase (const std::string &base)
 Check if the material property base exists. More...
 
virtual void computeOffDiagJacobian (unsigned int jvar) override
 
unsigned int mapJvarToCvar (unsigned int jvar)
 Return index into the _coupled_moose_vars array for a given jvar. More...
 
int mapJvarToCvar (unsigned int jvar, const JvarMap &jvar_map)
 Return an index into a specific coupled variable vector for a given jvar. More...
 
bool mapJvarToCvar (unsigned int jvar, unsigned int &cvar)
 Set the cvar value to the mapped jvar value and return true if the mapping exists. More...
 
const JvarMapgetJvarMap ()
 Obtain the map connecting libmesh variable ID number to its position in the _coupled_moose_vars vector. More...
 
const JvarMapgetParameterJvarMap (std::string parameter_name)
 Make a specific map for a given parameter name representing a couple variable (vector) More...
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 Helper functions to generate the material property names for the arbitrary derivatives. More...
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 Helper functions to generate the material property names for the first derivatives. More...
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 Helper functions to generate the material property names for the second derivatives. More...
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 Helper functions to generate the material property names for the third derivatives. More...
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 Methods for declaring derivative material properties. More...
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 Methods for retrieving derivative material properties. More...
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, unsigned int v2, unsigned int v3=libMesh::invalid_uint)
 Convenience methods for retrieving derivative material properties based on a mix of variable names c and indices v into the _coupled_standard_moose_vars vector. More...
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, unsigned int v1, unsigned int v2=libMesh::invalid_uint, unsigned int v3=libMesh::invalid_uint)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 Methods for retrieving derivative material properties. More...
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
void validateCoupling (const MaterialPropertyName &base, const std::vector< VariableName > &c, bool validate_aux=true)
 check if derivatives of the passed in material property exist w.r.t a variable that is not coupled in to the current object More...
 
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 aliases for the deprecated old function names More...
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const SymbolName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual GenericRealVectorValue< is_ad > precomputeQpResidual () override
 

Protected Attributes

const GenericMaterialProperty< T, is_ad > & _diffusivity
 diffusion coefficient More...
 
const GenericVariableGradient< is_ad > & _grad_v
 Gradient of the concentration. More...
 
 usingGenericKernelGradMembers
 
const unsigned int _n_args
 number of coupled moose variables More...
 

Detailed Description

template<typename T, bool is_ad>
class MatDiffusionBaseTempl< T, is_ad >

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 26 of file MatDiffusionBase.h.

Member Typedef Documentation

◆ JvarMap

typedef std::vector<int> JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::JvarMap
inherited

Definition at line 63 of file JvarMapInterface.h.

◆ SymbolName

Definition at line 35 of file DerivativeMaterialInterface.h.

Constructor & Destructor Documentation

◆ MatDiffusionBaseTempl()

template<typename T , bool is_ad>
MatDiffusionBaseTempl< T, is_ad >::MatDiffusionBaseTempl ( const InputParameters parameters)

Definition at line 39 of file MatDiffusionBase.C.

41  _diffusivity(this->template getGenericMaterialProperty<T, is_ad>("diffusivity")),
42  _grad_v(isCoupled("v") ? this->template coupledGenericGradient<is_ad>("v") : _grad_u)
43 {
44 }
Interface class ("Veneer") to provide generator methods for derivative material property names...
const GenericMaterialProperty< T, is_ad > & _diffusivity
diffusion coefficient
const GenericVariableGradient< is_ad > & _grad_v
Gradient of the concentration.

Member Function Documentation

◆ computeOffDiagJacobian()

void JvarMapKernelInterface< GenericKernelGrad< is_ad > >::computeOffDiagJacobian ( unsigned int  jvar)
overridevirtualinherited

Definition at line 201 of file JvarMapInterface.h.

202 {
203  // the Kernel is not coupled to the variable; no need to loop over QPs
204  if (this->_jvar_map[jvar] < 0)
205  return;
206 
207  // call the underlying class' off-diagonal Jacobian
208  T::computeOffDiagJacobian(jvar);
209 }
JvarMap _jvar_map
look-up table to determine the _coupled_moose_vars index for the jvar parameter

◆ declarePropertyDerivative() [1/3]

GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::declarePropertyDerivative ( const std::string &  base,
const std::vector< VariableName > &  c 
)
inherited

Methods for declaring derivative material properties.

Template Parameters
UThe material property type
Parameters
baseThe name of the property to take the derivative of
cThe variable(s) to take the derivatives with respect to

Definition at line 258 of file DerivativeMaterialInterface.h.

260 {
261  std::vector<SymbolName> symbol_vector(c.begin(), c.end());
262  return declarePropertyDerivative<U, is_ad>(base, symbol_vector);
263 }

◆ declarePropertyDerivative() [2/3]

GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::declarePropertyDerivative ( const std::string &  base,
const std::vector< SymbolName > &  c 
)
inherited

Definition at line 268 of file DerivativeMaterialInterface.h.

270 {
271  return this->template declareGenericProperty<U, is_ad>(derivativePropertyName(base, c));
272 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ declarePropertyDerivative() [3/3]

GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::declarePropertyDerivative ( const std::string &  base,
const SymbolName c1,
const SymbolName c2 = "",
const SymbolName c3 = "" 
)
inherited

Definition at line 277 of file DerivativeMaterialInterface.h.

281 {
282  if (c3 != "")
283  return this->template declareGenericProperty<U, is_ad>(
284  derivativePropertyNameThird(base, c1, c2, c3));
285  if (c2 != "")
286  return this->template declareGenericProperty<U, is_ad>(
287  derivativePropertyNameSecond(base, c1, c2));
288  return this->template declareGenericProperty<U, is_ad>(derivativePropertyNameFirst(base, c1));
289 }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
Helper functions to generate the material property names for the first derivatives.
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
Helper functions to generate the material property names for the third derivatives.

◆ derivativePropertyName()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::derivativePropertyName ( const MaterialPropertyName &  base,
const std::vector< SymbolName > &  c 
) const
inherited

Helper functions to generate the material property names for the arbitrary derivatives.

Definition at line 16 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeMaterialPropertyNameInterface::derivativePropertyNameSecond(), DerivativeMaterialPropertyNameInterface::derivativePropertyNameThird(), and DerivativeMaterialPropertyNameInterface::propertyName().

18 {
19  // to obtain well defined names we sort alphabetically
20  std::vector<SymbolName> a(c);
21  std::sort(a.begin(), a.end());
22 
23  // derivative order
24  unsigned int order = a.size();
25  if (order == 0)
26  return base;
27 
28  // build the property name as a stringstream
29  std::stringstream name;
30 
31  // build numerator
32  name << 'd';
33  if (order > 1)
34  name << '^' << order;
35  name << base << '/';
36 
37  // build denominator with 'pretty' names using exponents rather than repeat multiplication
38  unsigned int exponent = 1;
39  for (unsigned i = 1; i <= order; ++i)
40  {
41  if (i == order || a[i - 1] != a[i])
42  {
43  name << 'd' << a[i - 1];
44  if (exponent > 1)
45  name << '^' << exponent;
46  exponent = 1;
47  }
48  else
49  exponent++;
50  }
51 
52  return name.str();
53 }
std::string name(const ElemQuality q)

◆ derivativePropertyNameFirst()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::derivativePropertyNameFirst ( const MaterialPropertyName &  base,
const SymbolName c1 
) const
inherited

Helper functions to generate the material property names for the first derivatives.

Definition at line 56 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeMaterialPropertyNameInterface::propertyNameFirst().

58 {
59  return "d" + base + "/d" + c1;
60 }

◆ derivativePropertyNameSecond()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::derivativePropertyNameSecond ( const MaterialPropertyName &  base,
const SymbolName c1,
const SymbolName c2 
) const
inherited

Helper functions to generate the material property names for the second derivatives.

Definition at line 63 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeMaterialPropertyNameInterface::propertyNameSecond().

65 {
66  return derivativePropertyName(base, {c1, c2});
67 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ derivativePropertyNameThird()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::derivativePropertyNameThird ( const MaterialPropertyName &  base,
const SymbolName c1,
const SymbolName c2,
const SymbolName c3 
) const
inherited

Helper functions to generate the material property names for the third derivatives.

Definition at line 70 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeMaterialPropertyNameInterface::propertyNameThird().

75 {
76  return derivativePropertyName(base, {c1, c2, c3});
77 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ getDefaultMaterialProperty()

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getDefaultMaterialProperty ( const std::string &  name)
inherited

Fetch a material property if it exists, otherwise return getZeroMaterialProperty.

Parameters
nameThe input parameter key of type MaterialPropertyName

Definition at line 231 of file DerivativeMaterialInterface.h.

232 {
233  // get the base property name
234  std::string prop_name = this->getMaterialPropertyName(name);
235 
236  // Check if it's just a constant
237  const auto * default_property =
238  this->template defaultGenericMaterialProperty<U, is_ad>(prop_name);
239  if (default_property)
240  return *default_property;
241 
242  // if found return the requested property
243  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(prop_name);
244 }

◆ getDefaultMaterialPropertyByName()

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getDefaultMaterialPropertyByName ( const std::string &  name)
inherited

Fetch a material property by name if it exists, otherwise return getZeroMaterialProperty.

Definition at line 249 of file DerivativeMaterialInterface.h.

250 {
251  // TODO: deprecate this
252  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(prop_name);
253 }

◆ getJvarMap()

const JvarMap& JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::getJvarMap ( )
inlineinherited

Obtain the map connecting libmesh variable ID number to its position in the _coupled_moose_vars vector.

Definition at line 80 of file JvarMapInterface.h.

80 { return _jvar_map; }
JvarMap _jvar_map
look-up table to determine the _coupled_moose_vars index for the jvar parameter

◆ getMaterialPropertyDerivative() [1/5]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivative ( const std::string &  base,
const std::vector< VariableName > &  c 
)
inherited

Methods for retrieving derivative material properties.

Template Parameters
UThe material property type
Parameters
baseThe name of the property to take the derivative of
cThe variable(s) to take the derivatives with respect to

Definition at line 294 of file DerivativeMaterialInterface.h.

296 {
297  std::vector<SymbolName> symbol_vector(c.begin(), c.end());
298  return getMaterialPropertyDerivative(base, symbol_vector);
299 }
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative(const std::string &base, const std::vector< VariableName > &c)
Methods for retrieving derivative material properties.

◆ getMaterialPropertyDerivative() [2/5]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivative ( const std::string &  base,
const std::vector< SymbolName > &  c 
)
inherited

Check if base is a default property and shortcut to returning zero, as derivatives of constants are zero.

Definition at line 304 of file DerivativeMaterialInterface.h.

306 {
307  // get the base property name
308  std::string prop_name = this->getMaterialPropertyName(base);
309 
314  if (this->template defaultGenericMaterialProperty<U, is_ad>(prop_name))
315  return this->template getGenericZeroMaterialProperty<U, is_ad>();
316 
317  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
318  derivativePropertyName(prop_name, c));
319 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ getMaterialPropertyDerivative() [3/5]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivative ( const std::string &  base,
const SymbolName c1,
const SymbolName c2 = "",
const SymbolName c3 = "" 
)
inherited

Check if base is a default property and shortcut to returning zero, as derivatives of constants are zero.

Definition at line 324 of file DerivativeMaterialInterface.h.

328 {
329  // get the base property name
330  std::string prop_name = this->getMaterialPropertyName(base);
331 
336  if (this->template defaultGenericMaterialProperty<Real, is_ad>(prop_name))
337  return this->template getGenericZeroMaterialProperty<U, is_ad>();
338 
339  if (c3 != "")
340  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
341  derivativePropertyNameThird(prop_name, c1, c2, c3));
342  if (c2 != "")
343  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
344  derivativePropertyNameSecond(prop_name, c1, c2));
345  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
346  derivativePropertyNameFirst(prop_name, c1));
347 }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
Helper functions to generate the material property names for the first derivatives.
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
Helper functions to generate the material property names for the third derivatives.

◆ getMaterialPropertyDerivative() [4/5]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivative ( const std::string &  base,
const SymbolName c1,
unsigned int  v2,
unsigned int  v3 = libMesh::invalid_uint 
)
inherited

Convenience methods for retrieving derivative material properties based on a mix of variable names c and indices v into the _coupled_standard_moose_vars vector.

Definition at line 352 of file DerivativeMaterialInterface.h.

356 {
357  return getMaterialPropertyDerivative<U, is_ad>(
358  base,
359  c1,
360  this->_coupled_standard_moose_vars[v2]->name(),
361  v3 == libMesh::invalid_uint ? "" : this->_coupled_standard_moose_vars[v3]->name());
362 }
const unsigned int invalid_uint

◆ getMaterialPropertyDerivative() [5/5]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivative ( const std::string &  base,
unsigned int  v1,
unsigned int  v2 = libMesh::invalid_uint,
unsigned int  v3 = libMesh::invalid_uint 
)
inherited

Definition at line 367 of file DerivativeMaterialInterface.h.

371 {
372  return getMaterialPropertyDerivative<U, is_ad>(
373  base,
374  this->_coupled_standard_moose_vars[v1]->name(),
375  v2 == libMesh::invalid_uint ? "" : this->_coupled_standard_moose_vars[v2]->name(),
376  v3 == libMesh::invalid_uint ? "" : this->_coupled_standard_moose_vars[v3]->name());
377 }
const unsigned int invalid_uint

◆ getMaterialPropertyDerivativeByName() [1/3]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivativeByName ( const MaterialPropertyName &  base,
const std::vector< VariableName > &  c 
)
inherited

Methods for retrieving derivative material properties.

Template Parameters
UThe material property type
Parameters
baseThe name of the property to take the derivative of
cThe variable(s) to take the derivatives with respect to

Definition at line 382 of file DerivativeMaterialInterface.h.

384 {
385  std::vector<SymbolName> symbol_vector(c.begin(), c.end());
386  return getMaterialPropertyDerivativeByName(base, symbol_vector);
387 }
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const std::vector< VariableName > &c)
Methods for retrieving derivative material properties.

◆ getMaterialPropertyDerivativeByName() [2/3]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivativeByName ( const MaterialPropertyName &  base,
const std::vector< SymbolName > &  c 
)
inherited

Definition at line 392 of file DerivativeMaterialInterface.h.

394 {
395  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
396  derivativePropertyName(base, c));
397 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ getMaterialPropertyDerivativeByName() [3/3]

const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::getMaterialPropertyDerivativeByName ( const MaterialPropertyName &  base,
const SymbolName c1,
const SymbolName c2 = "",
const SymbolName c3 = "" 
)
inherited

Definition at line 402 of file DerivativeMaterialInterface.h.

407 {
408  if (c3 != "")
409  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
410  derivativePropertyNameThird(base, c1, c2, c3));
411  if (c2 != "")
412  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
413  derivativePropertyNameSecond(base, c1, c2));
414  return this->template getGenericZeroMaterialPropertyByName<U, is_ad>(
415  derivativePropertyNameFirst(base, c1));
416 }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
Helper functions to generate the material property names for the first derivatives.
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
Helper functions to generate the material property names for the third derivatives.

◆ getParameterJvarMap()

const JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::JvarMap & JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::getParameterJvarMap ( std::string  parameter_name)
inherited

Make a specific map for a given parameter name representing a couple variable (vector)

Definition at line 168 of file JvarMapInterface.h.

169 {
170  auto & jvar_map = _jvar_local_map[parameter_name];
171  jvar_map.assign(_jvar_max_size, -1);
172 
173  // populate local map
174  const auto num = this->coupledComponents(parameter_name);
175  for (std::size_t i = 0; i < num; ++i)
176  {
177  const auto number = this->getVar(parameter_name, i)->number();
178 
179  // skip AuxVars as off-diagonal jacobian entries are not calculated for them
180  if (number < _jvar_max_size)
181  jvar_map[number] = i;
182  }
183 
184  return jvar_map;
185 }
const std::size_t _jvar_max_size
number of nonlinear variables in the system
std::map< std::string, JvarMap > _jvar_local_map
map of local look-up tables for specific parameters

◆ mapJvarToCvar() [1/3]

unsigned int JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::mapJvarToCvar ( unsigned int  jvar)
inherited

Return index into the _coupled_moose_vars array for a given jvar.

Definition at line 147 of file JvarMapInterface.h.

148 {
149  mooseAssert(jvar < _jvar_max_size,
150  "Calling mapJvarToCvar for an invalid Moose variable number. Maybe an AuxVariable?");
151  int cit = _jvar_map[jvar];
152 
153  mooseAssert(cit >= 0, "Calling mapJvarToCvar for a variable not coupled to this kernel.");
154  return cit;
155 }
const std::size_t _jvar_max_size
number of nonlinear variables in the system
JvarMap _jvar_map
look-up table to determine the _coupled_moose_vars index for the jvar parameter

◆ mapJvarToCvar() [2/3]

int JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::mapJvarToCvar ( unsigned int  jvar,
const JvarMap jvar_map 
)
inherited

Return an index into a specific coupled variable vector for a given jvar.

A negative return value indicates that the jvar value does not point to a variable in the couple variable vector corresponding to the mapped parameter.

Definition at line 159 of file JvarMapInterface.h.

160 {
161  mooseAssert(jvar < _jvar_max_size,
162  "Calling mapJvarToCvar for an invalid Moose variable number. Maybe an AuxVariable?");
163  return jvar_map[jvar];
164 }
const std::size_t _jvar_max_size
number of nonlinear variables in the system

◆ mapJvarToCvar() [3/3]

bool JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::mapJvarToCvar ( unsigned int  jvar,
unsigned int cvar 
)
inherited

Set the cvar value to the mapped jvar value and return true if the mapping exists.

Otherwise return false.

Parameters
[in]jvarVariable number passed as argument to computeQpOffDiagJacobian
[out]cvarCorresponding index into the _coupled_moose_vars array
Returns
true if the requested variable is coupled, false otherwise

◆ precomputeQpResidual()

template<typename T , bool is_ad>
GenericRealVectorValue< is_ad > MatDiffusionBaseTempl< T, is_ad >::precomputeQpResidual ( )
overrideprotectedvirtual

Definition at line 62 of file MatDiffusionBase.C.

63 {
64  return _diffusivity[_qp] * _grad_v[_qp];
65 }
const GenericMaterialProperty< T, is_ad > & _diffusivity
diffusion coefficient
const GenericVariableGradient< is_ad > & _grad_v
Gradient of the concentration.

◆ propertyName()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::propertyName ( const MaterialPropertyName &  base,
const std::vector< SymbolName > &  c 
) const
inlineinherited

aliases for the deprecated old function names

Definition at line 59 of file DerivativeMaterialPropertyNameInterface.h.

61  {
62  mooseDeprecated("This function was renamed to 'derivativePropertyName'");
63  return derivativePropertyName(base, c);
64  }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:374

◆ propertyNameFirst()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::propertyNameFirst ( const MaterialPropertyName &  base,
const SymbolName c1 
) const
inlineinherited

Definition at line 65 of file DerivativeMaterialPropertyNameInterface.h.

67  {
68  mooseDeprecated("This function was renamed to 'derivativePropertyNameFirst'");
69  return derivativePropertyNameFirst(base, c1);
70  }
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const SymbolName &c1) const
Helper functions to generate the material property names for the first derivatives.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:374

◆ propertyNameSecond()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::propertyNameSecond ( const MaterialPropertyName &  base,
const SymbolName c1,
const SymbolName c2 
) const
inlineinherited

Definition at line 71 of file DerivativeMaterialPropertyNameInterface.h.

74  {
75  mooseDeprecated("This function was renamed to 'derivativePropertyNameSecond'");
76  return derivativePropertyNameSecond(base, c1, c2);
77  }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2) const
Helper functions to generate the material property names for the second derivatives.
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:374

◆ propertyNameThird()

const MaterialPropertyName DerivativeMaterialPropertyNameInterface::propertyNameThird ( const MaterialPropertyName &  base,
const SymbolName c1,
const SymbolName c2,
const SymbolName c3 
) const
inlineinherited

Definition at line 78 of file DerivativeMaterialPropertyNameInterface.h.

82  {
83  mooseDeprecated("This function was renamed to 'derivativePropertyNameThird'");
84  return derivativePropertyNameThird(base, c1, c2, c3);
85  }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:374
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2, const SymbolName &c3) const
Helper functions to generate the material property names for the third derivatives.

◆ validateCoupling() [1/2]

void DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::validateCoupling ( const MaterialPropertyName &  base,
const std::vector< VariableName > &  c,
bool  validate_aux = true 
)
inherited

check if derivatives of the passed in material property exist w.r.t a variable that is not coupled in to the current object

Definition at line 461 of file DerivativeMaterialInterface.h.

464 {
465  // get the base property name
466  std::string prop_name = this->getMaterialPropertyName(base);
467  // list of potentially missing coupled variables
468  std::vector<VariableName> missing;
469 
470  // iterate over all variables in the both the non-linear and auxiliary system (optional)
471  validateCouplingHelper<U, is_ad>(
472  prop_name, c, _dmi_fe_problem.getNonlinearSystemBase(/*nl_sys=*/0).system(), missing);
473  if (validate_aux)
474  validateCouplingHelper<U, is_ad>(
475  prop_name, c, _dmi_fe_problem.getAuxiliarySystem().system(), missing);
476 
477  if (missing.size() > 0)
478  {
479  // join list of missing variable names
480  std::string list = missing[0];
481  for (unsigned int i = 1; i < missing.size(); ++i)
482  list += ", " + missing[i];
483 
484  mooseWarning("Missing coupled variables {",
485  list,
486  "} (add them to coupled_variables parameter of ",
487  this->name(),
488  ")");
489  }
490 }
std::string name(const ElemQuality q)
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:357
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
AuxiliarySystem & getAuxiliarySystem()
virtual libMesh::System & system() override
Get the reference to the libMesh system.
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ validateCoupling() [2/2]

void DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::validateCoupling ( const MaterialPropertyName &  base,
const VariableName &  c1 = "",
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)
inherited

Definition at line 515 of file DerivativeMaterialInterface.h.

519 {
520  validateCoupling<U, is_ad>(base, buildVariableVector(c1, c2, c3), true);
521 }
std::vector< VariableName > buildVariableVector(const VariableName &c1, const VariableName &c2, const VariableName &c3)
helper method to combine multiple VariableNames into a vector (if they are != "") ...

◆ validateDerivativeMaterialPropertyBase()

void DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::validateDerivativeMaterialPropertyBase ( const std::string &  base)
inherited

Check if the material property base exists.

Print a warning if it doesn't. This is useful in materials that pull in only derivative properties, which are optional. If the base property name has a typo all derivatives will be set to zero without the user ever knowing.

Definition at line 537 of file DerivativeMaterialInterface.h.

538 {
539  // resolve the input parameter name base to the actual material property name
540  const MaterialPropertyName prop_name = this->template getParam<MaterialPropertyName>(base);
541 
542  // check if the material property does not exist on the blocks of the current object,
543  // and check if it is not a plain number in the input file
544  if (!haveMaterialProperty<U, is_ad>(prop_name) &&
545  this->template defaultGenericMaterialProperty<U, is_ad>(prop_name) == 0)
546  mooseWarning("The material property '",
547  prop_name,
548  "' does not exist. The kernel '",
549  this->name(),
550  "' only needs its derivatives, but this may indicate a typo in the input file.");
551 }
std::string name(const ElemQuality q)
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:357

◆ validateNonlinearCoupling()

void DerivativeMaterialInterface< JvarMapKernelInterface< GenericKernelGrad< is_ad > > >::validateNonlinearCoupling ( const MaterialPropertyName &  base,
const VariableName &  c1 = "",
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)
inherited

Definition at line 526 of file DerivativeMaterialInterface.h.

530 {
531  validateCoupling<U, is_ad>(base, buildVariableVector(c1, c2, c3), false);
532 }
std::vector< VariableName > buildVariableVector(const VariableName &c1, const VariableName &c2, const VariableName &c3)
helper method to combine multiple VariableNames into a vector (if they are != "") ...

◆ validParams()

template<typename T , bool is_ad>
InputParameters MatDiffusionBaseTempl< T, is_ad >::validParams ( )
static

Definition at line 14 of file MatDiffusionBase.C.

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

15 {
17  params.addParam<MaterialPropertyName>(
18  "diffusivity", "D", "The diffusivity value or material property");
19  params.addCoupledVar("v",
20  "Coupled concentration variable for kernel to operate on; if this "
21  "is not specified, the kernel's nonlinear variable will be used as "
22  "usual");
23  return params;
24 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams()
void addCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...

Member Data Documentation

◆ _diffusivity

template<typename T, bool is_ad>
const GenericMaterialProperty<T, is_ad>& MatDiffusionBaseTempl< T, is_ad >::_diffusivity
protected

diffusion coefficient

Definition at line 38 of file MatDiffusionBase.h.

◆ _grad_v

template<typename T, bool is_ad>
const GenericVariableGradient<is_ad>& MatDiffusionBaseTempl< T, is_ad >::_grad_v
protected

Gradient of the concentration.

Definition at line 41 of file MatDiffusionBase.h.

◆ _n_args

const unsigned int JvarMapInterfaceBase< GenericKernelGrad< is_ad > >::_n_args
protectedinherited

number of coupled moose variables

Definition at line 97 of file JvarMapInterface.h.

◆ usingGenericKernelGradMembers

template<typename T, bool is_ad>
MatDiffusionBaseTempl< T, is_ad >::usingGenericKernelGradMembers
protected

Definition at line 43 of file MatDiffusionBase.h.


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