25#ifndef FREE_ENERGY_DYNAMICS_H
26#define FREE_ENERGY_DYNAMICS_H
48 template <
typename DESCRIPTOR,
typename MOMENTA>
52 template <
typename CELL,
typename RHO,
typename U,
typename FEQ,
typename V=
typename CELL::value_t>
55 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
61 template <
typename CELL,
typename PARAMETERS,
typename FEQ,
typename V=
typename CELL::value_t>
63 auto u = cell.template getField<descriptors::FORCE>();
65 return compute(cell, rho, u, fEq);
83 template <
typename DESCRIPTOR,
typename MOMENTA,
typename EQUILIBRIUM>
87 template <
typename CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
89 V fEq[DESCRIPTOR::q] { };
91 const V omega =
parameters.template get<descriptors::OMEGA>();
92 const V gamma =
parameters.template get<GAMMA>();
93 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
94 cell[iPop] *= V{1} - omega;
95 cell[iPop] += omega * fEq[iPop];
98 * cell.template getField<descriptors::CHEM_POTENTIAL>();
99 for (
int iPop=1; iPop < DESCRIPTOR::q; ++iPop) {
108template <
int direction,
int orientation>
113 return "FreeEnergyInletOutlet<"
114 + std::to_string(direction) +
"," + std::to_string(orientation) +
118 template <
typename DESCRIPTOR,
typename MOMENTA,
typename EQUILIBRIUM>
122 template <
typename CELL,
typename PARAMETERS,
typename V=
typename CELL::value_t>
125 V rho, u[DESCRIPTOR::d];
126 MomentaF().computeRhoU(cell, rho, u);
127 const V omega =
parameters.template get<descriptors::OMEGA>();
129 for (
int iPop=1; iPop < DESCRIPTOR::q; ++iPop) {
135 V missingRho = rho - V{1};
136 V missingWeightSum = 0;
137 for (
int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
146 bool contains =
false;
147 for(
long unsigned int i=0; i < missingIndices.size(); i++){
148 if(missingIndices[i] == (
long unsigned int)iPop){
156 missingRho -= cell[iPop];
161 for (
unsigned iPop=0; iPop < missingIndices.size(); ++iPop) {
171template <
typename T,
typename DESCRIPTOR,
typename MOMENTA=momenta::FreeEnergyBulkTuple>
179template <
typename T,
typename DESCRIPTOR>
192template <
typename T,
typename DESCRIPTOR,
int direction,
int orientation>
Instantiation of Momenta tuples which define the computation and definition of momenta in a specific ...
constexpr T invCs2() any_platform
constexpr T t(unsigned iPop, tag::CUM) any_platform
constexpr auto subIndexOutgoing() any_platform
Compute opposites of wall-incoming population indices.
auto normSqr(const ARRAY_LIKE &u) any_platform
Compute norm square of a d-dimensional vector.
Top level namespace for all of OpenLB.
Return value of any collision.
typename MOMENTA::template type< DESCRIPTOR > MomentaF
CellStatistic< V > apply(CELL &cell, PARAMETERS ¶meters) any_platform
static std::string getName()
typename meta::list< descriptors::OMEGA > parameters
CellStatistic< V > apply(CELL &cell, PARAMETERS ¶meters) any_platform
typename EQUILIBRIUM::template type< DESCRIPTOR, MOMENTA > EquilibriumF
static std::string getName()
typename meta::list< descriptors::OMEGA, GAMMA > parameters
Base of a field whose size is defined by [C_0,C_1,C_2]^T * [1,D,Q].
Dynamics constructed as a tuple of momenta, equilibrium and collision.
CellStatistic< V > compute(CELL &cell, RHO &rho, U &u, FEQ &fEq) any_platform
CellStatistic< V > compute(CELL &cell, PARAMETERS ¶meters, FEQ &fEq) any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
static std::string getName()
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 bgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
BGK collision step.
Standard computation for density in the bulk as zeroth moment of the population.
The momenta are defined one after the other.
The density is stored in descriptors::FORCE[0] (TODO: absurd, to be changed)
Computation of the stress tensor for regularized boundary nodes.
Momentum is zero at solid material.
The stress is always zero.