Loading...
Searching...
No Matches
15MSR_cavity.C
1#include "usmsrProblem.H"
2#include "ReducedUnsteadyMSR.H"
3#include "ITHACAstream.H"
4#include "LRSensitivity.H"
5#include "Tm.H"
6#include "Ptot.H"
7#include <Eigen/Dense>
8#include <math.h>
9#include <iomanip>
10#include <chrono>
11#include <ctime>
12#include "Tm_time.H"
13#include "Ptot_time.H"
14
15class msr : public usmsrProblem
16{
17 public:
18 explicit msr(int argc, char* argv[])
19 :
20 usmsrProblem(argc, argv),
21 U(_U()),
22 p(_p()),
23 flux(_flux()),
24 prec1(_prec1()),
25 prec2(_prec2()),
26 prec3(_prec3()),
27 prec4(_prec4()),
28 prec5(_prec5()),
29 prec6(_prec6()),
30 prec7(_prec7()),
31 prec8(_prec8()),
32 T(_T()),
33 dec1(_dec1()),
34 dec2(_dec2()),
35 dec3(_dec3()),
36 v(_v()),
37 D(_D()),
38 NSF(_NSF()),
39 A(_A()),
40 SP(_SP()),
41 TXS(_TXS())
42 {}
43
44 volVectorField& U;
45 volScalarField& p;
46 volScalarField& flux;
47 volScalarField& prec1;
48 volScalarField& prec2;
49 volScalarField& prec3;
50 volScalarField& prec4;
51 volScalarField& prec5;
52 volScalarField& prec6;
53 volScalarField& prec7;
54 volScalarField& prec8;
55 volScalarField& T;
56 volScalarField& dec1;
57 volScalarField& dec2;
58 volScalarField& dec3;
59 volScalarField& v;
60 volScalarField& D;
61 volScalarField& NSF;
62 volScalarField& A;
63 volScalarField& SP;
64 volScalarField& TXS;
65
66 ITHACAparameters* para = ITHACAparameters::getInstance(_mesh(), _runTime());
67 int NUproj = para->ITHACAdict->lookupOrDefault<int>("NUproj", 2);
68 int NPproj = para->ITHACAdict->lookupOrDefault<int>("NPproj", 2);
69 int NFluxproj = para->ITHACAdict->lookupOrDefault<int>("NFluxproj", 2);
70 int NPrecproj1 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj1", 2);
71 int NPrecproj2 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj2", 2);
72 int NPrecproj3 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj3", 2);
73 int NPrecproj4 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj4", 2);
74 int NPrecproj5 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj5", 2);
75 int NPrecproj6 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj6", 2);
76 int NPrecproj7 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj7", 2);
77 int NPrecproj8 = para->ITHACAdict->lookupOrDefault<int>("NPrecproj8", 2);
78 int NTproj = para->ITHACAdict->lookupOrDefault<int>("NTproj", 2);
79 int NDecproj1 = para->ITHACAdict->lookupOrDefault<int>("NDecproj1", 2);
80 int NDecproj2 = para->ITHACAdict->lookupOrDefault<int>("NDecproj2", 2);
81 int NDecproj3 = para->ITHACAdict->lookupOrDefault<int>("NDecproj3", 2);
82 int NCproj = para->ITHACAdict->lookupOrDefault<int>("NCproj", 2);
83
84 double r1 = _beta1().value() / _betaTot().value();
85 double r2 = _beta2().value() / _betaTot().value();
86 double r3 = _beta3().value() / _betaTot().value();
87 double r4 = _beta4().value() / _betaTot().value();
88 double r5 = _beta5().value() / _betaTot().value();
89 double r6 = _beta6().value() / _betaTot().value();
90 double r7 = _beta7().value() / _betaTot().value();
91 double r8 = _beta8().value() / _betaTot().value();
92
93 void offlineSolve()
94 {
95 if (offline == false)
96 {
97 List<scalar> mu_now(3);
98
99 for (int i = 0; i < mu.cols(); i++)
100 {
101 _nu().value() = mu(0, i);
102 change_viscosity(mu(0, i));
103 _betaTot().value() = mu(1, i);
104 _beta1().value() = r1 * mu(1, i);
105 _beta2().value() = r2 * mu(1, i);
106 _beta3().value() = r3 * mu(1, i);
107 _beta4().value() = r4 * mu(1, i);
108 _beta5().value() = r5 * mu(1, i);
109 _beta6().value() = r6 * mu(1, i);
110 _beta7().value() = r7 * mu(1, i);
111 _beta8().value() = r8 * mu(1, i);
112 _decLam3().value() = mu(2, i);
113 mu_now[0] = mu(0, i);
114 mu_now[1] = mu(1, i);
115 mu_now[2] = mu(2, i);
116 truthSolve(mu_now);
117 restart();
118 }
119 }
120 else
121 {
123 }
124 }
125
126};
127
128class Tmlocal : public Tm
129{
130 public:
131 explicit Tmlocal(int argc, char* argv[], int Nsampled)
132 :
133 Tm(argc, argv, Nsampled),
134 T(_T())
135 {}
136
137 volScalarField& T;
138};
139
140class Ploct: public Ptot_time
141{
142 public:
143 explicit Ploct(int argc, char* argv[], int Nsampled)
144 :
145 Ptot_time(argc, argv, Nsampled),
146 powerDens(_powerDens())
147 {}
148
149 volScalarField& powerDens;
150};
151
152class Plocal: public Ptot
153{
154 public:
155 explicit Plocal(int argc, char* argv[], int Nsampled)
156 :
157 Ptot(argc, argv, Nsampled),
158 powerDens(_powerDens())
159 {}
160
161 volScalarField& powerDens;
162};
163
164class Tmloct: public Tm_time
165{
166 public:
167 explicit Tmloct(int argc, char* argv[], int Nsampled)
168 :
169 Tm_time(argc, argv, Nsampled),
170 T(_T())
171 {}
172
173 volScalarField& T;
174};
175
176int main(int argc, char* argv[])
177{
178 //object initialization
179 msr prova(argc, argv);
180 //inletIndex set
181 prova.inletIndex.resize(1, 2);
182 prova.inletIndex(0, 0) = 0;
183 prova.inletIndex(0, 1) = 0;
184 prova.inletIndexT.resize(4, 1);
185 prova.inletIndexT(0, 0) = 0;
186 prova.inletIndexT(1, 0) = 1;
187 prova.inletIndexT(2, 0) = 2;
188 prova.inletIndexT(3, 0) = 3;
189 //set the number of parameters and values of each
190 prova.Pnumber = 3;
191 prova.Tnumber = 31;
192 prova.setParameters();
193 int central = static_cast<int>(prova.Tnumber / 2);
194 double nu0 = 2.46E-06;
195 double betatot0 = 3.218E-05;
196 double dlam30 = 3.58e-04;
197 //+-10% from default values
198 prova.mu_range(0, 0) = 1.1 * nu0; //nu range
199 prova.mu_range(0, 1) = 0.9 * nu0;
200 prova.mu_range(1, 0) = 1.1 * betatot0; //betaTot range
201 prova.mu_range(1, 1) = 0.9 * betatot0;
202 prova.mu_range(2, 0) = 1.1 * dlam30; //decLam3 range
203 prova.mu_range(2, 1) = 0.9 * dlam30;
204 prova.genRandPar();
205 //override central column of mu with reference values of the parameters
206 prova.mu(0, central) = nu0;
207 prova.mu(1, central) = betatot0;
208 prova.mu(2, central) = dlam30;
209 double tstart = std::time(0);
210 Eigen::MatrixXd arange(prova.Pnumber, 2);
211 Eigen::MatrixXd mu_f = prova.mu;
212
213 if (prova.offline == false)
214 {
215 for (int i = 0; i < prova.Pnumber; i++)
216 {
217 arange(i, 0) = prova.mu.row(i).minCoeff();
218 arange(i, 1) = prova.mu.row(i).maxCoeff();
219 }
220
221 ITHACAstream::exportMatrix(arange, "range", "eigen", "./ITHACAoutput");
222 ITHACAstream::exportMatrix(prova.mu, "mu_off", "eigen", "./ITHACAoutput");
223 }
224 else
225 {
226 mu_f = ITHACAstream::readMatrix("./ITHACAoutput/mu_off_mat.txt");
227 arange = ITHACAstream::readMatrix("./ITHACAoutput/range_mat.txt");
228 }
229
230 //perform the offline step
231 prova.offlineSolve();
232 prova._nu().value() = nu0;
233 prova.change_viscosity(nu0);
234 double tend = std::time(0);
235 double deltat_offline;
236 deltat_offline = difftime(tend, tstart);
237
238 //save the time needed to perform offline stage
239 if (prova.offline == false)
240 {
241 std::ofstream diff_t("./ITHACAoutput/t_offline=" + name(deltat_offline));
242 }
243
244 Info << "Offline stage time= " << deltat_offline << endl;
245 //compute the liftfunction for the velocity
246 prova.liftSolve();
247 //compute the liftfuncion for the temperature
248 prova.liftSolveT();
249 //homogenize the velocity field
250 prova.homogenizeU();
251 //homogenize the temperature field
252 prova.homogenizeT();
253 //compute the spatial modes
254 prova.msrgetModesEVD();
255 // perform the projection
256 Eigen::VectorXi NPrec(8);
257 NPrec(0) = prova.NPrecproj1;
258 NPrec(1) = prova.NPrecproj2;
259 NPrec(2) = prova.NPrecproj3;
260 NPrec(3) = prova.NPrecproj4;
261 NPrec(4) = prova.NPrecproj5;
262 NPrec(5) = prova.NPrecproj6;
263 NPrec(6) = prova.NPrecproj7;
264 NPrec(7) = prova.NPrecproj8;
265 Eigen::VectorXi NDec(3);
266 NDec(0) = prova.NDecproj1;
267 NDec(1) = prova.NDecproj2;
268 NDec(2) = prova.NDecproj3;
269 prova.projectPPE("./Matrices", prova.NUproj, prova.NPproj, prova.NFluxproj,
270 NPrec, prova.NTproj, NDec, prova.NCproj);
271 //define the moving wall bc condition for U
272 double umedio = 2.46E-03;
273 //define the temperature at the moving wall
274 Eigen::MatrixXd Twall(4, 2);
275 Twall.setZero();
276 Twall(0, 0) = 850;
277 Twall(1, 0) = 950;
278 Twall(2, 0) = 950;
279 Twall(3, 0) = 950;
280 //define the ROM object and its time settings
281 reducedusMSR ridotto(prova);
282 ridotto.tstart = 0;
283 ridotto.finalTime = 10;
284 ridotto.dt = 0.1;
285 //vel_now for the ROM object
286 Eigen::MatrixXd vel_now(1, 1);
287 vel_now(0, 0) = umedio;
288 //temp_now for the ROM object
289 Eigen::MatrixXd temp_now = Twall;
290 // set the online value of mu equal to mu(:,central)
291 Eigen::VectorXd mu_on(3);
292 ridotto.nu = mu_f(0, central);
293 ridotto.btot = mu_f(1, central);
294 ridotto.b1 = prova.r1 * ridotto.btot;
295 ridotto.b2 = prova.r2 * ridotto.btot;
296 ridotto.b3 = prova.r3 * ridotto.btot;
297 ridotto.b4 = prova.r4 * ridotto.btot;
298 ridotto.b5 = prova.r5 * ridotto.btot;
299 ridotto.b6 = prova.r6 * ridotto.btot;
300 ridotto.b7 = prova.r7 * ridotto.btot;
301 ridotto.b8 = prova.r8 * ridotto.btot;
302 ridotto.dl3 = mu_f(2, central);
303 // index corresponding at central solution
304 int ref_start = 465;
305 mu_on(0) = ridotto.nu;
306 mu_on(1) = ridotto.btot;
307 mu_on(2) = ridotto.dl3;
308 ridotto.solveOnline(vel_now, temp_now, mu_on, ref_start);
309 ridotto.reconstructAP("./ITHACAoutput/Reconstruction/", 10);
310 //ridotto.reconstructAP("./ITHACAoutput/Reconstruction/",50);
311 //final snapshots for ROM and FOM respectively
312 int tf = 21;
313 int tf_fom = 31;
314 //Some post process calculations
315 int c = 0;
316 Eigen::MatrixXd err(10, tf);
317 Eigen::MatrixXd TmFOM(prova.Tnumber, tf);
318 Eigen::MatrixXd PtotFOM(prova.Tnumber, tf);
319 Eigen::MatrixXd TmROM(prova.Tnumber, tf);
320 Eigen::MatrixXd PtotROM(prova.Tnumber, tf);
321 Info << "Computing errors on reference case..." << endl;
322
323 for (int i = ref_start; i < ref_start + tf; i++)
324 {
325 err(0, c) = ITHACAutilities::errorL2Rel(prova.Ufield[i], ridotto.UREC[c]);
326 err(1, c) = ITHACAutilities::errorL2Rel(prova.Fluxfield[i],
327 ridotto.FLUXREC[c]);
328 err(2, c) = ITHACAutilities::errorL2Rel(prova.Prec1field[i],
329 ridotto.PREC1REC[c]);
330 err(3, c) = ITHACAutilities::errorL2Rel(prova.Prec4field[i],
331 ridotto.PREC4REC[c]);
332 err(4, c) = ITHACAutilities::errorL2Rel(prova.Prec8field[i],
333 ridotto.PREC8REC[c]);
334 err(5, c) = ITHACAutilities::errorL2Rel(prova.Tfield[i], ridotto.TREC[c]);
335 err(6, c) = ITHACAutilities::errorL2Rel(prova.Dec1field[i],
336 ridotto.DEC1REC[c]);
337 err(7, c) = ITHACAutilities::errorL2Rel(prova.Dec3field[i],
338 ridotto.DEC3REC[c]);
339 err(8, c) = ITHACAutilities::errorL2Rel(prova.PowerDensfield[i],
340 ridotto.POWERDENSREC[c]);
341 err(9, c) = ITHACAutilities::errorL2Rel(prova.TXSFields[i],
342 ridotto.TXSREC[c]);
343 c++;
344 }
345
346 Info << "End" << endl;
347 ITHACAstream::exportMatrix(err, "err", "eigen",
348 "./ITHACAoutput");
349 Info << "computing FOM output..." << endl;
350 double tmpt;
351 double tmpp;
352 int rig = 0;
353 int col = 0;
354
355 for (int i = 0; i < prova.Tfield.size(); i++)
356 {
357 tmpt = prova.Tfield[i].weightedAverage(prova._mesh().V()).value();
358 tmpp = fvc::domainIntegrate(prova.PowerDensfield[i]).value();
359
360 if (col < tf)
361 {
362 TmFOM(rig, col) = tmpt;
363 PtotFOM(rig, col) = tmpp;
364 col++;
365 }
366 else if (col == tf_fom)
367 {
368 col = 0;
369 rig++;
370 }
371 else
372 {
373 col++;
374 }
375 }
376
377 Info << "End" << endl;
378 ITHACAstream::exportMatrix(TmFOM, "fom_resT", "eigen",
379 "./ITHACAoutput");
380 ITHACAstream::exportMatrix(PtotFOM, "fom_resP", "eigen",
381 "./ITHACAoutput");
382 // perform online solve for all the values of mu_offline
383 std::string folder = {"./ITHACAoutput/ROMOutput/"};
384
385 for (int i = 0; i < prova.Tnumber; i++)
386 {
387 ridotto.nu = mu_f(0, i);
388 ridotto.btot = mu_f(1, i);
389 ridotto.b1 = prova.r1 * ridotto.btot;
390 ridotto.b2 = prova.r2 * ridotto.btot;
391 ridotto.b3 = prova.r3 * ridotto.btot;
392 ridotto.b4 = prova.r4 * ridotto.btot;
393 ridotto.b5 = prova.r5 * ridotto.btot;
394 ridotto.b6 = prova.r6 * ridotto.btot;
395 ridotto.b7 = prova.r7 * ridotto.btot;
396 ridotto.b8 = prova.r8 * ridotto.btot;
397 ridotto.dl3 = mu_f(2, i);
398 mu_on(0) = ridotto.nu;
399 mu_on(1) = ridotto.btot;
400 mu_on(2) = ridotto.dl3;
401 folder.append(std::to_string(i));
402 ridotto.solveOnline(vel_now, temp_now, mu_on, ref_start);
403 ridotto.reconstructAP(folder, 50);
404 folder = {"./ITHACAoutput/ROMOutput/"};
405 ridotto.clearFields();
406 }
407
408 //compute the figures of merit for every "snapshot" time
409 Tmloct Tmedia(argc, argv, prova.Tnumber);
410 Ploct Ptotale(argc, argv, prova.Tnumber);
411 c = 0;
412
413 for (int i = 0; i < tf; i++)
414 {
415 Tmedia.buildMO(folder, i);
416 Ptotale.buildMO(folder, i);
417 TmROM.col(c) = Tmedia.modelOutput;
418 PtotROM.col(c) = Ptotale.modelOutput;
419 c++;
420 }
421
422 ITHACAstream::exportMatrix(TmROM, "rom_resT", "eigen",
423 "./ITHACAoutput");
424 ITHACAstream::exportMatrix(PtotROM, "rom_resP", "eigen",
425 "./ITHACAoutput");
426 //Sensitivity Analysis, two figures of merit considered:
427 // average temperature and total power at the last time instant, i.e rom.finalTime
428 //define the folder where save the output
429 folder = {"./ITHACAoutput/Sensitivity/ModelOutput/"};
430 int Nparameters = prova.Pnumber;
431 std::vector<std::string> pdflist = {"normal", "normal", "normal"};
432 int samplingPoints = 1000;
433 LRSensitivity analisi(Nparameters, samplingPoints);
434 //define the training range, values sampled outside are rejected
435 analisi.trainingRange = arange;
436 //set the parameters of each distributions
437 Eigen::MatrixXd Mp(Nparameters, 2);
438 Mp(0, 0) = nu0;
439 Mp(0, 1) = nu0 * 0.1 / 3;
440 Mp(1, 0) = betatot0;
441 Mp(1, 1) = betatot0 * 0.1 / 3;
442 Mp(2, 0) = dlam30;
443 Mp(2, 1) = dlam30 * 0.1 / 3;
444 //build and export the sampling sets
445 analisi.buildSamplingSet(pdflist, Mp);
446 ITHACAstream::exportMatrix(analisi.MatX, "sampled", "eigen", "./ITHACAoutput");
447 //compute parameters statistics
448 analisi.getXstats();
449 //perform the simulations with the reduced object
450 int counter = 0;
451 tstart = std::time(0);
452 ridotto.clearFields();
453
454 for (int j = 0; j < samplingPoints; j++)
455 {
456 ridotto.nu = analisi.MatX(j, 0);
457 ridotto.btot = analisi.MatX(j, 1);
458 ridotto.b1 = prova.r1 * ridotto.btot;
459 ridotto.b2 = prova.r2 * ridotto.btot;
460 ridotto.b3 = prova.r3 * ridotto.btot;
461 ridotto.b4 = prova.r4 * ridotto.btot;
462 ridotto.b5 = prova.r5 * ridotto.btot;
463 ridotto.b6 = prova.r6 * ridotto.btot;
464 ridotto.b7 = prova.r7 * ridotto.btot;
465 ridotto.b8 = prova.r8 * ridotto.btot;
466 ridotto.dl3 = analisi.MatX(j, 2);
467 mu_on(0) = ridotto.nu;
468 mu_on(1) = ridotto.btot;
469 mu_on(2) = ridotto.dl3;
470 folder.append(std::to_string(counter));
471 ridotto.solveOnline(vel_now, temp_now, mu_on, ref_start);
472 ridotto.reconstructAP(folder, 1000);
473 folder = {"./ITHACAoutput/Sensitivity/ModelOutput/"};
474 ridotto.clearFields();
475 counter++;
476 }
477
478 tend = std::time(0);
479 int Ntot = samplingPoints;
480 double deltat_online = difftime(tend, tstart);
481 // save SA online time
482 std::ofstream diff_ton("./ITHACAoutput/t_onlineSA_" + name(Ntot) + "=" + name(
483 deltat_online));
484 //initialize the figure of merit objects
485 Tmlocal TmediaSA(argc, argv, Ntot);
486 Plocal PtotSA(argc, argv, Ntot);
487 //build the Model Output
488 TmediaSA.buildMO(folder);
489 PtotSA.buildMO(folder);
490 //assign FofM to LRSensitivity object, first figure of merit considered is the average temperature
491 analisi.M = autoPtr<FofM>(& TmediaSA);
492 //load the model output in the LRSensitivity object
493 analisi.load_output();
494 //compute output statistics
495 analisi.getYstat();
496 Info << "Mean value and variance of the output:" << endl;
497 Info << analisi.Ey << "\t" << analisi.Vy << endl;
498 Info << "-------------" << endl;
499 // compute linear regression coefficients
500 analisi.getBetas();
501 Info << "analisi regression coefficients:" << endl;
502 Info << analisi.betas << endl;
503 Info << "-------------" << endl;
504 // assess the quality of the linear regression, i.e. R^2
505 analisi.assessQuality();
506 Info << "quality: " << analisi.QI << endl;
507 // save the ROM output, linear output, statistics
508 Eigen::MatrixXd saveyout(samplingPoints, 1);
509 Eigen::MatrixXd saveymodel(samplingPoints, 1);
510 saveyout.col(0) = analisi.y;
511 saveymodel.col(0) = analisi.ylin;
512 ITHACAstream::exportMatrix(saveyout, "T_out", "eigen", "./ITHACAoutput");
513 ITHACAstream::exportMatrix(saveymodel, "T_model", "eigen", "./ITHACAoutput");
514 Eigen::MatrixXd coeffsT(4, 3);
515 coeffsT.setZero();
516 coeffsT(0, 0) = analisi.Ey;
517 coeffsT(0, 1) = analisi.Vy;
518 coeffsT(0, 2) = analisi.QI;
519 coeffsT.row(1) = analisi.EX;
520 coeffsT.row(2) = analisi.VX;
521 coeffsT.row(3) = analisi.betas;
522 ITHACAstream::exportMatrix(coeffsT, "coeffsT", "eigen", "./ITHACAoutput");
523 //assign FofM object to LRSensitivity object
524 analisi.M = autoPtr<FofM>(& PtotSA);
525 //load the model output in the LRSensitivity object, repeat all the previous step
526 // for the total power
527 analisi.load_output();
528 analisi.getYstat();
529 Info << "Mean value and variance of the output:" << endl;
530 Info << analisi.Ey << "\t" << analisi.Vy << endl;
531 Info << "-------------" << endl;
532 analisi.getBetas();
533 Info << "analisi regression coefficients:" << endl;
534 Info << analisi.betas << endl;
535 Info << "-------------" << endl;
536 analisi.assessQuality();
537 Info << "quality: " << analisi.QI << endl;
538 Eigen::MatrixXd saveyoutP(samplingPoints, 1);
539 Eigen::MatrixXd saveymodelP(samplingPoints, 1);
540 saveyoutP.col(0) = analisi.y;
541 saveymodelP.col(0) = analisi.ylin;
542 ITHACAstream::exportMatrix(saveyoutP, "P_out", "eigen", "./ITHACAoutput");
543 ITHACAstream::exportMatrix(saveymodelP, "P_model", "eigen", "./ITHACAoutput");
544 Eigen::MatrixXd coeffsP(4, 3);
545 coeffsP.setZero();
546 coeffsP(0, 0) = analisi.Ey;
547 coeffsP(0, 1) = analisi.Vy;
548 coeffsP(0, 2) = analisi.QI;
549 coeffsP.row(1) = analisi.EX;
550 coeffsP.row(2) = analisi.VX;
551 coeffsP.row(3) = analisi.betas;
552 ITHACAstream::exportMatrix(coeffsP, "coeffsP", "eigen", "./ITHACAoutput");
553 return 0;
554}
555
Header file of the ITHACAstream class, it contains the implementation of several methods for input ou...
Class for the definition of some general parameters, the parameters must be defined from the file ITH...
static ITHACAparameters * getInstance()
Gets an instance of ITHACAparameters, to be used if the instance is already existing.
autoPtr< volScalarField > _powerDens
List of pointers to power density field.
Definition Ptot_time.H:51
autoPtr< volScalarField > _powerDens
List of pointers to power density field.
Definition Ptot.H:52
autoPtr< volScalarField > _T
List of pointers to temperature field.
Definition Tm_time.H:51
autoPtr< volScalarField > _T
List of pointers to temperature field.
Definition Tm.H:51
void change_viscosity(double mu)
method to change the viscosity in UEqn
void readMSRfields()
Method to read all the fieds of the MSR problem in the offline folder, it also reads mu_samples matri...
void restart()
method to set all fields back to values in 0 folder
bool offline
Boolean variable, it is 1 if the Offline phase has already been computed, else 0.
Eigen::MatrixXd mu
Row matrix of parameters.
void truthSolve()
Perform a TruthSolve.
usmsrProblem()
Construct Null.
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.
double errorL2Rel(GeometricField< T, fvPatchField, volMesh > &field1, GeometricField< T, fvPatchField, volMesh > &field2, List< label > *labels)
Computes the relative error between two geometric Fields in L2 norm.