OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
olb::ShanChenForcedPostProcessor< POTENTIAL > Struct Template Reference

#include <shanChenForcedPostProcessor.h>

+ Collaboration diagram for olb::ShanChenForcedPostProcessor< POTENTIAL >:

Classes

struct  G
 
struct  OMEGA_A
 
struct  OMEGA_B
 
struct  RHO0
 

Public Types

using parameters
 

Public Member Functions

template<typename CELLS , typename PARAMETERS >
void apply (CELLS &cells, PARAMETERS &parameters) any_platform
 

Static Public Attributes

static constexpr OperatorScope scope = OperatorScope::PerCellWithParameters
 

Detailed Description

template<typename POTENTIAL>
struct olb::ShanChenForcedPostProcessor< POTENTIAL >

Definition at line 61 of file shanChenForcedPostProcessor.h.

Member Typedef Documentation

◆ parameters

template<typename POTENTIAL >
using olb::ShanChenForcedPostProcessor< POTENTIAL >::parameters
Initial value:
typename POTENTIAL::parameters::template decompose_into<
meta::list<RHO0,G,OMEGA_A,OMEGA_B>::template include
>

Definition at line 69 of file shanChenForcedPostProcessor.h.

Member Function Documentation

◆ apply()

template<typename POTENTIAL >
template<typename CELLS , typename PARAMETERS >
void olb::ShanChenForcedPostProcessor< POTENTIAL >::apply ( CELLS & cells,
PARAMETERS & parameters )
inline

Definition at line 74 of file shanChenForcedPostProcessor.h.

75 {
76 using V = typename CELLS::template value_t<names::A>::value_t;
77 using DESCRIPTOR = typename CELLS::template value_t<names::A>::descriptor_t;
78
79 auto& cellA = cells.template get<names::A>();
80 auto& cellB = cells.template get<names::B>();
81
82 auto rho0 = parameters.template get<RHO0>();
83
84 Vector<V,2> rhoField{
85 cellA.template getFieldComponent<descriptors::STATISTIC>(0) * rho0[0],
86 cellB.template getFieldComponent<descriptors::STATISTIC>(0) * rho0[1]
87 };
88 Vector<V,DESCRIPTOR::d> uA{};
90 Vector<V,DESCRIPTOR::d> uB{};
92
93 V omegaA = parameters.template get<OMEGA_A>();
94 V omegaB = parameters.template get<OMEGA_B>();
95 // Computation of the common velocity, shared among the two populations
96 V rhoTot = rhoField[0]*omegaA
97 + rhoField[1]*omegaB;
98
99 Vector<V,DESCRIPTOR::d> uTot = (uA*rho0[0]*omegaA + uB*rho0[1]*omegaB) / rhoTot;
100
101 // Computation of the interaction potential
102 Vector<V,DESCRIPTOR::d> rhoBlockContribution{};
103 Vector<V,DESCRIPTOR::d> rhoPartnerContribution{};
104 V psi1 = POTENTIAL().compute(rhoField[0], parameters);
105 V psi2 = POTENTIAL().compute(rhoField[1], parameters);
106
107 for (int iPop = 0; iPop < DESCRIPTOR::q; ++iPop) {
108 auto nextCellA = cellA.neighbor(descriptors::c<DESCRIPTOR>(iPop));
109 auto nextCellB = cellB.neighbor(descriptors::c<DESCRIPTOR>(iPop));
110 V rhoA = POTENTIAL().compute(nextCellA.template getFieldComponent<descriptors::STATISTIC>(0)*rho0[0], parameters);
111 V rhoB = POTENTIAL().compute(nextCellB.template getFieldComponent<descriptors::STATISTIC>(0)*rho0[1], parameters);
112 rhoBlockContribution += psi2 * rhoA * descriptors::c<DESCRIPTOR>(iPop) * descriptors::t<V,DESCRIPTOR>(iPop);
113 rhoPartnerContribution += psi1 * rhoB * descriptors::c<DESCRIPTOR>(iPop) * descriptors::t<V,DESCRIPTOR>(iPop);
114 }
115
116 // Computation and storage of the final velocity, consisting
117 // of u and the momentum difference due to interaction
118 // potential plus external force
119 auto externalBlockForce = cellA.template getField<descriptors::EXTERNAL_FORCE>();
120 auto externalPartnerForce = cellB.template getField<descriptors::EXTERNAL_FORCE>();
121
122 auto g = parameters.template get<G>();
123
124 cellA.template setField<descriptors::VELOCITY>(uTot);
125 cellB.template setField<descriptors::VELOCITY>(uTot);
126 cellA.template setField<descriptors::FORCE>(externalBlockForce
127 - g*rhoPartnerContribution/rhoField[0]);
128 cellB.template setField<descriptors::FORCE>(externalPartnerForce
129 - g*rhoBlockContribution/rhoField[1]);
130 }
typename POTENTIAL::parameters::template decompose_into< meta::list< RHO0, G, OMEGA_A, OMEGA_B >::template include > parameters
static void computeJ(CELL &cell, J &j) any_platform
Computation of momentum.
Definition lbm.h:197

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

+ Here is the call graph for this function:

Member Data Documentation

◆ scope

template<typename POTENTIAL >
constexpr OperatorScope olb::ShanChenForcedPostProcessor< POTENTIAL >::scope = OperatorScope::PerCellWithParameters
staticconstexpr

Definition at line 62 of file shanChenForcedPostProcessor.h.


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