Go to the documentation of this file.
17 #include "libmesh/quadrature.h"
31 params.
addParam<
bool>(
"use_displaced_mesh",
33 "Whether or not this object should use the "
34 "displaced mesh for computation. Note that "
35 "in the case this is true but no "
36 "displacements are provided in the Mesh block "
37 "the undisplaced mesh will still be used.");
40 "When false, MOOSE will not call compute methods on this material. "
41 "The user must call computeProperties() after retrieving the MaterialBase "
42 "via MaterialBasePropertyInterface::getMaterialBase(). "
43 "Non-computed MaterialBases are not sorted for dependencies.");
50 params.set<std::vector<OutputName>>(
"outputs") = {
"none"};
51 params.addParam<std::vector<std::string>>(
53 "List of material properties, from this material, to output (outputs "
54 "must also be defined to an output type)");
56 params.addParamNamesToGroup(
"outputs output_properties",
"Outputs");
57 params.addParamNamesToGroup(
"use_displaced_mesh",
"Advanced");
58 params.registerBase(
"MaterialBase");
83 *parameters.getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base"),
87 _subproblem(*getCheckedPointerParam<
SubProblem *>(
"_subproblem")),
88 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
90 _assembly(_subproblem.assembly(_tid)),
91 _qp(
std::numeric_limits<unsigned int>::max()),
92 _coord(_assembly.coordTransformation()),
93 _normals(_assembly.normals()),
94 _mesh(_subproblem.mesh()),
95 _coord_sys(_assembly.coordSystem()),
96 _compute(getParam<bool>(
"compute")),
97 _has_stateful_property(false)
112 if (
materialData().getMaterialPropertyStorage().isStatefulProp(prop) &&
115 "\" provides one or more stateful "
116 "properties but initQpStatefulProperties() "
117 "was not overridden in the derived class.");
130 if (static_cast<int>(it.second) % 2 == 0)
131 mooseError(
"Material '",
name(),
"' requests undefined stateful property '", it.first,
"'");
151 if (static_cast<int>(state) % 2 == 0)
156 for (
const auto & block_id :
blockIDs())
167 const std::vector<OutputName> & out = getParam<std::vector<OutputName>>(
"outputs");
168 return std::set<OutputName>(out.begin(), out.end());
174 mooseError(
"MaterialBase::computeSubdomainQpProperties in Material '",
176 "' needs to be implemented");
182 mooseError(
"MaterialBase::subdomainSetup in Material'",
name(),
"' needs to be implemented");
188 mooseError(
"MaterialBase::computeProperties in Material '",
name(),
"' needs to be implemented");
207 mooseDoOnce(
mooseWarning(
"You disabled the computation of this (",
209 ") material by MOOSE, but have not overridden the 'resetQpProperties' "
210 "method, this can lead to unintended values being set for material "
211 "property values."));
225 mooseError(
"Material properties must be retrieved during material object construction to "
226 "ensure correct dependency resolution.");
238 props[prop_id]->copyDualNumberToValue(
_qp);
unsigned int getPropertyId(const std::string &prop_name) const
Wrapper for MaterialStorage::getPropertyId.
static InputParameters validParams()
void checkExecutionStage()
Check and throw an error if the execution has progerssed past the construction stage.
MaterialBase(const InputParameters ¶meters)
void mooseError(Args &&... args) const
virtual void initStatefulProperties(unsigned int n_points)
Initialize stateful properties (if material has some)
Container for storing material properties.
static InputParameters validParams()
virtual const bool & currentlyComputingJacobian() const
Returns true if the problem is in the process of computing Jacobian.
const bool _compute
If False MOOSE does not compute this property.
const virtual std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object.
void usingADMatProps(bool using_ad_mat_props)
Set the global automatic differentiaion (AD) flag which indicates whether any consumer has requested ...
static InputParameters validParams()
std::set< unsigned int > _supplied_ad_prop_ids
Interface for objects that need to use functions.
Interface for objects that need to use UserObjects.
virtual const QBase & qRule() const =0
void registerPropName(std::string prop_name, bool is_get, Prop_State state, bool is_declared_ad=false)
Small helper function to call store{Subdomain,Boundary}MatPropName.
virtual void computePropertiesAtQp(unsigned int qp)
A method for (re)computing the properties of a MaterialBase.
bool _overrides_init_stateful_props
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
std::set< unsigned int > _supplied_regular_prop_ids
virtual void computeSubdomainProperties()
Evaluate material properties on subdomain.
static InputParameters validParams()
virtual void computeProperties()=0
Performs the quadrature point loop, calling computeQpProperties.
A class to provide an common interface to objects requiring "outputs" option.
const virtual std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
Every object that can be built by the factory should be derived from this class.
virtual const MaterialData & materialData() const =0
virtual void computeQpProperties()
Users must override this method.
virtual void resetProperties()
Resets the properties at each quadrature point (see resetQpProperties), only called if 'compute = fal...
static InputParameters validParams()
Generic class for solving transient nonlinear problems.
Interface for objects that need to use distributions.
MaterialBases compute MaterialProperties.
void copyDualNumbersToValues()
std::map< std::string, int > _props_to_flags
Interface for objects that needs scalar coupling capabilities.
Interface class for classes which interact with Postprocessors.
bool _has_stateful_property
std::set< OutputName > getOutputs()
Get the list of output objects that this class is restricted.
A class for creating restricted objects.
Interface for objects that needs transient capabilities.
virtual void storeSubdomainMatPropName(SubdomainID block_id, const std::string &name)
Adds the given material property to a storage map based on block ids.
MaterialProperties & props()
Methods for retrieving MaterialProperties object.
Interface for notifications that the mesh has changed.
virtual void initQpStatefulProperties()
Initialize stateful properties at quadrature points.
virtual void storeBoundaryMatPropName(BoundaryID boundary_id, const std::string &name)
Adds the given material property to a storage map based on boundary ids.
virtual void resetQpProperties()
Resets the properties prior to calculation of traditional materials (only if 'compute = false').
FEProblemBase & _fe_problem
defineLegacyParams(MaterialBase)
An interface that restricts an object to subdomains via the 'blocks' input parameter.
static InputParameters validParams()
std::set< std::string > _supplied_props
Set of properties declared.
void checkStatefulSanity() const
Interface for objects that need parallel consistent random numbers without patterns over the course o...
static InputParameters validParams()
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual bool startedInitialSetup()
Returns true if we are in or beyond the initialSetup stage.
Interface for sorting dependent vectors of objects.
std::set< unsigned int > _supplied_prop_ids
The ids of the supplied properties, i.e.
void mooseWarning(Args &&... args) const
virtual void subdomainSetup() override
Subdomain setup evaluating material properties when required.
virtual const std::string & name() const
Get the name of the object.