VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
F16AdvectionDiffusion.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32
33#include <basics/DataTypes.h>
35
39#include <lbm/constants/D3Q27.h>
40
41#include "CollisionParameter.h"
42
43
45{
46
48{
49 using namespace vf::basics::constant;
50 using namespace dir;
51
55 real f000 = parameters.distribution[d000];
56 real fP00 = parameters.distribution[dP00];
57 real fM00 = parameters.distribution[dM00];
58 real f0P0 = parameters.distribution[d0P0];
59 real f0M0 = parameters.distribution[d0M0];
60 real f00P = parameters.distribution[d00P];
61 real f00M = parameters.distribution[d00M];
62 real fPP0 = parameters.distribution[dPP0];
63 real fMM0 = parameters.distribution[dMM0];
64 real fPM0 = parameters.distribution[dPM0];
65 real fMP0 = parameters.distribution[dMP0];
66 real fP0P = parameters.distribution[dP0P];
67 real fM0M = parameters.distribution[dM0M];
68 real fP0M = parameters.distribution[dP0M];
69 real fM0P = parameters.distribution[dM0P];
70 real f0PP = parameters.distribution[d0PP];
71 real f0MM = parameters.distribution[d0MM];
72 real f0PM = parameters.distribution[d0PM];
73 real f0MP = parameters.distribution[d0MP];
74 real fPPP = parameters.distribution[dPPP];
75 real fMPP = parameters.distribution[dMPP];
76 real fPMP = parameters.distribution[dPMP];
77 real fMMP = parameters.distribution[dMMP];
78 real fPPM = parameters.distribution[dPPM];
79 real fMPM = parameters.distribution[dMPM];
80 real fPMM = parameters.distribution[dPMM];
81 real fMMM = parameters.distribution[dMMM];
82
86 real& m211 = fP00;
87 real& m011 = fM00;
88 real& m121 = f0P0;
89 real& m101 = f0M0;
90 real& m112 = f00P;
91 real& m110 = f00M;
92 real& m221 = fPP0;
93 real& m001 = fMM0;
94 real& m201 = fPM0;
95 real& m021 = fMP0;
96 real& m212 = fP0P;
97 real& m010 = fM0M;
98 real& m210 = fP0M;
99 real& m012 = fM0P;
100 real& m122 = f0PP;
101 real& m100 = f0MM;
102 real& m120 = f0PM;
103 real& m102 = f0MP;
104 real& m111 = f000;
105 real& m222 = fPPP;
106 real& m002 = fMMP;
107 real& m202 = fPMP;
108 real& m022 = fMPP;
109 real& m220 = fPPM;
110 real& m000 = fMMM;
111 real& m200 = fPMM;
112 real& m020 = fMPM;
113
114 const real concentration = vf::lbm::getDensity(parameters.distribution);
115
117 // calculate the square of velocities for this lattice node
118 const real vvx = parameters.velocityX;
119 const real vvy = parameters.velocityY;
120 const real vvz = parameters.velocityZ;
121
122 const real vx2 = vvx * vvx;
123 const real vy2 = vvy * vvy;
124 const real vz2 = vvz * vvz;
125
132 // Z - Dir
142
144 // Y - Dir
154
156 // X - Dir
166
172
173 // linearized orthogonalization of 3rd order central moments
174 real M012 = m012 - m010 * c1o3;
175 real M120 = m120 - m100 * c1o3;
176 real M021 = m021 - m001 * c1o3;
177 real M210 = m210 - m010 * c1o3;
178 real M201 = m201 - m001 * c1o3;
179 real M102 = m102 - m100 * c1o3;
180 // linearized orthogonalization of 5th order central moments
181 real M212 = m212 - m010 * c1o9;
182 real M122 = m122 - m100 * c1o9;
183 real M221 = m221 - m001 * c1o9;
184
185 // collision of 1st order moments
186 m100 *= c1o1 - parameters.omega;
187 m010 *= c1o1 - parameters.omega;
188 m001 *= c1o1 - parameters.omega;
189
190 // equilibration of 3rd order moments
191 M012 = c0o1;
192 M120 = c0o1;
193 M021 = c0o1;
194 M210 = c0o1;
195 M201 = c0o1;
196 M102 = c0o1;
197 m111 = c0o1;
198
199 // equilibration of 5th order moments
200 M212 = c0o1;
201 M122 = c0o1;
202 M221 = c0o1;
203
204 // equilibration of 2nd order moments
205 m110 = c0o1;
206 m101 = c0o1;
207 m011 = c0o1;
208
209 m200 = c1o3 * concentration;
210 m020 = c1o3 * concentration;
211 m002 = c1o3 * concentration;
212
213 // equilibration of 4th order moments
214 m022 = c1o9 * concentration;
215 m202 = c1o9 * concentration;
216 m220 = c1o9 * concentration;
217
218 m211 = c0o1;
219 m121 = c0o1;
220 m112 = c0o1;
221
222 // equilibration of 6th order moment
223 m222 = c1o27 * concentration;
224
225 // from linearized orthogonalization 3rd order central moments to central moments
226 m012 = M012 + m010 * c1o3;
227 m120 = M120 + m100 * c1o3;
228 m021 = M021 + m001 * c1o3;
229 m210 = M210 + m010 * c1o3;
230 m201 = M201 + m001 * c1o3;
231 m102 = M102 + m100 * c1o3;
232
233 // from linearized orthogonalization 5th order central moments to central moments
234 m212 = M212 + m010 * c1o9;
235 m122 = M122 + m100 * c1o9;
236 m221 = M221 + m001 * c1o9;
237
244 // X - Dir
254
256 // Y - Dir
266
268 // Z - Dir
278
279 parameters.distribution[dP00] = fP00;
280 parameters.distribution[dM00] = fM00;
281 parameters.distribution[d0P0] = f0P0;
282 parameters.distribution[d0M0] = f0M0;
283 parameters.distribution[d00P] = f00P;
284 parameters.distribution[d00M] = f00M;
285 parameters.distribution[dPP0] = fPP0;
286 parameters.distribution[dMM0] = fMM0;
287 parameters.distribution[dPM0] = fPM0;
288 parameters.distribution[dMP0] = fMP0;
289 parameters.distribution[dP0P] = fP0P;
290 parameters.distribution[dM0M] = fM0M;
291 parameters.distribution[dP0M] = fP0M;
292 parameters.distribution[dM0P] = fM0P;
293 parameters.distribution[d0PP] = f0PP;
294 parameters.distribution[d0MM] = f0MM;
295 parameters.distribution[d0PM] = f0PM;
296 parameters.distribution[d0MP] = f0MP;
297 parameters.distribution[d000] = f000;
298 parameters.distribution[dPPP] = fPPP;
299 parameters.distribution[dPMP] = fPMP;
300 parameters.distribution[dPPM] = fPPM;
301 parameters.distribution[dPMM] = fPMM;
302 parameters.distribution[dMPP] = fMPP;
303 parameters.distribution[dMMP] = fMMP;
304 parameters.distribution[dMPM] = fMPM;
305 parameters.distribution[dMMM] = fMMM;
306
307 parameters.concentration = concentration;
308}
310
311}
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
constexpr void runF16AdvectionDiffusion(ADCollisionParameter &parameters)
constexpr void backwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2)
backward chimera transformation backwardChimera Transformation from central moments to distributions ...
constexpr real getDensity(const real *const &f)
constexpr void forwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2)
forward chimera transformation forwardChimera Transformation from distributions to central moments ac...