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

Interface class ("Veneer") to provide generator methods for derivative material property names. More...

#include <DerivativeMaterialInterface.h>

Inheritance diagram for DerivativeMaterialInterface< T >:
[legend]

Public Member Functions

 DerivativeMaterialInterface (const InputParameters &parameters)
 
template<typename U >
const MaterialProperty< U > & getDefaultMaterialProperty (const std::string &name)
 Fetch a material property if it exists, otherwise return getZeroMaterialProperty. More...
 
template<typename U >
const MaterialProperty< U > & getDefaultMaterialPropertyByName (const std::string &name)
 Fetch a material property by name if it exists, otherwise return getZeroMaterialProperty. More...
 
template<typename U >
void validateDerivativeMaterialPropertyBase (const std::string &base)
 Check if the material property base exists. More...
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< VariableName > &c) const
 Helper functions to generate the material property names for the arbitrary derivatives. More...
 
const MaterialPropertyName derivativePropertyNameFirst (const MaterialPropertyName &base, const VariableName &c1) const
 Helper functions to generate the material property names for the first derivatives. More...
 
const MaterialPropertyName derivativePropertyNameSecond (const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2) const
 Helper functions to generate the material property names for the second derivatives. More...
 
const MaterialPropertyName derivativePropertyNameThird (const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3) const
 Helper functions to generate the material property names for the third derivatives. More...
 
template<typename U >
MaterialProperty< U > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 Methods for declaring derivative material properties. More...
 
template<typename U >
MaterialProperty< U > & declarePropertyDerivative (const std::string &base, const VariableName &c1, const VariableName &c2="", const VariableName &c3="")
 
template<typename U >
const MaterialProperty< U > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 Methods for retreiving derivative material properties. More...
 
template<typename U >
const MaterialProperty< U > & getMaterialPropertyDerivative (const std::string &base, const VariableName &c1, const VariableName &c2="", const VariableName &c3="")
 
template<typename U >
const MaterialProperty< U > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 Methods for retreiving derivative material properties. More...
 
template<typename U >
const MaterialProperty< U > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2="", const VariableName &c3="")
 
template<typename U >
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...
 
template<typename U >
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
template<typename U >
void validateNonlinearCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
const MaterialPropertyName propertyName (const MaterialPropertyName &base, const std::vector< VariableName > &c) const
 aliases for the deprecated old function names More...
 
const MaterialPropertyName propertyNameFirst (const MaterialPropertyName &base, const VariableName &c1) const
 
const MaterialPropertyName propertyNameSecond (const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2) const
 
const MaterialPropertyName propertyNameThird (const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3) const
 

Private Member Functions

template<typename U >
bool haveMaterialProperty (const std::string &prop_name)
 Check if a material property is present with the applicable restrictions. More...
 
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 != "") More...
 
template<typename U >
void validateCouplingHelper (const MaterialPropertyName &base, const std::vector< VariableName > &c, const System &system, std::vector< VariableName > &missing)
 helper method to compile list of missing coupled variables for a given system More...
 
bool isNotObjectVariable (const VariableName &name)
 

Private Attributes

FEProblemBase_dmi_fe_problem
 Reference to FEProblemBase. More...
 

Detailed Description

template<class T>
class DerivativeMaterialInterface< T >

Interface class ("Veneer") to provide generator methods for derivative material property names.

Definition at line 33 of file DerivativeMaterialInterface.h.

Constructor & Destructor Documentation

◆ DerivativeMaterialInterface()

template<class T >
DerivativeMaterialInterface< T >::DerivativeMaterialInterface ( const InputParameters parameters)

Definition at line 156 of file DerivativeMaterialInterface.h.

