OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
olb::momenta::FixedPressureMomentum< 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::FixedPressureMomentum< 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::FixedPressureMomentum< 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.

Definition at line 463 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::FixedPressureMomentum< direction, orientation >::compute ( CELL & cell,
J & j )
inline

Definition at line 468 of file elements.h.

469 {
470 computeU<TYPE>(cell, j);
471 const V rho = TYPE().computeRho(cell);
472 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
473 j[iD] *= rho;
474 }
475 }

◆ 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::FixedPressureMomentum< direction, orientation >::computeU ( CELL & cell,
U & u )
inline

Definition at line 479 of file elements.h.

480 {
481 auto values = cell.template getField<VELOCITY>();
482 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
483 u[iD] = values[iD];
484 }
485 const V rho = TYPE().computeRho(cell);
486
487 constexpr auto onWallIndices = util::populationsContributingToVelocity<DESCRIPTOR,direction,0>();
488 constexpr auto normalIndices = util::populationsContributingToVelocity<DESCRIPTOR,direction,orientation>();
489
490 V rhoOnWall = V{};
491 for (auto e : onWallIndices) {
492 rhoOnWall += cell[e];
493 }
494
495 V rhoNormal = V{};
496 for (auto e : normalIndices) {
497 rhoNormal += cell[e];
498 }
499
500 u[direction] = orientation * ((V{2}*rhoNormal+rhoOnWall+V{1}) / rho-V{1});
501 }

◆ define()

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

Definition at line 505 of file elements.h.

506 {
507 cell.template setField<VELOCITY>(u);
508 }

◆ getName()

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

Definition at line 520 of file elements.h.

520 {
521 return "FixedPressureMomentum";
522 }

◆ 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::FixedPressureMomentum< direction, orientation >::initialize ( CELL & cell)
inline

Definition at line 511 of file elements.h.

512 {
513 V u[DESCRIPTOR::d] { V{} };
514 cell.template setField<VELOCITY>(u);
515 }

◆ inverseShift()

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

Definition at line 518 of file elements.h.

518{};

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