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
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
95
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
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
117
118
119 auto externalBlockForce = cellA.template getField<descriptors::EXTERNAL_FORCE>();
120 auto externalPartnerForce = cellB.template getField<descriptors::EXTERNAL_FORCE>();
121
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.