OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::momenta::PressureBoundaryMomentum< direction, orientation > Struct Template Reference

The velocity is stored in the external field U, except for the component "direction", which is computed by means of the population and the pressure. More...

#include <elements.h>

+ Collaboration diagram for olb::momenta::PressureBoundaryMomentum< direction, orientation >:

Classes

struct  VELOCITY
 

Public Member Functions

template<typename TYPE , typename CELL , typename J , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void compute (CELL &cell, J &j) any_platform
 
template<typename TYPE , typename CELL , typename U , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void computeU (CELL &cell, U &u) any_platform
 
template<typename TYPE , typename CELL , typename U >
void define (CELL &cell, const U &u) any_platform
 
template<typename TYPE , typename CELL , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void initialize (CELL &cell) any_platform
 
template<typename TYPE , typename CELL , typename U >
void inverseShift (CELL &cell, U &u) any_platform
 

Static Public Member Functions

static std::string getName ()
 

Detailed Description

template<int direction, int orientation>
struct olb::momenta::PressureBoundaryMomentum< direction, orientation >

The velocity is stored in the external field U, except for the component "direction", which is computed by means of the population and the pressure.

This is for incompressible multi-phase models.

Definition at line 648 of file elements.h.

Member Function Documentation

◆ compute()

template<int direction, int orientation>
template<typename TYPE , typename CELL , typename J , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void olb::momenta::PressureBoundaryMomentum< direction, orientation >::compute ( CELL & cell,
J & j )
inline

Definition at line 653 of file elements.h.

654 {
655 computeU<TYPE>(cell, j);
656 auto rho = cell.template getField<descriptors::RHO>();
657 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
658 j[iD] *= rho;
659 }
660 }
void computeU(CELL &cell, U &u) any_platform
Definition elements.h:664

References olb::momenta::PressureBoundaryMomentum< direction, orientation >::computeU().

+ Here is the call graph for this function:

◆ computeU()

template<int direction, int orientation>
template<typename TYPE , typename CELL , typename U , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void olb::momenta::PressureBoundaryMomentum< direction, orientation >::computeU ( CELL & cell,
U & u )
inline

Definition at line 664 of file elements.h.

665 {
666 auto values = cell.template getField<VELOCITY>();
667 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
668 u[iD] = values[iD];
669 }
670 auto rho = cell.template getField<descriptors::RHO>();
671 auto gradRho = cell.template getField<descriptors::NABLARHO>();
672 //V rho = 10.;
673 //V gradRho[2] = {0.,0.};
674 auto force = cell.template getField<descriptors::FORCE>();
675 const V p = TYPE().computeRho(cell);
676
679
680 V popOnWall = V{};
681 for (auto e : onWallIndices) {
682 popOnWall += cell[e];
683 }
684 popOnWall -= cell[0];
685
686 V popNormal = V{};
687 for (auto e : normalIndices) {
688 popNormal += cell[e];
689 }
690
693 V pops = V{2}*popNormal+popOnWall;
694 V term = cs2*(V{2}*rho-gradRho[direction])/(V{2}*rho*w0);
695 V otherU = 0;
696 for (int iDim = 1; iDim < DESCRIPTOR::d; ++iDim) {
697 u[(direction+iDim)%DESCRIPTOR::d] = 0.5/rho*force[(direction+iDim)%DESCRIPTOR::d];
698 otherU += cs2*0.5*u[(direction+iDim)%DESCRIPTOR::d]*gradRho[(direction+iDim)%DESCRIPTOR::d]
699 -0.5*w0*rho*u[(direction+iDim)%DESCRIPTOR::d]*u[(direction+iDim)%DESCRIPTOR::d];
700 }
701 u[direction] = orientation*(-term + util::sqrt(term*term + V{2}/rho/w0*(cs2*(pops+0.5*force[direction])-(V{1}-w0)*p+otherU)));
702 }
platform_constant Fraction cs2
Definition functions.h:66
constexpr T invCs2() any_platform
Definition functions.h:107
constexpr T t(unsigned iPop, tag::CUM) any_platform
Definition cum.h:108
Expr sqrt(Expr x)
Definition expr.cpp:225
constexpr auto populationsContributingToVelocity() any_platform
Return array of population indices where c[iVel] == value.
Definition util.h:222

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ define()

template<int direction, int orientation>
template<typename TYPE , typename CELL , typename U >
void olb::momenta::PressureBoundaryMomentum< direction, orientation >::define ( CELL & cell,
const U & u )
inline

Definition at line 706 of file elements.h.

707 {
708 cell.template setField<VELOCITY>(u);
709 }

◆ getName()

template<int direction, int orientation>
static std::string olb::momenta::PressureBoundaryMomentum< direction, orientation >::getName ( )
inlinestatic

Definition at line 721 of file elements.h.

721 {
722 return "PressureBoundaryMomentum";
723 }

◆ initialize()

template<int direction, int orientation>
template<typename TYPE , typename CELL , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void olb::momenta::PressureBoundaryMomentum< direction, orientation >::initialize ( CELL & cell)
inline

Definition at line 712 of file elements.h.

713 {
714 V u[DESCRIPTOR::d] { V{} };
715 cell.template setField<VELOCITY>(u);
716 }

◆ inverseShift()

template<int direction, int orientation>
template<typename TYPE , typename CELL , typename U >
void olb::momenta::PressureBoundaryMomentum< direction, orientation >::inverseShift ( CELL & cell,
U & u )
inline

Definition at line 719 of file elements.h.

719{};

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