https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
DerivativeKernelInterface< T > Class Template Reference

Interface class ("Veneer") to provide generator methods for derivative material property names, and guarded getMaterialPropertyPointer calls. More...

#include <DerivativeKernelInterface.h>

Inheritance diagram for DerivativeKernelInterface< T >:
[legend]

Public Types

typedef DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
 

Public Member Functions

 DerivativeKernelInterface (const InputParameters &parameters)
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty (const std::string &name)
 Fetch a material property if it exists, otherwise return getZeroMaterialProperty.
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName (const std::string &name)
 Fetch a material property by name if it exists, otherwise return getZeroMaterialProperty.
 
template<typename U , bool is_ad = false>
void validateDerivativeMaterialPropertyBase (const std::string &base)
 Check if the material property base exists.
 
const MaterialPropertyName derivativePropertyName (const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
 Helper functions to generate the material property names for the arbitrary 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 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 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.
 
template<typename U , bool is_ad = false>
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 Methods for declaring derivative material properties.
 
template<typename U , bool is_ad = false>
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
template<typename U , bool is_ad = false>
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< VariableName > &c)
 Methods for retrieving derivative material properties.
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const std::vector< SymbolName > &c)
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative (const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
template<typename U , bool is_ad = false>
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.
 
template<typename U , bool is_ad = false>
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)
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< VariableName > &c)
 Methods for retrieving derivative material properties.
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const std::vector< SymbolName > &c)
 
template<typename U , bool is_ad = false>
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName (const MaterialPropertyName &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
 
template<typename U , bool is_ad = false>
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
 
template<typename U , bool is_ad = false>
void validateCoupling (const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
 
template<typename U , bool is_ad = false>
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
 
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 ()
 as partial template specialization is not allowed in C++ we have to implement this as a static method
 

Protected Attributes

unsigned int _nvar
 
std::string _F_name
 

Private Member Functions

template<typename U , bool is_ad = false>
bool haveMaterialProperty (const std::string &prop_name)
 Check if a material property is present with the applicable restrictions.
 
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 != "")
 
template<typename U , bool is_ad = false>
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
 
bool isNotObjectVariable (const VariableName &name)
 

Private Attributes

FEProblemBase_dmi_fe_problem
 Reference to FEProblemBase.
 

Detailed Description

template<class T>
class DerivativeKernelInterface< T >

Interface class ("Veneer") to provide generator methods for derivative material property names, and guarded getMaterialPropertyPointer calls.

Definition at line 19 of file DerivativeKernelInterface.h.

Member Typedef Documentation

◆ SymbolName

template<class T >
typedef DerivativeMaterialPropertyNameInterface::SymbolName DerivativeMaterialInterface< T >::SymbolName
inherited

Definition at line 35 of file DerivativeMaterialInterface.h.

Constructor & Destructor Documentation

◆ DerivativeKernelInterface()

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

Definition at line 33 of file DerivativeKernelInterface.h.

35 _nvar(this->_coupled_moose_vars.size()),
36 _F_name(this->template getRenamedParam<std::string>("f_name", "property_name"))
37{
38}
Interface class ("Veneer") to provide generator methods for derivative material property names.

Member Function Documentation

◆ buildVariableVector()

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

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

Definition at line 494 of file DerivativeMaterialInterface.h.

497{
498 std::vector<VariableName> c;
499 if (c1 != "")
500 {
501 c.push_back(c1);
502 if (c2 != "")
503 {
504 c.push_back(c2);
505 if (c3 != "")
506 c.push_back(c3);
507 }
508 }
509 return c;
510}

◆ declarePropertyDerivative() [1/3]

template<class T >
template<typename U , bool is_ad>
GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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() [2/3]

template<class T >
template<typename U , bool is_ad>
GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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() [3/3]

template<class T >
template<typename U , bool is_ad>
GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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 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.
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.

◆ 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.

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)

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

◆ 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.

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

Referenced by DerivativeMaterialPropertyNameInterface::propertyNameFirst(), NEML2Action::setupDerivativeMappings(), and NEML2Action::setupParameterDerivativeMappings().

◆ 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.

65{
66 return derivativePropertyName(base, {c1, c2});
67}

Referenced by DerivativeMaterialPropertyNameInterface::propertyNameSecond().

◆ 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.

75{
76 return derivativePropertyName(base, {c1, c2, c3});
77}

Referenced by DerivativeMaterialPropertyNameInterface::propertyNameThird().

◆ getDefaultMaterialProperty()

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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()

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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}

◆ getMaterialPropertyDerivative() [1/5]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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}

◆ getMaterialPropertyDerivative() [2/5]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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() [3/5]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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}

◆ getMaterialPropertyDerivative() [4/5]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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}
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...

◆ getMaterialPropertyDerivativeByName() [1/3]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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}

◆ getMaterialPropertyDerivativeByName() [2/3]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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() [3/3]

template<class T >
template<typename U , bool is_ad>
const GenericMaterialProperty< U, is_ad > & DerivativeMaterialInterface< T >::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>(
416}

