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

Userobject that generates a normaly distributed random number once per timestep for every quadrature point in a way that the integral over all random numbers is zero. More...

#include <ConservedNormalNoise.h>

Inheritance diagram for ConservedNormalNoise:
[legend]

Public Member Functions

 ConservedNormalNoise (const InputParameters &parameters)
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void threadJoin (const UserObject &y)
 
virtual void finalize ()
 
Real getQpValue (dof_id_type element_id, unsigned int qp) const
 

Protected Member Functions

Real getQpRandom ()
 

Protected Attributes

std::unordered_map< dof_id_type, std::vector< Real > > _random_data
 
Real _integral
 
Real _volume
 
Real _offset
 
unsigned int _qp
 

Detailed Description

Userobject that generates a normaly distributed random number once per timestep for every quadrature point in a way that the integral over all random numbers is zero.

See also
ConservedNoiseBase

Definition at line 24 of file ConservedNormalNoise.h.

Constructor & Destructor Documentation

ConservedNormalNoise::ConservedNormalNoise ( const InputParameters &  parameters)
inline

Member Function Documentation

void ConservedNoiseBase::execute ( )
virtualinherited

Definition at line 38 of file ConservedNoiseBase.C.

Referenced by ConservedNoiseBase::~ConservedNoiseBase().

39 {
40  // reserve space for each quadrature point in the element
41  std::vector<Real> & me = _random_data[_current_elem->id()] =
42  std::vector<Real>(_qrule->n_points());
43 
44  // store a random number for each quadrature point
45  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
46  {
47  me[_qp] = getQpRandom();
48  _integral += _JxW[_qp] * _coord[_qp] * me[_qp];
49  _volume += _JxW[_qp] * _coord[_qp];
50  }
51 }
std::unordered_map< dof_id_type, std::vector< Real > > _random_data
virtual Real getQpRandom()=0
void ConservedNoiseBase::finalize ( )
virtualinherited
Real ConservedNormalNoiseVeneer< ConservedNoiseBase >::getQpRandom ( )
protectedvirtualinherited
Real ConservedNoiseBase::getQpValue ( dof_id_type  element_id,
unsigned int  qp 
) const
virtualinherited

Implements ConservedNoiseInterface.

Definition at line 73 of file ConservedNoiseBase.C.

Referenced by ConservedNoiseBase::~ConservedNoiseBase().

74 {
75  const auto it_pair = _random_data.find(element_id);
76 
77  if (it_pair == _random_data.end())
78  mooseError("Element not found.");
79  else
80  {
81  libmesh_assert_less(qp, it_pair->second.size());
82  return it_pair->second[qp] - _offset;
83  }
84 }
std::unordered_map< dof_id_type, std::vector< Real > > _random_data
void ConservedNoiseBase::initialize ( )
virtualinherited

Definition at line 30 of file ConservedNoiseBase.C.

Referenced by ConservedNoiseBase::~ConservedNoiseBase().

31 {
32  _random_data.clear();
33  _integral = 0.0;
34  _volume = 0.0;
35 }
std::unordered_map< dof_id_type, std::vector< Real > > _random_data
void ConservedNoiseBase::threadJoin ( const UserObject &  y)
virtualinherited

Definition at line 54 of file ConservedNoiseBase.C.

Referenced by ConservedNoiseBase::~ConservedNoiseBase().

55 {
56  const ConservedNoiseBase & uo = static_cast<const ConservedNoiseBase &>(y);
57 
58  _random_data.insert(uo._random_data.begin(), uo._random_data.end());
59  _integral += uo._integral;
60  _volume += uo._volume;
61 }
This Userobject is the base class of Userobjects that generate one random number per timestep and qua...
std::unordered_map< dof_id_type, std::vector< Real > > _random_data

Member Data Documentation

Real ConservedNoiseInterface::_integral
protectedinherited
Real ConservedNoiseInterface::_offset
protectedinherited
unsigned int ConservedNoiseInterface::_qp
protectedinherited
std::unordered_map<dof_id_type, std::vector<Real> > ConservedNoiseBase::_random_data
protectedinherited
Real ConservedNoiseInterface::_volume
protectedinherited

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