MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
fvzonalrtv.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#include "fvzonalrtv.h"
8
9#include <algorithm>
10#include <iostream>
11#include <stack>
12#include <vector>
15#include "MEMORY/alloc.h"
16#include "UTIL/functions.h"
17#include "UTIL/kdtree.h"
18#include "globals.h"
19#include "globalvariables.h"
20
21using namespace std;
22
23template <MInt nDim, class SysEqn>
24FvZonalRTV<nDim, SysEqn>::FvZonalRTV(const MInt couplingId, RANS* R, LES* L)
25 : Coupling(couplingId), FvZonal<nDim, SysEqn>(couplingId, R, L) /*, m_RANSSolver(R), m_LESSolver(L)*/ {
26 m_log << "Create Zonal coupler for RANS Solver (" << RANSSolver().m_solverId << ") and LES Solver ("
27 << LESSolver().m_solverId << ")" << endl;
28
29
37 m_rntStartTimeStep = Context::getBasicProperty<MInt>("rntStartTimeStep", AT_, &m_rntStartTimeStep);
38
46 m_reconstructAverageFromNut = false;
47 if(Context::propertyExists("reconstructAverageFromNut")) {
48 m_reconstructAverageFromNut =
49 Context::getBasicProperty<MBool>("reconstructAverageFromNut", AT_, &m_reconstructAverageFromNut);
50 }
51
59 m_reconstructNut = false;
60 if(Context::propertyExists("reconstructNut")) {
61 m_reconstructNut = Context::getBasicProperty<MBool>("reconstructNut", AT_, &m_reconstructNut);
62 }
63
64 /*
65 turbulent intensity of the free stream
66 */
74 m_turbulentIntensity = -1;
75 if(Context::propertyExists("turbulentIntensity")) {
76 m_turbulentIntensity = Context::getBasicProperty<MFloat>("turbulentIntensity", AT_, &m_turbulentIntensity);
77 }
78
79 /*
80 Length scale correction when turbulent intensity of the free stream
81 is reconstructed from data from literature based on the Reynolds number
82 (activated if m_turbulentIntensity is not specified in property file)
83 */
84 m_tuLengthScaleCorrection = F1;
85 if(Context::propertyExists("tuLengthScaleCorrection")) {
86 m_tuLengthScaleCorrection =
87 Context::getBasicProperty<MFloat>("tuLengthScaleCorrection", AT_, &m_tuLengthScaleCorrection);
88 }
89}
90
91
92template <MInt nDim, class SysEqn>
94 TRACE();
95
96 m_RANSSolverId = RANSSolver().m_solverId;
97 m_LESSolverId = LESSolver().m_solverId;
98
99 LESSolver().m_LESNoVarAverage = LESVarAverageData::noAvgVars;
100
101 initRANSValues();
102 initLESValues();
103
104 determineZonalPositions();
105}
106
107
108template <MInt nDim, class SysEqn>
110 TRACE();
111
112 m_7902faceNormalDir = -1;
113 m_7902Position = std::numeric_limits<MFloat>::infinity();
114
115 // read cutoff positions to determine average and sponge cells
116 if(Context::propertyExists("cutOffBndryIds")) {
117 MInt propertyLength = Context::propertyLength("cutOffBndryIds", m_RANSSolverId);
118 for(MInt i = 0; i < propertyLength; i++) {
119 MInt bcId = Context::getSolverProperty<MFloat>("cutOffBndryIds", m_RANSSolverId, AT_, i);
120 if(bcId == 7902 || bcId == 7905) {
121 m_7902faceNormalDir = Context::getSolverProperty<MFloat>("cutOffDirections", m_RANSSolverId, AT_, i);
122 }
123 }
124 }
125 if(m_7902faceNormalDir != -1) {
126 m_7902faceNormalDir = (m_7902faceNormalDir % 2 == 0) ? m_7902faceNormalDir + 1 : m_7902faceNormalDir - 1;
127 }
128
129 m_bcId7902 = -1;
130 m_7902wallDir = 1;
131 m_7902periodicDir = 2;
132
133 if(Context::propertyExists("bc7902wallDir")) {
134 m_7902wallDir = Context::getSolverProperty<MInt>("bc7902wallDir", m_RANSSolverId, AT_);
135 }
136 if(Context::propertyExists("bc7902periodicDir")) {
137 m_7902periodicDir = Context::getSolverProperty<MInt>("bc7902periodicDir", m_RANSSolverId, AT_);
138 }
139
140 for(MInt bcId = 0; bcId < RANSSolver().m_fvBndryCnd->m_noCutOffBndryCndIds; bcId++) {
141 if(RANSSolver().m_fvBndryCnd->m_cutOffBndryCndIds[bcId] == 7902) {
142 m_bcId7902 = bcId;
143 }
144 }
145
146
147 // determine real m_7909Position based on cell centers
148 MFloat tmpPos7902 = ((m_7902faceNormalDir + 1) % 2 > 0) ? -std::numeric_limits<MFloat>::infinity()
149 : std::numeric_limits<MFloat>::infinity();
150 MFloat compFactor7902 = ((m_7902faceNormalDir + 1) % 2 > 0) ? F1 : -F1;
151
152 if(LESSolver().grid().isActive()) {
153 for(MInt cellId = 0; cellId < a_noFvGridCellsLES(); cellId++) {
154 MInt RANSId = convertIdParent(LESSolver(), RANSSolver(), cellId);
155 if(RANSId != -1) {
156 MFloat pos = LESSolver().a_coordinate(cellId, 0);
157 if(compFactor7902 * pos > compFactor7902 * tmpPos7902) {
158 tmpPos7902 = pos;
159 }
160 }
161 }
162
163 if(compFactor7902 > 0) {
164 MPI_Allreduce(MPI_IN_PLACE, &tmpPos7902, 1, MPI_DOUBLE, MPI_MAX, LESSolver().mpiComm(), AT_, "MPI_IN_PLACE",
165 "tmpPos7902");
166 } else {
167 MPI_Allreduce(MPI_IN_PLACE, &tmpPos7902, 1, MPI_DOUBLE, MPI_MIN, LESSolver().mpiComm(), AT_, "MPI_IN_PLACE",
168 "tmpPos7902");
169 }
170 m_7902Position = tmpPos7902;
171 }
172
173 if(RANSSolver().grid().isActive()) {
174 if(compFactor7902 > 0) {
175 MPI_Allreduce(MPI_IN_PLACE, &tmpPos7902, 1, MPI_DOUBLE, MPI_MAX, RANSSolver().mpiComm(), AT_, "MPI_IN_PLACE",
176 "tmpPos7902");
177 } else {
178 MPI_Allreduce(MPI_IN_PLACE, &tmpPos7902, 1, MPI_DOUBLE, MPI_MIN, RANSSolver().mpiComm(), AT_, "MPI_IN_PLACE",
179 "tmpPos7902");
180 }
181
182 if(m_7902faceNormalDir != -1) {
183 m_7902Position = tmpPos7902;
184 }
185 }
186
187 m_averagePos = m_7902Position;
188 m_averageDir = abs(m_7902wallDir + m_7902periodicDir - nDim);
189 m_averageFaceDir = m_7902faceNormalDir;
190
191 LESSolver().m_averagePos.push_back(m_averagePos);
192 LESSolver().m_averageDir.push_back(m_averageDir);
193 LESSolver().m_averageReconstructNut.push_back(m_reconstructNut);
194}
195
196
197template <MInt nDim, class SysEqn>
199 TRACE();
200
201 // finalizeLESAverage();
202 determineNutReconstructionCells();
203
204 if(globalTimeStep > m_rntStartTimeStep) {
205 reconstructNutilde();
206 }
207
208 transferSolverData();
209}
210
211
212template <MInt nDim, class SysEqn>
214 TRACE();
215
216 if(LESSolver().grid().isActive()) {
217 m_noRntBcCells = 0;
218 for(MInt LESId = 0; LESId < a_noFvGridCellsLES(); LESId++) {
219 if(LESSolver().a_isHalo(LESId)) continue;
220
221 MFloat halfCellLength = LESSolver().grid().halfCellLength(LESId);
222 MFloat pos = LESSolver().a_coordinate(LESId, m_averageDir);
223
224 if(approx(m_averagePos, pos, halfCellLength)) {
225 m_rntBcCells.push_back(LESId);
226 m_noRntBcCells++;
227 }
228 }
229 }
230}
231
232
233template <MInt nDim, class SysEqn>
235 TRACE();
236
237 if(LESSolver().grid().isActive()) {
238 // copy local vectors
239 std::vector<MFloat> LESAverageCells_OLD_L;
240 std::vector<std::vector<MFloat>> LESVarAverage_OLD;
241 std::vector<MInt> rntBcCells_OLD;
242 std::vector<MInt> LESAverageCells_OLD;
243
244 for(MInt c = 0; c < (MInt)LESSolver().m_LESAverageCells.size(); c++) {
245 LESAverageCells_OLD_L.push_back(LESSolver().m_LESAverageCells[c]);
246 }
247
248 for(MInt cc = 0; cc < m_noRntBcCells; cc++) {
249 rntBcCells_OLD.push_back(m_rntBcCells[cc]);
250 }
251 }
252
253 if(globalTimeStep > m_rntStartTimeStep) {
254 reconstructNutilde();
255 }
256
257 transferSolverData();
258}
259
260
261template <MInt nDim, class SysEqn>
263 TRACE();
264
265 if(LESSolver().grid().isActive()) {
266 if(LESSolver().noNeighborDomains() > 0) {
267 LESSolver().exchangeData(&LESSolver().a_variable(0, 0), noLESVariables());
268 LESSolver().exchangeData(&LESSolver().a_oldVariable(0, 0), noLESVariables());
269 LESSolver().exchangeData(&LESSolver().a_pvariable(0, 0), noLESVariables());
270 }
271 }
272
273 if(RANSSolver().grid().isActive()) {
274 if(RANSSolver().noNeighborDomains() > 0) {
275 RANSSolver().exchangeData(&RANSSolver().a_variable(0, 0), noRANSVariables());
276 RANSSolver().exchangeData(&RANSSolver().a_oldVariable(0, 0), noRANSVariables());
277 RANSSolver().exchangeData(&RANSSolver().a_pvariable(0, 0), noRANSVariables());
278 }
279 }
280
281 if(globalTimeStep % m_zonalTransferInterval == 0) {
282 if(globalTimeStep > m_rntStartTimeStep) {
283 reconstructNutilde();
284 }
285 transferSolverData();
286 }
287}
288
289
290template <MInt nDim, class SysEqn>
292 TRACE();
293
294 // write LES data to RANS Solver and RANS data to LES Solver
295 if(RANSSolver().grid().isActive()) {
296 for(MInt var = 0; var < noRANSVariables(); var++) {
297 for(MInt cellId = 0; cellId < a_noFvGridCellsRANS(); cellId++) {
298 MInt LESId = convertIdParent(RANSSolver(), LESSolver(), cellId);
299
300 ASSERT(cellId < (MInt)RANSSolver().m_LESValues[var].size(),
301 "Trying to access data [" + to_string(var) + "][" + to_string(cellId)
302 + "] in LESSolver().m_LESVarAverage(RANS) with length "
303 + to_string(RANSSolver().m_LESValues[var].size())
304 + ", domainId: " + to_string(RANSSolver().domainId()));
305
306 if(LESId != -1) {
307 vector<MInt>::iterator findAvgId =
308 find(LESSolver().m_LESAverageCells.begin(), LESSolver().m_LESAverageCells.end(), LESId);
309 if(findAvgId != LESSolver().m_LESAverageCells.end()) {
310 MInt avgId = distance(LESSolver().m_LESAverageCells.begin(), findAvgId);
311 MInt var_ = var;
312 // if(var == nDim + 2) var_ = nDim + 2 + 1;
313 RANSSolver().m_LESValues[var][cellId] = LESSolver().m_LESVarAverage[var_][avgId];
314 }
315 }
316 }
317 }
318 }
319
320 // write RANS data to LES Solver
321 if(LESSolver().grid().isActive()) {
322 for(MInt cellId = 0; cellId < a_noFvGridCellsLES(); cellId++) {
323 MInt RANSId = convertIdParent(LESSolver(), RANSSolver(), cellId);
324
325 if(RANSId != -1) {
326 for(MInt var = 0; var < noRANSVariables(); var++) {
327 ASSERT(cellId < (MInt)LESSolver().m_RANSValues[var].size(),
328 "Trying to access data [" + to_string(var) + "][" + to_string(cellId)
329 + "] in m_RANSValues with length " + to_string(LESSolver().m_RANSValues[var].size())
330 + ", domainId: " + to_string(LESSolver().domainId()));
331
332 LESSolver().m_RANSValues[var][cellId] = RANSSolver().a_pvariable(RANSId, var);
333 }
334 }
335 }
336 }
337}
338
339
340template <MInt nDim, class SysEqn>
342 TRACE();
343
344 const MInt N = RANSSolver().m_sysEqn.PV->N;
345
346 if(LESSolver().grid().isActive()) {
347 // reconstruct nuTilde
348 //---------------------------------------------
349 const MFloat rRe = F1 / LESSolver().m_sysEqn.m_Re0;
350
351 // Turbulent intensity is calculated and used as a limiter for the turbulent kinetic energy
352 /*data taken from:
353 Brandt, Luca & Schlatter, Philipp. (2004). Transition in boundary layers subject to free-stream turbulence.
354 Journal of Fluid Mechanics. 517. 167 - 198. 10.1017/S0022112004000941.
355 ------------
356 used to determine the expected freestream turbulence intensity
357 */
358
359 MFloat tuFreeStream = 0.05;
360
361 if(abs(m_turbulentIntensity + 1) < 1e-16) {
362 std::vector<std::pair<MFloat, MFloat>> tuFreeStreamData = {
363 std::make_pair(31171.1711712, 0.0451546391753), std::make_pair(34774.7747748, 0.0428865979381),
364 std::make_pair(38378.3783784, 0.0407216494845), std::make_pair(42702.7027027, 0.0385567010309),
365 std::make_pair(51711.7117117, 0.0349484536082), std::make_pair(58558.5585586, 0.0327835051546),
366 std::make_pair(66846.8468468, 0.0305154639175), std::make_pair(78738.7387387, 0.0278350515464),
367 std::make_pair(93513.5135135, 0.0250515463918), std::make_pair(111891.891892, 0.0223711340206),
368 std::make_pair(132432.432432, 0.0198969072165), std::make_pair(158738.738739, 0.0175257731959),
369 std::make_pair(186126.126126, 0.0154639175258), std::make_pair(215675.675676, 0.0137113402062),
370 std::make_pair(243783.783784, 0.0124742268041), std::make_pair(273693.693694, 0.0113402061856),
371 std::make_pair(301801.801802, 0.0105154639175)};
372
373 // interpolant freestream turbulence intensity from data
374 MInt length = (MInt)tuFreeStreamData.size();
375 for(MInt i = 0; i < length; i++) {
376 if(tuFreeStreamData[i].first > LESSolver().m_Re * m_tuLengthScaleCorrection) {
377 tuFreeStream = tuFreeStreamData[i - 1].second
378 + (tuFreeStreamData[i].second - tuFreeStreamData[i - 1].second)
379 / (tuFreeStreamData[i].first - tuFreeStreamData[i - 1].first)
380 * (LESSolver().m_Re * m_tuLengthScaleCorrection - tuFreeStreamData[i - 1].first);
381 break;
382 }
383 }
384 // extrapolat freestream turbulence intensity from data
385 if(LESSolver().m_Re * m_tuLengthScaleCorrection < tuFreeStreamData[0].first) {
386 tuFreeStream = tuFreeStreamData[0].second
387 + (tuFreeStreamData[1].second - tuFreeStreamData[0].second)
388 / (tuFreeStreamData[1].first - tuFreeStreamData[0].first)
389 * (LESSolver().m_Re * m_tuLengthScaleCorrection - tuFreeStreamData[0].first);
390 }
391 if(LESSolver().m_Re * m_tuLengthScaleCorrection > tuFreeStreamData[length - 1].first) {
392 tuFreeStream = tuFreeStreamData[length - 2].second
393 + (tuFreeStreamData[length - 1].second - tuFreeStreamData[length - 2].second)
394 / (tuFreeStreamData[length - 1].first - tuFreeStreamData[length - 2].first)
395 * (LESSolver().m_Re * m_tuLengthScaleCorrection - tuFreeStreamData[length - 2].first);
396 }
397
398 tuFreeStream *= 0.95;
399
400 m_log << "interpolation of freestream turbulence intensity: " << tuFreeStream << endl;
401
402 } else {
403 tuFreeStream = m_turbulentIntensity;
404 }
405
406 for(MInt c = 0; c < m_noRntBcCells; c++) {
407 MInt cellId = m_rntBcCells[c];
408 vector<MInt>::iterator findLESId =
409 find(LESSolver().m_LESAverageCells.begin(), LESSolver().m_LESAverageCells.end(), cellId);
410 if(findLESId == LESSolver().m_LESAverageCells.end()) TERMM(1, "Something went wrong " + to_string(cellId));
411 MInt LESAvgId = distance(LESSolver().m_LESAverageCells.begin(), findLESId);
412
413 // calculating turbulent kinetic energy k = 0.5(ui'ui')
414 MFloat tuarg = 0.0;
415 MFloat k = F0;
416 MInt count_ = 0;
417 MInt index_ = 0;
418 MInt index1 = 0;
419 MInt index2 = 0;
420 for(MInt i = 0; i < nDim; i++) {
421 for(MInt j = count_; j < nDim; j++) {
422 index1 = index_ + noRANSVariables();
423 if(i == j) {
424 ASSERT(c < (MInt)LESSolver().m_LESVarAverage[index1].size(),
425 "Trying to access data [" + to_string(index1) + "][" + to_string(LESAvgId)
426 + "] in LESSolver().m_LESVarAverage with length "
427 + to_string(LESSolver().m_LESVarAverage[index1].size()));
428
429 k += 0.5
430 * (LESSolver().m_LESVarAverage[index1][LESAvgId]
431 - pow(LESSolver().m_LESVarAverage[index2][LESAvgId], F2));
432 tuarg += (LESSolver().m_LESVarAverage[index1][LESAvgId]
433 - pow(LESSolver().m_LESVarAverage[index2][LESAvgId], F2));
434 index2++;
435 }
436 index_++;
437 }
438 count_++;
439 }
440
441 tuarg = max(tuarg, epss);
442
443 MFloat tu = sqrt(tuarg / 3.0) / LESSolver().m_Ma;
444 MFloat tufac = tanh((tu - tuFreeStream) / tuFreeStream);
445 MFloat tulim = max(tu, tuFreeStream);
446 tulim = tu / tulim;
447
448 k = k * tufac * tulim;
449
450 // calculating strain rate tensor Sij = 0.5(dui/dxj + duj/dxi)
451 MFloat du[3][3]{{F0, F0, F0}, {F0, F0, F0}, {F0, F0, F0}};
452 const MInt recData = LESSolver().a_reconstructionData(cellId);
453
454 const MFloat u[3] = {LESSolver().m_LESVarAverage[0][LESAvgId], LESSolver().m_LESVarAverage[1][LESAvgId],
455 LESSolver().m_LESVarAverage[2][LESAvgId]};
456
457 for(MInt nghbr = 0; nghbr < LESSolver().a_noReconstructionNeighbors(cellId); nghbr++) {
458 const MInt recNghbrId = LESSolver().a_reconstructionNeighborId(cellId, nghbr);
459 const MFloat recConst_x = LESSolver().m_reconstructionConstants[nDim * (recData + nghbr) + 0];
460 const MFloat recConst_y = LESSolver().m_reconstructionConstants[nDim * (recData + nghbr) + 1];
461 const MFloat recConst_z = LESSolver().m_reconstructionConstants[nDim * (recData + nghbr) + 2];
462
463 vector<MInt>::iterator findRecNghbrId =
464 find(LESSolver().m_LESAverageCells.begin(), LESSolver().m_LESAverageCells.end(), recNghbrId);
465
466 if(findRecNghbrId == LESSolver().m_LESAverageCells.end())
467 TERMM(1, "Something went wrong in nghbr " + to_string(recNghbrId));
468
469 MInt LESRecNghbrId = distance(LESSolver().m_LESAverageCells.begin(), findRecNghbrId);
470
471 for(MInt dim = 0; dim < nDim; dim++) {
472 ASSERT(c < (MInt)LESSolver().m_LESVarAverage[dim].size(),
473 "Trying to access data [" + to_string(dim) + "][" + to_string(LESRecNghbrId)
474 + "] in LESSolver().m_LESVarAverage with length "
475 + to_string(LESSolver().m_LESVarAverage[dim].size()));
476
477 const MFloat delta_u = LESSolver().m_LESVarAverage[dim][LESRecNghbrId] - u[dim];
478 if(abs(LESSolver().m_LESVarAverage[dim][LESRecNghbrId]) > epss
479 || abs(u[dim] / LESSolver().m_LESVarAverage[dim][LESRecNghbrId]) > 100) {
480 du[dim][0] += recConst_x * delta_u;
481 du[dim][1] += recConst_y * delta_u;
482 du[dim][2] += recConst_z * delta_u;
483 }
484 }
485 }
486
487 MFloat SijSij = F0;
488 for(MInt d1 = 0; d1 < nDim; d1++) {
489 for(MInt d2 = 0; d2 < nDim; d2++) {
490 MFloat sij = 0.5 * (du[d1][d2] + du[d2][d1]);
491 SijSij += sij * sij;
492 }
493 }
494
495 const MFloat SijSijLim = (4.0 * pow(LESSolver().m_Ma, F2)) * 0.0001;
496 SijSij = max(SijSij, SijSijLim);
497 const MFloat c_mu = 0.09;
498 MFloat omega = 1 / sqrt(c_mu) * sqrt(2 * SijSij);
499 omega = max(omega, epss);
500
501 // calculating nut
502 MFloat nuTurb = max(k / (omega * rRe), LESSolver().m_nuTildeInfinity);
503 MFloat nuTilde = LESSolver().m_nuTildeInfinity;
504 if(std::isnan(omega) || tulim < 1) {
505 nuTurb = LESSolver().m_nuTildeInfinity;
506 }
507
508 if(approx(tulim, F1, eps)) {
509 const MFloat rho = LESSolver().a_pvariable(cellId, LESSolver().m_sysEqn.PV->RHO);
510 const MFloat p = LESSolver().a_pvariable(cellId, LESSolver().m_sysEqn.PV->P);
511 const MFloat T = LESSolver().m_gamma * p / rho;
512 const MFloat mue = (T * sqrt(T) * LESSolver().m_sutherlandPlusOne) / (T + LESSolver().m_sutherlandConstant);
513 const MFloat nuLaminar = mue / rho;
514
515 // Iteration of nuTilde (using Newton, nu_(n+1) = nu_n - f(nu_n)/f'(nu_n))
516 MInt NewtonIter = 50;
517 MFloat nut = nuTurb;
518 MFloat nu_new = nut;
519 MFloat nu_old = 0;
520 MFloat func_n = 0.0;
521 MFloat derv_n = 0.0;
522 MInt icount = 0;
523
524 while(abs(nu_new - nu_old) > eps && icount < NewtonIter) {
525 nu_old = nu_new;
526
527 MFloat chi = nu_old / nuLaminar;
528 MFloat chi3 = pow(chi, 3.0);
530 MFloat fv1 = chi3 / (chi3 + cv13);
531
532 // current function value
533 func_n = nu_old * fv1 - nut;
534 // derivative of function
535 derv_n = fv1 + 3.0 * fv1 - 3.0 * fv1 * fv1;
536 // newton iteration formula
537 nu_new = nu_old - func_n / derv_n;
538
539 icount++;
540 }
541
542 nuTilde = nu_new;
543 }
544
545 LESSolver().m_LESVarAverage[N][LESAvgId] = nuTilde;
546 }
547 }
548}
549
550
551template <MInt nDim, class SysEqn>
553 TRACE();
554
555 if(LESSolver().grid().isActive()) {
556 for(MInt c = 0; c < (MInt)LESSolver().m_LESAverageCells.size(); c++) {
557 MInt cellId = LESSolver().m_LESAverageCells[c];
558
559 MInt RANSId = convertIdParent(LESSolver(), RANSSolver(), cellId);
560 if(RANSId > -1) {
561 MFloat nuTilde = RANSSolver().a_pvariable(RANSId, RANSSolver().m_sysEqn.PV->N);
562 MFloat add = F0;
563 for(MInt i = 0; i < nDim; i++) {
564 add += F2B3 * RANSSolver().a_slope(RANSId, i, i);
565 }
566
567 MInt count = 0;
568 MInt index = 0;
569 for(MInt i = 0; i < nDim; i++) {
570 for(MInt j = count; j < nDim; j++) {
571 MInt indexAvg = index + noRANSVariables();
572
573 ASSERT(c < (MInt)LESSolver().m_LESVarAverage[indexAvg].size(),
574 "Trying to access data [" + to_string(indexAvg) + "][" + to_string(c)
575 + "] in LESSolver().m_LESVarAverage with length "
576 + to_string(LESSolver().m_LESVarAverage[indexAvg].size()));
577
578 if(i == j) {
579 LESSolver().m_LESVarAverage[indexAvg][c] =
580 LESSolver().m_LESVarAverage[i][c] * LESSolver().m_LESVarAverage[j][c]
581 - nuTilde * (RANSSolver().a_slope(RANSId, i, j) + RANSSolver().a_slope(RANSId, j, i) - add);
582 } else {
583 LESSolver().m_LESVarAverage[indexAvg][c] =
584 LESSolver().m_LESVarAverage[i][c] * LESSolver().m_LESVarAverage[j][c]
585 - nuTilde * (RANSSolver().a_slope(RANSId, i, j) + RANSSolver().a_slope(RANSId, j, i));
586 }
587
588 index++;
589 }
590 count++;
591 }
592 }
593 }
594 }
595}
596
597
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
Definition: context.cpp:538
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
Definition: context.cpp:494
void reconstructAverageFromNut()
Definition: fvzonalrtv.cpp:552
void transferSolverData()
Definition: fvzonalrtv.cpp:291
void determineNutReconstructionCells()
Definition: fvzonalrtv.cpp:213
FvZonalRTV(const MInt couplingId, RANS *R, LES *L)
void reconstructNutilde()
Definition: fvzonalrtv.cpp:341
void determineZonalPositions()
Definition: fvzonalrtv.cpp:109
void preCouple(MInt)
Definition: fvzonalrtv.cpp:262
void postAdaptation()
Definition: fvzonalrtv.cpp:234
void init()
Definition: fvzonalrtv.cpp:93
void finalizeCouplerInit()
Definition: fvzonalrtv.cpp:198
MInt convertIdParent(SolverA &solverA, SolverB &solverB, const MInt solverAId)
Conversion from solverA id to the solverB id If no cell on the same level is found,...
Definition: couplingutils.h:46
MBool approx(const T &, const U &, const T)
Definition: functions.h:272
MInt globalTimeStep
InfoOutFile m_log
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce