18 #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.");
55 params.set<std::vector<OutputName>>(
"outputs") = {
"none"};
56 params.addParam<std::vector<std::string>>(
59 "List of material properties, from this material, to output (outputs " 60 "must also be defined to an output type)");
61 params.addParam<MaterialPropertyName>(
64 "An optional suffix parameter that can be appended to any declared properties. The suffix " 65 "will be prepended with a '_' character.");
68 params.declareControllable(
"enable");
70 params.addParamNamesToGroup(
"outputs output_properties",
"Outputs");
71 params.addParamNamesToGroup(
"use_displaced_mesh",
"Advanced");
72 params.registerBase(
"MaterialBase");
96 *parameters.getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base"),
103 _subproblem(*getCheckedPointerParam<
SubProblem *>(
"_subproblem")),
104 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
106 _assembly(_subproblem.assembly(_tid, 0)),
107 _qp(
std::numeric_limits<unsigned
int>::
max()),
108 _coord(_assembly.coordTransformation()),
109 _normals(_assembly.normals()),
110 _mesh(_subproblem.
mesh()),
111 _coord_sys(_assembly.coordSystem()),
112 _compute(getParam<bool>(
"compute")),
113 _has_stateful_property(false),
114 _declare_suffix(getParam<MaterialPropertyName>(
"declare_suffix")),
115 _force_stateful_init(getParam<bool>(
"_force_stateful_init"))
130 if (
materialData().getMaterialPropertyStorage().getPropRecord(
id).stateful() &&
133 "\" provides one or more stateful " 134 "properties but initQpStatefulProperties() " 135 "was not overridden in the derived class.");
169 find_min_state->second =
std::min(find_min_state->second, state);
172 for (
const auto & block_id :
blockIDs())
189 if (needed_props.count(supplied_id))
196 const std::vector<OutputName> &
out = getParam<std::vector<OutputName>>(
"outputs");
197 return std::set<OutputName>(
out.begin(),
out.end());
203 mooseError(
"MaterialBase::subdomainSetup in Material'",
name(),
"' needs to be implemented");
209 mooseError(
"MaterialBase::computeProperties in Material '",
name(),
"' needs to be implemented");
228 mooseDoOnce(
mooseWarning(
"You disabled the computation of this (",
230 ") material by MOOSE, but have not overridden the 'resetQpProperties' " 231 "method, this can lead to unintended values being set for material " 232 "property values."));
246 mooseError(
"Material properties must be retrieved during material object construction to " 247 "ensure correct dependency resolution.");
Interface for objects that need parallel consistent random numbers without patterns over the course o...
FEProblemBase & _fe_problem
A class for creating restricted objects.
virtual void computeQpProperties()
Users must override this method.
MaterialBase(const InputParameters ¶meters)
virtual void storeSubdomainZeroMatProp(SubdomainID block_id, const MaterialPropertyName &name)
Adds to a map based on block ids of material properties for which a zero value can be returned...
static InputParameters validParams()
static InputParameters validParams()
bool _has_stateful_property
virtual void resetProperties()
Resets the properties at each quadrature point (see resetQpProperties), only called if 'compute = fal...
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
unsigned int getPropertyId(const std::string &prop_name) const
Wrapper for MaterialStorage::getPropertyId.
virtual void storeBoundaryZeroMatProp(BoundaryID boundary_id, const MaterialPropertyName &name)
Adds to a map based on boundary ids of material properties for which a zero value can be returned...
static InputParameters validParams()
A class to provide an common interface to objects requiring "outputs" option.
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
std::set< OutputName > getOutputs()
Get the list of output objects that this class is restricted.
virtual void initQpStatefulProperties()
Initialize stateful properties at quadrature points.
virtual void subdomainSetup() override
Subdomain setup evaluating material properties when required.
virtual const std::set< SubdomainID > & blockIDs() const
Return the block subdomain ids for this object Note, if this is not block restricted, this function returns all mesh subdomain ids.
static InputParameters validParams()
virtual const QBase & qRule() const =0
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const std::string & name() const
Get the name of the class.
virtual void markMatPropRequested(const std::string &)
Helper method for adding a material property name to the _material_property_requested set...
virtual void computeProperties()=0
Performs the quadrature point loop, calling computeQpProperties.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
auto max(const L &left, const R &right)
void checkStatefulSanity() const
static InputParameters validParams()
An interface for accessing Moose::Functors for systems that care about automatic differentiation, e.g.
std::unordered_map< unsigned int, unsigned int > _props_to_min_states
The minimum states requested (0 = current, 1 = old, 2 = older) This is sparse and is used to keep tra...
virtual void resetQpProperties()
Resets the properties prior to calculation of traditional materials (only if 'compute = false')...
void storeBoundaryZeroMatProp(BoundaryID boundary_id, const MaterialPropertyName &name)
Adds to a map based on boundary ids of material properties for which a zero value can be returned...
An interface that allows the marking of invalid solutions during a solve.
Interface for objects that needs transient capabilities.
unsigned int getMaxQps() const
Interface for notifications that the mesh has changed.
const bool _compute
If False MOOSE does not compute this property.
Every object that can be built by the factory should be derived from this class.
void checkExecutionStage()
Check and throw an error if the execution has progressed past the construction stage.
boundary_id_type BoundaryID
static InputParameters validParams()
Interface for objects that need to use distributions.
virtual void storeBoundaryMatPropName(BoundaryID boundary_id, const std::string &name)
Adds the given material property to a storage map based on boundary ids.
std::unordered_set< unsigned int > _active_prop_ids
The ids of the current active supplied properties.
std::set< unsigned int > _supplied_prop_ids
The ids of the supplied properties, i.e.
Interface for objects that need to use UserObjects.
virtual void initStatefulProperties(unsigned int n_points)
Initialize stateful properties (if material has some)
static InputParameters validParams()
bool _overrides_init_stateful_props
void setActiveProperties(const std::unordered_set< unsigned int > &needed_props)
Set active properties of this material Note: This function is called by FEProblemBase::setActiveMater...
Generic class for solving transient nonlinear problems.
void markMatPropRequested(const std::string &name)
Helper method for adding a material property name to the material property requested set...
const std::string & getName(const unsigned int id) const
An interface that restricts an object to subdomains via the 'blocks' input parameter.
Interface for sorting dependent vectors of objects.
Interface for objects that needs scalar coupling capabilities.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
void registerPropName(const std::string &prop_name, bool is_get, const unsigned int state)
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.
std::set< std::string > _supplied_props
Set of properties declared.
static InputParameters validParams()
const MaterialPropertyRegistry & getMaterialPropertyRegistry() const
auto min(const L &left, const R &right)
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
virtual const MaterialData & materialData() const =0
void storeSubdomainZeroMatProp(SubdomainID block_id, const MaterialPropertyName &name)
Adds to a map based on block ids of material properties for which a zero value can be returned...
Interface for objects that need to use functions.
void ErrorVector unsigned int
virtual void storeSubdomainMatPropName(SubdomainID block_id, const std::string &name)
Adds the given material property to a storage map based on block ids.
Interface class for classes which interact with Postprocessors.
virtual bool startedInitialSetup()
Returns true if we are in or beyond the initialSetup stage.
unsigned int getMaxQps() const