157  : T(parameters),
158  _dmi_fe_problem(*parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"))
159 {
160 }
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
FEProblemBase & _dmi_fe_problem
Reference to FEProblemBase.

Member Function Documentation

◆ buildVariableVector()

template<class T >
std::vector< VariableName > DerivativeMaterialInterface< T >::buildVariableVector ( const VariableName &  c1,
const VariableName &  c2,
const VariableName &  c3 
)
private

helper method to combine multiple VariableNames into a vector (if they are != "")

Definition at line 384 of file DerivativeMaterialInterface.h.

387 {
388  std::vector<VariableName> c;
389  if (c1 != "")
390  {
391  c.push_back(c1);
392  if (c2 != "")
393  {
394  c.push_back(c2);
395  if (c3 != "")
396  c.push_back(c3);
397  }
398  }
399  return c;
400 }

◆ declarePropertyDerivative() [1/2]

template<class T >
template<typename U >
MaterialProperty< U > & DerivativeMaterialInterface< T >::declarePropertyDerivative ( const std::string &  base,
const std::vector< VariableName > &  c 
)

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 219 of file DerivativeMaterialInterface.h.

221 {
222  return this->template declareProperty<U>(derivativePropertyName(base, c));
223 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< VariableName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ declarePropertyDerivative() [2/2]

template<class T >
template<typename U >
MaterialProperty< U > & DerivativeMaterialInterface< T >::declarePropertyDerivative ( const std::string &  base,
const VariableName &  c1,
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)

Definition at line 228 of file DerivativeMaterialInterface.h.

232 {
233  if (c3 != "")
234  return this->template declareProperty<U>(derivativePropertyNameThird(base, c1, c2, c3));
235  if (c2 != "")
236  return this->template declareProperty<U>(derivativePropertyNameSecond(base, c1, c2));
237  return this->template declareProperty<U>(derivativePropertyNameFirst(base, c1));
238 }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3) const
Helper functions to generate the material property names for the third derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const VariableName &c1) const
Helper functions to generate the material property names for the first derivatives.

◆ derivativePropertyName()

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

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

Definition at line 15 of file DerivativeMaterialPropertyNameInterface.C.

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

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

◆ derivativePropertyNameFirst()

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

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

Definition at line 55 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeFunctionMaterialBase::initialSetup(), and DerivativeMaterialPropertyNameInterface::propertyNameFirst().

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

◆ derivativePropertyNameSecond()

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

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

Definition at line 62 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeFunctionMaterialBase::initialSetup(), and DerivativeMaterialPropertyNameInterface::propertyNameSecond().

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

◆ derivativePropertyNameThird()

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

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

Definition at line 69 of file DerivativeMaterialPropertyNameInterface.C.

Referenced by DerivativeFunctionMaterialBase::initialSetup(), and DerivativeMaterialPropertyNameInterface::propertyNameThird().

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

◆ getDefaultMaterialProperty()

template<class T >
template<typename U >
const MaterialProperty< U > & DerivativeMaterialInterface< T >::getDefaultMaterialProperty ( const std::string &  name)

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

Parameters
nameThe input parameter key of type MaterialPropertyName

Definition at line 189 of file DerivativeMaterialInterface.h.

190 {
191  // get the base property name
192  std::string prop_name = this->deducePropertyName(name);
193 
194  // Check if it's just a constant
195  const MaterialProperty<U> * default_property =
196  this->template defaultMaterialProperty<U>(prop_name);
197  if (default_property)
198  return *default_property;
199 
200  // if found return the requested property
201  return getDefaultMaterialPropertyByName<U>(prop_name);
202 }
Concrete definition of a parameter value for a specified type.

◆ getDefaultMaterialPropertyByName()

template<class T >
template<typename U >
const MaterialProperty< U > & DerivativeMaterialInterface< T >::getDefaultMaterialPropertyByName ( const std::string &  name)

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

Definition at line 207 of file DerivativeMaterialInterface.h.

208 {
209  // if found return the requested property
210  if (haveMaterialProperty<U>(prop_name))
211  return this->template getMaterialPropertyByName<U>(prop_name);
212 
213  return this->template getZeroMaterialProperty<U>(prop_name);
214 }