◆ haveMaterialProperty()

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

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

Definition at line 217 of file DerivativeMaterialInterface.h.

218{
219 // Call the correct method to test for material property declarations
220 BlockRestrictable * blk = dynamic_cast<BlockRestrictable *>(this);
221 BoundaryRestrictable * bnd = dynamic_cast<BoundaryRestrictable *>(this);
222 return ((bnd && bnd->boundaryRestricted() &&
223 bnd->template hasBoundaryMaterialProperty<U, is_ad>(prop_name)) ||
224 (blk && blk->template hasBlockMaterialProperty<U, is_ad>(prop_name)) ||
225 (this->template hasGenericMaterialProperty<U, is_ad>(prop_name)));
226}
An interface that restricts an object to subdomains via the 'blocks' input parameter.
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
virtual bool boundaryRestricted() const
Returns true if this object has been restricted to a boundary.

◆ isNotObjectVariable()

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

Definition at line 555 of file DerivativeMaterialInterface.h.

556{
557 // try to cast this to a Kernel pointer
558 KernelBase * kernel_ptr = dynamic_cast<KernelBase *>(this);
559 if (kernel_ptr != nullptr)
560 return kernel_ptr->variable().name() != name;
561
562 // try to cast this to a BoundaryCondition pointer
563 BoundaryCondition * bc_ptr = dynamic_cast<BoundaryCondition *>(this);
564 if (bc_ptr != nullptr)
565 return bc_ptr->variable().name() != name;
566
567 // This interface is not templated on a class derived from either Kernel or BC
568 return true;
569}
Base class for creating new types of boundary conditions.
This is the common base class for the three main kernel types implemented in MOOSE,...
Definition KernelBase.h:29
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
virtual const MooseVariableBase & variable() const =0
Returns the variable that this object operates on.

◆ 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 }
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition MooseError.h:363

◆ 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 }

◆ 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 }

◆ 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 }

◆ validateCoupling() [1/2]

template<class T >
template<typename U , bool is_ad>
void DerivativeMaterialInterface< T >::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}
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition MooseError.h:345
virtual libMesh::System & system() override
Get the reference to the libMesh system.
FEProblemBase & _dmi_fe_problem
Reference to FEProblemBase.
AuxiliarySystem & getAuxiliarySystem()
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ validateCoupling() [2/2]

template<class T >
template<typename U , bool is_ad>
void DerivativeMaterialInterface< T >::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 != "")

◆ validateCouplingHelper()

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

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

Definition at line 421 of file DerivativeMaterialInterface.h.

425{
426 unsigned int ncoupled = this->_coupled_standard_moose_vars.size();
427
428 // iterate over all variables in the current system (in groups)
429 for (unsigned int i = 0; i < system.n_variable_groups(); ++i)
430 {
431 const libMesh::VariableGroup & vg = system.variable_group(i);
432 for (unsigned int j = 0; j < vg.n_variables(); ++j)
433 {
434 std::vector<SymbolName> cj(c.begin(), c.end());
435 SymbolName jname = vg.name(j);
436 cj.push_back(jname);
437
438 // if the derivative exists make sure the variable is coupled
439 if (haveMaterialProperty<U, is_ad>(derivativePropertyName(base, cj)))
440 {
441 // kernels and BCs to not have the variable they are acting on in coupled_moose_vars
442 bool is_missing = isNotObjectVariable(jname);
443
444 for (unsigned int k = 0; k < ncoupled; ++k)
445 if (this->_coupled_standard_moose_vars[k]->name() == jname)
446 {
447 is_missing = false;
448 break;
449 }
450
451 if (is_missing)
452 missing.push_back(jname);
453 }
454 }
455 }
456}
DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
bool isNotObjectVariable(const VariableName &name)
unsigned int n_variables() const
const std::string & name(unsigned int v) const

◆ validateDerivativeMaterialPropertyBase()

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

◆ validateNonlinearCoupling()

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

◆ validParams()

template<class T >
InputParameters DerivativeKernelInterface< T >::validParams ( )
static

as partial template specialization is not allowed in C++ we have to implement this as a static method

Definition at line 42 of file DerivativeKernelInterface.h.

43{
44 InputParameters params = T::validParams();
45 params.addDeprecatedParam<std::string>(
46 "f_name",
47 "Base name of the free energy function F defined in a DerivativeParsedMaterial",
48 "Deprecated, use property_name");
49 // TODO Make required once deprecation is handled, see #20535
50 params.addParam<std::string>(
51 "property_name", "Base name of the material property defined in a DerivativeParsedMaterial");
52 return params;
53}
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)

Member Data Documentation

◆ _dmi_fe_problem

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

Reference to FEProblemBase.

Definition at line 194 of file DerivativeMaterialInterface.h.

◆ _F_name

template<class T >
std::string DerivativeKernelInterface< T >::_F_name
protected

Definition at line 29 of file DerivativeKernelInterface.h.

◆ _nvar

template<class T >
unsigned int DerivativeKernelInterface< T >::_nvar
protected

Definition at line 28 of file DerivativeKernelInterface.h.


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