www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PorousFlowMaterial Class Reference

PorousFlowMaterial is the base class for all PorousFlow Materials It allows users to specify that the Material should be a "nodal" Material, in which Material Properties will be evaluated at nodes (using the Variable's nodal values rather than their quadpoint values). More...

#include <PorousFlowMaterial.h>

Inheritance diagram for PorousFlowMaterial:
[legend]

Public Member Functions

 PorousFlowMaterial (const InputParameters &parameters)
 

Protected Member Functions

virtual void initStatefulProperties (unsigned int n_points) override
 Correctly sizes nodal materials, then initialises using Material::initStatefulProperties. More...
 
virtual void computeProperties () override
 Correctly sizes nodal materials, then computes using Material::computeProperties. More...
 
void sizeNodalProperty (const std::string &prop_name)
 Makes property with name prop_name to be size equal to max(number of nodes, number of quadpoints) in the current element. More...
 
void sizeAllSuppliedProperties ()
 Makes all supplied properties for this material to be size equal to max(number of nodes, number of quadpoints) in the current element. More...
 
unsigned nearestQP (unsigned nodenum) const
 Find the nearest quadpoint to the node labelled by nodenum in the current element. More...
 

Protected Attributes

const bool _nodal_material
 Whether the derived class holds nodal values. More...
 
const PorousFlowDictator_dictator
 The variable names UserObject for the PorousFlow variables. More...
 
const VariableName _pressure_variable_name
 Names of variables used to declare/get derivatives in the DerivativeMaterialInterface to ensure consistency. More...
 
const VariableName _saturation_variable_name
 
const VariableName _temperature_variable_name
 
const VariableName _mass_fraction_variable_name
 

Detailed Description

PorousFlowMaterial is the base class for all PorousFlow Materials It allows users to specify that the Material should be a "nodal" Material, in which Material Properties will be evaluated at nodes (using the Variable's nodal values rather than their quadpoint values).

In a derived class's computeQpProperties, _qp must be recognized as a label for a quadpoint (for ordinary Materials) or a node (for nodal Materials).

For the nodal Material case, the Material Properties are sized to max(number of nodes, number of quadpoints). Only "number of nodes" of these will ever be computed and used: the remaining ones (if any) exist just to make sure that the vectors are correctly sized in MOOSE's copying operations (etc).

If number of quadpoints < number of nodes (eg for boundary elements) care should be taken to store the required nodal information in the first number_of_quadpoint elements in the std::vector!

Definition at line 41 of file PorousFlowMaterial.h.

Constructor & Destructor Documentation

◆ PorousFlowMaterial()

PorousFlowMaterial::PorousFlowMaterial ( const InputParameters &  parameters)

Definition at line 29 of file PorousFlowMaterial.C.

30  : Material(parameters),
31  _nodal_material(getParam<bool>("at_nodes")),
32  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
33  _pressure_variable_name("pressure_variable"),
34  _saturation_variable_name("saturation_variable"),
35  _temperature_variable_name("temperature_variable"),
36  _mass_fraction_variable_name("mass_fraction_variable")
37 {
38 }
const VariableName _temperature_variable_name
const bool _nodal_material
Whether the derived class holds nodal values.
const VariableName _pressure_variable_name
Names of variables used to declare/get derivatives in the DerivativeMaterialInterface to ensure consi...
const VariableName _mass_fraction_variable_name
const VariableName _saturation_variable_name
const PorousFlowDictator & _dictator
The variable names UserObject for the PorousFlow variables.

Member Function Documentation

◆ computeProperties()

void PorousFlowMaterial::computeProperties ( )
overrideprotectedvirtual

Correctly sizes nodal materials, then computes using Material::computeProperties.

Definition at line 56 of file PorousFlowMaterial.C.

57 {
58  if (_nodal_material)
59  {
60  // size the Properties to max(number_of_nodes, number_of_quadpoints)
62 
63  // compute the values only for number_of_nodes
64  for (_qp = 0; _qp < _current_elem->n_nodes(); ++_qp)
65  computeQpProperties();
66  }
67  else
68  Material::computeProperties();
69 }
void sizeAllSuppliedProperties()
Makes all supplied properties for this material to be size equal to max(number of nodes...
const bool _nodal_material
Whether the derived class holds nodal values.

◆ initStatefulProperties()

void PorousFlowMaterial::initStatefulProperties ( unsigned int  n_points)
overrideprotectedvirtual

Correctly sizes nodal materials, then initialises using Material::initStatefulProperties.

Definition at line 41 of file PorousFlowMaterial.C.

42 {
43  if (_nodal_material)
44  {
45  // size the Properties to max(number_of_nodes, number_of_quadpoints)
47 
48  // compute the values only for number_of_nodes
49  Material::initStatefulProperties(_current_elem->n_nodes());
50  }
51  else
52  Material::initStatefulProperties(n_points);
53 }
void sizeAllSuppliedProperties()
Makes all supplied properties for this material to be size equal to max(number of nodes...
const bool _nodal_material
Whether the derived class holds nodal values.

◆ nearestQP()

unsigned PorousFlowMaterial::nearestQP ( unsigned  nodenum) const
protected

Find the nearest quadpoint to the node labelled by nodenum in the current element.

Parameters
nodenumthe node number in the current element
Returns
the nearest quadpoint

Definition at line 100 of file PorousFlowMaterial.C.

Referenced by PorousFlowNearestQp::computeQpProperties().

101 {
102  unsigned nearest_qp = 0;
103  Real smallest_dist = std::numeric_limits<Real>::max();
104  for (unsigned qp = 1; qp < _qrule->n_points(); ++qp)
105  {
106  const Real this_dist = (_current_elem->point(nodenum) - _q_point[qp]).size();
107  if (this_dist < smallest_dist)
108  {
109  nearest_qp = qp;
110  smallest_dist = this_dist;
111  }
112  }
113  return nearest_qp;
114 }

◆ sizeAllSuppliedProperties()

void PorousFlowMaterial::sizeAllSuppliedProperties ( )
protected

Makes all supplied properties for this material to be size equal to max(number of nodes, number of quadpoints) in the current element.

Definition at line 93 of file PorousFlowMaterial.C.

Referenced by computeProperties(), and initStatefulProperties().

94 {
95  for (auto prop_name : getSuppliedItems())
96  sizeNodalProperty(prop_name);
97 }
void sizeNodalProperty(const std::string &prop_name)
Makes property with name prop_name to be size equal to max(number of nodes, number of quadpoints) in ...

◆ sizeNodalProperty()

void PorousFlowMaterial::sizeNodalProperty ( const std::string &  prop_name)
protected

Makes property with name prop_name to be size equal to max(number of nodes, number of quadpoints) in the current element.

Definition at line 72 of file PorousFlowMaterial.C.

Referenced by sizeAllSuppliedProperties().

73 {
74  /*
75  * For nodal materials, the Properties should be sized as the maximum of
76  * the number of nodes and the number of quadpoints.
77  * We only actually need "number of nodes" pieces of information, which are
78  * computed by computeProperties(), so the n_points - _current_elem->n_nodes()
79  * elements at the end of the std::vector will always be zero, but they
80  * are needed because MOOSE does copy operations (etc) that assumes that
81  * the std::vector is sized to number of quadpoints.
82  */
83  mooseAssert(_material_data->getMaterialPropertyStorage().hasProperty(prop_name),
84 
85  "PorousFlowMaterial can not find nodal property " << prop_name);
86  const unsigned prop_id =
87  _material_data->getMaterialPropertyStorage().retrievePropertyId(prop_name);
88  // _material_data->props() returns MaterialProperties, which is a std::vector of PropertyValue.
89  _material_data->props()[prop_id]->resize(std::max(_current_elem->n_nodes(), _qrule->n_points()));
90 }

Member Data Documentation

◆ _dictator

const PorousFlowDictator& PorousFlowMaterial::_dictator
protected

The variable names UserObject for the PorousFlow variables.

Definition at line 77 of file PorousFlowMaterial.h.

◆ _mass_fraction_variable_name

const VariableName PorousFlowMaterial::_mass_fraction_variable_name
protected

Definition at line 84 of file PorousFlowMaterial.h.

◆ _nodal_material

const bool PorousFlowMaterial::_nodal_material
protected

Whether the derived class holds nodal values.

Definition at line 74 of file PorousFlowMaterial.h.

Referenced by computeProperties(), initStatefulProperties(), and PorousFlowDarcyVelocityMaterial::PorousFlowDarcyVelocityMaterial().

◆ _pressure_variable_name

const VariableName PorousFlowMaterial::_pressure_variable_name
protected

Names of variables used to declare/get derivatives in the DerivativeMaterialInterface to ensure consistency.

Definition at line 81 of file PorousFlowMaterial.h.

◆ _saturation_variable_name

const VariableName PorousFlowMaterial::_saturation_variable_name
protected

Definition at line 82 of file PorousFlowMaterial.h.

◆ _temperature_variable_name

const VariableName PorousFlowMaterial::_temperature_variable_name
protected

Definition at line 83 of file PorousFlowMaterial.h.


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