Loading...
Searching...
No Matches
UnsteadyNSTTurb.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
31#include "UnsteadyNSTTurb.H"
32#include "viscosityModel.H"
33#include "alphatJayatillekeWallFunctionFvPatchScalarField.H"
34
35
38
39// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
40
41// Construct Null
43
44// Construct from zero
45UnsteadyNSTTurb::UnsteadyNSTTurb(int argc, char* argv[])
46{
47#include "setRootCase.H"
48#include "createTime.H"
49#include "createMesh.H"
50 _piso = autoPtr<pisoControl>
51 (
52 new pisoControl
53 (
54 mesh
55 )
56 );
57#pragma GCC diagnostic push
58#pragma GCC diagnostic ignored "-Wunused-variable"
59#include "createFields.H"
60#include "createFvOptions.H"
61#pragma GCC diagnostic pop
63}
64
65// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66
67void UnsteadyNSTTurb::truthSolve(List<scalar> mu_now)
68{
69 Time& runTime = _runTime();
70 surfaceScalarField& phi = _phi();
71 fvMesh& mesh = _mesh();
72#include "initContinuityErrs.H"
73 fv::options& fvOptions = _fvOptions();
74 pisoControl& piso = _piso();
75 volScalarField p = _p();
76 volVectorField U = _U();
77 volScalarField T = _T();
78 volScalarField _nut(turbulence->nut());
79 dimensionedScalar nu = _nu();
80 dimensionedScalar Pr = _Pr();
81 dimensionedScalar Prt = _Prt();
82 volScalarField alphat = _alphat();
83 singlePhaseTransportModel& laminarTransport = _laminarTransport();
84 //dimensionedScalar alphaEff = _alphaEff();
85 IOMRFZoneList& MRF = _MRF();
86 instantList Times = runTime.times();
87 runTime.setEndTime(finalTime);
88 // Perform a TruthSolve
89 bool WRITE;
90 runTime.setTime(Times[1], 1);
91 runTime.setDeltaT(timeStep);
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 turbulence->validate();
95
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97
98 // Start the time loop
99 while (runTime.run())
100 {
101#include "CourantNo.H"
102 runTime.setEndTime(finalTime);
103 runTime++;
104 Info << "Time = " << runTime.timeName() << nl << endl;
105 // --- Pressure-velocity PIMPLE corrector loop
106 {
107#include "UEqn.H"
108
109 // --- Pressure corrector loop
110 while (piso.correct())
111 {
112#include "pEqn.H"
113 }
114 }
115
116 {
117#include "TEqn.H"
118 //TEqn.solve();
119 }
120
121 volScalarField _nut(turbulence->nut());
122 laminarTransport.correct();
123 turbulence->correct();
124 Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
125 << " ClockTime = " << runTime.elapsedClockTime() << " s"
126 << nl << endl;
127 WRITE = checkWrite(runTime);
128
129 if (WRITE)
130 {
131 ITHACAstream::exportSolution(U, name(counter), "./ITHACAoutput/Offline/");
132 ITHACAstream::exportSolution(p, name(counter), "./ITHACAoutput/Offline/");
133 ITHACAstream::exportSolution(_nut, name(counter), "./ITHACAoutput/Offline/");
134 ITHACAstream::exportSolution(T, name(counter), "./ITHACAoutput/Offline/");
135 ITHACAstream::exportSolution(alphat, name(counter), "./ITHACAoutput/Offline/");
136 std::ofstream of("./ITHACAoutput/Offline/" + name(counter) + "/" +
137 runTime.timeName());
138 Ufield.append(U.clone());
139 Pfield.append(p.clone());
140 nutFields.append(_nut.clone());
141 Tfield.append(T.clone());
142 counter++;
144 writeMu(mu_now);
145 }
146 }
147}
148
149bool UnsteadyNSTTurb::checkWrite(Time& timeObject)
150{
151 scalar diffnow = mag(nextWrite - atof(timeObject.timeName().c_str()));
152 scalar diffnext = mag(nextWrite - atof(timeObject.timeName().c_str()) -
153 timeObject.deltaTValue());
154
155 if ( diffnow < diffnext)
156 {
157 return true;
158 }
159 else
160 {
161 return false;
162 }
163}
164
166{
167 for (label k = 0; k < inletIndexT.rows(); k++)
168 {
169 Time& runTime = _runTime();
170 fvMesh& mesh = _mesh();
171 volScalarField& T = _T();
172 simpleControl simple(mesh);
173 //IOMRFZoneList& MRF = _MRF();
174 //singlePhaseTransportModel& laminarTransport = _laminarTransport();
175 //volScalarField& nut = _nut();
176 volScalarField& alphat = _alphat();
177 //dimensionedScalar& nu = _nu();
178 dimensionedScalar& Pr = _Pr();
179 dimensionedScalar& Prt = _Prt();
180 label BCind = inletIndexT(k, 0);
181 volScalarField Tlift("Tlift" + name(k), T);
182 instantList Times = runTime.times();
183 runTime.setTime(Times[1], 1);
184 Info << "Solving a lifting Problem" << endl;
185 scalar t1 = 1;
186 scalar t0 = 0;
187
188 for (label j = 0; j < T.boundaryField().size(); j++)
189 {
190 if (j == BCind)
191 {
192 assignBC(Tlift, j, t1);
193 }
194 else if (T.boundaryField()[BCind].type() == "zeroGradient")
195 {
196 assignBC(Tlift, j, t0);
197 assignIF(Tlift, t1);
198 }
199 else if (T.boundaryField()[BCind].type() == "fixedValue")
200 {
201 assignBC(Tlift, j, t0);
202 assignIF(Tlift, t0);
203 }
204 else
205 {
206 }
207 }
208
209 while (simple.correctNonOrthogonal())
210 {
211 alphat = turbulence->nut() / Prt;
212 alphat.correctBoundaryConditions();
213 volScalarField alphaEff("alphaEff", turbulence->nu() / Pr + alphat);
214 fvScalarMatrix TEqn
215 (
216 fvm::ddt(Tlift)
217 - fvm::laplacian(alphaEff, Tlift)
218 );
219 TEqn.solve();
220 Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
221 << " ClockTime = " << runTime.elapsedClockTime() << " s"
222 << nl << endl;
223 }
224
225 scalar totalTime = mesh.time().value();
226 scalar dt = mesh.time().deltaTValue();
227 forAll(Tlift, i)
228 {
229 Tlift[i] = (totalTime * Tlift[i] + dt * Tlift[i] ) / (totalTime + dt);
230 }
231
232 Tlift.write();
233 liftfieldT.append(Tlift.clone());
234 }
235}
236
237List <Eigen::MatrixXd> UnsteadyNSTTurb::turbulenceTerm1(label NUmodes,
238 label NSUPmodes, label Nnutmodes)
239{
240 label Csize = NUmodes + NSUPmodes + liftfield.size();
241 List <Eigen::MatrixXd> CT1_matrix;
242 CT1_matrix.setSize(Csize);
243
244 for (label j = 0; j < Csize; j++)
245 {
246 CT1_matrix[j].resize(Nnutmodes, Csize);
247 CT1_matrix[j] = CT1_matrix[j] * 0;
248 }
249
250 PtrList<volVectorField> Together(0);
251
252 // Create PTRLIST with lift, velocities and supremizers
253
254 if (liftfield.size() != 0)
255 {
256 for (label k = 0; k < liftfield.size(); k++)
257 {
258 Together.append(liftfield[k].clone());
259 }
260 }
261
262 if (NUmodes != 0)
263 {
264 for (label k = 0; k < NUmodes; k++)
265 {
266 Together.append(Umodes[k].clone());
267 }
268 }
269
270 if (NSUPmodes != 0)
271 {
272 for (label k = 0; k < NSUPmodes; k++)
273 {
274 Together.append(supmodes[k].clone());
275 }
276 }
277
278 for (label i = 0; i < Csize; i++)
279 {
280 Info << "Filling layer number " << i + 1 << " in the matrix CT1_matrix" << endl;
281
282 for (label j = 0; j < Nnutmodes; j++)
283 {
284 for (label k = 0; k < Csize; k++)
285 {
286 CT1_matrix[i](j, k) = fvc::domainIntegrate(Together[i] & fvc::laplacian(
287 nuTmodes[j], Together[k])).value();
288 }
289 }
290 }
291
292 // Export the matrix
293 ITHACAstream::exportMatrix(CT1_matrix, "CT1_matrix", "python",
294 "./ITHACAoutput/Matrices/");
295 ITHACAstream::exportMatrix(CT1_matrix, "CT1_matrix", "matlab",
296 "./ITHACAoutput/Matrices/");
297 ITHACAstream::exportMatrix(CT1_matrix, "CT1_matrix", "eigen",
298 "./ITHACAoutput/Matrices/CT1");
299 return CT1_matrix;
300}
301
302List <Eigen::MatrixXd> UnsteadyNSTTurb::turbulenceTerm2(label NUmodes,
303 label NSUPmodes, label Nnutmodes)
304{
305 label Csize = NUmodes + NSUPmodes + liftfield.size();
306 List <Eigen::MatrixXd> CT2_matrix;
307 CT2_matrix.setSize(Csize);
308
309 for (label j = 0; j < Csize; j++)
310 {
311 CT2_matrix[j].resize(Nnutmodes, Csize);
312 CT2_matrix[j] = CT2_matrix[j] * 0;
313 }
314
315 PtrList<volVectorField> Together(0);
316
317 // Create PTRLIST with lift, velocities and supremizers
318
319 if (liftfield.size() != 0)
320 {
321 for (label k = 0; k < liftfield.size(); k++)
322 {
323 Together.append(liftfield[k].clone());
324 }
325 }
326
327 if (NUmodes != 0)
328 {
329 for (label k = 0; k < NUmodes; k++)
330 {
331 Together.append(Umodes[k].clone());
332 }
333 }
334
335 if (NSUPmodes != 0)
336 {
337 for (label k = 0; k < NSUPmodes; k++)
338 {
339 Together.append(supmodes[k].clone());
340 }
341 }
342
343 for (label i = 0; i < Csize; i++)
344 {
345 Info << "Filling layer number " << i + 1 << " in the matrix CT2_matrix" << endl;
346
347 for (label j = 0; j < Nnutmodes; j++)
348 {
349 for (label k = 0; k < Csize; k++)
350 {
351 CT2_matrix[i](j, k) = fvc::domainIntegrate(Together[i] & (fvc::div(
352 nuTmodes[j] * dev((fvc::grad(Together[k]))().T())))).value();
353 }
354 }
355 }
356
357 // Export the matrix
358 ITHACAstream::exportMatrix(CT2_matrix, "CT2_matrix", "python",
359 "./ITHACAoutput/Matrices/");
360 ITHACAstream::exportMatrix(CT2_matrix, "CT2_matrix", "matlab",
361 "./ITHACAoutput/Matrices/");
362 ITHACAstream::exportMatrix(CT2_matrix, "CT2_matrix", "eigen",
363 "./ITHACAoutput/Matrices/CT2");
364 return CT2_matrix;
365}
366
368{
369 label BTsize = NUmodes + NSUPmodes + liftfield.size();
370 Eigen::MatrixXd BT_matrix(BTsize, BTsize);
371 BT_matrix = BT_matrix * 0;
372 // Create PTRLIST with lift, velocities and supremizers
373 PtrList<volVectorField> Together(0);
374
375 if (liftfield.size() != 0)
376 {
377 for (label k = 0; k < liftfield.size(); k++)
378 {
379 Together.append(liftfield[k].clone());
380 }
381 }
382
383 if (NUmodes != 0)
384 {
385 for (label k = 0; k < NUmodes; k++)
386 {
387 Together.append(Umodes[k].clone());
388 }
389 }
390
391 if (NSUPmodes != 0)
392 {
393 for (label k = 0; k < NSUPmodes; k++)
394 {
395 Together.append(supmodes[k].clone());
396 }
397 }
398
399 // Project everything
400 for (label i = 0; i < BTsize; i++)
401 {
402 for (label j = 0; j < BTsize; j++)
403 {
404 BT_matrix(i, j) = fvc::domainIntegrate(Together[i] & (fvc::div(dev((T(fvc::grad(
405 Together[j]))))))).value();
406 }
407 }
408
409 // Export the matrix
410 ITHACAstream::exportMatrix(BT_matrix, "BT_matrix", "python",
411 "./ITHACAoutput/Matrices/");
412 ITHACAstream::exportMatrix(BT_matrix, "BT_matrix", "matlab",
413 "./ITHACAoutput/Matrices/");
414 ITHACAstream::exportMatrix(BT_matrix, "BT_matrix", "eigen",
415 "./ITHACAoutput/Matrices/");
416 return BT_matrix;
417}
418
420 label NTmodes, label Nnutmodes)
421{
422 label Stsize = NTmodes + liftfieldT.size();
423 List <Eigen::MatrixXd> S_matrix;
424 S_matrix.setSize(Stsize);
425
426 for (label j = 0; j < Stsize; j++)
427 {
428 S_matrix[j].resize(Nnutmodes, Stsize);
429 }
430
431 PtrList<volScalarField> Together(0);
432
433 // Create PTRLIST with lift, velocities and supremizers
434
435 if (liftfieldT.size() != 0)
436 {
437 for (label k = 0; k < liftfieldT.size(); k++)
438 {
439 Together.append(liftfieldT[k].clone());
440 }
441 }
442
443 if (NTmodes != 0)
444 {
445 for (label k = 0; k < NTmodes; k++)
446 {
447 Together.append(Tmodes[k].clone());
448 }
449 }
450
451 for (label i = 0; i < Stsize; i++)
452 {
453 Info << "Filling layer number " << i + 1 << " in the matrix S_matrix" << endl;
454
455 for (label j = 0; j < Nnutmodes; j++)
456 {
457 for (label k = 0; k < Stsize; k++)
458 {
459 S_matrix[i](j, k) = fvc::domainIntegrate(Together[i] * fvc::laplacian(
460 nuTmodes[j], Together[k])).value();
461 }
462 }
463 }
464
465 // Export the matrix
466 ITHACAstream::exportMatrix(S_matrix, "S_matrix", "python",
467 "./ITHACAoutput/Matrices/");
468 ITHACAstream::exportMatrix(S_matrix, "S_matrix", "matlab",
469 "./ITHACAoutput/Matrices/");
470 ITHACAstream::exportMatrix(S_matrix, "S_matrix", "eigen",
471 "./ITHACAoutput/Matrices/S");
472 return S_matrix;
473}
474
475void UnsteadyNSTTurb::projectSUP(fileName folder, label NU, label NP,
476 label NSUP, label Nnut, label NT)
477{
478 if (ITHACAutilities::check_folder("./ITHACAoutput/Matrices/"))
479 {
480 B_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/B_mat.txt");
481 C_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/C", "C");
482 K_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/K_mat.txt");
483 P_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/P_mat.txt");
484 M_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/M_mat.txt");
485 BT_matrix =
486 ITHACAstream::readMatrix("./ITHACAoutput/Matrices/BT_matrix_mat.txt");
487 CT1_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/CT1",
488 "CT1_matrix");
489 CT2_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/CT2",
490 "CT2_matrix");
491 Q_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/Q", "Q");
492 Y_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/Y_mat.txt");
493 S_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/S_mat.txt");
494 MT_matrix = ITHACAstream::readMatrix("./ITHACAoutput/Matrices/MT_mat.txt");
495 }
496 else
497 {
498 NUmodes = NU;
499 NPmodes = NP;
500 NSUPmodes = NSUP;
501 Nnutmodes = Nnut;
502 NTmodes = NT;
515 }
516
518 C_total_matrix.setSize(C_matrix.size());
519
520 for (label i = 0; i < C_matrix.size(); i++)
521 {
523 }
524
525 NUmodes = NU;
526 NPmodes = NP;
527 NSUPmodes = NSUP;
528 Nnutmodes = Nnut;
529 // Get the coeffs for interpolation (the orthonormal one is used because basis are orthogonal)
530 Eigen::MatrixXd Ncoeff = ITHACAutilities::getCoeffs(nutFields, nuTmodes);
531 ITHACAstream::exportMatrix(Ncoeff, "Ncoeff", "python",
532 "./ITHACAoutput/Matrices/");
533 SAMPLES.resize(Nnutmodes);
534 rbfsplines.resize(Nnutmodes);
535
536 for (label i = 0; i < Nnutmodes; i++)
537 {
538 SAMPLES[i] = new SPLINTER::DataTable(1, 1);
539
540 for (label j = 0; j < Ncoeff.cols(); j++)
541 {
542 SAMPLES[i]->addSample(mu.row(j), Ncoeff(i, j));
543 }
544
545 rbfsplines[i] = new SPLINTER::RBFSpline(* SAMPLES[i],
546 SPLINTER::RadialBasisFunctionType::GAUSSIAN);
547 std::cout << "Constructing RadialBasisFunction for mode " << i + 1 << std::endl;
548 }
549}
forAll(example_CG.gList, solutionI)
Definition CGtest.H:21
Foam::fvMesh & mesh
Definition createMesh.H:47
Foam::Time & runTime
Definition createTime.H:33
fv::options & fvOptions
Definition NLsolve.H:25
volScalarField alphaEff("alphaEff", turbulence->nu()/Pr+alphat)
Header file of the unsteadyNSTTurb class.
label Nnutmodes
Number of viscoisty modes used for the projection.
scalar Prt
Scalar to store the turbulent Prandtl number.
Eigen::MatrixXd BT_matrix
Turbulent viscosity term.
PtrList< volScalarField > nutFields
List of snapshots for the solution for eddy viscosity.
List< Eigen::MatrixXd > CT1_matrix
Turbulent viscosity term.
bool checkWrite(Time &timeObject)
Function to check if the solution must be exported.
List< Eigen::MatrixXd > S_matrix
Turbulent diffusivity term.
scalar Pr
Scalar to store the Prandtl number.
List< Eigen::MatrixXd > C_total_matrix
Total C Matrix.
void projectSUP(fileName folder, label NU, label NP, label NSUP, label Nnut, label NT)
Project using a supremizer approach.
List< Eigen::MatrixXd > CT2_matrix
Turbulent viscosity term.
Eigen::MatrixXd B_total_matrix
Total B Matrix.
autoPtr< volScalarField > _alphat
Turbulent thermal diffusivity.
List< Eigen::MatrixXd > turbulenceTerm1(label NUmodes, label NSUPmodes, label Nnutmodes)
CT1 added matrix for the turbulence treatement.
List< Eigen::MatrixXd > turbulenceTerm2(label NUmodes, label NSUPmodes, label Nnutmodes)
CT2 added matrix for the turbulence treatement.
std::vector< SPLINTER::RBFSpline * > rbfsplines
Create a SAMPLES for interpolation.
Eigen::MatrixXd BTturbulence(label NUmodes, label NSUPmodes)
BT added matrix for the turbulence treatement.
std::vector< SPLINTER::DataTable * > SAMPLES
Create a Rbf splines for interpolation.
PtrList< volScalarField > nuTmodes
List of POD modes for eddy viscosity.
autoPtr< dimensionedScalar > _Prt
Turbulent Prandtl number.
autoPtr< volScalarField > _nut
Eddy viscosity field.
List< Eigen::MatrixXd > temperatureTurbulenceTerm(label NTmodes, label Nnutmodes)
S added matrix for the thermal turbulence treatement.
autoPtr< dimensionedScalar > _Pr
Prandtl number.
void liftSolveT()
Perform a lift solve for temperature field.
UnsteadyNSTTurb()
Construct Null.
Eigen::MatrixXi inletIndexT
void writeMu(List< scalar > mu_now)
Write out a list of scalar corresponding to the parameters used in the truthSolve.
label counter
Counter used for the output of the full order solutions.
void assignBC(volVectorField &s, label BC_ind, Vector< double > &value)
Assign Boundary Condition to a volVectorField.
void assignIF(T &s, G &value)
Assign internal field condition.
Eigen::MatrixXd mu
Row matrix of parameters.
void truthSolve()
Perform a TruthSolve.
label NPmodes
Number of pressure modes used for the projection.
Definition steadyNS.H:146
bool supex
Boolean variable to check the existence of the supremizer modes.
Definition steadyNS.H:265
Eigen::MatrixXd diffusive_term(label NUmodes, label NPmodes, label NSUPmodes)
Diffusive Term.
Definition steadyNS.C:883
autoPtr< surfaceScalarField > _phi
Flux.
Definition steadyNS.H:302
PtrList< volScalarField > Pfield
List of pointers used to form the pressure snapshots matrix.
Definition steadyNS.H:86
volVectorModes supmodes
List of pointers used to form the supremizer modes.
Definition steadyNS.H:104
autoPtr< fv::options > _fvOptions
fvOptions
Definition steadyNS.H:296
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
Eigen::MatrixXd divergence_term(label NUmodes, label NPmodes, label NSUPmodes)
Divergence Term (supremizer approach)
Definition steadyNS.C:1110
Eigen::MatrixXd mass_term(label NUmodes, label NPmodes, label NSUPmodes)
Mass Term.
Definition steadyNS.C:1084
autoPtr< singlePhaseTransportModel > _laminarTransport
Laminar transport (used by turbulence model)
Definition steadyNS.H:311
label NUmodes
Number of velocity modes used for the projection.
Definition steadyNS.H:143
PtrList< volVectorField > liftfield
List of pointers used to form the list of lifting functions.
Definition steadyNS.H:110
Eigen::MatrixXd B_matrix
Diffusion term.
Definition steadyNS.H:160
autoPtr< IOMRFZoneList > _MRF
MRF variable.
Definition steadyNS.H:314
label NSUPmodes
Number of supremizer modes used for the projection.
Definition steadyNS.H:149
Eigen::MatrixXd K_matrix
Gradient of pressure matrix.
Definition steadyNS.H:166
List< Eigen::MatrixXd > C_matrix
Non linear term.
Definition steadyNS.H:169
List< Eigen::MatrixXd > convective_term(label NUmodes, label NPmodes, label NSUPmodes)
Convective Term.
Definition steadyNS.C:962
Eigen::MatrixXd pressure_gradient_term(label NUmodes, label NPmodes, label NSUPmodes)
Gradient of pressure.
Definition steadyNS.C:935
Eigen::MatrixXd P_matrix
Div of velocity.
Definition steadyNS.H:173
Eigen::MatrixXd M_matrix
Mass Matrix.
Definition steadyNS.H:163
autoPtr< volVectorField > _U
Velocity field.
Definition steadyNS.H:272
autoPtr< volScalarField > _p
Pressure field.
Definition steadyNS.H:269
Eigen::MatrixXd Y_matrix
Gradient of pressure matrix.
PtrList< volScalarField > Tfield
List of pointers used to form the temperature snapshots matrix.
Definition unsteadyNST.H:99
List< Eigen::MatrixXd > convective_term_temperature(label NUmodes, label NTmodes, label NSUPmodes)
Convective Term for Temperature.
List< Eigen::MatrixXd > Q_matrix
Non linear term.
PtrList< volScalarField > liftfieldT
List of pointers used to form the list of the temperature lifting functions.
scalar timeStep
Time step of the simulation.
Definition unsteadyNST.H:81
autoPtr< Time > _runTime
Time.
label NTmodes
Number of temperature modes used for the projection.
scalar finalTime
Final time (final time of the simulation and consequently of the acquisition of the snapshots)
Definition unsteadyNST.H:78
Eigen::MatrixXd diffusive_term_temperature(label NUmodes, label NTmodes, label NSUPmodes)
Diffusive Term for Temperature.
autoPtr< dimensionedScalar > _nu
dimensionedScalar nu;
Eigen::MatrixXd mass_term_temperature(label NUmodes, label NTmodes, label NSUPmodes)
Mass Term for Temperature.
scalar nextWrite
Auxiliary variable to store the next writing instant.
Definition unsteadyNST.H:87
scalar startTime
Start Time (initial time to start storing the snapshots)
Definition unsteadyNST.H:75
autoPtr< volScalarField > _T
Temperature field.
autoPtr< pisoControl > _piso
pisoControl
scalar writeEvery
Time step of the writing procedure.
Definition unsteadyNST.H:84
Eigen::MatrixXd MT_matrix
Mass Matrix T.
autoPtr< fvMesh > _mesh
Mesh.
PtrList< volScalarField > Tmodes
List of pointers used to form the temperature modes.
autoPtr< incompressible::turbulenceModel > turbulence
Turbulence model.
Definition unsteadyNS.H:76
volScalarField & T
Definition createT.H:46
fvScalarMatrix & TEqn
Definition TEqn.H:15
volScalarField & alphat
dimensionedScalar & nu
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 ...
List< Eigen::MatrixXd > readMatrix(word folder, word mat_name)
Read a three dimensional matrix from a txt file in Eigen format.
Eigen::VectorXd getCoeffs(GeometricField< Type, PatchField, GeoMesh > &snapshot, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes, bool consider_volumes)
Projects a snapshot on a basis function and gets the coefficients of the projection.
bool check_folder(word folder)
Checks if a folder exists.
bool check_sup()
Check if the supremizer folder exists.
simpleControl simple(mesh)
surfaceScalarField & phi
volVectorField & U
volScalarField & p
singlePhaseTransportModel & laminarTransport
label i
Definition pEqn.H:46