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

Material designed to provide the nearest quadpoint to each node in the element. More...

#include <PorousFlowNearestQp.h>

Inheritance diagram for PorousFlowNearestQp:
[legend]

Public Member Functions

 PorousFlowNearestQp (const InputParameters &parameters)
 
virtual void initialSetup () override
 

Protected Member Functions

virtual void computeQpProperties () override
 
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 sizeNodalProperties ()
 Resizes properties to be 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

MaterialProperty< unsigned int > & _nearest_qp
 The nearest quadpoint. More...
 
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

Material designed to provide the nearest quadpoint to each node in the element.

Definition at line 23 of file PorousFlowNearestQp.h.

Constructor & Destructor Documentation

◆ PorousFlowNearestQp()

PorousFlowNearestQp::PorousFlowNearestQp ( const InputParameters &  parameters)

Definition at line 25 of file PorousFlowNearestQp.C.

26  : PorousFlowMaterial(parameters),
27  _nearest_qp(declareProperty<unsigned>("PorousFlow_nearestqp_nodal"))
28 {
29  if (getParam<bool>("nodal_material") == false)
30  paramError("nodal_material", "This must be a nodal material!");
31 }

Member Function Documentation

◆ computeProperties()

void PorousFlowMaterial::computeProperties ( )
overrideprotectedvirtualinherited

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

Definition at line 63 of file PorousFlowMaterial.C.

64 {
65  if (_nodal_material)
66  {
67  // size the properties to max(number_of_nodes, number_of_quadpoints)
69 
70  // compute the values for number_of_nodes
71  for (_qp = 0; _qp < _current_elem->n_nodes(); ++_qp)
72  computeQpProperties();
73  }
74  else
75  Material::computeProperties();
76 }

◆ computeQpProperties()

void PorousFlowNearestQp::computeQpProperties ( )
overrideprotectedvirtual

Definition at line 34 of file PorousFlowNearestQp.C.

35 {
36  _nearest_qp[_qp] = nearestQP(_qp);
37 }

◆ initialSetup()

void PorousFlowMaterial::initialSetup ( )
overridevirtualinherited

Definition at line 41 of file PorousFlowMaterial.C.

42 {
43  if (_nodal_material)
44  _material_data->onlyResizeIfSmaller(true);
45 }

◆ initStatefulProperties()

void PorousFlowMaterial::initStatefulProperties ( unsigned int  n_points)
overrideprotectedvirtualinherited

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

Definition at line 48 of file PorousFlowMaterial.C.

49 {
50  if (_nodal_material)
51  {
52  // size the properties to max(number_of_nodes, number_of_quadpoints)
54 
55  // compute the values for number_of_nodes
56  Material::initStatefulProperties(_current_elem->n_nodes());
57  }
58  else
59  Material::initStatefulProperties(n_points);
60 }

◆ nearestQP()

unsigned PorousFlowMaterial::nearestQP ( unsigned  nodenum) const
protectedinherited

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 98 of file PorousFlowMaterial.C.

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

Referenced by computeQpProperties().

◆ sizeNodalProperties()

void PorousFlowMaterial::sizeNodalProperties ( )
protectedinherited

Resizes properties to be equal to max(number of nodes, number of quadpoints) in the current element.

Definition at line 79 of file PorousFlowMaterial.C.

80 {
81  /*
82  * For nodal materials, the Properties should be sized as the maximum of
83  * the number of nodes and the number of quadpoints.
84  * We only actually need "number of nodes" pieces of information, which are
85  * computed by computeProperties(), so the n_points - _current_elem->n_nodes()
86  * elements at the end of the std::vector will always be zero, but they
87  * are needed because MOOSE does copy operations (etc) that assumes that
88  * the std::vector is sized to number of quadpoints.
89  *
90  * On boundary materials, the number of nodes may be larger than the number of
91  * qps on the face of the element, in which case the remaining entries in the
92  * material properties storage will be zero.
93  */
94  _material_data->resize(std::max(_current_elem->n_nodes(), _qrule->n_points()));
95 }

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

Member Data Documentation

◆ _dictator

const PorousFlowDictator& PorousFlowMaterial::_dictator
protectedinherited

The variable names UserObject for the PorousFlow variables.

Definition at line 71 of file PorousFlowMaterial.h.

◆ _mass_fraction_variable_name

const VariableName PorousFlowMaterial::_mass_fraction_variable_name
protectedinherited

Definition at line 78 of file PorousFlowMaterial.h.

◆ _nearest_qp

MaterialProperty<unsigned int>& PorousFlowNearestQp::_nearest_qp
protected

The nearest quadpoint.

Definition at line 32 of file PorousFlowNearestQp.h.

Referenced by computeQpProperties().

◆ _nodal_material

const bool PorousFlowMaterial::_nodal_material
protectedinherited

◆ _pressure_variable_name

const VariableName PorousFlowMaterial::_pressure_variable_name
protectedinherited

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

Definition at line 75 of file PorousFlowMaterial.h.

◆ _saturation_variable_name

const VariableName PorousFlowMaterial::_saturation_variable_name
protectedinherited

Definition at line 76 of file PorousFlowMaterial.h.

◆ _temperature_variable_name

const VariableName PorousFlowMaterial::_temperature_variable_name
protectedinherited

Definition at line 77 of file PorousFlowMaterial.h.


The documentation for this class was generated from the following files:
PorousFlowMaterial::nearestQP
unsigned nearestQP(unsigned nodenum) const
Find the nearest quadpoint to the node labelled by nodenum in the current element.
Definition: PorousFlowMaterial.C:98
PorousFlowMaterial::PorousFlowMaterial
PorousFlowMaterial(const InputParameters &parameters)
Definition: PorousFlowMaterial.C:29
PorousFlowMaterial::_nodal_material
const bool _nodal_material
Whether the derived class holds nodal values.
Definition: PorousFlowMaterial.h:68
PorousFlowMaterial::sizeNodalProperties
void sizeNodalProperties()
Resizes properties to be equal to max(number of nodes, number of quadpoints) in the current element.
Definition: PorousFlowMaterial.C:79
PorousFlowNearestQp::_nearest_qp
MaterialProperty< unsigned int > & _nearest_qp
The nearest quadpoint.
Definition: PorousFlowNearestQp.h:32