Alamo
src
Set
Set.cpp
Go to the documentation of this file.
1
#include "
Set.H
"
2
#include <random>
3
namespace
Set
4
{
5
}
6
7
namespace
Set
8
{
9
namespace
Constant
10
{
11
12
// Pi
13
const
Set::Scalar
Pi
= 3.14159265359;
14
Set::Scalar
Rg
= 0.0;
15
Set::Scalar
Boltzmann
= 0.0;
16
Set::Scalar
Avogadro
= 0.0;
17
18
// Function to update constants to match system level units
19
void
SetGlobalConstants
()
20
{
21
// Gas constant
22
Rg
=
Unit::Parse
(
"8.31446261815_J/mol/K"
).
normalized_value
();
23
// Boltzmann constant
24
Boltzmann
=
Unit::Parse
(
"1.380649e-23_J/K"
).
normalized_value
();
25
// Avogadro's number
26
Avogadro
=
Unit::Parse
(
"6.02214076e23_1/mol"
).
normalized_value
();
27
}
28
29
}
30
}
31
32
namespace
Util
33
{
34
Set::Scalar
Random
()
35
{
36
return
((
Set::Scalar
) rand()) / ((
Set::Scalar
) RAND_MAX);
37
}
38
Set::Scalar
Gaussian
(amrex::Real mean,amrex::Real std_deviation)
39
{
40
std::random_device randomness_device{};
41
std::mt19937 pseudorandom_generator{randomness_device()};
42
std::normal_distribution<double> distribution{mean, std_deviation};
43
auto
sample = distribution(pseudorandom_generator);
44
return
sample;
45
}
46
47
}
Set.H
Set::Constant::Boltzmann
Set::Scalar Boltzmann
Definition
Set.cpp:15
Set::Constant::SetGlobalConstants
void SetGlobalConstants()
Definition
Set.cpp:19
Set::Constant::Avogadro
Set::Scalar Avogadro
Definition
Set.cpp:16
Set::Constant::Rg
Set::Scalar Rg
Definition
Set.cpp:14
Set::Constant::Pi
const Set::Scalar Pi
Definition
Set.cpp:13
Set
A collection of data types and symmetry-reduced data structures.
Definition
Base.H:17
Set::Scalar
amrex::Real Scalar
Definition
Base.H:18
Util
A collection of utility routines.
Definition
Set.cpp:33
Util::Random
Set::Scalar Random()
Definition
Set.cpp:34
Util::Gaussian
Set::Scalar Gaussian(amrex::Real mean, amrex::Real std_deviation)
Definition
Set.cpp:38
Unit::Parse
static Unit Parse(double val, std::string unitstring, bool verbose=false)
Definition
Unit.H:270
Unit::normalized_value
double normalized_value() const
Definition
Unit.H:501
Generated by
1.9.8