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)
 

Protected Member Functions

virtual void computeQpProperties () override
 
virtual void initStatefulProperties (unsigned int n_points) override
 
virtual void computeProperties () override
 
void sizeNodalProperty (const std::string &prop_name)
 Makes property with name prop_name to be size equal to the number of nodes in the current element. More...
 
void sizeAllSuppliedProperties ()
 Makes all supplied properties for this material to be size equal to the number of nodes 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...
 

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 ( const InputParameters &  parameters)

Definition at line 20 of file PorousFlowNearestQp.C.

21  : PorousFlowMaterial(parameters),
22  _nearest_qp(declareProperty<unsigned>("PorousFlow_nearestqp_nodal"))
23 {
24  if (getParam<bool>("nodal_material") == false)
25  mooseError("PorousFlowNearestQp must be a nodal material");
26 }
MaterialProperty< unsigned int > & _nearest_qp
the nearest quadpoint
PorousFlowMaterial(const InputParameters &parameters)

Member Function Documentation

void PorousFlowMaterial::computeProperties ( )
overrideprotectedvirtualinherited

Definition at line 46 of file PorousFlowMaterial.C.

47 {
48  if (_nodal_material)
49  {
51  for (_qp = 0; _qp < _current_elem->n_nodes(); ++_qp)
52  computeQpProperties();
53  }
54  else
55  Material::computeProperties();
56 }
void sizeAllSuppliedProperties()
Makes all supplied properties for this material to be size equal to the number of nodes in the curren...
const bool _nodal_material
whether the derived class holds nodal values
void PorousFlowNearestQp::computeQpProperties ( )
overrideprotectedvirtual

Definition at line 29 of file PorousFlowNearestQp.C.

30 {
31  _nearest_qp[_qp] = nearestQP(_qp);
32 }
unsigned nearestQP(unsigned nodenum) const
Find the nearest quadpoint to the node labelled by nodenum in the current element.
MaterialProperty< unsigned int > & _nearest_qp
the nearest quadpoint
void PorousFlowMaterial::initStatefulProperties ( unsigned int  n_points)
overrideprotectedvirtualinherited

Definition at line 34 of file PorousFlowMaterial.C.

35 {
36  if (_nodal_material)
37  {
39  Material::initStatefulProperties(_current_elem->n_nodes());
40  }
41  else
42  Material::initStatefulProperties(n_points);
43 }
void sizeAllSuppliedProperties()
Makes all supplied properties for this material to be size equal to the number of nodes in the curren...
const bool _nodal_material
whether the derived class holds nodal values
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 77 of file PorousFlowMaterial.C.

Referenced by computeQpProperties().

78 {
79  unsigned nearest_qp = 0;
80  Real smallest_dist = std::numeric_limits<Real>::max();
81  for (unsigned qp = 1; qp < _qrule->n_points(); ++qp)
82  {
83  const Real this_dist = (_current_elem->point(nodenum) - _q_point[qp]).size();
84  if (this_dist < smallest_dist)
85  {
86  nearest_qp = qp;
87  smallest_dist = this_dist;
88  }
89  }
90  return nearest_qp;
91 }
void PorousFlowMaterial::sizeAllSuppliedProperties ( )
protectedinherited

Makes all supplied properties for this material to be size equal to the number of nodes in the current element.

Definition at line 70 of file PorousFlowMaterial.C.

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

71 {
72  for (auto prop_name : getSuppliedItems())
73  sizeNodalProperty(prop_name);
74 }
void sizeNodalProperty(const std::string &prop_name)
Makes property with name prop_name to be size equal to the number of nodes in the current element...
void PorousFlowMaterial::sizeNodalProperty ( const std::string &  prop_name)
protectedinherited

Makes property with name prop_name to be size equal to the number of nodes in the current element.

Definition at line 59 of file PorousFlowMaterial.C.

Referenced by PorousFlowMaterial::sizeAllSuppliedProperties().

60 {
61  mooseAssert(_material_data->getMaterialPropertyStorage().hasProperty(prop_name),
62  "PorousFlowMaterial can not find nodal property " << prop_name);
63  const unsigned prop_id =
64  _material_data->getMaterialPropertyStorage().retrievePropertyId(prop_name);
65  // _material_data->props() returns MaterialProperties, which is a std::vector of PropertyValue.
66  _material_data->props()[prop_id]->resize(_current_elem->n_nodes());
67 }

Member Data Documentation

const PorousFlowDictator& PorousFlowMaterial::_dictator
protectedinherited

The variable names UserObject for the PorousFlow variables.

Definition at line 34 of file PorousFlowMaterial.h.

MaterialProperty<unsigned int>& PorousFlowNearestQp::_nearest_qp
protected

the nearest quadpoint

Definition at line 32 of file PorousFlowNearestQp.h.

Referenced by computeQpProperties().

const bool PorousFlowMaterial::_nodal_material
protectedinherited

whether the derived class holds nodal values

Definition at line 31 of file PorousFlowMaterial.h.

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


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