609 {
610 using V = typename CELL::template value_t<names::NavierStokes>::value_t;
611 using DESCRIPTOR = typename CELL::template value_t<names::NavierStokes>::descriptor_t;
612
613 auto& cellNS = cells.template get<names::NavierStokes>();
614 auto& cellCH = cells.template get<names::Component1>();
615
616 V phi = cellCH.template getFieldComponent<descriptors::STATISTIC>(0);
617 V mu = cellCH.template getField<descriptors::CHEM_POTENTIAL>();
620 V laplacePhi = 0;
621
622 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
625
626
627
633 }
634
635 auto rho_v =
parameters.template get<RHOS>()[0];
636 auto rho_l =
parameters.template get<RHOS>()[1];
637 V rho = rho_v + (rho_l-rho_v)*phi;
638 auto tau_v =
parameters.template get<TAUS>()[0];
639 auto tau_l =
parameters.template get<TAUS>()[1];
640 V tau = tau_v + (tau_l-tau_v)*phi;
641
642
644 V u[DESCRIPTOR::d] {};
645 forceNS += -phi*gradMu;
646
647
648 auto externalBlockForce = cellNS.template getField<descriptors::EXTERNAL_FORCE>();
649 cellNS.template setField<descriptors::FORCE>(externalBlockForce + forceNS/rho);
650 cellNS.template setField<descriptors::NABLARHO>((rho_l-rho_v)*gradPhi);
651 cellNS.template setField<descriptors::TAU_EFF>(tau);
652 cellNS.template setField<descriptors::RHO>(rho);
653
654 V source{};
655 cellNS.computeU(u);
656 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
657 source += gradPhi[iD]*u[iD];
658 }
659 V source_old = cellCH.template getField<descriptors::SOURCE_OLD>();
660 cellCH.template setField<descriptors::SOURCE>(1.5*source-0.5*source_old);
661 cellCH.template setField<descriptors::SOURCE_OLD>(source);
662 cellCH.template setField<descriptors::VELOCITY>(u);
663 }
constexpr T invCs2() any_platform
constexpr T t(unsigned iPop, tag::CUM) any_platform
constexpr int c(unsigned iPop, unsigned iDim) any_platform
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>
meta::list< TAUS, RHOS > parameters