14#include "libmesh/quadrature.h"
23 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names");
25 "at_nodes",
false,
"Evaluate Material properties at nodes instead of quadpoints");
27 params.
addClassDescription(
"This generalises MOOSE's Material class to allow for Materials that "
28 "hold information related to the nodes in the finite element");
32 params.
set<
bool>(
"_force_stateful_init") =
true;
39 _nodal_material(getParam<bool>(
"at_nodes")),
41 _pressure_variable_name(
"pressure_variable"),
42 _saturation_variable_name(
"saturation_variable"),
43 _temperature_variable_name(
"temperature_variable"),
44 _mass_fraction_variable_name(
"mass_fraction_variable")
56 if (!storage.hasStatefulProperties())
60 for (
const auto i : index_range(stateful_prop_id_to_prop_id))
62 const auto prop_id = stateful_prop_id_to_prop_id[i];
98 if (numnodes < _qrule->n_points())
104 for (
unsigned int qp = numnodes; qp <
_qrule->n_points(); ++qp)
105 props[prop_id].qpCopy(qp, props[prop_id], numnodes - 1);
151 props[prop_id].resize(new_size);
153 for (
const auto state : storage.statefulIndexRange())
162 unsigned nearest_qp = 0;
163 Real smallest_dist = std::numeric_limits<Real>::max();
164 for (
const auto qp : make_range(
_qrule->n_points()))
167 if (this_dist < smallest_dist)
170 smallest_dist = this_dist;
virtual void computeQpProperties()
virtual void initStatefulProperties(const unsigned int n_points)
std::set< unsigned int > _supplied_prop_ids
void onlyResizeIfSmaller(bool flag)
const MaterialPropertyStorage & getMaterialPropertyStorage() const
const MaterialProperties & props(const unsigned int state=0) const
void resize(const std::size_t size, const WriteKey)
MaterialData & _material_data
const std::vector< unsigned int > & statefulProps() const
virtual void computeProperties() override
static InputParameters validParams()
const Elem *const & _current_elem
const QBase *const & _qrule
const MooseArray< Point > & _q_point
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
std::vector< unsigned int > _supplied_old_prop_ids
stateful material property ids that this material supplies
virtual void initStatefulProperties(unsigned int n_points) override
Correctly sizes nodal materials, then initialises using Material::initStatefulProperties.
static InputParameters validParams()
virtual void initialSetup() override
virtual void computeProperties() override
Correctly sizes nodal materials, then computes using Material::computeProperties.
unsigned nearestQP(unsigned nodenum) const
Find the nearest quadpoint to the node labelled by nodenum in the current element.
void computeNodalProperties()
Compute the material properties at each node, and if the number of nodes is less than the number of q...
void sizeNodalProperties()
Resizes properties to be equal to max(number of nodes, number of quadpoints) in the current element.
PorousFlowMaterial(const InputParameters ¶meters)
const bool _nodal_material
Whether the derived class holds nodal values.
bool hasValue(const std::size_t i) const