43 template <
typename U,
bool is_ad = false>
47 template <
typename U,
bool is_ad = false>
58 template <
typename U,
bool is_ad = false>
62 template <
typename U,
bool is_ad = false>
64 const std::vector<SymbolName> & c);
66 template <
typename U,
bool is_ad = false>
80 template <
typename U,
bool is_ad = false>
84 template <
typename U,
bool is_ad = false>
88 template <
typename U,
bool is_ad = false>
101 template <
typename U,
bool is_ad = false>
108 template <
typename U,
bool is_ad = false>
123 template <
typename U,
bool is_ad = false>
126 const std::vector<VariableName> & c);
128 template <
typename U,
bool is_ad = false>
131 const std::vector<SymbolName> & c);
133 template <
typename U,
bool is_ad = false>
141#ifdef MOOSE_KOKKOS_SCOPE
153 template <
typename U,
unsigned int dimension = 0>
157 template <
typename U,
unsigned int dimension = 0>
161 return getKokkosMaterialPropertyDerivative<U, dimension>(base, std::vector<SymbolName>{c1});
164 template <
typename U,
unsigned int dimension = 0>
167 const std::vector<SymbolName> & c);
178 template <
typename U,
unsigned int dimension = 0>
182 return this->
template declareKokkosPropertyByName<U, dimension>(
192 template <
typename U,
bool is_ad = false>
194 const std::vector<VariableName> & c,
195 bool validate_aux =
true);
197 template <
typename U,
bool is_ad = false>
199 const VariableName & c1 =
"",
200 const VariableName & c2 =
"",
201 const VariableName & c3 =
"");
203 template <
typename U,
bool is_ad = false>
205 const VariableName & c1 =
"",
206 const VariableName & c2 =
"",
207 const VariableName & c3 =
"");
216 template <
typename U,
bool is_ad = false>
221 template <
typename U,
bool is_ad = false>
225 std::vector<VariableName>
229 template <
typename U,
bool is_ad = false>
231 const std::vector<VariableName> & c,
232 const System & system,
233 std::vector<VariableName> & missing);
246 _dmi_fe_problem(*parameters.getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base"))
251template <
typename U,
bool is_ad>
255 return ((this->boundaryRestricted() &&
256 this->
template hasBoundaryMaterialProperty<U, is_ad>(prop_name)) ||
257 (this->
template hasBlockMaterialProperty<U, is_ad>(prop_name)));
261template <
typename U,
bool is_ad>
269 bnd->template hasBoundaryMaterialProperty<U, is_ad>(prop_name)) ||
270 (blk && blk->template hasBlockMaterialProperty<U, is_ad>(prop_name)) ||
271 (this->
template hasGenericMaterialProperty<U, is_ad>(prop_name)));
275template <
typename U,
bool is_ad>
280 std::string prop_name = this->getMaterialPropertyName(name);
283 const auto * default_property =
284 this->
template defaultGenericMaterialProperty<U, is_ad>(prop_name);
285 if (default_property)
286 return *default_property;
289 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(prop_name);
293template <
typename U,
bool is_ad>
298 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(prop_name);
302template <
typename U,
bool is_ad>
305 const std::vector<VariableName> & c)
307 std::vector<SymbolName> symbol_vector(c.begin(), c.end());
308 return declarePropertyDerivative<U, is_ad>(base, symbol_vector);
312template <
typename U,
bool is_ad>
315 const std::vector<SymbolName> & c)
317 return this->
template declareGenericProperty<U, is_ad>(derivativePropertyName(base, c));
321template <
typename U,
bool is_ad>
329 return this->
template declareGenericProperty<U, is_ad>(
330 derivativePropertyNameThird(base, c1, c2, c3));
332 return this->
template declareGenericProperty<U, is_ad>(
333 derivativePropertyNameSecond(base, c1, c2));
334 return this->
template declareGenericProperty<U, is_ad>(derivativePropertyNameFirst(base, c1));
338template <
typename U,
bool is_ad>
341 const std::vector<VariableName> & c)
343 std::vector<SymbolName> symbol_vector(c.begin(), c.end());
344 return getMaterialPropertyDerivative(base, symbol_vector);
348template <
typename U,
bool is_ad>
351 const std::vector<SymbolName> & c)
354 std::string prop_name = this->getMaterialPropertyName(base);
360 if (this->
template defaultGenericMaterialProperty<U, is_ad>(prop_name))
361 return this->
template getGenericZeroMaterialProperty<U, is_ad>();
363 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
364 derivativePropertyName(prop_name, c));
368template <
typename U,
bool is_ad>
376 std::string prop_name = this->getMaterialPropertyName(base);
382 if (this->
template defaultGenericMaterialProperty<Real, is_ad>(prop_name))
383 return this->
template getGenericZeroMaterialProperty<U, is_ad>();
386 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
387 derivativePropertyNameThird(prop_name, c1, c2, c3));
389 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
390 derivativePropertyNameSecond(prop_name, c1, c2));
391 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
392 derivativePropertyNameFirst(prop_name, c1));
396template <
typename U,
bool is_ad>
403 return getMaterialPropertyDerivative<U, is_ad>(
406 this->_coupled_standard_moose_vars[v2]->name(),
411template <
typename U,
bool is_ad>
418 return getMaterialPropertyDerivative<U, is_ad>(
420 this->_coupled_standard_moose_vars[v1]->name(),
426template <
typename U,
bool is_ad>
429 const MaterialPropertyName & base,
const std::vector<VariableName> & c)
431 std::vector<SymbolName> symbol_vector(c.begin(), c.end());
432 return getMaterialPropertyDerivativeByName(base, symbol_vector);
436template <
typename U,
bool is_ad>
439 const MaterialPropertyName & base,
const std::vector<SymbolName> & c)
441 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
442 derivativePropertyName(base, c));
445#ifdef MOOSE_KOKKOS_SCOPE
447template <
typename U,
unsigned int dimension>
450 const std::string & base,
const std::vector<SymbolName> & c)
452 const auto prop_name = this->getMaterialPropertyName(base);
458 return getKokkosMaterialPropertyDerivativeByName<U, dimension>(prop_name, c);
462template <
typename U,
unsigned int dimension>
465 const MaterialPropertyName & base,
const std::vector<SymbolName> & c)
467 const auto prop_name = derivativePropertyName(base, c);
469 if (!this->
template hasKokkosMaterialPropertyByName<U, dimension>(prop_name))
472 return this->
template getKokkosMaterialPropertyByName<U, dimension>(prop_name);
477template <
typename U,
bool is_ad>
480 const MaterialPropertyName & base,
486 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
487 derivativePropertyNameThird(base, c1, c2, c3));
489 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
490 derivativePropertyNameSecond(base, c1, c2));
491 return this->
template getGenericZeroMaterialPropertyByName<U, is_ad>(
492 derivativePropertyNameFirst(base, c1));
496template <
typename U,
bool is_ad>
499 const std::vector<VariableName> & c,
500 const System & system,
501 std::vector<VariableName> & missing)
503 unsigned int ncoupled = this->_coupled_standard_moose_vars.size();
506 for (
unsigned int i = 0; i < system.n_variable_groups(); ++i)
509 for (
unsigned int j = 0; j < vg.
n_variables(); ++j)
511 std::vector<SymbolName> cj(c.begin(), c.end());
516 if (haveMaterialProperty<U, is_ad>(derivativePropertyName(base, cj)))
519 bool is_missing = isNotObjectVariable(jname);
521 for (
unsigned int k = 0; k < ncoupled; ++k)
522 if (this->_coupled_standard_moose_vars[k]->name() == jname)
529 missing.push_back(jname);
536template <
typename U,
bool is_ad>
539 const std::vector<VariableName> & c,
543 std::string prop_name = this->getMaterialPropertyName(base);
545 std::vector<VariableName> missing;
548 validateCouplingHelper<U, is_ad>(
549 prop_name, c, _dmi_fe_problem.getNonlinearSystemBase(0).system(), missing);
551 validateCouplingHelper<U, is_ad>(
552 prop_name, c, _dmi_fe_problem.getAuxiliarySystem().system(), missing);
554 if (missing.size() > 0)
557 std::string list = missing[0];
558 for (
unsigned int i = 1; i < missing.size(); ++i)
559 list +=
", " + missing[i];
563 "} (add them to coupled_variables parameter of ",
570std::vector<VariableName>
572 const VariableName & c2,
573 const VariableName & c3)
575 std::vector<VariableName> c;
590template <
typename U,
bool is_ad>
593 const VariableName & c1,
594 const VariableName & c2,
595 const VariableName & c3)
597 validateCoupling<U, is_ad>(base, buildVariableVector(c1, c2, c3),
true);
601template <
typename U,
bool is_ad>
604 const VariableName & c1,
605 const VariableName & c2,
606 const VariableName & c3)
608 validateCoupling<U, is_ad>(base, buildVariableVector(c1, c2, c3),
false);
612template <
typename U,
bool is_ad>
617 const MaterialPropertyName prop_name = this->
template getParam<MaterialPropertyName>(base);
621 if (!haveMaterialProperty<U, is_ad>(prop_name) &&
622 this->
template defaultGenericMaterialProperty<U, is_ad>(prop_name) == 0)
625 "' does not exist. The kernel '",
627 "' only needs its derivatives, but this may indicate a typo in the input file.");
636 if (kernel_ptr !=
nullptr)
641 if (bc_ptr !=
nullptr)
typename GenericMaterialPropertyStruct< T, is_ad >::type GenericMaterialProperty
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
An interface that restricts an object to subdomains via the 'blocks' input parameter.
Base class for creating new types of boundary conditions.
/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.
Interface class ("Veneer") to provide generator methods for derivative material property names.
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative(const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
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 != "")
DerivativeMaterialPropertyNameInterface::SymbolName SymbolName
void validateCoupling(const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative(const std::string &base, const std::vector< SymbolName > &c)
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
FEProblemBase & _dmi_fe_problem
Reference to FEProblemBase.
Moose::Kokkos::MaterialProperty< U, dimension > declareKokkosPropertyDerivative(const std::string &base, const std::vector< SymbolName > &c)
Declare a derivative Kokkos material property.
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const std::vector< SymbolName > &c)
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialPropertyByName(const std::string &name)
Fetch a material property by name if it exists, otherwise return getZeroMaterialProperty.
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 ...
Moose::Kokkos::MaterialProperty< U, dimension > getKokkosMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const std::vector< SymbolName > &c)
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)
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative(const std::string &base, const SymbolName &c1, const SymbolName &c2="", const SymbolName &c3="")
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivativeByName(const MaterialPropertyName &base, const std::vector< VariableName > &c)
Methods for retrieving derivative material properties.
DerivativeMaterialInterface(const InputParameters ¶meters)
void validateNonlinearCoupling(const MaterialPropertyName &base, const VariableName &c1="", const VariableName &c2="", const VariableName &c3="")
bool haveMaterialProperty(const std::string &prop_name)
Check if a material property is present with the applicable restrictions.
Moose::Kokkos::MaterialProperty< U, dimension > getKokkosMaterialPropertyDerivative(const std::string &base, const std::vector< SymbolName > &c)
Methods for retrieving derivative Kokkos material properties.
bool isNotObjectVariable(const VariableName &name)
const GenericMaterialProperty< U, is_ad > & getMaterialPropertyDerivative(const std::string &base, const std::vector< VariableName > &c)
Methods for retrieving derivative material properties.
Moose::Kokkos::MaterialProperty< U, dimension > getKokkosMaterialPropertyDerivative(const std::string &base, const SymbolName &c1)
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative(const std::string &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...
const GenericMaterialProperty< U, is_ad > & getDefaultMaterialProperty(const std::string &name)
Fetch a material property if it exists, otherwise return getZeroMaterialProperty.
void validateDerivativeMaterialPropertyBase(const std::string &base)
Check if the material property base exists.
GenericMaterialProperty< U, is_ad > & declarePropertyDerivative(const std::string &base, const std::vector< VariableName > &c)
Methods for declaring derivative material properties.
const MaterialPropertyName derivativePropertyName(const MaterialPropertyName &base, const std::vector< SymbolName > &c) const
Helper functions to generate the material property names for the arbitrary derivatives.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
This is the common base class for the three main kernel types implemented in MOOSE,...
const std::string & name() const
Get the name of the class.
The Kokkos material property class.
virtual const MooseVariableBase & variable() const =0
Returns the variable that this object operates on.
unsigned int n_variables() const
const std::string & name(unsigned int v) const
bool parsesToReal(const std::string &input, Real *parsed_real)
const unsigned int invalid_uint