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
 
const Real _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 28 of file InternalVolume.h.

Constructor & Destructor Documentation

InternalVolume::InternalVolume ( const InputParameters &  parameters)

Definition at line 28 of file InternalVolume.C.

29  : SideIntegralPostprocessor(parameters),
30  _component(getParam<unsigned int>("component")),
31  _scale(getParam<Real>("scale_factor")),
32  _addition(getParam<Real>("addition"))
33 {
34 }
const Real _addition
const Real _scale
const unsigned int _component

Member Function Documentation

Real InternalVolume::computeQpIntegral ( )
protectedvirtual

Definition at line 96 of file InternalVolume.C.

97 {
98  // Default scale factor is 1
99  Real scale = 1.0;
100  if (_coord_sys == Moose::COORD_RSPHERICAL)
101  {
102  // MOOSE will multiply by 4*pi*r*r
103  scale = 1.0 / 3.0;
104  }
105  else if (_coord_sys == Moose::COORD_RZ && _component == 0)
106  {
107  // MOOSE will multiply by 2*pi*r
108  // Will integrate over z giving 0.5*2*pi*r*r*height
109  scale = 0.5;
110  }
111  else if (_coord_sys == Moose::COORD_RZ && _component == 1)
112  {
113  // MOOSE will multiply by 2*pi*r
114  // Will integrate over r:
115  // integral(2*pi*r*height) over r:
116  // pi*r*r*height
117  scale = 1.0;
118  }
119  return -scale * _q_point[_qp](_component) * _normals[_qp](_component);
120 }
const unsigned int _component
Real InternalVolume::getValue ( )
protectedvirtual

Definition at line 123 of file InternalVolume.C.

124 {
125  return _scale * SideIntegralPostprocessor::getValue() + _addition;
126 }
const Real _addition
const Real _scale
void InternalVolume::initialSetup ( )

Definition at line 63 of file InternalVolume.C.

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

Member Data Documentation

const Real InternalVolume::_addition
protected

Definition at line 41 of file InternalVolume.h.

Referenced by getValue().

const unsigned int InternalVolume::_component
protected

Definition at line 39 of file InternalVolume.h.

Referenced by computeQpIntegral(), and initialSetup().

const Real InternalVolume::_scale
protected

Definition at line 40 of file InternalVolume.h.

Referenced by getValue().


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