OpenLB 1.7
Loading...
Searching...
No Matches
wallFunctionBoundaryPostProcessors3D.h
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2018 Marc Haussmann
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef WALLFUNCTION_BOUNDARY_POST_PROCESSORS_3D_H
25#define WALLFUNCTION_BOUNDARY_POST_PROCESSORS_3D_H
26
27#include "core/postProcessing.h"
30
31namespace olb {
32
33template <typename T>
35 /* Used method for density reconstruction
36 * 0: Zou-He (only for straight wall)
37 * 1: extrapolation (0th order)
38 * 2: constant (rho = 1.)
39 */
40 int rhoMethod = 1;
41
42 /* Used method for non-equilibrium particle distribution reconstruction
43 * 0: regularized NEBB (Latt, BounceBack, use for straight walls)
44 * 1: extrapolation NEQ (Guo Zhaoli, more precise, less stable)
45 * 2: regularized second order finite Differnce (for straight walls)
46 * 3: equilibrium scheme (less precise, more stability)
47 */
48 int fneqMethod = 1;
49
50 /* Used wall profile
51 * 0: Musker profile
52 * 1: power law profile
53 */
54 int wallProfile = 0;
55
58
60 bool curved = true;
61
63 bool useVanDriest = true;
64
66 T vonKarman = 0.375;
67
70};
71
73template <typename T, typename S>
74class Musker : public AnalyticalF<1,T,S> {
75private:
76 T _nu;
77 T _y;
78 T _rho;
79public:
80 Musker(T nu, T y, T rho);
81 bool operator() (T output[], const S tau_w[]);
82};
83
85template <typename T, typename S>
86class PowerLawProfile : public AnalyticalF<1,T,S> {
87private:
88 T _nu;
89 T _u2;
90 T _y2;
91 T _y1;
92 T _rho;
93public:
94 PowerLawProfile(T nu, T u2, T y2, T y1, T rho);
95 bool operator() (T output[], const S tau_w[]);
96};
97
98template<typename T, typename DESCRIPTOR>
100public:
101 WallFunctionBoundaryProcessor3D(int x0, int x1, int y0, int y1, int z0, int z1, BlockGeometry<T,3>& blockGeometryStructure,
102 std::vector<int> discreteNormal, std::vector<int> missingIndices,
104 IndicatorF3D<T>* geoIndicator);
105 virtual int extent() const
106 {
107 return 2;
108 }
109 virtual int extent(int whichDirection) const
110 {
111 return 2;
112 }
113 virtual void process(BlockLattice<T,DESCRIPTOR>& blockLattice);
114 virtual void processSubDomain ( BlockLattice<T,DESCRIPTOR>& blockLattice,
115 int x0_, int x1_, int y0_, int y1_, int z0_, int z1_ );
116 virtual void ComputeWallFunction(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z);
117private:
118 void getIndices(int index, int value, std::vector<int>& indices);
119 void calculateWallDistances(IndicatorF3D<T>* indicator);
120 // FD Difference Methods
121 void VelGradFromSecondOrderFD(bool NormalGradient, T Vel_BC[DESCRIPTOR::d], T Vel_1[DESCRIPTOR::d], T Vel_2[DESCRIPTOR::d], T VelGrad[DESCRIPTOR::d]);
122 void computeNeighborsU(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z,
123 T u_x1[DESCRIPTOR::d], T u_x2[DESCRIPTOR::d], T u_y1[DESCRIPTOR::d], T u_y2[DESCRIPTOR::d], T u_z1[DESCRIPTOR::d], T u_z2[DESCRIPTOR::d]);
124 void computeVelocityGradientTensor(T u_bc[DESCRIPTOR::d], T u_x1[DESCRIPTOR::d], T u_x2[DESCRIPTOR::d], T u_y1[DESCRIPTOR::d],
125 T u_y2[DESCRIPTOR::d], T u_z1[DESCRIPTOR::d], T u_z2[DESCRIPTOR::d], T VelGrad[DESCRIPTOR::d][DESCRIPTOR::d]);
126 void computeVelocityGradient(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z, T u_BC[DESCRIPTOR::d], T VelGrad[DESCRIPTOR::d][DESCRIPTOR::d]);
127 void ComputeUWallNeighbor(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z, T (&u)[DESCRIPTOR::d]);
128 void computeNeighborsRho(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z,
129 T u_x1[DESCRIPTOR::d], T u_x2[DESCRIPTOR::d], T u_y1[DESCRIPTOR::d], T u_y2[DESCRIPTOR::d], T u_z1[DESCRIPTOR::d], T u_z2[DESCRIPTOR::d],
130 T& rho_x1, T& rho_x2, T& rho_y1, T& rho_y2, T& rho_z1, T& rho_z2);
131 void computeNeighborsRhoU(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z,
132 T u_x1[DESCRIPTOR::d], T u_x2[DESCRIPTOR::d], T u_y1[DESCRIPTOR::d], T u_y2[DESCRIPTOR::d], T u_z1[DESCRIPTOR::d], T u_z2[DESCRIPTOR::d],
133 T& rho_x1, T& rho_x2, T& rho_y1, T& rho_y2, T& rho_z1, T& rho_z2);
134
135 // Van Driest Method
136 void computeVanDriestTauEff(T y_bc, T tau_w, T u_bc, T u_1, T u_2, T& tau_eff);
137 //
138 void ComputeUWall(BlockLattice<T,DESCRIPTOR>& blockLattice, int x, int y, int z, T u[DESCRIPTOR::d]);
139 void ComputeTauEff(BlockLattice<T,DESCRIPTOR>& blockLattice, Cell<T,DESCRIPTOR>& cell, int x, int y, int z, T u_bc[DESCRIPTOR::d]);
140 void ComputeRhoWall(BlockLattice<T,DESCRIPTOR>& blockLattice, Cell<T,DESCRIPTOR>& cell, int x, int y, int z, T u_bc[DESCRIPTOR::d], T& rho_bc);
141
142 // Methods FneqWall
143 void computeRFneqfromFneq(T fneq_bc[DESCRIPTOR::q]);
144 void computeFneqRNEBB(Cell<T,DESCRIPTOR>& cell, T u_bc[DESCRIPTOR::d], T rho_bc, T fneq_bc[DESCRIPTOR::q]);
145 void computeFneqENeq(BlockLattice<T,DESCRIPTOR>& blockLattice, Cell<T,DESCRIPTOR>& cell, int x, int y, int z, T u_bc[DESCRIPTOR::d], T rho_bc, T fneq_bc[DESCRIPTOR::q]);
146 void computeFneqRSOFD(BlockLattice<T,DESCRIPTOR>& blockLattice, Cell<T,DESCRIPTOR>& cell, int x, int y, int z, T u_bc[DESCRIPTOR::d], T rho_bc, T fneq_bc[DESCRIPTOR::q]);
147
148 void ComputeFneqWall(BlockLattice<T,DESCRIPTOR>& blockLattice, Cell<T,DESCRIPTOR>& cell, int x, int y, int z, T u_bc[DESCRIPTOR::d], T rho_bc, T fneq_bc[DESCRIPTOR::q]);
149
150 int x0, x1, y0, y1, z0, z1;
151 BlockGeometry<T,3>& _blockGeometryStructure;
152 std::vector<int> _discreteNormal;
153 std::vector<int> _missingIndices;
154 UnitConverter<T, DESCRIPTOR> const& _converter;
155 wallFunctionParam<T> const& _wallFunctionParam;
156
157 T y_1;
158 T y_2;
159
160 int discreteNormalX;
161 int discreteNormalY;
162 int discreteNormalZ;
163
164 int direction;
165 int orientation;
166 T unit_normal[3];
167 std::vector<int> onWallIndices;
168 std::vector<int> normalIndices;
169 std::vector<int> normalInwardsIndices;
170};
171
172
173template<typename T, typename DESCRIPTOR>
175public:
176 WallFunctionBoundaryProcessorGenerator3D(int x0, int x1, int y0, int y1, int z0, int z1, BlockGeometry<T,3>& blockGeometryStructure,
177 std::vector<int> discreteNormal, std::vector<int> missingIndices,
179 PostProcessor3D<T,DESCRIPTOR>* generate() const override;
181private:
182 BlockGeometry<T,3>& _blockGeometryStructure;
183 std::vector<int> _discreteNormal;
184 std::vector<int> _missingIndices;
185 UnitConverter<T, DESCRIPTOR> const& _converter;
186 wallFunctionParam<T> const& _wallFunctionParam;
187 IndicatorF3D<T>* _geoIndicator;
188};
189
190}
191
192
193
194#endif
AnalyticalF are applications from DD to XD, where X is set by the constructor.
Representation of a block geometry.
Platform-abstracted block lattice for external access and inter-block interaction.
Highest-level interface to Cell data.
Definition cell.h:148
IndicatorF3D is an application from .
bool operator()(T output[], const S tau_w[])
has to be implemented for 'every' derived class
PowerLawProfile(T nu, T u2, T y2, T y1, T rho)
bool operator()(T output[], const S tau_w[])
has to be implemented for 'every' derived class
Conversion between physical and lattice units, as well as discretization.
virtual int extent(int whichDirection) const
Extent of application area along a direction (0 or 1)
WallFunctionBoundaryProcessor3D(int x0, int x1, int y0, int y1, int z0, int z1, BlockGeometry< T, 3 > &blockGeometryStructure, std::vector< int > discreteNormal, std::vector< int > missingIndices, UnitConverter< T, DESCRIPTOR > const &converter, wallFunctionParam< T > const &wallFunctionParam, IndicatorF3D< T > *geoIndicator)
virtual int extent() const
Extent of application area (0 for purely local operations)
virtual void processSubDomain(BlockLattice< T, DESCRIPTOR > &blockLattice, int x0_, int x1_, int y0_, int y1_, int z0_, int z1_)
Execute post-processing step on a sublattice.
virtual void ComputeWallFunction(BlockLattice< T, DESCRIPTOR > &blockLattice, int x, int y, int z)
virtual void process(BlockLattice< T, DESCRIPTOR > &blockLattice)
Execute post-processing step.
PostProcessorGenerator3D< T, DESCRIPTOR > * clone() const override
WallFunctionBoundaryProcessorGenerator3D(int x0, int x1, int y0, int y1, int z0, int z1, BlockGeometry< T, 3 > &blockGeometryStructure, std::vector< int > discreteNormal, std::vector< int > missingIndices, UnitConverter< T, DESCRIPTOR > const &converter, wallFunctionParam< T > const &wallFunctionParam, IndicatorF3D< T > *geoIndicator)
PostProcessor3D< T, DESCRIPTOR > * generate() const override
Instantiation of Momenta tuples which define the computation and definition of momenta in a specific ...
Top level namespace for all of OpenLB.
Interface for post-processing steps – header file.
bool bodyForce
check if descriptor with body force is used
T latticeWalldistance
distance from cell to real wall in lattice units
bool curved
special formulation for straight boundaries
bool useVanDriest
use van Driest damping function in boundary cell, stabilizes LES
T vonKarman
von Karman constant for van Driest model (~0.3-0.5)