OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::LiangPostProcessor Struct Reference

#include <phaseFieldCoupling.h>

+ Collaboration diagram for olb::LiangPostProcessor:

Classes

struct  RHOS
 
struct  SIGMA
 
struct  SWITCH
 
struct  TAUS
 
struct  W
 

Public Types

using parameters = meta::list<SIGMA,W,TAUS,RHOS,SWITCH>
 

Public Member Functions

int getPriority () const
 
template<typename CELL , typename PARAMETERS >
void apply (CELL &cells, PARAMETERS &parameters) any_platform
 

Static Public Attributes

static constexpr OperatorScope scope = OperatorScope::PerCellWithParameters
 

Detailed Description

Definition at line 500 of file phaseFieldCoupling.h.

Member Typedef Documentation

◆ parameters

Member Function Documentation

◆ apply()

template<typename CELL , typename PARAMETERS >
void olb::LiangPostProcessor::apply ( CELL & cells,
PARAMETERS & parameters )
inline

Definition at line 514 of file phaseFieldCoupling.h.

515 {
516 using V = typename CELL::template value_t<names::NavierStokes>::value_t;
517 using DESCRIPTOR = typename CELL::template value_t<names::NavierStokes>::descriptor_t;
518
519 auto& cellNS = cells.template get<names::NavierStokes>();
520 auto& cellAC = cells.template get<names::Component1>();
521
522 V phi = cellAC.template getFieldComponent<descriptors::STATISTIC>(0);
523 Vector<V,DESCRIPTOR::d> gradPhi{};
524 V laplacePhi = 0;
525 //TODO: use lattice gradient schemes here from Cahn-Hilliard implementation
526 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
527 const V phi_i = cellAC.neighbor(descriptors::c<DESCRIPTOR>(iPop)).template getFieldComponent<descriptors::STATISTIC>(0);
529 gradPhi += phi_i * descriptors::c<DESCRIPTOR>(iPop) * tcs2;
530 laplacePhi += 2*(phi_i - phi) * tcs2;
531 }
532
533 auto scale = cellNS.template getField<descriptors::SCALAR>();
534 auto sigma = parameters.template get<SIGMA>()*scale;
535 auto w = parameters.template get<W>();
536 auto rho_v = parameters.template get<RHOS>()[0];
537 auto rho_l = parameters.template get<RHOS>()[1];
538 V rho = rho_v + (rho_l-rho_v)*phi;
539 auto tau_v = parameters.template get<TAUS>()[0];
540 auto tau_l = parameters.template get<TAUS>()[1];
541 V tau = (tau_v + (tau_l-tau_v)*phi)*scale + (1-scale)*5.;
542
543 // Computation and storage of forces
544 Vector<V,DESCRIPTOR::d> forceNS{};
545 V u[DESCRIPTOR::d] {};
546 V k = 1.5*sigma*w;
547 V beta = 12*sigma/w;
548 V mu = 4*beta*phi*(phi-1.)*(phi-0.5)-k*laplacePhi;
549 forceNS += mu*gradPhi;
550 auto externalForce = cellNS.template getField<descriptors::EXTERNAL_FORCE>();
551 cellNS.template setField<descriptors::FORCE>(externalForce + forceNS/rho);
552 cellNS.template setField<descriptors::NABLARHO>((rho_l-rho_v)*gradPhi);
553 cellNS.template setField<descriptors::TAU_EFF>(tau);
554 cellNS.template setField<descriptors::RHO>(rho);
555 cellNS.computeU(u);
556
557 Vector<V,DESCRIPTOR::d> forceAC{};
558 Vector<V,DESCRIPTOR::d> old_phiU{};
561 auto velo_switch = parameters.template get<SWITCH>();
562 V gradPhiSqr = 0;
563 for (int iD=0; iD < DESCRIPTOR::d; ++iD) {
564 gradPhiSqr += gradPhi[iD]*gradPhi[iD];
565 u[iD] *= velo_switch;
566 phiU[iD] = phi*u[iD];
567 }
568 if (gradPhiSqr >= 1e-28) {
569 n += gradPhi/util::sqrt(gradPhiSqr);
570 }
571 old_phiU = cellAC.template getField<descriptors::OLD_PHIU>();
572 cellAC.template setField<descriptors::OLD_PHIU>(phiU);
573 V lambda = 4*phi*(1.-phi)/w;
574 forceAC += (phiU - old_phiU) + lambda*n/descriptors::invCs2<V,DESCRIPTOR>();
575 cellAC.template setField<descriptors::FORCE>(forceAC);
576 cellAC.template setField<descriptors::VELOCITY>(u);
577 }
constexpr T invCs2() any_platform
Definition functions.h:107
constexpr T t(unsigned iPop, tag::CUM) any_platform
Definition cum.h:108
constexpr int c(unsigned iPop, unsigned iDim) any_platform
Definition functions.h:83
T scale(std::function< T(const Vector< T, D > &)> sdf, const Vector< T, D > &p, T s, const Vector< T, D > &center=(T(0))) any_platform
Function to scale a geometry The object has to be placed in the origin of the coodinate system.
Definition sdf.h:477
Expr sqrt(Expr x)
Definition expr.cpp:225
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>
meta::list< SIGMA, W, TAUS, RHOS, SWITCH > parameters

References olb::descriptors::c(), olb::descriptors::invCs2(), olb::util::sqrt(), and olb::descriptors::t().

+ Here is the call graph for this function:

◆ getPriority()

int olb::LiangPostProcessor::getPriority ( ) const
inline

Definition at line 509 of file phaseFieldCoupling.h.

509 {
510 return 0;
511 }

Member Data Documentation

◆ scope

OperatorScope olb::LiangPostProcessor::scope = OperatorScope::PerCellWithParameters
staticconstexpr

Definition at line 501 of file phaseFieldCoupling.h.


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