◆ getMaterialPropertyDerivative() [1/2]

template<class T >
template<typename U >
const MaterialProperty< U > & DerivativeMaterialInterface< T >::getMaterialPropertyDerivative ( const std::string &  base,
const std::vector< VariableName > &  c 
)

Methods for retreiving 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

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

Definition at line 243 of file DerivativeMaterialInterface.h.

Referenced by FunctionMaterialPropertyDescriptor::value().

245 {
246  // get the base property name
247  std::string prop_name = this->deducePropertyName(base);
248 
253  if (this->template defaultMaterialProperty<U>(prop_name))
254  return this->template getZeroMaterialProperty<U>(prop_name + "_zeroderivative");
255 
256  return getDefaultMaterialPropertyByName<U>(derivativePropertyName(prop_name, c));
257 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< VariableName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ getMaterialPropertyDerivative() [2/2]

template<class T >
template<typename U >
const MaterialProperty< U > & DerivativeMaterialInterface< T >::getMaterialPropertyDerivative ( const std::string &  base,
const VariableName &  c1,
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)

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

Definition at line 262 of file DerivativeMaterialInterface.h.

266 {
267  // get the base property name
268  std::string prop_name = this->deducePropertyName(base);
269 
274  if (this->template defaultMaterialProperty<U>(prop_name))
275  return this->template getZeroMaterialProperty<U>(prop_name + "_zeroderivative");
276 
277  if (c3 != "")
278  return getDefaultMaterialPropertyByName<U>(derivativePropertyNameThird(prop_name, c1, c2, c3));
279  if (c2 != "")
280  return getDefaultMaterialPropertyByName<U>(derivativePropertyNameSecond(prop_name, c1, c2));
281  return getDefaultMaterialPropertyByName<U>(derivativePropertyNameFirst(prop_name, c1));
282 }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3) const
Helper functions to generate the material property names for the third derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const VariableName &c1) const
Helper functions to generate the material property names for the first derivatives.

◆ getMaterialPropertyDerivativeByName() [1/2]

template<class T >
template<typename U >
const MaterialProperty< U > & DerivativeMaterialInterface< T >::getMaterialPropertyDerivativeByName ( const MaterialPropertyName &  base,
const std::vector< VariableName > &  c 
)

Methods for retreiving 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 287 of file DerivativeMaterialInterface.h.

289 {
290  return getDefaultMaterialPropertyByName<U>(derivativePropertyName(base, c));
291 }
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< VariableName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.

◆ getMaterialPropertyDerivativeByName() [2/2]

template<class T >
template<typename U >
const MaterialProperty< U > & DerivativeMaterialInterface< T >::getMaterialPropertyDerivativeByName ( const MaterialPropertyName &  base,
const VariableName &  c1,
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)

Definition at line 296 of file DerivativeMaterialInterface.h.

301 {
302  if (c3 != "")
303  return getDefaultMaterialPropertyByName<U>(derivativePropertyNameThird(base, c1, c2, c3));
304  if (c2 != "")
305  return getDefaultMaterialPropertyByName<U>(derivativePropertyNameSecond(base, c1, c2));
306  return getDefaultMaterialPropertyByName<U>(derivativePropertyNameFirst(base, c1));
307 }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2) const
Helper functions to generate the material property names for the second derivatives.
const MaterialPropertyName derivativePropertyNameThird(const MaterialPropertyName &base, const VariableName &c1, const VariableName &c2, const VariableName &c3) const
Helper functions to generate the material property names for the third derivatives.
const MaterialPropertyName derivativePropertyNameFirst(const MaterialPropertyName &base, const VariableName &c1) const
Helper functions to generate the material property names for the first derivatives.

◆ haveMaterialProperty()

template<class T >
template<typename U >
bool DerivativeMaterialInterface< T >::haveMaterialProperty ( const std::string &  prop_name)
private

