OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
olb::collision::FreeEnergyInletOutlet< direction, orientation >::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM > Struct Template Reference

#include <freeEnergyDynamics.h>

+ Collaboration diagram for olb::collision::FreeEnergyInletOutlet< direction, orientation >::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >:

Public Types

using MomentaF = typename MOMENTA::template type<DESCRIPTOR>
 

Public Member Functions

template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > apply (CELL &cell, PARAMETERS &parameters) any_platform
 

Detailed Description

template<int direction, int orientation>
template<typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
struct olb::collision::FreeEnergyInletOutlet< direction, orientation >::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >

Definition at line 125 of file freeEnergyDynamics.h.

Member Typedef Documentation

◆ MomentaF

template<int direction, int orientation>
template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM >
using olb::collision::FreeEnergyInletOutlet< direction, orientation >::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >::MomentaF = typename MOMENTA::template type<DESCRIPTOR>

Definition at line 126 of file freeEnergyDynamics.h.

Member Function Documentation

◆ apply()

template<int direction, int orientation>
template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM >
template<typename CELL , typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > olb::collision::FreeEnergyInletOutlet< direction, orientation >::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 129 of file freeEnergyDynamics.h.

129 {
130 // Do a standard collision neglecting the chemical potential term.
131 V rho, u[DESCRIPTOR::d];
132 MomentaF().computeRhoU(cell, rho, u);
133 const V omega = parameters.template get<descriptors::OMEGA>();
134 V uSqr = lbm<DESCRIPTOR>::bgkCollision(cell, rho, u, omega);
135 for (int iPop=1; iPop < DESCRIPTOR::q; ++iPop) {
136 cell[iPop] -= omega * descriptors::t<V,DESCRIPTOR>(iPop) * rho;
137 }
138 cell[0] += omega * (V{1} - descriptors::t<V,DESCRIPTOR>(0)) * rho;
139 // Distribute the missing density to the unknown distribution functions.
140 constexpr auto missingIndices = util::subIndexOutgoing<DESCRIPTOR,direction,orientation>();
141 V missingRho = rho - V{1};
142 V missingWeightSum = 0;
143 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
144
145 // std::find can conflict with CUDA
146 /*if (std::find(missingIndices.begin(), missingIndices.end(), iPop) != missingIndices.end()) {
147 missingWeightSum += descriptors::t<V,DESCRIPTOR>(iPop);
148 } else {
149 missingRho -= cell[iPop];
150 }*/
151
152 bool contains = false;
153 for(long unsigned int i=0; i < missingIndices.size(); i++){
154 if(missingIndices[i] == (long unsigned int)iPop){
155 contains = true;
156 }
157 }
158
159 if(contains){
160 missingWeightSum += descriptors::t<V,DESCRIPTOR>(iPop);
161 } else {
162 missingRho -= cell[iPop];
163 }
164
165 }
166
167 for (unsigned iPop=0; iPop < missingIndices.size(); ++iPop) {
168 cell[missingIndices[iPop]] = missingRho * descriptors::t<V,DESCRIPTOR>(missingIndices[iPop]) / missingWeightSum;
169 }
170 return {rho, uSqr};
171 };
constexpr bool contains()
Returns true iff a given type list contains WANTED.
Definition meta.h:125
typename MOMENTA::template type< DESCRIPTOR > MomentaF
typename meta::list< descriptors::OMEGA > parameters
static V bgkCollision(CELL &cell, const RHO &rho, const VELOCITY &u, const OMEGA &omega) any_platform
BGK collision step.
Definition lbm.h:290

References olb::lbm< DESCRIPTOR >::bgkCollision().

+ Here is the call graph for this function:

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