OpenLB 1.7
Loading...
Searching...
No Matches
turbulentF3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2013 Patrick Nathen, Mathias J. Krause
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 TURBULENT_F_3D_HH
25#define TURBULENT_F_3D_HH
26
27#include "turbulentF3D.h"
28
29namespace olb {
30
31
33template <typename T, typename DESCRIPTOR>
35 const UnitConverter<T,DESCRIPTOR>& converter, SuperGeometry<T,3>& superGeometry,
36 IndicatorF3D<T>& indicator, const int material )
37 : SuperLatticePhysF3D<T,DESCRIPTOR>(sLattice,converter,1),
38 _superGeometry(superGeometry), _indicator(indicator), _material(material)
39{
40 this->getName() = "yPlus";
41}
42
43template <typename T, typename DESCRIPTOR>
44bool SuperLatticeYplus3D<T,DESCRIPTOR>::operator() (T output[], const int input[])
45{
46 int globIC = input[0];
47 int locix = input[1];
48 int lociy = input[2];
49 int lociz = input[3];
50
51 output[0]=T();
52 if ( this->_sLattice.getLoadBalancer().rank(globIC) == singleton::mpi().getRank() ) {
53 std::vector<T> normalTemp(3,T());
54 std::vector<T> normal(3,T()); // normalized
55 unsigned counter {0};
56 T distance = T();
57 if (_superGeometry.get(input) == 1) {
58 for (int iPop = 1; iPop < DESCRIPTOR::q; ++iPop) {
59 if (_superGeometry.get(input[0],
60 input[1] + descriptors::c<DESCRIPTOR>(iPop,0),
61 input[2] + descriptors::c<DESCRIPTOR>(iPop,1),
62 input[3] + descriptors::c<DESCRIPTOR>(iPop,2)) == _material) {
63 ++counter;
64 normalTemp[0] += descriptors::c<DESCRIPTOR>(iPop,0);
65 normalTemp[1] += descriptors::c<DESCRIPTOR>(iPop,1);
66 normalTemp[2] += descriptors::c<DESCRIPTOR>(iPop,2);
67 }
68 }
69 if ( counter > 0 ) {
70 // get physical Coordinates at intersection
71
72 std::vector<T> physR(3, T());
73 _superGeometry.getCuboidGeometry().getPhysR(&(physR[0]), &(input[0]));
74
75 T voxelSize = _superGeometry.getCuboidGeometry().get(globIC).getDeltaR();
76
77 normal = util::normalize(normalTemp);
78
79 std::vector<T> direction(normal);
80 direction[0] = voxelSize*normal[0]*2.;
81 direction[1] = voxelSize*normal[1]*2.;
82 direction[2] = voxelSize*normal[2]*2.;
83
84 // calculate distance to STL file
85 if ( _indicator.distance(distance, physR, direction) ) {
86 // call stress at this point
87 T rho;
88 T u[3];
89 T pi[6];
90 auto cell = this->_sLattice.getBlock(this->_sLattice.getLoadBalancer().loc(globIC)).get(locix, lociy, lociz);
91 cell.computeAllMomenta(rho, u, pi);
92
93 // Compute phys stress tau = mu*du/dx
94 T omega = 1. / this->_converter.getLatticeRelaxationTime();
95 T dt = this->_converter.getConversionFactorTime();
96 T physFactor = -omega*descriptors::invCs2<T,DESCRIPTOR>()/rho/2./dt*this->_converter.getPhysDensity(rho)*this->_converter.getPhysViscosity();
97
98 // Totel Stress projected from cell in normal direction on obstacle
99 T Rx = pi[0]*physFactor*normal[0] + pi[1]*physFactor*normal[1] + pi[2]*physFactor*normal[2];
100 T Ry = pi[1]*physFactor*normal[0] + pi[3]*physFactor*normal[1] + pi[4]*physFactor*normal[2];
101 T Rz = pi[2]*physFactor*normal[0] + pi[4]*physFactor*normal[1] + pi[5]*physFactor*normal[2];
102
103 // Stress appearing as pressure in corresponding direction is calculated and substracted
104 T R_res_pressure = normal[0]*pi[0]*physFactor*normal[0] + normal[0]*pi[1]*physFactor*normal[1] + normal[0]*pi[2]*physFactor*normal[2]
105 +normal[1]*pi[1]*physFactor*normal[0] + normal[1]*pi[3]*physFactor*normal[1] + normal[1]*pi[4]*physFactor*normal[2]
106 +normal[2]*pi[2]*physFactor*normal[0] + normal[2]*pi[4]*physFactor*normal[1] + normal[2]*pi[5]*physFactor*normal[2];
107
108 Rx -= R_res_pressure *normal[0];
109 Ry -= R_res_pressure *normal[1];
110 Rz -= R_res_pressure *normal[2];
111
112 T tau_wall = util::sqrt(Rx*Rx+Ry*Ry+Rz*Rz);
113 T u_tau = util::sqrt(tau_wall/this->_converter.getPhysDensity(rho));
114 //y_plus
115 output[0] = distance*u_tau / this->_converter.getPhysViscosity();
116 } // if 4
117 }
118 }
119 }
120 return true;
121}
122
124template <typename T, typename DESCRIPTOR>
126(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockFinDiff)
127 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 9), _blockFinDiff(blockFinDiff)
128{
129 this->getName() = "VelocityGradientFD";
130}
131
132template <typename T, typename DESCRIPTOR>
134{
135 //1 dudx 2 dudy 3 dudz
136 //4 dydx 5 dydy 6 dydz
137 //7 dwdx 8 dwdy 9 dwdz
138 _blockFinDiff(output,input);
139 return true;
140}
141
143template <typename T, typename DESCRIPTOR>
145(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockFinDiff)
146 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 9), _blockFinDiff(blockFinDiff)
147{
148 this->getName() = "externalVelocityGradientFD";
149}
150
151template <typename T, typename DESCRIPTOR>
153{
154 //1 dudx 2 dudy 3 dudz
155 //4 dydx 5 dydy 6 dydz
156 //7 dwdx 8 dwdy 9 dwdz
157 _blockFinDiff(output,input);
158 return true;
159}
160
162template <typename T, typename DESCRIPTOR>
164(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,9),
165 _sVelocity(sLattice), _sFinDiff(sGeometry, _sVelocity, matNumber)
166{
167 this->getName() = "VelocityGradientFD";
168 int maxC = this->_superStructure.getLoadBalancer().size();
169 this->_blockF.reserve(maxC);
170 for (int iC = 0; iC < maxC; iC++) {
171 this->_blockF.emplace_back(new BlockLatticeVelocityGradientFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sFinDiff.getBlockF(iC)));
172 }
173}
174
176template <typename T, typename DESCRIPTOR>
178(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,9),
179 _sVelocity(sLattice), _sFinDiff(sGeometry, _sVelocity, matNumber)
180{
181 this->getName() = "externalVelocityGradientFD";
182 int maxC = this->_superStructure.getLoadBalancer().size();
183 this->_blockF.reserve(maxC);
184 for (int iC = 0; iC < maxC; iC++) {
185 this->_blockF.emplace_back(new BlockLatticeExternalVelocityGradientFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sFinDiff.getBlockF(iC)));
186 }
187}
188
190template <typename T, typename DESCRIPTOR>
192(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockFinDiff, const UnitConverter<T,DESCRIPTOR>& converter)
193 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 9), _blockFinDiff(blockFinDiff), _converter(converter)
194{
195 this->getName() = "PhysVelocityGradientFD";
196}
197
198template <typename T, typename DESCRIPTOR>
200{
201 _blockFinDiff(output,input);
202 return true;
203}
204
206template <typename T, typename DESCRIPTOR>
208(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,9),
209 _sVelocity(sLattice, converter), _sFinDiff(sGeometry, _sVelocity, matNumber, converter), _converter(converter)
210{
211 this->getName() = "PhysVelocityGradientFD";
212 int maxC = this->_superStructure.getLoadBalancer().size();
213 this->_blockF.reserve(maxC);
214 for (int iC = 0; iC < maxC; iC++) {
215 this->_blockF.emplace_back(new BlockLatticePhysVelocityGradientFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sFinDiff.getBlockF(iC), this->_converter));
216 }
217}
218
220template <typename T, typename DESCRIPTOR>
222(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad)
223 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 9), _blockVeloGrad(blockVeloGrad)
224{
225 this->getName() = "StrainRateFD";
226}
227
228template <typename T, typename DESCRIPTOR>
230{
231 T velograd[9];
232 _blockVeloGrad(velograd,input);
233 output[0] = velograd[0];
234 output[1] = 0.5 * (velograd[1] + velograd[3]);
235 output[2] = 0.5 * (velograd[2] + velograd[6]);
236 output[3] = output[1];
237 output[4] = velograd[4];
238 output[5] = 0.5 * (velograd[5] + velograd[7]);
239 output[6] = output[2];
240 output[7] = output[5];
241 output[8] = velograd[8];
242 return true;
243}
244
246template <typename T, typename DESCRIPTOR>
248(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,9),
249 _sVeloGrad(sGeometry, sLattice, matNumber)
250{
251 this->getName() = "StrainRateFD";
252 int maxC = this->_superStructure.getLoadBalancer().size();
253 this->_blockF.reserve(maxC);
254 for (int iC = 0; iC < maxC; iC++) {
255 this->_blockF.emplace_back(new BlockLatticeStrainRateFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
256 }
257}
258
260template <typename T, typename DESCRIPTOR>
262(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad, const UnitConverter<T,DESCRIPTOR>& converter)
263 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 9), _blockVeloGrad(blockVeloGrad), _converter(converter)
264{
265 this->getName() = "PhysStrainRateFD";
266}
267
268template <typename T, typename DESCRIPTOR>
270{
271 T velograd[9];
272 _blockVeloGrad(velograd,input);
273 output[0] = velograd[0];
274 output[1] = 0.5 * (velograd[1] + velograd[3]);
275 output[2] = 0.5 * (velograd[2] + velograd[6]);
276 output[3] = output[1];
277 output[4] = velograd[4];
278 output[5] = 0.5 * (velograd[5] + velograd[7]);
279 output[6] = output[2];
280 output[7] = output[5];
281 output[8] = velograd[8];
282
283 return true;
284}
285
287template <typename T, typename DESCRIPTOR>
289(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,9),
290 _sVeloGrad(sGeometry, sLattice, matNumber, converter), _converter(converter)
291{
292 this->getName() = "PhysStrainRateFD";
293 int maxC = this->_superStructure.getLoadBalancer().size();
294 this->_blockF.reserve(maxC);
295 for (int iC = 0; iC < maxC; iC++) {
296 this->_blockF.emplace_back(new BlockLatticePhysStrainRateFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
297 }
298}
299
301template <typename T, typename DESCRIPTOR>
303(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad, const UnitConverter<T,DESCRIPTOR>& converter)
304 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 1), _blockVeloGrad(blockVeloGrad), _converter(converter)
305{
306 this->getName() = "DissipationFD";
307}
308
309template <typename T, typename DESCRIPTOR>
311{
312 T velograd[9];
313 _blockVeloGrad(velograd,input);
314 output[0] = velograd[0] * velograd[0] + velograd[1] * velograd[1] + velograd[2] * velograd[2] +
315 velograd[3] * velograd[3] + velograd[4] * velograd[4] + velograd[5] * velograd[5] +
316 velograd[6] * velograd[6] + velograd[7] * velograd[7] + velograd[8] * velograd[8];
317 output[0] *= _converter.getLatticeViscosity();
318
319 return true;
320}
321
323template <typename T, typename DESCRIPTOR>
325(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,1),
326 _sVeloGrad(sGeometry, sLattice, matNumber, converter), _converter(converter)
327{
328 this->getName() = "DissipationFD";
329 int maxC = this->_superStructure.getLoadBalancer().size();
330 this->_blockF.reserve(maxC);
331 for (int iC = 0; iC < maxC; iC++) {
332 this->_blockF.emplace_back(new BlockLatticeDissipationFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
333 }
334}
335
337template <typename T, typename DESCRIPTOR>
339(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad, const UnitConverter<T,DESCRIPTOR>& converter)
340 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 1), _blockVeloGrad(blockVeloGrad), _converter(converter)
341{
342 this->getName() = "PhysDissipationFD";
343}
344
345template <typename T, typename DESCRIPTOR>
347{
348 T velograd[9];
349 _blockVeloGrad(velograd,input);
350 output[0] = velograd[0] * velograd[0] + velograd[1] * velograd[1] + velograd[2] * velograd[2] +
351 velograd[3] * velograd[3] + velograd[4] * velograd[4] + velograd[5] * velograd[5] +
352 velograd[6] * velograd[6] + velograd[7] * velograd[7] + velograd[8] * velograd[8];
353 output[0] *= _converter.getPhysViscosity();
354
355 return true;
356}
357
359template <typename T, typename DESCRIPTOR>
361(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,1),
362 _sVeloGrad(sGeometry, sLattice, matNumber, converter), _converter(converter)
363{
364 this->getName() = "PhysDissipationFD";
365 int maxC = this->_superStructure.getLoadBalancer().size();
366 this->_blockF.reserve(maxC);
367 for (int iC = 0; iC < maxC; iC++) {
368 this->_blockF.emplace_back(new BlockLatticePhysDissipationFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
369 }
370}
371
373template <typename T, typename DESCRIPTOR>
375 BlockLattice<T,DESCRIPTOR>& blockLattice,
376 BlockF3D<T>& blockVeloGrad,
377 const UnitConverter<T,DESCRIPTOR>& converter,
378 std::function<T(Cell<T,DESCRIPTOR>&)> effectiveOmegaF)
379 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 1),
380 _blockVeloGrad(blockVeloGrad),
381 _converter(converter),
382 _effectiveOmegaF(effectiveOmegaF)
383{
384 this->getName() = "PhysEffectiveDissipationFD";
385}
386
387template <typename T, typename DESCRIPTOR>
389{
390 T velograd[9];
391 _blockVeloGrad(velograd,input);
392 output[0] = velograd[0] * velograd[0] + velograd[1] * velograd[1] + velograd[2] * velograd[2] +
393 velograd[3] * velograd[3] + velograd[4] * velograd[4] + velograd[5] * velograd[5] +
394 velograd[6] * velograd[6] + velograd[7] * velograd[7] + velograd[8] * velograd[8];
395
396 auto cell = this->_blockLattice.get(input[0], input[1], input[2]);
397 T omegaEff = _effectiveOmegaF(cell);
398 T nuEff = ((1./omegaEff)-0.5)/descriptors::invCs2<T,DESCRIPTOR>();
399 output[0] *= _converter.getPhysViscosity( nuEff );
400
401 return true;
402}
403
405template <typename T, typename DESCRIPTOR>
407(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter,
408 std::function<T(Cell<T,DESCRIPTOR>&)> effectiveOmegaF)
409 : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,1), _sVeloGrad(sGeometry, sLattice, matNumber, converter), _converter(converter)
410{
411 this->getName() = "PhysEffectiveDissipationFD";
412 int maxC = this->_superStructure.getLoadBalancer().size();
413 this->_blockF.reserve(maxC);
414 for (int iC = 0; iC < maxC; iC++) {
415 this->_blockF.emplace_back(new BlockLatticePhysEffectiveDissipationFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter, effectiveOmegaF));
416 }
417}
418
420template <typename T, typename DESCRIPTOR>
422(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad)
423 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 3), _blockVeloGrad(blockVeloGrad)
424{
425 this->getName() = "VorticityFD";
426}
427
428template <typename T, typename DESCRIPTOR>
430{
431 T velograd[9];
432 _blockVeloGrad(velograd,input);
433 output[0] = velograd[7] - velograd[5];
434 output[1] = velograd[2] - velograd[6];
435 output[2] = velograd[3] - velograd[1];
436 return true;
437}
438
440template <typename T, typename DESCRIPTOR>
442(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,3),
443 _sVeloGrad(sGeometry, sLattice, matNumber)
444{
445 this->getName() = "VorticityFD";
446 int maxC = this->_superStructure.getLoadBalancer().size();
447 this->_blockF.reserve(maxC);
448 for (int iC = 0; iC < maxC; iC++) {
449 this->_blockF.emplace_back(new BlockLatticeVorticityFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
450 }
451}
452
454template <typename T, typename DESCRIPTOR>
456(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad, const UnitConverter<T,DESCRIPTOR>& converter)
457 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 3), _blockVeloGrad(blockVeloGrad), _converter(converter)
458{
459 this->getName() = "PhysVorticityFD";
460}
461
462template <typename T, typename DESCRIPTOR>
464{
465 T velograd[9];
466 _blockVeloGrad(velograd,input);
467 output[0] = velograd[7] - velograd[5];
468 output[1] = velograd[2] - velograd[6];
469 output[2] = velograd[3] - velograd[1];
470 return true;
471}
472
474template <typename T, typename DESCRIPTOR>
476(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,3),
477 _sVeloGrad(sGeometry, sLattice, matNumber, converter), _converter(converter)
478{
479 this->getName() = "PhysVorticityFD";
480 int maxC = this->_superStructure.getLoadBalancer().size();
481 this->_blockF.reserve(maxC);
482 for (int iC = 0; iC < maxC; iC++) {
483 this->_blockF.emplace_back(new BlockLatticePhysVorticityFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
484 }
485}
486
488template <typename T, typename DESCRIPTOR>
490(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockStrainRate, const UnitConverter<T,DESCRIPTOR>& converter)
491 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 9), _blockStrainRate(blockStrainRate), _converter(converter)
492{
493 this->getName() = "PhysStressFD";
494}
495
496template <typename T, typename DESCRIPTOR>
498{
499 _blockStrainRate(output,input);
500 for (int i = 0; i < 9; i++) {
501 output[i] /= _converter.getPhysViscosity() * _converter.getPhysDensity();
502 }
503 return true;
504}
505
507template <typename T, typename DESCRIPTOR>
509(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice,9),
510 _sStrainRate(sGeometry, sLattice, matNumber, converter), _converter(converter)
511{
512 this->getName() = "PhysStressFD";
513 int maxC = this->_superStructure.getLoadBalancer().size();
514 this->_blockF.reserve(maxC);
515 for (int iC = 0; iC < maxC; iC++) {
516 this->_blockF.emplace_back(new BlockLatticePhysStressFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sStrainRate.getBlockF(iC), this->_converter));
517 }
518}
519
521template<typename T, typename DESCRIPTOR>
523 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 1), _blockVelocity(blockVelocity)
524{
525 this->getName() = "IsotropicHomogeneousTKE";
526}
527
528template<typename T, typename DESCRIPTOR>
530{
531 output[0] = T();
532 T data[_blockVelocity.getTargetDim()];
533 _blockVelocity(data,input);
534 for (int i = 0; i < _blockVelocity.getTargetDim(); ++i) {
535 output[0] += data[i] * data[i];
536 }
537 output[0] = 0.5 * output[0];
538 return true;
539}
540
542template<typename T, typename DESCRIPTOR>
545 : SuperLatticeF3D<T,DESCRIPTOR>(sLattice, 1), _sVelocity(sLattice, converter), _converter(converter)
546
547{
548 this->getName() = "IsotropicHomogeneousTKE";
549 int maxC = this->_sLattice.getLoadBalancer().size();
550 this->_blockF.reserve(maxC);
551 for (int iC = 0; iC < maxC; iC++) {
552 this->_blockF.emplace_back(new BlockIsotropicHomogeneousTKE3D<T,DESCRIPTOR>(this->_sLattice.getBlock(iC), this-> _sVelocity.getBlockF(iC)));
553 }
554}
555
557template <typename T, typename DESCRIPTOR>
559(BlockLattice<T,DESCRIPTOR>& blockLattice, BlockF3D<T>& blockVeloGrad, const UnitConverter<T,DESCRIPTOR>& converter)
560 : BlockLatticeF3D<T,DESCRIPTOR>(blockLattice, 1), _blockVeloGrad(blockVeloGrad), _converter(converter)
561{
562 this->getName() = "PhysEnstrophyFD";
563}
564
565template <typename T, typename DESCRIPTOR>
567{
568 T velograd[9];
569 _blockVeloGrad(velograd,input);
570 output[0] = 0.5 * ( util::pow(velograd[7] - velograd[5], 2) + util::pow(velograd[2] - velograd[6], 2) + util::pow(velograd[3] - velograd[1], 2) );
571 return true;
572}
573
575template <typename T, typename DESCRIPTOR>
577(SuperGeometry<T,3>& sGeometry, SuperLattice<T,DESCRIPTOR>& sLattice, std::list<int>& matNumber, const UnitConverter<T,DESCRIPTOR>& converter) : SuperLatticeF3D<T,DESCRIPTOR>(sLattice, 1),
578 _sVeloGrad(sGeometry, sLattice, matNumber, converter), _converter(converter)
579{
580 this->getName() = "PhysEnstrophyFD";
581 int maxC = this->_superStructure.getLoadBalancer().size();
582 this->_blockF.reserve(maxC);
583 for (int iC = 0; iC < maxC; iC++) {
584 this->_blockF.emplace_back(new BlockLatticePhysEnstrophyFD3D<T,DESCRIPTOR> (this->_sLattice.getBlock(iC), this->_sVeloGrad.getBlockF(iC), this->_converter));
585 }
586}
587
588
589} // end namespace olb
590#endif
represents all functors that operate on a cuboid in general, mother class of BlockLatticeF,...
functor that returns pointwise the turbulent, kinetic energy
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockIsotropicHomogeneousTKE3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &f)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockLatticeDissipationFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &converter)
BlockLatticeExternalVelocityGradientFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(),...
BlockLatticePhysDissipationFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &_converter)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
BlockLatticePhysEffectiveDissipationFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &converter, std::function< T(Cell< T, DESCRIPTOR > &)> effectiveOmegaF)
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
functor that returns pointwise the enstrophy
BlockLatticePhysEnstrophyFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockVeloGrad, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockLatticePhysStrainRateFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &converter)
BlockLatticePhysStressFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
bool operator()(T output[], const int input[]) override
has to be implemented for 'every' derived class
BlockLatticePhysVelocityGradientFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &converter)
BlockLatticePhysVorticityFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor, const UnitConverter< T, DESCRIPTOR > &converter)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockLatticeStrainRateFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor)
functor to get pointwise explicit filtering on local lattice, if globIC is not on the local processor...
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
BlockLatticeVelocityGradientFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor)
BlockLatticeVorticityFD3D(BlockLattice< T, DESCRIPTOR > &blockLattice, BlockF3D< T > &blockFunctor)
bool operator()(T output[], const int input[])
has to be implemented for 'every' derived class
Platform-abstracted block lattice for external access and inter-block interaction.
Highest-level interface to Cell data.
Definition cell.h:148
std::string & getName()
read and write access to name
Definition genericF.hh:51
IndicatorF3D is an application from .
SuperStructure< T, 3 > & _superStructure
std::vector< std::unique_ptr< BlockF3D< T > > > _blockF
Super functors may consist of several BlockF3D<W> derived functors.
Representation of a statistic for a parallel 2D geometry.
SuperIsotropicHomogeneousTKE3D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticeDissipationFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticeExternalVelocityGradientFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber)
represents all functors that operate on a SuperLattice in general, e.g. getVelocity(),...
SuperLattice< T, DESCRIPTOR > & _sLattice
SuperLatticePhysDissipationFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticePhysEffectiveDissipationFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter, std::function< T(Cell< T, DESCRIPTOR > &)> effectiveOmegaF)
SuperLatticePhysEnstrophyFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(),...
SuperLatticePhysStrainRateFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticePhysStressFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticePhysVelocityGradientFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticePhysVorticityFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber, const UnitConverter< T, DESCRIPTOR > &converter)
SuperLatticeStrainRateFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber)
SuperLatticeVelocityGradientFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber)
SuperLatticeVorticityFD3D(SuperGeometry< T, 3 > &sGeometry, SuperLattice< T, DESCRIPTOR > &sLattice, std::list< int > &matNumber)
bool operator()(T output[], const int input[]) override
SuperLatticeYplus3D(SuperLattice< T, DESCRIPTOR > &sLattice, const UnitConverter< T, DESCRIPTOR > &converter, SuperGeometry< T, 3 > &superGeometry, IndicatorF3D< T > &indicator, const int material)
Super class maintaining block lattices for a cuboid decomposition.
LoadBalancer< T > & getLoadBalancer()
Read and write access to the load balancer.
Conversion between physical and lattice units, as well as discretization.
int getRank() const
Returns the process ID.
MpiManager & mpi()
cpu::simd::Pack< T > sqrt(cpu::simd::Pack< T > value)
Definition pack.h:100
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)
Definition pack.h:112
Vector< T, D > normalize(const Vector< T, D > &a)
Top level namespace for all of OpenLB.