Check if a material property is present with the applicable restrictions.

Definition at line 175 of file DerivativeMaterialInterface.h.

176 {
177  // Call the correct method to test for material property declarations
178  BlockRestrictable * blk = dynamic_cast<BlockRestrictable *>(this);
179  BoundaryRestrictable * bnd = dynamic_cast<BoundaryRestrictable *>(this);
180  return ((bnd && bnd->boundaryRestricted() &&
181  bnd->template hasBoundaryMaterialProperty<U>(prop_name)) ||
182  (blk && blk->template hasBlockMaterialProperty<U>(prop_name)) ||
183  (this->template hasMaterialProperty<U>(prop_name)));
184 }
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.

◆ isNotObjectVariable()

template<class T >
bool DerivativeMaterialInterface< T >::isNotObjectVariable ( const VariableName &  name)
inlineprivate

Definition at line 445 of file DerivativeMaterialInterface.h.

446 {
447  // try to cast this to a Kernel pointer
448  KernelBase * kernel_ptr = dynamic_cast<KernelBase *>(this);
449  if (kernel_ptr != nullptr)
450  return kernel_ptr->variable().name() != name;
451 
452  // try to cast this to a BoundaryCondition pointer
453  BoundaryCondition * bc_ptr = dynamic_cast<BoundaryCondition *>(this);
454  if (bc_ptr != nullptr)
455  return bc_ptr->variable().name() != name;
456 
457  // This interface is not templated on a class derived from either Kernel or BC
458  return true;
459 }
virtual MooseVariableFEBase & variable()=0
Returns the variable number that this Kernel operates on.
virtual MooseVariableFEBase & variable()=0
Get a reference to the MooseVariableFE.
This is the common base class for the two main kernel types implemented in MOOSE, EigenKernel and Ker...
Definition: KernelBase.h:45
Base class for creating new types of boundary conditions.
const std::string & name() const
Get the variable name.

◆ propertyName()

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

aliases for the deprecated old function names

Definition at line 51 of file DerivativeMaterialPropertyNameInterface.h.

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

◆ propertyNameFirst()

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

Definition at line 57 of file DerivativeMaterialPropertyNameInterface.h.

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

◆ propertyNameSecond()

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

Definition at line 63 of file DerivativeMaterialPropertyNameInterface.h.

66  {
67  mooseDeprecated("This function was renamed to 'derivativePropertyNameSecond'");
68  return derivativePropertyNameSecond(base, c1, c2);
69  }
const MaterialPropertyName derivativePropertyNameSecond(const MaterialPropertyName &base, const VariableName &c1, const VariableName &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:237

◆ propertyNameThird()

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

Definition at line 70 of file DerivativeMaterialPropertyNameInterface.h.

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

◆ validateCoupling() [1/2]

template<class T >
template<typename U >
void DerivativeMaterialInterface< T >::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

Definition at line 352 of file DerivativeMaterialInterface.h.

355 {
356  // get the base property name
357  std::string prop_name = this->deducePropertyName(base);
358  // list of potentially missing coupled variables
359  std::vector<VariableName> missing;
360 
361  // iterate over all variables in the both the non-linear and auxiliary system (optional)
362  validateCouplingHelper<U>(
363  prop_name, c, _dmi_fe_problem.getNonlinearSystemBase().system(), missing);
364  if (validate_aux)
365  validateCouplingHelper<U>(prop_name, c, _dmi_fe_problem.getAuxiliarySystem().system(), missing);
366 
367  if (missing.size() > 0)
368  {
369  // join list of missing variable names
370  std::string list = missing[0];
371  for (unsigned int i = 1; i < missing.size(); ++i)
372  list += ", " + missing[i];
373 
374  mooseWarning("Missing coupled variables {",
375  list,
376  "} (add them to args parameter of ",
377  this->name(),
378  ")");
379  }
380 }
NonlinearSystemBase & getNonlinearSystemBase()
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:220
FEProblemBase & _dmi_fe_problem
Reference to FEProblemBase.
AuxiliarySystem & getAuxiliarySystem()
virtual System & system() override
Get the reference to the libMesh system.
virtual System & system() override
Get the reference to the libMesh system.

◆ validateCoupling() [2/2]

template<class T >
template<typename U >
void DerivativeMaterialInterface< T >::validateCoupling ( const MaterialPropertyName &  base,
const VariableName &  c1 = "",
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)

Definition at line 405 of file DerivativeMaterialInterface.h.

409 {
410  validateCoupling<U>(base, buildVariableVector(c1, c2, c3), true);
411 }
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 != "") ...

