OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation > Class Template Reference

This class computes a convection BC on a flat wall in 2D. More...

#include <boundaryPostProcessors2D.h>

+ Collaboration diagram for olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >:

Classes

struct  PREV_CELL
 

Public Member Functions

int getPriority () const
 
template<concepts::DynamicCell CELL>
void initialize (CELL &cell) any_platform
 
template<concepts::DynamicCell CELL>
void apply (CELL &cell) any_platform
 

Static Public Attributes

static constexpr OperatorScope scope = OperatorScope::PerCell
 

Detailed Description

template<typename T, typename DESCRIPTOR, int direction, int orientation>
class olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >

This class computes a convection BC on a flat wall in 2D.

Definition at line 284 of file boundaryPostProcessors2D.h.

Member Function Documentation

◆ apply()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
template<concepts::DynamicCell CELL>
void olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >::apply ( CELL & cell)

Definition at line 108 of file boundaryPostProcessors2D.hh.

109{
110 using V = typename CELL::value_t;
111 constexpr auto missing =
112 util::populationsContributingToVelocity<DESCRIPTOR, direction,
113 -orientation>();
114
115 auto prevCell = cell.template getField<PREV_CELL>();
116
117 for (unsigned i = 0; i < missing.size(); ++i) {
118 cell[missing[i]] = prevCell[i];
119 }
120
121 V rho0, u0[2];
122 V rho1, u1[2];
123 V rho2, u2[2];
124
125 cell.computeRhoU(rho0, u0);
126
127 static_assert(direction == 0 || direction == 1
128 ,"Direction must be one of 0 or 1 in 2D");
129 if constexpr (direction == 0) {
130 cell.neighbor({-orientation, 0}).computeRhoU(rho1, u1);
131 cell.neighbor({-orientation * 2, 0}).computeRhoU(rho2, u2);
132 }
133 else if constexpr (direction == 1) {
134 cell.neighbor({0, -orientation}).computeRhoU(rho1, u1);
135 cell.neighbor({0, -orientation * 2}).computeRhoU(rho2, u2);
136 }
137
138 V uDelta[2];
139 V uAverage = rho0 * u0[direction];
140
141 uDelta[0] =
142 -uAverage * 0.5 * (3 * rho0 * u0[0] - 4 * rho1 * u1[0] + rho2 * u2[0]);
143 uDelta[1] =
144 -uAverage * 0.5 * (3 * rho0 * u0[1] - 4 * rho1 * u1[1] + rho2 * u2[1]);
145
146 for (unsigned i = 0; i < missing.size(); ++i) {
147 auto iPop = missing[i];
148 prevCell[i] =
151 (uDelta[0] * descriptors::c<DESCRIPTOR>(iPop, 0) +
152 uDelta[1] * descriptors::c<DESCRIPTOR>(iPop, 1));
153 }
154
155 cell.template setField<PREV_CELL>(prevCell);
156}
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
constexpr auto populationsContributingToVelocity() any_platform
Return array of population indices where c[iVel] == value.
Definition util.h:222

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

+ Here is the call graph for this function:

◆ getPriority()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
int olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >::getPriority ( ) const
inline

Definition at line 294 of file boundaryPostProcessors2D.h.

294 {
295 return 0;
296 }

◆ initialize()

template<typename T , typename DESCRIPTOR , int direction, int orientation>
template<concepts::DynamicCell CELL>
void olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >::initialize ( CELL & cell)

Definition at line 94 of file boundaryPostProcessors2D.hh.

95{
96 constexpr auto missing =
97 util::populationsContributingToVelocity<DESCRIPTOR, direction,
98 -orientation>();
99 auto prevCell = cell.template getFieldPointer<PREV_CELL>();
100 for (unsigned i = 0; i < missing.size(); ++i) {
101 prevCell[i] = cell[missing[i]];
102 }
103}

References olb::util::populationsContributingToVelocity().

+ Here is the call graph for this function:

Member Data Documentation

◆ scope

template<typename T , typename DESCRIPTOR , int direction, int orientation>
OperatorScope olb::StraightConvectionBoundaryProcessor2D< T, DESCRIPTOR, direction, orientation >::scope = OperatorScope::PerCell
staticconstexpr

Definition at line 286 of file boundaryPostProcessors2D.h.


The documentation for this class was generated from the following files: