OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::momenta::OffBoundaryMomentum Struct Reference

For offLattice boundary conditions. More...

#include <elements.h>

+ Collaboration diagram for olb::momenta::OffBoundaryMomentum:

Classes

struct  DISTANCES
 
struct  VELOCITY
 
struct  VELOCITY_COEFFICIENTS
 

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 , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void define (CELL &cell, const U &u) any_platform
 
template<typename TYPE , typename CELL , 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

For offLattice boundary conditions.

Definition at line 1051 of file elements.h.

Member Function Documentation

◆ compute()

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

Definition at line 1057 of file elements.h.

1058 {
1059 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
1060 j[iD] = V{};
1061 }
1062 }

◆ computeU()

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

Definition at line 1065 of file elements.h.

1066 {
1067 const auto distances = cell.template getFieldPointer<DISTANCES>();
1068 const auto velocities = cell.template getFieldPointer<VELOCITY>();
1069
1070 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
1071 u[iD] = V{};
1072 }
1073 unsigned counter = 0;
1074 for (int iPop = 0; iPop < DESCRIPTOR::q; iPop++) {
1075 if ( !util::nearZero(distances[iPop]+1) ) {
1076 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
1077 u[iD] += velocities[3*iPop + iD];
1078 }
1079 counter++;
1080 }
1081 }
1082 if (counter!=0) {
1083 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
1084 u[iD] /= counter;
1085 }
1086 }
1087 }
bool nearZero(T a) any_platform
return true if a is close to zero
Definition util.h:402

References olb::util::nearZero().

+ Here is the call graph for this function:

◆ define()

template<typename TYPE , typename CELL , typename U , typename V = typename CELL::value_t, typename DESCRIPTOR = typename CELL::descriptor_t>
void olb::momenta::OffBoundaryMomentum::define ( CELL & cell,
const U & u )
inline

Definition at line 1090 of file elements.h.

1091 {
1092 const auto distances = cell.template getFieldPointer<DISTANCES>();
1093 auto velocities = cell.template getFieldPointer<VELOCITY>();
1094 auto velocityCoefficient = cell.template getFieldPointer<VELOCITY_COEFFICIENTS>();
1095
1096 for (int iPop = 0; iPop < DESCRIPTOR::q; iPop++) {
1097 if ( !util::nearZero(distances[iPop]+1) ) {
1098 velocityCoefficient[iPop] = 0;
1099 // scalar product of c(iPop) and u
1100 for (int sum = 0; sum < DESCRIPTOR::d; sum++) { // +/- problem because of first stream than postprocess
1101 velocityCoefficient[iPop] -= descriptors::c<DESCRIPTOR>(iPop,sum)*u[sum];
1102 }
1103 // compute summand for boundary condition
1104 velocityCoefficient[iPop] *= 2*descriptors::invCs2<V,DESCRIPTOR>() * descriptors::t<V,DESCRIPTOR>(iPop);
1105
1106 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
1107 velocities[3 * iPop + iD] = u[iD];
1108 }
1109 }
1110 }
1111 }
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

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

+ Here is the call graph for this function:

◆ getName()

static std::string olb::momenta::OffBoundaryMomentum::getName ( )
inlinestatic

Definition at line 1125 of file elements.h.

1125 {
1126 return "OffBoundaryMomentum";
1127 }

◆ initialize()

template<typename TYPE , typename CELL , typename DESCRIPTOR = typename CELL::descriptor_t>
void olb::momenta::OffBoundaryMomentum::initialize ( CELL & cell)
inline

Definition at line 1114 of file elements.h.

1115 {
1116 auto distances = cell.template getFieldPointer<DISTANCES>();
1117 for (int iPop = 0; iPop < DESCRIPTOR::q; iPop++) {
1118 distances[iPop] = -1;
1119 }
1120 }

◆ inverseShift()

template<typename TYPE , typename CELL , typename U >
void olb::momenta::OffBoundaryMomentum::inverseShift ( CELL & cell,
U & u )
inline

Definition at line 1123 of file elements.h.

1123{}

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