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

#include <phaseFieldCoupling.h>

+ Collaboration diagram for olb::AllenCahnOutletCoupling:

Classes

struct  NORMAL
 
struct  SIGMA
 
struct  W
 

Public Types

using parameters = meta::list<SIGMA,W,NORMAL>
 

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 382 of file phaseFieldCoupling.h.

Member Typedef Documentation

◆ parameters

Member Function Documentation

◆ apply()

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

Definition at line 394 of file phaseFieldCoupling.h.

395 {
396 using V = typename CELL::template value_t<names::NavierStokes>::value_t;
397 using DESCRIPTOR = typename CELL::template value_t<names::NavierStokes>::descriptor_t;
398
399 auto& cellNS = cells.template get<names::NavierStokes>();
400 auto& cellAC = cells.template get<names::Component1>();
401
402 auto w = parameters.template get<W>();
403 auto sigma = parameters.template get<SIGMA>();
404 Vector<int, DESCRIPTOR::d> normal = parameters.template get<NORMAL>();
405 auto rho = cellNS.template getField<descriptors::RHO>();
406 auto nablaRho = cellNS.template getField<descriptors::NABLARHO>();
407
408 V phi = cellAC.template getFieldComponent<descriptors::STATISTIC>(0);
409 auto cellAC_n1 = cellAC.neighbor({-normal[0],-normal[1]});
410 auto cellNS_n1 = cellNS.neighbor({-normal[0],-normal[1]});
411 V phi_n1 = cellAC_n1.template getFieldComponent<descriptors::STATISTIC>(0);
412 Vector<V,DESCRIPTOR::d> gradPhi{};
413 V laplacePhi = 0;
414
415 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
416 const V phi_i = cellAC.neighbor(descriptors::c<DESCRIPTOR>(iPop)).template getFieldComponent<descriptors::STATISTIC>(0);
418 laplacePhi += 2*(phi_i - phi) * descriptors::t<V,DESCRIPTOR>(iPop) * descriptors::invCs2<V,DESCRIPTOR>();
419 }
420 V laplacePhi_n1 = 0;
421 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
422 const V phi_i_n1 = cellAC_n1.neighbor(descriptors::c<DESCRIPTOR>(iPop)).template getFieldComponent<descriptors::STATISTIC>(0);
423 laplacePhi_n1 += 2*(phi_i_n1 - phi_n1) * descriptors::t<V,DESCRIPTOR>(iPop) * descriptors::invCs2<V,DESCRIPTOR>();
424 }
425
426 // Computation of thermodynamic pressure and update populations
427 V k = 1.5*sigma*w;
428 V beta = 12*sigma/w;
429 V mu = 4*beta*phi*(phi-1.)*(phi-0.5)-k*laplacePhi;
430 V mu_n1 = 4*beta*phi_n1*(phi_n1-1.)*(phi_n1-0.5)-k*laplacePhi_n1;
431
432 V u[DESCRIPTOR::d] {};
433 //cellAC_n1.computeU(u);
434 V rhoU = u[0]*nablaRho[0]+u[1]*nablaRho[1];
435 V p_n1 = cellNS_n1.computeRho();
436 V p_n2 = cellNS.neighbor({-2*normal[0],-2*normal[1]}).computeRho();
437 V p_old = cellNS.computeRho();
438 V p_out = (p_n1 + (mu+mu_n1)/2*(phi-phi_n1));//0.8*(0.25*sigma*curv*(2*phi-1)*((2*phi-1)*(2*phi-1)-3)+0.5*sigma*curv);
439 //V p_star = p_out;
440 if (phi >= 0.95) {
441 p_out = 0;
442 }
443 //V p_star = p_out-3./10.*rhoU;
444 cellNS.defineRho(p_out);
445 for (int iPop=0; iPop < DESCRIPTOR::q; ++iPop) {
446 cellNS[iPop] += descriptors::t<V,DESCRIPTOR>(iPop) * descriptors::invCs2<V,DESCRIPTOR>() * (p_out-p_old);
447 }
448 }
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
Distribution< T > normal(T mean, T stddev)
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>
meta::list< SIGMA, W, NORMAL > parameters

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

+ Here is the call graph for this function:

◆ getPriority()

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

Definition at line 389 of file phaseFieldCoupling.h.

389 {
390 return 0;
391 }

Member Data Documentation

◆ scope

OperatorScope olb::AllenCahnOutletCoupling::scope = OperatorScope::PerCellWithParameters
staticconstexpr

Definition at line 383 of file phaseFieldCoupling.h.


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