24#ifndef DYNAMICS_EQUILIBRIUM_H
25#define DYNAMICS_EQUILIBRIUM_H
42 template <
typename DESCRIPTOR,
typename MOMENTA>
44 template <
typename RHO,
typename U>
49 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
51 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
66 template <
typename DESCRIPTOR,
typename MOMENTA>
70 template <
typename RHO,
typename U>
72 return descriptors::t<RHO,DESCRIPTOR>(iPop) * rho - descriptors::t<RHO,DESCRIPTOR>(iPop);
75 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
77 const V rho =
MomentaF().computeRho(cell);
78 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
79 fEq[iPop] = descriptors::t<V,DESCRIPTOR>(iPop) * rho - descriptors::t<V,DESCRIPTOR>(iPop);
93 template <
typename DESCRIPTOR,
typename MOMENTA>
97 template <
typename RHO,
typename U>
102 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
104 V rho, u[DESCRIPTOR::d];
105 MomentaF().computeRhoU(cell, rho, u);
106 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
109 return {rho, util::normSqr<V,DESCRIPTOR::d>(u)};
118 return "SecondOrder";
121 template <
typename DESCRIPTOR,
typename MOMENTA>
125 template <
typename RHO,
typename U>
130 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
132 V rho, u[DESCRIPTOR::d];
133 MomentaF().computeRhoU(cell, rho, u);
134 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
135 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
138 return {rho, util::normSqr<V,DESCRIPTOR::d>(u)};
147 return "Incompressible";
150 template <
typename DESCRIPTOR,
typename MOMENTA>
154 template <
typename RHO,
typename U,
typename V=RHO>
156 const V pressure = rho / descriptors::invCs2<V,DESCRIPTOR>();
157 V j[DESCRIPTOR::d] { };
158 for (
unsigned iD=0; iD < DESCRIPTOR::d; ++iD) {
164 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
166 V rho, j[DESCRIPTOR::d];
167 MomentaF().computeRhoJ(cell, rho, j);
168 const V pressure = rho / descriptors::invCs2<V,DESCRIPTOR>();
169 const V jSqr = util::normSqr<V,DESCRIPTOR::d>(j);
170 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
173 return {rho, jSqr / (rho*rho)};
185 template <
typename DESCRIPTOR,
typename MOMENTA>
189 template <
typename RHO,
typename U>
194 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
196 V rho, j[DESCRIPTOR::d] { };
197 MomentaF().computeRhoJ(cell, rho, j);
198 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
215 template <
typename DESCRIPTOR,
typename MOMENTA>
220 template <
typename RHO,
typename U,
typename VS2,
typename V=RHO>
221 auto compute(
int iPop,
const RHO& rho,
const U& u, VS2 vs2 = V{1} / descriptors::invCs2<V,DESCRIPTOR>())
any_platform {
222 const V uSqr = util::normSqr<V,DESCRIPTOR::d>(u);
224 return rho * (V{1} - vs2 * descriptors::invCs2<V,DESCRIPTOR>()*(V{1}-descriptors::t<V,DESCRIPTOR>(0))
225 - descriptors::t<V,DESCRIPTOR>(0)/V{2}*descriptors::invCs2<V,DESCRIPTOR>()*uSqr)
226 - descriptors::t<V,DESCRIPTOR>(0);
230 for (
int iD=0; iD < DESCRIPTOR::d; ++iD) {
231 c_u += descriptors::c<DESCRIPTOR>(iPop,iD)*u[iD];
233 return rho * descriptors::t<V,DESCRIPTOR>(iPop) * descriptors::invCs2<V,DESCRIPTOR>()
235 + descriptors::invCs2<V,DESCRIPTOR>() / V{2} * c_u*c_u
237 - descriptors::t<V,DESCRIPTOR>(iPop);
241 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
243 V rho, u[DESCRIPTOR::d] { };
244 MomentaF().computeRhoU(cell, rho, u);
245 const V vs2 =
parameters.template get<SPEED_OF_SOUND>();
246 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
247 fEq[iPop] =
compute(iPop, rho, u, vs2);
249 return {rho, util::normSqr<V,DESCRIPTOR::d>(u)};
Interface for post-processing steps – header file.
Top level namespace for all of OpenLB.
Return value of any collision.
Base of a field whose size is defined by [C,U_1,...,U_N]^T * [1,V_1,...V_N].
typename MOMENTA::template type< DESCRIPTOR > MomentaF
auto compute(int iPop, const RHO &rho, const U &u, VS2 vs2=V{1}/descriptors::invCs2< V, DESCRIPTOR >()) any_platform
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
static std::string getName()
auto compute(int iPop, const RHO &rho, const U &u) any_platform
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
static std::string getName()
typename MOMENTA::template type< DESCRIPTOR > MomentaF
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
auto compute(int iPop, const RHO &rho, const U &u) any_platform
static std::string getName()
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
auto compute(int iPop, const RHO &rho, const U &u) any_platform
static std::string getName()
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
auto compute(int iPop, const RHO &rho, const U &u) any_platform
static std::string getName()
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
auto compute(int iPop, const RHO &rho, const U &u) any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
static std::string getName()
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
auto compute(int iPop, const RHO &rho, const U &u) any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
static std::string getName()
static V incompressible(int iPop, const J &j, const JSQR &jSqr, const PRESSURE &pressure) any_platform
static V P1(int iPop, const RHO &rho, const U &u) any_platform
static V secondOrder(int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
Computation of equilibrium distribution, second order in u.
static V firstOrder(int iPop, const RHO &rho, const U &u) any_platform
Computation of equilibrium distribution, first order in u.