28#ifndef RTLBM_DYNAMICS_HH
29#define RTLBM_DYNAMICS_HH
43template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
45(T latticeAbsorption, T latticeScattering, std::array<std::array<T,DESCRIPTOR::q>, DESCRIPTOR::q>& anisoMatrix)
46 : legacy::BasicDynamics<T, DESCRIPTOR, MOMENTA>(), _absorption(latticeAbsorption), _scattering(latticeScattering), _anisoMatrix(anisoMatrix)
48 this->
getName() =
"RTLBMdynamicsMcHardy";
51template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
58template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
61 std::array<double, DESCRIPTOR::q> feq = {};
62 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop ) {
63 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop ) {
69 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
79template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
85template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
91template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
93(T latticeAbsorption, T latticeScattering, std::array<std::array<T,DESCRIPTOR::q>, DESCRIPTOR::q>& anisoMatrix)
94 : legacy::BasicDynamics<T, DESCRIPTOR, MOMENTA>(), _absorption(latticeAbsorption), _scattering(latticeScattering), _anisoMatrix(anisoMatrix)
96 this->
getName() =
"RTLBMdynamicsMcHardyRK";
99template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
105template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
109 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop ) {
110 for (
int jPop = 0; jPop < DESCRIPTOR::q; ++jPop ) {
111 feq[iPop] += cell[jPop] * _anisoMatrix[jPop][iPop];
117template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
120 std::array<T,DESCRIPTOR::q> k;
121 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
128template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
131 std::array<T,DESCRIPTOR::q> feq;
132 std::array<T,DESCRIPTOR::q> f_pre_collision;
134 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop ) {
139 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop ) {
142 computeEquilibriumAniso(cell,feq);
143 std::array<T,DESCRIPTOR::q> k1 = doCollision(cell,feq);
145 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
146 cell[iPop] = f_pre_collision[iPop] + 0.5*k1[iPop];
149 computeEquilibriumAniso(cell,feq);
150 std::array<T,DESCRIPTOR::q> k2 = doCollision(cell,feq);
152 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
153 cell[iPop] = f_pre_collision[iPop] + 0.5*k2[iPop];
156 computeEquilibriumAniso(cell,feq);
157 std::array<T,DESCRIPTOR::q> k3 = doCollision(cell,feq);
159 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
160 cell[iPop] = f_pre_collision[iPop] + k3[iPop];
163 computeEquilibriumAniso(cell,feq);
164 std::array<T,DESCRIPTOR::q> k4 = doCollision(cell,feq);
166 for (
int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
167 cell[iPop] = f_pre_collision[iPop] + 1/6.*(k1[iPop] + 2*k2[iPop] + 2*k3[iPop] + k4[iPop])
174template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
180template<
typename T,
typename DESCRIPTOR,
typename MOMENTA>
void incrementStats(T rho, T uSqr)
constexpr T t(unsigned iPop, tag::CUM) any_platform
constexpr T norm_c(unsigned iPop, tag::RTLBM)
Top level namespace for all of OpenLB.
A collection of radiative transport dynamics classes – header file.
Return value of any collision.
CellStatistic< V > collide(CELL &cell, PARAMETERS ¶meters) any_platform
void computeEquilibriumAniso(CELL &cell, Vector< V, DESCRIPTOR::q > &feq, MATRIX &anisoMatrix) const
void computeEquilibrium(ConstCell< T, DESCRIPTOR > &cell, T irradiance, const T u[DESCRIPTOR::d], T fEq[DESCRIPTOR::q]) const override
Return iPop equilibrium for given first and second momenta.
VECTOR doCollision(CELL &cell, VECTOR &feq, V absorption, V scattering) const
std::string getName() const override
Return human-readable name.
void setOmega(T omega)
Set local relaxation parameter of the dynamics.
RTLBMdynamicsMcHardyRK(T latticeAbsorption, T latticeScattering, std::array< std::array< T, DESCRIPTOR::q >, DESCRIPTOR::q > &anisoMatrix)
Constructor.
T getOmega() const
Get local relaxation parameter of the dynamics.
RTLBMdynamicsMcHardy(T latticeAbsorption, T latticeScattering, std::array< std::array< T, DESCRIPTOR::q >, DESCRIPTOR::q > &anisoMatrix)
Constructor.
void computeEquilibrium(ConstCell< T, DESCRIPTOR > &cell, T irradiance, const T u[DESCRIPTOR::d], T fEq[DESCRIPTOR::q]) const override
Return iPop equilibrium for given first and second momenta.
std::string getName() const override
Return human-readable name.
CellStatistic< V > collide(CELL &cell, PARAMETERS ¶meters) any_platform
T getOmega() const
Get local relaxation parameter of the dynamics.
void setOmega(T omega)
Set local relaxation parameter of the dynamics.
static V computeRho(CELL &cell) any_platform
Computation of density.