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

This class computes the volume of an interior space. More...

#include <InternalVolume.h>

Inheritance diagram for InternalVolume:
[legend]

Public Member Functions

 InternalVolume (const InputParameters &parameters)
 
void initialSetup ()
 

Protected Member Functions

virtual Real computeQpIntegral ()
 
virtual Real getValue ()
 

Protected Attributes

const unsigned int _component
 
const Real _scale
 
Function & _addition
 

Detailed Description

This class computes the volume of an interior space.

This class relies on being handed sidesets that define a closed space.

If the sideset defines an interior surface, the volume reported will be positive. If the sideset defines an exterior surface, the volume reported will be negative. It is therefore possible to compute the net interior volume by including an interior and an exterior surface in the same sideset.

Definition at line 31 of file InternalVolume.h.

Constructor & Destructor Documentation

◆ InternalVolume()

InternalVolume::InternalVolume ( const InputParameters &  parameters)

Definition at line 37 of file InternalVolume.C.

38  : SideIntegralPostprocessor(parameters),
39  _component(getParam<unsigned int>("component")),
40  _scale(getParam<Real>("scale_factor")),
41  _addition(getFunction("addition"))
42 {
43 }
const Real _scale
Function & _addition
const unsigned int _component

Member Function Documentation

◆ computeQpIntegral()

Real InternalVolume::computeQpIntegral ( )
protectedvirtual

Definition at line 105 of file InternalVolume.C.

106 {
107  // Default scale factor is 1
108  Real scale = 1.0;
109  if (_coord_sys == Moose::COORD_RSPHERICAL)
110  {
111  // MOOSE will multiply by 4*pi*r*r
112  scale = 1.0 / 3.0;
113  }
114  else if (_coord_sys == Moose::COORD_RZ && _component == 0)
115  {
116  // MOOSE will multiply by 2*pi*r
117  // Will integrate over z giving 0.5*2*pi*r*r*height
118  scale = 0.5;
119  }
120  else if (_coord_sys == Moose::COORD_RZ && _component == 1)
121  {
122  // MOOSE will multiply by 2*pi*r
123  // Will integrate over r:
124  // integral(2*pi*r*height) over r:
125  // pi*r*r*height
126  scale = 1.0;
127  }
128  return -scale * _q_point[_qp](_component) * _normals[_qp](_component);
129 }
const unsigned int _component

◆ getValue()

Real InternalVolume::getValue ( )
protectedvirtual

Definition at line 132 of file InternalVolume.C.

133 {
134  Point p;
135  return _scale * SideIntegralPostprocessor::getValue() + _addition.value(_t, p);
136 }
const Real _scale
Function & _addition

◆ initialSetup()

void InternalVolume::initialSetup ( )

Definition at line 72 of file InternalVolume.C.

73 {
74  SideIntegralPostprocessor::initialSetup();
75 
76  const std::set<SubdomainID> & subdomains = _mesh.meshSubdomains();
77  std::set<SubdomainID>::const_iterator iter = subdomains.begin();
78  const std::set<SubdomainID>::const_iterator iter_end = subdomains.end();
79  for (; iter != iter_end; ++iter)
80  {
81  const std::set<BoundaryID> & boundaries = _mesh.getSubdomainBoundaryIds(*iter);
82  std::set<BoundaryID>::const_iterator bnd = boundaries.begin();
83  const std::set<BoundaryID>::const_iterator bnd_end = boundaries.end();
84  for (; bnd != bnd_end; ++bnd)
85  {
86  const std::set<BoundaryID> & b = boundaryIDs();
87  std::set<BoundaryID>::const_iterator bit = b.begin();
88  const std::set<BoundaryID>::const_iterator bit_end = b.end();
89  for (; bit != bit_end; ++bit)
90  if (*bit == *bnd)
91  {
92  Moose::CoordinateSystemType coord_sys = _fe_problem.getCoordSystem(*iter);
93  if (_component != 0 && coord_sys == Moose::COORD_RSPHERICAL)
94  mooseError("With spherical coordinates, the component must be 0 in InternalVolume.");
95 
96  if (_component > 1 && coord_sys == Moose::COORD_RZ)
97  mooseError(
98  "With cylindrical coordinates, the component must be 0 or 1 in InternalVolume.");
99  }
100  }
101  }
102 }
const unsigned int _component

Member Data Documentation

◆ _addition

Function& InternalVolume::_addition
protected

Definition at line 44 of file InternalVolume.h.

Referenced by getValue().

◆ _component

const unsigned int InternalVolume::_component
protected

Definition at line 42 of file InternalVolume.h.

Referenced by computeQpIntegral(), and initialSetup().

◆ _scale

const Real InternalVolume::_scale
protected

Definition at line 43 of file InternalVolume.h.

Referenced by getValue().


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