◆ validateCouplingHelper()

template<class T >
template<typename U >
void DerivativeMaterialInterface< T >::validateCouplingHelper ( const MaterialPropertyName &  base,
const std::vector< VariableName > &  c,
const System &  system,
std::vector< VariableName > &  missing 
)
private

helper method to compile list of missing coupled variables for a given system

Definition at line 312 of file DerivativeMaterialInterface.h.

316 {
317  unsigned int ncoupled = this->_coupled_moose_vars.size();
318 
319  // iterate over all variables in the current system (in groups)
320  for (unsigned int i = 0; i < system.n_variable_groups(); ++i)
321  {
322  const VariableGroup & vg = system.variable_group(i);
323  for (unsigned int j = 0; j < vg.n_variables(); ++j)
324  {
325  std::vector<VariableName> cj(c);
326  VariableName jname = vg.name(j);
327  cj.push_back(jname);
328 
329  // if the derivative exists make sure the variable is coupled
330  if (haveMaterialProperty<U>(derivativePropertyName(base, cj)))
331  {
332  // kernels and BCs to not have the variable they are acting on in coupled_moose_vars
333  bool is_missing = isNotObjectVariable(jname);
334 
335  for (unsigned int k = 0; k < ncoupled; ++k)
336  if (this->_coupled_moose_vars[k]->name() == jname)
337  {
338  is_missing = false;
339  break;
340  }
341 
342  if (is_missing)
343  missing.push_back(jname);
344  }
345  }
346  }
347 }
nl system()
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< VariableName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.
bool isNotObjectVariable(const VariableName &name)

◆ validateDerivativeMaterialPropertyBase()

template<class T >
template<typename U >
void DerivativeMaterialInterface< T >::validateDerivativeMaterialPropertyBase ( const std::string &  base)

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 427 of file DerivativeMaterialInterface.h.

428 {
429  // resolve the input parameter name base to the actual material property name
430  const MaterialPropertyName prop_name = this->template getParam<MaterialPropertyName>(base);
431 
432  // check if the material property does not exist on the blocks of the current object,
433  // and check if it is not a plain number in the input file
434  if (!haveMaterialProperty<U>(prop_name) &&
435  this->template defaultMaterialProperty<U>(prop_name) == 0)
436  mooseWarning("The material property '",
437  prop_name,
438  "' does not exist. The kernel '",
439  this->name(),
440  "' only needs its derivatives, but this may indicate a typo in the input file.");
441 }
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:220

◆ validateNonlinearCoupling()

template<class T >
template<typename U >
void DerivativeMaterialInterface< T >::validateNonlinearCoupling ( const MaterialPropertyName &  base,
const VariableName &  c1 = "",
const VariableName &  c2 = "",
const VariableName &  c3 = "" 
)

Definition at line 416 of file DerivativeMaterialInterface.h.

420 {
421  validateCoupling<U>(base, buildVariableVector(c1, c2, c3), false);
422 }
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 != "") ...

Member Data Documentation

◆ _dmi_fe_problem

template<class T>
FEProblemBase& DerivativeMaterialInterface< T >::_dmi_fe_problem
private

Reference to FEProblemBase.

Definition at line 152 of file DerivativeMaterialInterface.h.


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