OpenLB 1.7
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
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 810 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 816 of file elements.h.

817 {
818 for (int iD=0; iD<DESCRIPTOR::d; ++iD) {
819 j[iD] = V{};
820 }
821 }

◆ 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 824 of file elements.h.

825 {
826 const auto distances = cell.template getFieldPointer<DISTANCES>();
827 const auto velocities = cell.template getFieldPointer<VELOCITY>();
828
829 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
830 u[iD] = V{};
831 }
832 unsigned counter = 0;
833 for (int iPop = 0; iPop < DESCRIPTOR::q; iPop++) {
834 if ( !util::nearZero(distances[iPop]+1) ) {
835 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
836 u[iD] += velocities[3*iPop + iD];
837 }
838 counter++;
839 }
840 }
841 if (counter!=0) {
842 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
843 u[iD] /= counter;
844 }
845 }
846 }
bool nearZero(const ADf< T, DIM > &a)
Definition aDiff.h:1087

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 849 of file elements.h.

850 {
851 const auto distances = cell.template getFieldPointer<DISTANCES>();
852 auto velocities = cell.template getFieldPointer<VELOCITY>();
853 auto velocityCoefficient = cell.template getFieldPointer<VELOCITY_COEFFICIENTS>();
854
855 for (int iPop = 0; iPop < DESCRIPTOR::q; iPop++) {
856 if ( !util::nearZero(distances[iPop]+1) ) {
857 velocityCoefficient[iPop] = 0;
858 // scalar product of c(iPop) and u
859 for (int sum = 0; sum < DESCRIPTOR::d; sum++) { // +/- problem because of first stream than postprocess
860 velocityCoefficient[iPop] -= descriptors::c<DESCRIPTOR>(iPop,sum)*u[sum];
861 }
862 // compute summand for boundary condition
863 velocityCoefficient[iPop] *= 2*descriptors::invCs2<V,DESCRIPTOR>() * descriptors::t<V,DESCRIPTOR>(iPop);
864
865 for (int iD = 0; iD < DESCRIPTOR::d; iD++) {
866 velocities[3 * iPop + iD] = u[iD];
867 }
868 }
869 }
870 }

References olb::util::nearZero().

+ Here is the call graph for this function:

◆ getName()

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

Definition at line 884 of file elements.h.

884 {
885 return "OffBoundaryMomentum";
886 }

◆ initialize()

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

Definition at line 873 of file elements.h.

874 {
875 auto distances = cell.template getFieldPointer<DISTANCES>();
876 for (int iPop = 0; iPop < DESCRIPTOR::q; iPop++) {
877 distances[iPop] = -1;
878 }
879 }

◆ inverseShift()

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

Definition at line 882 of file elements.h.

882{}

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