285 {
286 using V = typename CELL::template value_t<names::NavierStokes>::value_t;
287 using DESCRIPTOR = typename CELL::template value_t<names::NavierStokes>::descriptor_t;
288
289 auto& cellNS = cells.template get<names::NavierStokes>();
290 auto& cellAC = cells.template get<names::Component1>();
291
292 V phi = cellAC.template getFieldComponent<descriptors::STATISTIC>(0);
294 V laplacePhi = 0;
295
296 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
300 }
301
302 auto scale = cellNS.template getField<descriptors::SCALAR>();
305 auto rho_v =
parameters.template get<RHOS>()[0];
306 auto rho_l =
parameters.template get<RHOS>()[1];
307 V rho = rho_v + (rho_l-rho_v)*phi;
308 auto tau_v =
parameters.template get<TAUS>()[0];
309 auto tau_l =
parameters.template get<TAUS>()[1];
310 V tau = (tau_v + (tau_l-tau_v)*phi);
311 auto gamma =
parameters.template get<NONLOCALITY>();
312 auto tau_mobil =
parameters.template get<TAUS>()[2];
314
315
317 V u[DESCRIPTOR::d] {};
318
319 V k = 1.5*sigma*w;
320 V beta = 12*sigma/w;
321 V mu = 4*beta*phi*(phi-1.)*(phi-0.5)-k*laplacePhi;
322 forceNS += mu*gradPhi;
323 auto externalForce = cellNS.template getField<descriptors::EXTERNAL_FORCE>();
324 cellNS.template setField<descriptors::FORCE>(externalForce + forceNS/rho);
325 cellNS.template setField<descriptors::NABLARHO>((rho_l-rho_v)*gradPhi);
326 cellNS.template setField<descriptors::TAU_EFF>(tau);
327 cellNS.template setField<descriptors::RHO>(rho);
328 cellNS.computeU(u);
329
330 V psi = cellAC.template getField<descriptors::PSI>();
331 V interfaceIndicator = 0.;
332 if (
util::fabs(psi) < 3.*w) interfaceIndicator = 1;
337 V gradPhiSqr = 0;
338 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
339 gradPhiSqr += gradPhi[iD]*gradPhi[iD];
340 phiU[iD] = phi*u[iD];
341 }
342 if (gradPhiSqr >= 1e-28) {
344 }
345 old_phiU = cellAC.template getField<descriptors::OLD_PHIU>();
346 cellAC.template setField<descriptors::OLD_PHIU>(phiU);
347 V lambda = 4*phi*(1.-phi)/w;
348 V D_N = 4*beta/k*(interfaceIndicator-1.)*(phi*(phi-1.)*(phi-0.5)-gamma*(1.-phi)*phi);
349 V source_old = cellAC.template getField<descriptors::SOURCE_OLD>();
350 cellAC.template setField<descriptors::SOURCE_OLD>(M*D_N);
352 cellAC.template setField<descriptors::FORCE>(forceAC);
353 V source = 1.5*
M*D_N-0.5*source_old;
354 cellAC.template setField<descriptors::SOURCE>(source);
355 cellAC.template setField<descriptors::VELOCITY>(u);
356 }
platform_constant Fraction M[Q][Q]
constexpr T invCs2() any_platform
constexpr T t(unsigned iPop, tag::CUM) any_platform
constexpr int c(unsigned iPop, unsigned iDim) any_platform
T scale(std::function< T(const Vector< T, D > &)> sdf, const Vector< T, D > &p, T s, const Vector< T, D > ¢er=(T(0))) any_platform
Function to scale a geometry The object has to be placed in the origin of the coodinate system.
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>
meta::list< SIGMA, W, TAUS, RHOS, NONLOCALITY > parameters