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

#include <dualDynamics.h>

+ Collaboration diagram for olb::collision::DualPorousBGK::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >:

Public Types

using EquilibriumF = typename EQUILIBRIUM::template type<DESCRIPTOR,MOMENTA>
 
using MomentaF = typename MOMENTA::template type<DESCRIPTOR>
 

Public Member Functions

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

Detailed Description

template<typename DESCRIPTOR, typename MOMENTA, typename EQUILIBRIUM>
struct olb::collision::DualPorousBGK::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >

Definition at line 54 of file dualDynamics.h.

Member Typedef Documentation

◆ EquilibriumF

template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM >
using olb::collision::DualPorousBGK::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >::EquilibriumF = typename EQUILIBRIUM::template type<DESCRIPTOR,MOMENTA>

Definition at line 55 of file dualDynamics.h.

◆ MomentaF

template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM >
using olb::collision::DualPorousBGK::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >::MomentaF = typename MOMENTA::template type<DESCRIPTOR>

Definition at line 56 of file dualDynamics.h.

Member Function Documentation

◆ apply()

template<typename DESCRIPTOR , typename MOMENTA , typename EQUILIBRIUM >
template<CONCEPT(MinimalCell) CELL, typename PARAMETERS , typename V = typename CELL::value_t>
CellStatistic< V > olb::collision::DualPorousBGK::type< DESCRIPTOR, MOMENTA, EQUILIBRIUM >::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 59 of file dualDynamics.h.

59 {
60 // Revert for backwards-in-time propagation
61 //cell.revert();
62 for (int iPop=1; iPop <= DESCRIPTOR::q/2; ++iPop) {
63 V cell_iPop = cell[iPop];
64 cell[iPop] = cell[descriptors::opposite<DESCRIPTOR>(iPop)];
65 cell[descriptors::opposite<DESCRIPTOR>(iPop)] = cell_iPop;
66 }
67
68 // Preparation
69 const auto pop_f = cell.template getField<descriptors::F>();
70 const auto dJdF = cell.template getFieldPointer<descriptors::DJDF>();
71 const V d = cell.template getField<descriptors::POROSITY>();
72 const V omega = parameters.template get<descriptors::OMEGA>();
73
74 // Forward density and velocity
75 V rho_f { };
76 V u_f[DESCRIPTOR::d] { };
77 //this->computeRhoU( pop_f.data(), rho_f, u_f);
78 rho_f = V();
79 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
80 u_f[iD] = V();
81 }
82 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
83 rho_f += pop_f[iPop];
84 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
85 u_f[iD] += pop_f[iPop]*descriptors::c<DESCRIPTOR>(iPop,iD);
86 }
87 }
88 rho_f += (V)1;
89 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
90 u_f[iD] /= rho_f;
91 }
92
93 // Adjoint equilibrium
94 V pheq[DESCRIPTOR::q] { };
95 for (int i=0; i < DESCRIPTOR::q; ++i) {
96 pheq[i] = V{0};
97 for (int j=0; j < DESCRIPTOR::q; ++j) {
98 V feq_j = equilibrium<DESCRIPTOR>::secondOrder(j, rho_f, u_f)
99 + descriptors::t<V,DESCRIPTOR>(j);
100 V dot_ij = V();
101 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
102 dot_ij += ( descriptors::c<DESCRIPTOR>(j,iD) - d*u_f[iD] )
103 * ( descriptors::c<DESCRIPTOR>(i,iD) - u_f[iD] );
104 }
105 pheq[i] += cell[j]*feq_j*( V{1} + descriptors::invCs2<V,DESCRIPTOR>()*d*dot_ij );
106 }
107 pheq[i] /= rho_f;
108 }
109
110 // Collision
111 for (int i=0; i < DESCRIPTOR::q; ++i) {
112 cell[i] = cell[i] - omega*( cell[i] - pheq[i] ) + dJdF[i];
113 }
114
115 // Statistics
116 V rho_phi, u_phi[DESCRIPTOR::d];
117 MomentaF().computeRhoU( cell, rho_phi, u_phi );
118 V uSqr_phi = util::normSqr<V,DESCRIPTOR::d>( u_phi );
119
120 // Undo revert
121 //cell.revert();
122 for (int iPop=1; iPop <= DESCRIPTOR::q/2; ++iPop) {
123 V cell_iPop = cell[iPop];
124 cell[iPop] = cell[descriptors::opposite<DESCRIPTOR>(iPop)];
125 cell[descriptors::opposite<DESCRIPTOR>(iPop)] = cell_iPop;
126 }
127 return {rho_phi, uSqr_phi};
128 };
constexpr int d() any_platform
typename MOMENTA::template type< DESCRIPTOR > MomentaF
typename meta::list< descriptors::OMEGA > parameters
static V secondOrder(int iPop, const RHO &rho, const U &u, const USQR &uSqr) any_platform
Computation of equilibrium distribution, second order in u.
Definition lbm.h:51

References olb::equilibrium< DESCRIPTOR >::secondOrder().

+ Here is the call graph for this function:

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