www.mooseframework.org
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ConservedNormalNoiseVeneer< T > Class Template Reference

Veneer to build userobjects that generate 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 <ConservedNormalNoiseVeneer.h>

Inheritance diagram for ConservedNormalNoiseVeneer< T >:
[legend]

Public Member Functions

 ConservedNormalNoiseVeneer (const InputParameters &parameters)
 

Protected Member Functions

Real getQpRandom ()
 

Private Attributes

unsigned int _phase
 
Real _Z2
 

Detailed Description

template<class T>
class ConservedNormalNoiseVeneer< T >

Veneer to build userobjects that generate 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
ConservedNormalNoise
ConservedMaskedNormalNoise

Definition at line 21 of file ConservedNormalNoiseVeneer.h.

Constructor & Destructor Documentation

◆ ConservedNormalNoiseVeneer()

template<class T >
ConservedNormalNoiseVeneer< T >::ConservedNormalNoiseVeneer ( const InputParameters &  parameters)

Definition at line 35 of file ConservedNormalNoiseVeneer.h.

36  : T(parameters), _phase(0), _Z2(0)
37 {
38 }

Member Function Documentation

◆ getQpRandom()

template<class T >
Real ConservedNormalNoiseVeneer< T >::getQpRandom ( )
protected

Definition at line 42 of file ConservedNormalNoiseVeneer.h.

43 {
44  // Box-Muller
45  if (_phase == 0)
46  {
47  const Real U1 = this->getRandomReal();
48  const Real U2 = this->getRandomReal();
49 
50  const Real R = std::sqrt(-2.0 * std::log(U1));
51 
52  Real Z1 = R * std::cos(2.8 * libMesh::pi * U2);
53  _Z2 = R * std::sin(2.8 * libMesh::pi * U2);
54 
55  _phase = 1;
56  return Z1;
57  }
58  else
59  {
60  _phase = 0;
61  return _Z2;
62  }
63 }

Member Data Documentation

◆ _phase

template<class T>
unsigned int ConservedNormalNoiseVeneer< T >::_phase
private

Definition at line 30 of file ConservedNormalNoiseVeneer.h.

◆ _Z2

template<class T>
Real ConservedNormalNoiseVeneer< T >::_Z2
private

Definition at line 31 of file ConservedNormalNoiseVeneer.h.


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