Loading...
Searching...
No Matches
UnsteadyNSTurbIntrusive.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12
13 License
14 This file is part of ITHACA-FV
15
16 ITHACA-FV is free software: you can redistribute it and/or modify
17 it under the terms of the GNU Lesser General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 ITHACA-FV is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU Lesser General Public License for more details.
25
26 You should have received a copy of the GNU Lesser General Public License
27 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
28
29\*---------------------------------------------------------------------------*/
30
32
35
36// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
37
38// Construct Null
40
41// Construct from zero
43{
44 _args = autoPtr<argList>
45 (
46 new argList(argc, argv)
47 );
48
49 if (!_args->checkRootCase())
50 {
51 Foam::FatalError.exit();
52 }
53
54 argList& args = _args();
55#include "createTime.H"
56#include "createMesh.H"
57 _pimple = autoPtr<pimpleControl>
58 (
59 new pimpleControl
60 (
61 mesh
62 )
63 );
64#include "createFields.H"
65#include "createFvOptions.H"
66 ITHACAdict = new IOdictionary
67 (
68 IOobject
69 (
70 "ITHACAdict",
71 runTime.system(),
72 mesh,
73 IOobject::MUST_READ,
74 IOobject::NO_WRITE
75 )
76 );
77 tolerance = ITHACAdict->lookupOrDefault<scalar>("tolerance", 1e-5);
78 maxIter = ITHACAdict->lookupOrDefault<scalar>("maxIter", 1000);
79 bcMethod = ITHACAdict->lookupOrDefault<word>("bcMethod", "lift");
81 ITHACAdict->lookupOrDefault<word>("timeDerivativeSchemeOrder", "second");
82 M_Assert(bcMethod == "lift" || bcMethod == "penalty",
83 "The BC method must be set to lift or penalty in ITHACAdict");
85 || timeDerivativeSchemeOrder == "second",
86 "The time derivative approximation must be set to either first or second order scheme in ITHACAdict");
91}
92
93// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94
95void UnsteadyNSTurbIntrusive::truthSolve(List<scalar> mu_now)
96{
97 Time& runTime = _runTime();
98 surfaceScalarField& phi = _phi();
99 fvMesh& mesh = _mesh();
100#include "initContinuityErrs.H"
101 fv::options& fvOptions = _fvOptions();
102 pimpleControl& pimple = _pimple();
103 volScalarField p = _p();
104 volVectorField U = _U();
105 volScalarField nut = _nut();
106 IOMRFZoneList& MRF = _MRF();
107 singlePhaseTransportModel& laminarTransport = _laminarTransport();
108 instantList Times = runTime.times();
109 runTime.setEndTime(finalTime);
110 // Perform a TruthSolve
111 runTime.setTime(Times[1], 1);
112 runTime.setDeltaT(timeStep);
114 // Initialize Nsnapshots
115 label nsnapshots = 0;
116
117 // Start the time loop
118 while (runTime.run())
119 {
120#include "readTimeControls.H"
121#include "CourantNo.H"
122#include "setDeltaT.H"
123 runTime.setEndTime(finalTime + timeStep);
124 Info << "Time = " << runTime.timeName() << nl << endl;
125
126 // --- Pressure-velocity PIMPLE corrector loop
127 while (pimple.loop())
128 {
129#include "UEqn.H"
130
131 // --- Pressure corrector loop
132 while (pimple.correct())
133 {
134#include "pEqn.H"
135 }
136
137 if (pimple.turbCorr())
138 {
139 laminarTransport.correct();
140 turbulence->correct();
141 }
142 }
143
144 Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
145 << " ClockTime = " << runTime.elapsedClockTime() << " s"
146 << nl << endl;
147
148 if (checkWrite(runTime))
149 {
150 nsnapshots += 1;
151 volScalarField nut = turbulence->nut().ref();
152 ITHACAstream::exportSolution(U, name(counter), "./ITHACAoutput/Offline/");
153 ITHACAstream::exportSolution(p, name(counter), "./ITHACAoutput/Offline/");
154 ITHACAstream::exportSolution(nut, name(counter), "./ITHACAoutput/Offline/");
155 std::ofstream of("./ITHACAoutput/Offline/" + name(counter) + "/" +
156 runTime.timeName());
157 Ufield.append(U.clone());
158 Pfield.append(p.clone());
159 nutFields.append(nut.clone());
160 counter++;
162 writeMu(mu_now);
163 // --- Fill in the mu_samples with parameters (time, mu) to be used for the PODI sample points
164 mu_samples.conservativeResize(mu_samples.rows() + 1, mu_now.size() + 1);
165 mu_samples(mu_samples.rows() - 1, 0) = atof(runTime.timeName().c_str());
166
167 for (label i = 0; i < mu_now.size(); i++)
168 {
169 mu_samples(mu_samples.rows() - 1, i + 1) = mu_now[i];
170 }
171 }
172
173 runTime++;
174 }
175
176 // Resize to Unitary if not initialized by user (i.e. non-parametric problem)
177 if (mu.cols() == 0)
178 {
179 mu.resize(1, 1);
180 }
181
182 if (mu_samples.rows() == nsnapshots * mu.cols())
183 {
184 ITHACAstream::exportMatrix(mu_samples, "mu_samples", "eigen",
185 "./ITHACAoutput/Offline");
186 }
187}
188
190 label nModes)
191{
192 Eigen::Tensor<double, 3> ct1Tensor;
193 ct1Tensor.resize(nModes, nModes, nModes);
194
195 for (label i = 0; i < nModes; i++)
196 {
197 for (label j = 0; j < nModes; j++)
198 {
199 for (label k = 0; k < nModes; k++)
200 {
201 ct1Tensor(i, j, k) = fvc::domainIntegrate(Umodes[i] & fvc::laplacian(
202 nutModes[j], Umodes[k])).value();
203 }
204 }
205 }
206
207 if (Pstream::parRun())
208 {
209 reduce(ct1Tensor, sumOp<Eigen::Tensor<double, 3>>());
210 }
211
212 // Export the tensor
213 ITHACAstream::SaveDenseTensor(ct1Tensor, "./ITHACAoutput/Matrices/",
214 "ct1_" + name(nModes) + "_t");
215 return ct1Tensor;
216}
217
219 label nModes)
220{
221 Eigen::Tensor<double, 3> ct2Tensor;
222 ct2Tensor.resize(nModes, nModes, nModes);
223
224 for (label i = 0; i < nModes; i++)
225 {
226 for (label j = 0; j < nModes; j++)
227 {
228 for (label k = 0; k < nModes; k++)
229 {
230 ct2Tensor(i, j, k) = fvc::domainIntegrate(Umodes[i] & (fvc::div(
231 nutModes[j] * dev((fvc::grad(Umodes[k]))().T())))).value();
232 }
233 }
234 }
235
236 if (Pstream::parRun())
237 {
238 reduce(ct2Tensor, sumOp<Eigen::Tensor<double, 3>>());
239 }
240
241 // Export the tensor
242 ITHACAstream::SaveDenseTensor(ct2Tensor, "./ITHACAoutput/Matrices/",
243 "ct2_" + name(nModes) + "_t");
244 return ct2Tensor;
245}
246
247Eigen::MatrixXd UnsteadyNSTurbIntrusive::btTurbulence(label nModes)
248{
249 Eigen::MatrixXd btMatrix(nModes, nModes);
250 btMatrix = btMatrix * 0;
251
252 // Project everything
253 for (label i = 0; i < nModes; i++)
254 {
255 for (label j = 0; j < nModes; j++)
256 {
257 btMatrix(i, j) = fvc::domainIntegrate(Umodes[i] & (fvc::div(dev((T(
258 fvc::grad(
259 Umodes[j]))))))).value();
260 }
261 }
262
263 // Export the matrix
264 ITHACAstream::SaveDenseMatrix(btMatrix, "./ITHACAoutput/Matrices/",
265 "bt_" + name(nModes) + "_t");
266 return btMatrix;
267}
268
269void UnsteadyNSTurbIntrusive::project(fileName folder, label nModes)
270{
271 nModesOnline = nModes;
272 L_U_SUPmodes.resize(0);
273
274 if (nModes != 0)
275 {
276 for (label k = 0; k < nModes; k++)
277 {
278 L_U_SUPmodes.append(Umodes[k].clone());
279 }
280 }
281
282 if (ITHACAutilities::check_folder("./ITHACAoutput/Matrices/"))
283 {
284 word bStr = "b_" + name(nModes);
285
286 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + bStr))
287 {
288 ITHACAstream::ReadDenseMatrix(bMatrix, "./ITHACAoutput/Matrices/", bStr);
289 }
290 else
291 {
292 bMatrix = diffusiveTerm(nModes);
293 }
294
295 word btStr = "bt_" + name(nModes);
296
297 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + btStr))
298 {
299 ITHACAstream::ReadDenseMatrix(btMatrix, "./ITHACAoutput/Matrices/", btStr);
300 }
301 else
302 {
303 btMatrix = btTurbulence(nModes);
304 }
305
306 word kStr = "k_" + name(nModes);
307
308 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + kStr))
309 {
310 ITHACAstream::ReadDenseMatrix(kMatrix, "./ITHACAoutput/Matrices/", kStr);
311 }
312 else
313 {
315 }
316
317 word cStr = "c_" + name(nModes) + "_t";
318
319 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + cStr))
320 {
321 ITHACAstream::ReadDenseTensor(convTensor, "./ITHACAoutput/Matrices/", cStr);
322 }
323 else
324 {
325 convTensor = convectiveTerm(nModes);
326 }
327
328 word ct1Str = "ct1_" + name(nModes) + "_t";
329
330 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + ct1Str))
331 {
332 ITHACAstream::ReadDenseTensor(ct1Tensor, "./ITHACAoutput/Matrices/", ct1Str);
333 }
334 else
335 {
337 }
338
339 word ct2Str = "ct2_" + name(nModes) + "_t";
340
341 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + ct2Str))
342 {
343 ITHACAstream::ReadDenseTensor(ct2Tensor, "./ITHACAoutput/Matrices/", ct2Str);
344 }
345 else
346 {
348 }
349
350 if (bcMethod == "penalty")
351 {
352 bcVelVec = bcVelocityVec(nModes);
353 bcVelMat = bcVelocityMat(nModes);
354 }
355 }
356 else
357 {
358 bMatrix = diffusiveTerm(nModes);
359 convTensor = convectiveTerm(nModes);
361 btMatrix = btTurbulence(nModes);
364
365 if (bcMethod == "penalty")
366 {
367 bcVelVec = bcVelocityVec(nModes);
368 bcVelMat = bcVelocityMat(nModes);
369 }
370 }
371
372 // Export the matrices
373 if (para->exportPython)
374 {
375 ITHACAstream::exportMatrix(bMatrix, "b", "python", "./ITHACAoutput/Matrices/");
376 ITHACAstream::exportMatrix(kMatrix, "k", "python", "./ITHACAoutput/Matrices/");
377 ITHACAstream::exportMatrix(btMatrix, "bt", "python",
378 "./ITHACAoutput/Matrices/");
380 "./ITHACAoutput/Matrices/");
381 ITHACAstream::exportTensor(ct1Tensor, "ct1", "python",
382 "./ITHACAoutput/Matrices/");
383 ITHACAstream::exportTensor(ct2Tensor, "ct2", "python",
384 "./ITHACAoutput/Matrices/");
385 }
386
387 if (para->exportMatlab)
388 {
389 ITHACAstream::exportMatrix(bMatrix, "b", "matlab", "./ITHACAoutput/Matrices/");
390 ITHACAstream::exportMatrix(kMatrix, "k", "matlab", "./ITHACAoutput/Matrices/");
391 ITHACAstream::exportMatrix(btMatrix, "bt", "matlab",
392 "./ITHACAoutput/Matrices/");
394 "./ITHACAoutput/Matrices/");
395 ITHACAstream::exportTensor(ct1Tensor, "ct1", "matlab",
396 "./ITHACAoutput/Matrices/");
397 ITHACAstream::exportTensor(ct2Tensor, "ct2", "matlab",
398 "./ITHACAoutput/Matrices/");
399 }
400
401 if (para->exportTxt)
402 {
403 ITHACAstream::exportMatrix(bMatrix, "b", "eigen", "./ITHACAoutput/Matrices/");
404 ITHACAstream::exportMatrix(kMatrix, "k", "eigen", "./ITHACAoutput/Matrices/");
405 ITHACAstream::exportMatrix(btMatrix, "bt", "eigen", "./ITHACAoutput/Matrices/");
407 "./ITHACAoutput/Matrices/c");
408 ITHACAstream::exportTensor(ct1Tensor, "ct1_", "eigen",
409 "./ITHACAoutput/Matrices/ct1");
410 ITHACAstream::exportTensor(ct2Tensor, "ct2_", "eigen",
411 "./ITHACAoutput/Matrices/ct2");
412 }
413
415 cTotalTensor.resize(nModes, nModes, nModes);
417}
418
419void UnsteadyNSTurbIntrusive::projectPPE(fileName folder, label nUModes,
420 label nPModes)
421{
422 NUmodes = nUModes;
423 NPmodes = nPModes;
424 L_U_SUPmodes.resize(0);
425
426 if (nUModes != 0)
427 {
428 for (label k = 0; k < nUModes; k++)
429 {
430 L_U_SUPmodes.append(Umodes[k].clone());
431 }
432 }
433
434 if (ITHACAutilities::check_folder("./ITHACAoutput/Matrices/"))
435 {
436 word bStr = "b_" + name(nUModes);
437
438 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + bStr))
439 {
440 ITHACAstream::ReadDenseMatrix(bMatrix, "./ITHACAoutput/Matrices/", bStr);
441 }
442 else
443 {
444 bMatrix = diffusiveTerm(nUModes);
445 }
446
447 word btStr = "bt_" + name(nUModes);
448
449 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + btStr))
450 {
451 ITHACAstream::ReadDenseMatrix(btMatrix, "./ITHACAoutput/Matrices/", btStr);
452 }
453 else
454 {
455 btMatrix = btTurbulence(nUModes);
456 }
457
458 word kStr = "k_" + name(nUModes) + "_" + name(nPModes);
459
460 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + kStr))
461 {
462 ITHACAstream::ReadDenseMatrix(kMatrix, "./ITHACAoutput/Matrices/", kStr);
463 }
464 else
465 {
466 kMatrix = pressureGradientTerm(nUModes, nPModes);
467 }
468
469 word D_str = "D_" + name(nPModes);
470
471 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + D_str))
472 {
473 ITHACAstream::ReadDenseMatrix(D_matrix, "./ITHACAoutput/Matrices/", D_str);
474 }
475 else
476 {
477 D_matrix = laplacianPressure(nPModes);
478 }
479
480 word bc1_str = "BC1_" + name(nUModes) + "_" + name(nPModes);
481
482 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + bc1_str))
483 {
484 ITHACAstream::ReadDenseMatrix(BC1_matrix, "./ITHACAoutput/Matrices/", bc1_str);
485 }
486 else
487 {
488 BC1_matrix = pressureBC1(nUModes, nPModes);
489 }
490
491 word bc2_str = "BC2_" + name(nUModes) + "_" + name(nPModes) + "_t";
492
493 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + bc2_str))
494 {
495 ITHACAstream::ReadDenseTensor(bc2Tensor, "./ITHACAoutput/Matrices/", bc2_str);
496 }
497 else
498 {
499 bc2Tensor = pressureBC2(nUModes, nPModes);
500 }
501
502 word bc3_str = "BC3_" + name(nUModes) + "_" + name(nPModes);
503
504 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + bc3_str))
505 {
506 ITHACAstream::ReadDenseMatrix(BC3_matrix, "./ITHACAoutput/Matrices/", bc3_str);
507 }
508 else
509 {
510 BC3_matrix = pressureBC3(nUModes, nPModes);
511 }
512
513 word cStr = "c_" + name(nUModes) + "_t";
514
515 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + cStr))
516 {
517 ITHACAstream::ReadDenseTensor(convTensor, "./ITHACAoutput/Matrices/", cStr);
518 }
519 else
520 {
521 convTensor = convectiveTerm(nUModes);
522 }
523
524 word ct1Str = "ct1_" + name(nUModes) + "_t";
525
526 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + ct1Str))
527 {
528 ITHACAstream::ReadDenseTensor(ct1Tensor, "./ITHACAoutput/Matrices/", ct1Str);
529 }
530 else
531 {
532 ct1Tensor = turbulenceTensor1(nUModes);
533 }
534
535 word ct2Str = "ct2_" + name(nUModes) + "_t";
536
537 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + ct2Str))
538 {
539 ITHACAstream::ReadDenseTensor(ct2Tensor, "./ITHACAoutput/Matrices/", ct2Str);
540 }
541 else
542 {
543 ct2Tensor = turbulenceTensor2(nUModes);
544 }
545
546 word ct1PPEStr = "ct1PPE_" + name(nUModes) + "_" + name(nPModes) + "_t";
547
548 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + ct1PPEStr))
549 {
550 ITHACAstream::ReadDenseTensor(ct1PPETensor, "./ITHACAoutput/Matrices/",
551 ct1PPEStr);
552 }
553 else
554 {
555 ct1PPETensor = turbulencePPETensor1(nUModes, nPModes);
556 }
557
558 word ct2PPEStr = "ct2PPE_" + name(nUModes) + "_" + name(nPModes) + "_t";
559
560 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + ct2PPEStr))
561 {
562 ITHACAstream::ReadDenseTensor(ct2PPETensor, "./ITHACAoutput/Matrices/",
563 ct2PPEStr);
564 }
565 else
566 {
567 ct2PPETensor = turbulencePPETensor2(nUModes, nPModes);
568 }
569
570 word G_str = "G_" + name(nUModes) + "_" + name(nPModes) + "_t";
571
572 if (ITHACAutilities::check_file("./ITHACAoutput/Matrices/" + G_str))
573 {
574 ITHACAstream::ReadDenseTensor(gTensor, "./ITHACAoutput/Matrices/", G_str);
575 }
576 else
577 {
578 gTensor = divMomentum(nUModes, nPModes);
579 }
580
581 if (bcMethod == "penalty")
582 {
583 bcVelVec = bcVelocityVec(nUModes);
584 bcVelMat = bcVelocityMat(nUModes);
585 }
586 }
587 else
588 {
589 bMatrix = diffusiveTerm(nUModes);
590 convTensor = convectiveTerm(nUModes);
591 kMatrix = pressureGradientTerm(nUModes, nPModes);
592 btMatrix = btTurbulence(nUModes);
593 ct1Tensor = turbulenceTensor1(nUModes);
594 ct2Tensor = turbulenceTensor2(nUModes);
595 D_matrix = laplacianPressure(nPModes);
596 ct1PPETensor = turbulencePPETensor1(nUModes, nPModes);
597 ct2PPETensor = turbulencePPETensor2(nUModes, nPModes);
598 gTensor = divMomentum(nUModes, nPModes);
599 BC1_matrix = pressureBC1(nUModes, nPModes);
600 bc2Tensor = pressureBC2(nUModes, nPModes);
601 BC3_matrix = pressureBC3(nUModes, nPModes);
602
603 if (bcMethod == "penalty")
604 {
605 bcVelVec = bcVelocityVec(nUModes);
606 bcVelMat = bcVelocityMat(nUModes);
607 }
608 }
609
610 // Export the matrices
611 if (para->exportPython)
612 {
613 ITHACAstream::exportMatrix(bMatrix, "b", "python", "./ITHACAoutput/Matrices/");
614 ITHACAstream::exportMatrix(kMatrix, "k", "python", "./ITHACAoutput/Matrices/");
615 ITHACAstream::exportMatrix(btMatrix, "bt", "python",
616 "./ITHACAoutput/Matrices/");
617 ITHACAstream::exportMatrix(D_matrix, "D", "python", "./ITHACAoutput/Matrices/");
618 ITHACAstream::exportMatrix(BC1_matrix, "BC1", "python",
619 "./ITHACAoutput/Matrices/");
620 ITHACAstream::exportMatrix(BC3_matrix, "BC3", "python",
621 "./ITHACAoutput/Matrices/");
622 ITHACAstream::exportTensor(ct1PPETensor, "ct1PPE", "python",
623 "./ITHACAoutput/Matrices/");
624 ITHACAstream::exportTensor(ct2PPETensor, "ct2PPE", "python",
625 "./ITHACAoutput/Matrices/");
626 ITHACAstream::exportTensor(gTensor, "G", "python", "./ITHACAoutput/Matrices/");
627 ITHACAstream::exportTensor(bc2Tensor, "BC2", "python",
628 "./ITHACAoutput/Matrices/");
630 "./ITHACAoutput/Matrices/");
631 ITHACAstream::exportTensor(ct1Tensor, "ct1", "python",
632 "./ITHACAoutput/Matrices/");
633 ITHACAstream::exportTensor(ct2Tensor, "ct2", "python",
634 "./ITHACAoutput/Matrices/");
635 }
636
637 if (para->exportMatlab)
638 {
639 ITHACAstream::exportMatrix(bMatrix, "b", "matlab", "./ITHACAoutput/Matrices/");
640 ITHACAstream::exportMatrix(kMatrix, "k", "matlab", "./ITHACAoutput/Matrices/");
641 ITHACAstream::exportMatrix(btMatrix, "bt", "matlab",
642 "./ITHACAoutput/Matrices/");
643 ITHACAstream::exportMatrix(D_matrix, "D", "matlab", "./ITHACAoutput/Matrices/");
644 ITHACAstream::exportMatrix(BC1_matrix, "BC1", "matlab",
645 "./ITHACAoutput/Matrices/");
646 ITHACAstream::exportMatrix(BC3_matrix, "BC3", "matlab",
647 "./ITHACAoutput/Matrices/");
648 ITHACAstream::exportTensor(ct1PPETensor, "ct1PPE", "matlab",
649 "./ITHACAoutput/Matrices/");
650 ITHACAstream::exportTensor(ct2PPETensor, "ct2PPE", "matlab",
651 "./ITHACAoutput/Matrices/");
652 ITHACAstream::exportTensor(gTensor, "G", "matlab", "./ITHACAoutput/Matrices/");
653 ITHACAstream::exportTensor(bc2Tensor, "BC2", "matlab",
654 "./ITHACAoutput/Matrices/");
656 "./ITHACAoutput/Matrices/");
657 ITHACAstream::exportTensor(ct1Tensor, "ct1", "matlab",
658 "./ITHACAoutput/Matrices/");
659 ITHACAstream::exportTensor(ct2Tensor, "ct2", "matlab",
660 "./ITHACAoutput/Matrices/");
661 }
662
663 if (para->exportTxt)
664 {
665 ITHACAstream::exportMatrix(bMatrix, "b", "eigen", "./ITHACAoutput/Matrices/");
666 ITHACAstream::exportMatrix(kMatrix, "k", "eigen", "./ITHACAoutput/Matrices/");
667 ITHACAstream::exportMatrix(btMatrix, "bt", "eigen", "./ITHACAoutput/Matrices/");
668 ITHACAstream::exportMatrix(D_matrix, "D", "eigen", "./ITHACAoutput/Matrices/");
670 "./ITHACAoutput/Matrices/");
672 "./ITHACAoutput/Matrices/");
673 ITHACAstream::exportTensor(ct1PPETensor, "ct1PPE_", "eigen",
674 "./ITHACAoutput/Matrices/ct1PPE");
675 ITHACAstream::exportTensor(ct2PPETensor, "ct2PPE_", "eigen",
676 "./ITHACAoutput/Matrices/ct2PPE");
678 "./ITHACAoutput/Matrices/G");
679 ITHACAstream::exportTensor(bc2Tensor, "BC2_", "eigen",
680 "./ITHACAoutput/Matrices/BC2");
682 "./ITHACAoutput/Matrices/c");
683 ITHACAstream::exportTensor(ct1Tensor, "ct1_", "eigen",
684 "./ITHACAoutput/Matrices/ct1");
685 ITHACAstream::exportTensor(ct2Tensor, "ct2_", "eigen",
686 "./ITHACAoutput/Matrices/ct2");
687 }
688
690 cTotalTensor.resize(nUModes, nUModes, nUModes);
692 cTotalPPETensor.resize(nPModes, nUModes, nUModes);
694}
695
696Eigen::MatrixXd UnsteadyNSTurbIntrusive::diffusiveTerm(label nModes)
697{
698 Eigen::MatrixXd bMatrix;
699 bMatrix.resize(nModes, nModes);
700
701 // Project everything
702 for (label i = 0; i < nModes; i++)
703 {
704 for (label j = 0; j < nModes; j++)
705 {
706 bMatrix(i, j) = fvc::domainIntegrate(Umodes[i] & fvc::laplacian(
707 dimensionedScalar("1", dimless, 1), Umodes[j])).value();
708 }
709 }
710
711 if (Pstream::parRun())
712 {
713 reduce(bMatrix, sumOp<Eigen::MatrixXd>());
714 }
715
716 ITHACAstream::SaveDenseMatrix(bMatrix, "./ITHACAoutput/Matrices/",
717 "b_" + name(nModes));
718 return bMatrix;
719}
720
721Eigen::Tensor<double, 3> UnsteadyNSTurbIntrusive::convectiveTerm(label nModes)
722{
723 Eigen::Tensor<double, 3> convTensor;
724 convTensor.resize(nModes, nModes, nModes);
725
726 for (label i = 0; i < nModes; i++)
727 {
728 for (label j = 0; j < nModes; j++)
729 {
730 for (label k = 0; k < nModes; k++)
731 {
732 convTensor(i, j, k) = fvc::domainIntegrate(Umodes[i] & fvc::div(
733 linearInterpolate(Umodes[j]) & Umodes[j].mesh().Sf(),
734 Umodes[k])).value();
735 }
736 }
737 }
738
739 if (Pstream::parRun())
740 {
741 reduce(convTensor, sumOp<Eigen::Tensor<double, 3>>());
742 }
743
744 // Export the tensor
745 ITHACAstream::SaveDenseTensor(convTensor, "./ITHACAoutput/Matrices/",
746 "c_" + name(nModes) + "_t");
747 return convTensor;
748}
749
751{
752 Eigen::MatrixXd kMatrix(nModes, nModes);
753
754 // Project everything
755 for (label i = 0; i < nModes; i++)
756 {
757 for (label j = 0; j < nModes; j++)
758 {
759 kMatrix(i, j) = fvc::domainIntegrate(Umodes[i] & fvc::grad(
760 Pmodes[j])).value();
761 }
762 }
763
764 if (Pstream::parRun())
765 {
766 reduce(kMatrix, sumOp<Eigen::MatrixXd>());
767 }
768
769 ITHACAstream::SaveDenseMatrix(kMatrix, "./ITHACAoutput/Matrices/",
770 "k_" + name(nModes));
771 return kMatrix;
772}
773
775 label nPModes)
776{
777 Eigen::MatrixXd kMatrix(nUModes, nPModes);
778
779 // Project everything
780 for (label i = 0; i < nUModes; i++)
781 {
782 for (label j = 0; j < nPModes; j++)
783 {
784 kMatrix(i, j) = fvc::domainIntegrate(Umodes[i] & fvc::grad(
785 Pmodes[j])).value();
786 }
787 }
788
789 if (Pstream::parRun())
790 {
791 reduce(kMatrix, sumOp<Eigen::MatrixXd>());
792 }
793
794 ITHACAstream::SaveDenseMatrix(kMatrix, "./ITHACAoutput/Matrices/",
795 "k_" + name(nUModes) + "_" + name(nPModes));
796 return kMatrix;
797}
798
799Eigen::MatrixXd UnsteadyNSTurbIntrusive::laplacianPressure(label nPModes)
800{
801 Eigen::MatrixXd dMatrix(nPModes, nPModes);
802
803 // Project everything
804 for (label i = 0; i < nPModes; i++)
805 {
806 for (label j = 0; j < nPModes; j++)
807 {
808 dMatrix(i, j) = fvc::domainIntegrate(fvc::grad(Pmodes[i])&fvc::grad(
809 Pmodes[j])).value();
810 }
811 }
812
813 if (Pstream::parRun())
814 {
815 reduce(dMatrix, sumOp<Eigen::MatrixXd>());
816 }
817
818 ITHACAstream::SaveDenseMatrix(dMatrix, "./ITHACAoutput/Matrices/",
819 "D_" + name(nPModes));
820 return dMatrix;
821}
822
823Eigen::Tensor<double, 3> UnsteadyNSTurbIntrusive::divMomentum(label nUModes,
824 label nPModes)
825{
826 label g1Size = nPModes;
827 label g2Size = nUModes;
828 Eigen::Tensor<double, 3> gTensor;
829 gTensor.resize(g1Size, g2Size, g2Size);
830
831 for (label i = 0; i < g1Size; i++)
832 {
833 for (label j = 0; j < g2Size; j++)
834 {
835 for (label k = 0; k < g2Size; k++)
836 {
837 gTensor(i, j, k) = fvc::domainIntegrate(fvc::grad(Pmodes[i]) & (fvc::div(
838 fvc::interpolate(Umodes[j]) & Umodes[j].mesh().Sf(),
839 Umodes[k]))).value();
840 }
841 }
842 }
843
844 if (Pstream::parRun())
845 {
846 reduce(gTensor, sumOp<Eigen::Tensor<double, 3>>());
847 }
848
849 // Export the tensor
850 ITHACAstream::SaveDenseTensor(gTensor, "./ITHACAoutput/Matrices/",
851 "G_" + name(nUModes) + "_" + name(
852 nPModes) + "_t");
853 return gTensor;
854}
855
856Eigen::MatrixXd UnsteadyNSTurbIntrusive::pressureBC1(label nUModes,
857 label nPModes)
858{
859 label P_BC1size = nPModes;
860 label P_BC2size = nUModes;
861 Eigen::MatrixXd BC1_matrix(P_BC1size, P_BC2size);
862 fvMesh& mesh = _mesh();
863
864 for (label i = 0; i < P_BC1size; i++)
865 {
866 for (label j = 0; j < P_BC2size; j++)
867 {
868 surfaceScalarField lpl((fvc::interpolate(fvc::laplacian(
869 Umodes[j]))&mesh.Sf())*fvc::interpolate(Pmodes[i]));
870 double s = 0;
871
872 for (label k = 0; k < lpl.boundaryField().size(); k++)
873 {
874 s += gSum(lpl.boundaryField()[k]);
875 }
876
877 BC1_matrix(i, j) = s;
878 }
879 }
880
881 if (Pstream::parRun())
882 {
883 reduce(BC1_matrix, sumOp<Eigen::MatrixXd>());
884 }
885
886 ITHACAstream::SaveDenseMatrix(BC1_matrix, "./ITHACAoutput/Matrices/",
887 "BC1_" + name(nUModes) + "_" + name(nPModes));
888 return BC1_matrix;
889}
890
891Eigen::Tensor<double, 3 > UnsteadyNSTurbIntrusive::pressureBC2(label nUModes,
892 label nPModes)
893{
894 label pressureBC1Size = nPModes;
895 label pressureBC2Size = nUModes;
896 Eigen::Tensor<double, 3 > bc2Tensor;
897 fvMesh& mesh = _mesh();
898 bc2Tensor.resize(pressureBC1Size, pressureBC2Size, pressureBC2Size);
899
900 for (label i = 0; i < pressureBC1Size; i++)
901 {
902 for (label j = 0; j < pressureBC2Size; j++)
903 {
904 for (label k = 0; k < pressureBC2Size; k++)
905 {
906 surfaceScalarField div_m(fvc::interpolate(fvc::div(fvc::interpolate(
907 Umodes[j]) & mesh.Sf(),
908 Umodes[k]))&mesh.Sf()*fvc::interpolate(Pmodes[i]));
909 double s = 0;
910
911 for (label k = 0; k < div_m.boundaryField().size(); k++)
912 {
913 s += gSum(div_m.boundaryField()[k]);
914 }
915
916 bc2Tensor(i, j, k) = s;
917 }
918 }
919 }
920
921 if (Pstream::parRun())
922 {
923 reduce(bc2Tensor, sumOp<Eigen::Tensor<double, 3>>());
924 }
925
926 // Export the tensor
927 ITHACAstream::SaveDenseTensor(bc2Tensor, "./ITHACAoutput/Matrices/",
928 "BC2_" + name(nUModes) + "_" + name(nPModes) + "_t");
929 return bc2Tensor;
930}
931
932Eigen::MatrixXd UnsteadyNSTurbIntrusive::pressureBC3(label nUModes,
933 label nPModes)
934{
935 label P3_BC1size = nPModes;
936 label P3_BC2size = nUModes;
937 Eigen::MatrixXd BC3_matrix(P3_BC1size, P3_BC2size);
938 fvMesh& mesh = _mesh();
939 surfaceVectorField n(mesh.Sf() / mesh.magSf());
940
941 for (label i = 0; i < P3_BC1size; i++)
942 {
943 for (label j = 0; j < P3_BC2size; j++)
944 {
945 surfaceVectorField BC3 = fvc::interpolate(fvc::curl(Umodes[j])).ref();
946 surfaceVectorField BC4 = (n ^ fvc::interpolate(fvc::grad(Pmodes[i]))).ref();
947 surfaceScalarField BC5 = ((BC3 & BC4) * mesh.magSf()).ref();
948 double s = 0;
949
950 for (label k = 0; k < BC5.boundaryField().size(); k++)
951 {
952 s += gSum(BC5.boundaryField()[k]);
953 }
954
955 BC3_matrix(i, j) = s;
956 }
957 }
958
959 if (Pstream::parRun())
960 {
961 reduce(BC3_matrix, sumOp<Eigen::MatrixXd>());
962 }
963
964 ITHACAstream::SaveDenseMatrix(BC3_matrix, "./ITHACAoutput/Matrices/",
965 "BC3_" + name(nUModes) + "_" + name(nPModes));
966 return BC3_matrix;
967}
968
969Eigen::MatrixXd UnsteadyNSTurbIntrusive::pressureBC4(label nUModes,
970 label nPModes)
971{
972 label P4_BC1size = nPModes;
973 label P4_BC2size = nUModes;
974 Eigen::MatrixXd BC4_matrix(P4_BC1size, P4_BC2size);
975 fvMesh& mesh = _mesh();
976 surfaceVectorField n(mesh.Sf() / mesh.magSf());
977
978 for (label i = 0; i < P4_BC1size; i++)
979 {
980 for (label j = 0; j < P4_BC2size; j++)
981 {
982 surfaceScalarField BC3 = fvc::interpolate(Pmodes[i]).ref();
983 surfaceScalarField BC4 = (n & fvc::interpolate(Umodes[j])).ref();
984 surfaceScalarField BC5 = ((BC3 * BC4) * mesh.magSf()).ref();
985 double s = 0;
986
987 for (label k = 0; k < BC5.boundaryField().size(); k++)
988 {
989 s += gSum(BC5.boundaryField()[k]);
990 }
991
992 BC4_matrix(i, j) = s;
993 }
994 }
995
996 if (Pstream::parRun())
997 {
998 reduce(BC4_matrix, sumOp<Eigen::MatrixXd>());
999 }
1000
1001 ITHACAstream::SaveDenseMatrix(BC4_matrix, "./ITHACAoutput/Matrices/",
1002 "BC4_" + name(nUModes) + "_" + name(nPModes));
1003 return BC4_matrix;
1004}
1005
1006List< Eigen::MatrixXd > UnsteadyNSTurbIntrusive::bcVelocityVec(label nModes)
1007{
1008 List < Eigen::MatrixXd > bcVelVec(inletIndex.rows());
1009
1010 for (label j = 0; j < inletIndex.rows(); j++)
1011 {
1012 bcVelVec[j].resize(nModes, 1);
1013 }
1014
1015 for (label k = 0; k < inletIndex.rows(); k++)
1016 {
1017 label BCind = inletIndex(k, 0);
1018 label BCcomp = inletIndex(k, 1);
1019
1020 for (label i = 0; i < nModes; i++)
1021 {
1022 bcVelVec[k](i, 0) = gSum(Umodes[i].boundaryField()[BCind].component(
1023 BCcomp));
1024 }
1025 }
1026
1027 ITHACAstream::exportMatrix(bcVelVec, "bcVelVec", "eigen",
1028 "./ITHACAoutput/Matrices/bcVelVec");
1029 return bcVelVec;
1030}
1031
1032List< Eigen::MatrixXd > UnsteadyNSTurbIntrusive::bcVelocityMat(label nModes)
1033{
1034 label BCUsize = inletIndex.rows();
1035 List < Eigen::MatrixXd > bcVelMat(BCUsize);
1036
1037 for (label j = 0; j < inletIndex.rows(); j++)
1038 {
1039 bcVelMat[j].resize(nModes, nModes);
1040 }
1041
1042 for (label k = 0; k < inletIndex.rows(); k++)
1043 {
1044 label BCind = inletIndex(k, 0);
1045 label BCcomp = inletIndex(k, 1);
1046
1047 for (label i = 0; i < nModes; i++)
1048 {
1049 for (label j = 0; j < nModes; j++)
1050 {
1051 bcVelMat[k](i, j) = gSum(Umodes[i].boundaryField()[BCind].component(
1052 BCcomp) *
1053 Umodes[j].boundaryField()[BCind].component(BCcomp));
1054 }
1055 }
1056 }
1057
1058 ITHACAstream::exportMatrix(bcVelMat, "bcVelMat", "eigen",
1059 "./ITHACAoutput/Matrices/bcVelMat");
1060 return bcVelMat;
1061}
1062
1064 label nUModes, label nPModes)
1065{
1066 Eigen::Tensor<double, 3> ct1PPETensor;
1067 ct1PPETensor.resize(nPModes, nUModes, nUModes);
1068
1069 for (label i = 0; i < nPModes; i++)
1070 {
1071 for (label j = 0; j < nUModes; j++)
1072 {
1073 for (label k = 0; k < nUModes; k++)
1074 {
1075 ct1PPETensor(i, j, k) = fvc::domainIntegrate(fvc::grad(Pmodes[i]) & (
1076 fvc::laplacian(
1077 nutModes[j], Umodes[k]))).value();
1078 }
1079 }
1080 }
1081
1082 if (Pstream::parRun())
1083 {
1084 reduce(ct1PPETensor, sumOp<Eigen::Tensor<double, 3>>());
1085 }
1086
1087 // Export the tensor
1088 ITHACAstream::SaveDenseTensor(ct1PPETensor, "./ITHACAoutput/Matrices/",
1089 "ct1PPE_" + name(nUModes) + "_" + name(nPModes) + "_t");
1090 return ct1PPETensor;
1091}
1092
1094 label nUModes, label nPModes)
1095{
1096 Eigen::Tensor<double, 3> ct2PPETensor;
1097 ct2PPETensor.resize(nPModes, nUModes, nUModes);
1098
1099 for (label i = 0; i < nPModes; i++)
1100 {
1101 for (label j = 0; j < nUModes; j++)
1102 {
1103 for (label k = 0; k < nUModes; k++)
1104 {
1105 ct2PPETensor(i, j, k) = fvc::domainIntegrate(fvc::grad(Pmodes[i]) & ((fvc::div(
1106 nutModes[j] * dev2((fvc::grad(Umodes[k]))().T()))))).value();
1107 }
1108 }
1109 }
1110
1111 if (Pstream::parRun())
1112 {
1113 reduce(ct2PPETensor, sumOp<Eigen::Tensor<double, 3>>());
1114 }
1115
1116 // Export the tensor
1117 ITHACAstream::SaveDenseTensor(ct2PPETensor, "./ITHACAoutput/Matrices/",
1118 "ct2PPE_" + name(nUModes) + "_" + name(nPModes) + "_t");
1119 return ct2PPETensor;
1120}
Foam::fvMesh & mesh
Definition createMesh.H:47
Foam::Time & runTime
Definition createTime.H:33
#define M_Assert(Expr, Msg)
Header file of the UnsteadyNSTurbIntrusive class.
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
Eigen::Tensor< double, 3 > convectiveTerm(label nModes)
The method for computing the convective term tensor.
Eigen::MatrixXd pressureBC4(label nUModes, label nPModes)
Term N° 4 given by the additional boundary condition using a PPE approach.
Eigen::MatrixXd kMatrix
Pressure Gradient matrix.
Eigen::Tensor< double, 3 > cTotalTensor
Total Turbulent tensor.
Eigen::Tensor< double, 3 > turbulencePPETensor1(label nUModes, label nPModes)
Method to compute one of the turbulence eddy viscosity tensors in the PPE approach.
List< Eigen::MatrixXd > bcVelocityMat(label nModes)
Boundary integral modes on boundary used by the penaly method.
Eigen::MatrixXd pressureGradientTerm(label nModes)
The method for computing the pressure gradient term with number of modes of pressure being equal to t...
Eigen::Tensor< double, 3 > ct1PPETensor
Turbulent viscosity tensor PPE approach.
Eigen::Tensor< double, 3 > turbulenceTensor1(label nModes)
Method to compute one of the turbulence tensors.
Eigen::MatrixXd btTurbulence(label nModes)
bt added matrix for the turbulence treatement
Eigen::Tensor< double, 3 > divMomentum(label nUModes, label nPModes)
Divergence of convective term (PPE approach)
Eigen::Tensor< double, 3 > turbulenceTensor2(label nModes)
Method to compute one of the turbulence tensors.
Eigen::Tensor< double, 3 > ct2PPETensor
Turbulent viscosity tensor PPE approach.
Eigen::Tensor< double, 3 > pressureBC2(label nUModes, label nPModes)
Term N° 2 given by the additional boundary condition using a PPE approach.
Eigen::Tensor< double, 3 > turbulencePPETensor2(label nUModes, label nPModes)
Method to compute one of the turbulence eddy viscosity tensors in the PPE approach.
Eigen::MatrixXd pressureBC3(label nUModes, label nPModes)
Term N° 3 given by the additional boundary condition using a PPE approach.
Eigen::Tensor< double, 3 > convTensor
Convective tensor.
void projectPPE(fileName folder, label nUModes, label nPModes)
The projection method for computing the reduced order matrices with the usage of Poisson equation for...
Eigen::Tensor< double, 3 > ct2Tensor
Turbulent viscosity tensor.
Eigen::Tensor< double, 3 > cTotalPPETensor
Total Turbulent tensor PPE approach.
Eigen::MatrixXd btMatrix
Turbulent viscosity matrix.
Eigen::MatrixXd bTotalMatrix
Total B Matrix.
Eigen::MatrixXd laplacianPressure(label nPModes)
Laplacian of pressure term (PPE approach)
Eigen::Tensor< double, 3 > ct1Tensor
Turbulent viscosity tensor.
UnsteadyNSTurbIntrusive()
Construct Null.
autoPtr< volScalarField > _nut
Eddy viscosity field.
Eigen::MatrixXd bMatrix
Diffusive matrix.
PtrList< volScalarField > nutFields
List of snapshots for the solution for eddy viscosity.
label nModesOnline
Number of modes used in the online stage.
volScalarModes nutModes
List of POD modes for eddy viscosity.
Eigen::MatrixXd diffusiveTerm(label nModes)
Diffusive Term.
Eigen::MatrixXd pressureBC1(label nUModes, label nPModes)
Term N° 1 given by the additional boundary condition using a PPE approach.
List< Eigen::MatrixXd > bcVelocityVec(label nModes)
Boundary integral modes on boundary used by the penaly method.
bool checkWrite(Time &timeObject)
Function to check if the solution must be exported.
scalar startTime
Start Time (initial time to start storing the snapshots)
scalar writeEvery
Time step of the writing procedure.
scalar timeStep
Time step of the simulation.
scalar nextWrite
Auxiliary variable to store the next writing instant.
scalar finalTime
Final time (final time of the simulation and consequently of the acquisition of the snapshots)
void project()
General projection operation.
void writeMu(List< scalar > mu_now)
Write out a list of scalar corresponding to the parameters used in the truthSolve.
Eigen::MatrixXd mu_samples
Matrix of parameters to be used for PODI, where each row corresponds to a sample point....
label counter
Counter used for the output of the full order solutions.
bool offline
Boolean variable, it is 1 if the Offline phase has already been computed, else 0.
IOdictionary * ITHACAdict
dictionary to store input output infos
Eigen::MatrixXd mu
Row matrix of parameters.
autoPtr< argList > _args
argList
Eigen::MatrixXi inletIndex
Matrix that contains informations about the inlet boundaries.
bool podex
Boolean variable, it is 1 if the POD has already been computed, else 0.
void truthSolve()
Perform a TruthSolve.
List< Eigen::MatrixXd > bcVelVec
Boundary term for penalty method - vector.
Definition steadyNS.H:218
scalar maxIter
Number of maximum iterations to be done for the computation of the truth solution.
Definition steadyNS.H:125
label NPmodes
Number of pressure modes used for the projection.
Definition steadyNS.H:143
bool supex
Boolean variable to check the existence of the supremizer modes.
Definition steadyNS.H:256
Eigen::MatrixXd BC1_matrix
PPE BC1.
Definition steadyNS.H:182
autoPtr< surfaceScalarField > _phi
Flux.
Definition steadyNS.H:293
Eigen::MatrixXd BC4_matrix
PPE BC4.
Definition steadyNS.H:194
Eigen::MatrixXd BC3_matrix
PPE BC3.
Definition steadyNS.H:191
PtrList< volScalarField > Pfield
List of pointers used to form the pressure snapshots matrix.
Definition steadyNS.H:86
autoPtr< fv::options > _fvOptions
fvOptions
Definition steadyNS.H:287
autoPtr< Time > _runTime
Time.
Definition steadyNS.H:290
volVectorModes Umodes
List of pointers used to form the velocity modes.
Definition steadyNS.H:101
PtrList< volVectorField > Ufield
List of pointers used to form the velocity snapshots matrix.
Definition steadyNS.H:89
scalar tolerance
Tolerance for the residual of the stationary problems, there is the same tolerance for velocity and p...
Definition steadyNS.H:122
autoPtr< fvMesh > _mesh
Mesh.
Definition steadyNS.H:281
autoPtr< singlePhaseTransportModel > _laminarTransport
Laminar transport (used by turbulence model)
Definition steadyNS.H:302
label NUmodes
Number of velocity modes used for the projection.
Definition steadyNS.H:140
volVectorModes L_U_SUPmodes
List of pointers containing the total number of lift, supremizer and velocity modes.
Definition steadyNS.H:116
ITHACAparameters * para
Definition steadyNS.H:82
Eigen::MatrixXd D_matrix
Laplacian term PPE.
Definition steadyNS.H:173
autoPtr< IOMRFZoneList > _MRF
MRF variable.
Definition steadyNS.H:305
Eigen::Tensor< double, 3 > gTensor
Divergence of momentum PPE.
Definition steadyNS.H:179
List< Eigen::MatrixXd > bcVelMat
Boundary term for penalty method - matrix.
Definition steadyNS.H:221
Eigen::Tensor< double, 3 > bc2Tensor
PPE BC2.
Definition steadyNS.H:188
autoPtr< volVectorField > _U
Velocity field.
Definition steadyNS.H:263
volScalarModes Pmodes
List of pointers used to form the pressure modes.
Definition steadyNS.H:98
word bcMethod
Boundary Method.
Definition steadyNS.H:317
autoPtr< volScalarField > _p
Pressure field.
Definition steadyNS.H:260
autoPtr< incompressible::turbulenceModel > turbulence
Turbulence model.
Definition unsteadyNS.H:76
word timeDerivativeSchemeOrder
Definition unsteadyNS.H:99
autoPtr< pimpleControl > _pimple
pimpleControl
Definition unsteadyNS.H:73
volScalarField & T
Definition createT.H:46
void ReadDenseMatrix(MatrixType &Matrix, word folder, word MatrixName)
Read a dense matrix from a binary format file.
void exportSolution(GeometricField< Type, PatchField, GeoMesh > &s, fileName subfolder, fileName folder, word fieldName)
Export a field to file in a certain folder and subfolder.
void exportMatrix(Eigen::Matrix< T, -1, dim > &matrix, word Name, word type, word folder)
Export the reduced matrices in numpy (type=python), matlab (type=matlab) and txt (type=eigen) format ...
void SaveDenseMatrix(MatrixType &Matrix, word folder, word MatrixName)
Save a dense matrix to a binary format file.
void ReadDenseTensor(TensorType &Tensor, word folder, word MatrixName)
Read a dense tensor from file.
void exportTensor(Eigen::Tensor< T, 3 > tensor, word Name, word type, word folder)
Export the reduced tensor in numpy (tipo=python), matlab (tipo=matlab) and txt (tipo=eigen) format.
void SaveDenseTensor(TensorType &Tensor, word folder, word MatrixName)
Save a dense tensor to file.
bool check_pod()
Check if the POD data folder "./ITHACAoutput/POD" exists.
bool check_off()
Check if the offline data folder "./ITHACAoutput/Offline" exists.
bool check_folder(word folder)
Checks if a folder exists.
bool check_file(std::string fileName)
Function that returns true if a file exists.
bool check_sup()
Check if the supremizer folder exists.
surfaceScalarField & phi
volVectorField & U
pimpleControl & pimple
volScalarField & nut
volScalarField & p
singlePhaseTransportModel & laminarTransport
label i
Definition pEqn.H:46