VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
InterpolationAdvectionDiffusionCF.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#ifndef ADVECTION_DIFFUSION_INTERPOLATION_CF_H
34#define ADVECTION_DIFFUSION_INTERPOLATION_CF_H
35
36
38
39#include "lbm/constants/D3Q27.h"
40
42
44
45namespace vf::lbm::ad
46{
47
49 real* const populations,
50 real* populationsAD,
52 const real& epsnew,
54 const real& x,
55 const real& y,
56 const real& z)
57{
58 using namespace ::vf::basics::constant;
59 using namespace ::vf::lbm::dir;
60
61 const real &d000 = coefficients.d000;
62 const real &d100 = coefficients.d100;
63 const real &d010 = coefficients.d010;
64 const real &d001 = coefficients.d001;
65 const real &d200 = coefficients.d200, &d020 = coefficients.d020, &d002 = coefficients.d002;
66 const real &d110 = coefficients.d110, &d101 = coefficients.d101, &d011 = coefficients.d011;
67 const real &d111 = coefficients.d111;
68
72 real m111 = c0o1;
73 real m211 = c0o1;
74 real m011 = c0o1;
75 real m121 = c0o1;
76 real m101 = c0o1;
77 real m112 = c0o1;
78 real m110 = c0o1;
79 real m221 = c0o1;
80 real m001 = c0o1;
81 real m201 = c0o1;
82 real m021 = c0o1;
83 real m212 = c0o1;
84 real m010 = c0o1;
85 real m210 = c0o1;
86 real m012 = c0o1;
87 real m122 = c0o1;
88 real m100 = c0o1;
89 real m120 = c0o1;
90 real m102 = c0o1;
91 real m222 = c0o1;
92 real m022 = c0o1;
93 real m202 = c0o1;
94 real m002 = c0o1;
95 real m220 = c0o1;
96 real m020 = c0o1;
97 real m200 = c0o1;
98 real m000 = c0o1;
99
130
131
135 real press = c0o1;
136 real vvx = c0o1;
137 real vvy = c0o1;
138 real vvz = c0o1;
139
140 getCompressibleMacroscopicValues(populations, press, vvx, vvy, vvz);
141
142 m000 = d000 + d100 * x + d010 * y + d001 * z + d200 * x * x + d020 * y * y + d002 * z * z + d110 * x * y + d101 * x * z + d011 * y * z + d111 * x * y * z;
143 // m000 is the concentration
144
145 real dxConcentration = d100 + x * d200 + y * d110 + z * d101 + y * z * d111;
146 real dyConcentration = d010 + y * d020 + x * d110 + z * d011 + x * z * d111;
147 real dzConcentration = d001 + z * d002 + x * d101 + y * d011 + x * y * d111;
148
149 m100 = - (c1o1) / (c3o1 * omegaDiffusivityFine) * c1o2 * dxConcentration;
150 m010 = - (c1o1) / (c3o1 * omegaDiffusivityFine) * c1o2 * dyConcentration;
151 m001 = - (c1o1) / (c3o1 * omegaDiffusivityFine) * c1o2 * dzConcentration;
152
153
157 // linear combinations for second order moments
158 //const real mxxPyyPzz = m000;
159
160 m200 = m000 * c1o3;
161 m020 = m000 * c1o3;
162 m002 = m000 * c1o3;
163
164 // fourth order moments
165 m022 = m000 * c1o9;
166 m202 = m022;
167 m220 = m022;
168
169 // fifth order moments
170
171 // sixth order moment
172 m222 = m000 * c1o27;
173
174 const real vxsq = vvx * vvx;
175 const real vysq = vvy * vvy;
176 const real vzsq = vvz * vvz;
177
185
187 // X - Dir
197
199 // Y - Dir
210 // Z - Dir
220
221
222 populationsAD[dir::d000] = populationsAD_000;
223 populationsAD[dP00] = populationsAD_P00;
224 populationsAD[dM00] = populationsAD_M00;
225 populationsAD[d0P0] = populationsAD_0P0;
226 populationsAD[d0M0] = populationsAD_0M0;
227 populationsAD[d00P] = populationsAD_00P;
228 populationsAD[d00M] = populationsAD_00M;
229 populationsAD[dPP0] = populationsAD_PP0;
230 populationsAD[dMM0] = populationsAD_MM0;
231 populationsAD[dPM0] = populationsAD_PM0;
232 populationsAD[dMP0] = populationsAD_MP0;
233 populationsAD[dP0P] = populationsAD_P0P;
234 populationsAD[dM0M] = populationsAD_M0M;
235 populationsAD[dP0M] = populationsAD_P0M;
236 populationsAD[dM0P] = populationsAD_M0P;
237 populationsAD[d0PP] = populationsAD_0PP;
238 populationsAD[d0MM] = populationsAD_0MM;
239 populationsAD[d0PM] = populationsAD_0PM;
240 populationsAD[d0MP] = populationsAD_0MP;
241 populationsAD[dPPP] = populationsAD_PPP;
242 populationsAD[dMPP] = populationsAD_MPP;
243 populationsAD[dPMP] = populationsAD_PMP;
244 populationsAD[dMMP] = populationsAD_MMP;
245 populationsAD[dPPM] = populationsAD_PPM;
246 populationsAD[dMPM] = populationsAD_MPM;
247 populationsAD[dPMM] = populationsAD_PMM;
248 populationsAD[dMMM] = populationsAD_MMM;
249}
250
251}
252
253#endif
254
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
@ z
Definition Axis.h:44
@ x
Definition Axis.h:42
@ y
Definition Axis.h:43
constexpr void interpolateAdvectionDiffusionCF(real *const populations, real *populationsAD, const real &omegaDiffusivityFine, const real &epsnew, const InterpolationCoefficients &coefficients, const real &x, const real &y, const real &z)
constexpr void backwardChimera(real &mfa, real &mfb, real &mfc, real vv, real v2)
backward chimera transformation backwardChimera Transformation from central moments to distributions ...
constexpr void getCompressibleMacroscopicValues(const real *const &f, real &drho, real &oneOverRho, real &vx1, real &vx2, real &vx3)