Loading...
Searching...
No Matches
ReducedMSR.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-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24\*---------------------------------------------------------------------------*/
25#include "ReducedMSR.H"
26
30
32{
33 problem = &FOMproblem;
34 N_BC = problem->inletIndex.rows();
35 N_BCt = problem->inletIndexT.rows();
36 Nphi_u = problem->B_matrix.rows();
37 Nphi_p = problem->K_matrix.cols();
38 Nphi_flux = problem->LF_matrix[0].cols();
47 Nphi_T = problem->LT_matrix.rows();
51 Nphi_const = problem->PF_matrix[0].rows();
53
54 //load the modes function
55 for (int k = 0; k < problem->liftfield.size(); k++)
56 {
57 Umodes.append((problem->liftfield[k]).clone());
58 }
59
60 for (int k = 0; k < problem->NUmodes; k++)
61 {
62 Umodes.append((problem->Umodes[k]).clone());
63 }
64
65 for (int k = 0; k < problem->NPmodes; k++)
66 {
67 Pmodes.append((problem->Pmodes[k]).clone());
68 }
69
70 for (int k = 0; k < problem->NFluxmodes; k++)
71 {
72 Fluxmodes.append((problem->Fluxmodes[k]).clone());
73 }
74
75 for (int k = 0; k < Nphi_prec1; k++)
76 {
77 Prec1modes.append((problem->Prec1modes[k]).clone());
78 }
79
80 for (int k = 0; k < Nphi_prec2; k++)
81 {
82 Prec2modes.append((problem->Prec2modes[k]).clone());
83 }
84
85 for (int k = 0; k < Nphi_prec3; k++)
86 {
87 Prec3modes.append((problem->Prec3modes[k]).clone());
88 }
89
90 for (int k = 0; k < Nphi_prec4; k++)
91 {
92 Prec4modes.append((problem->Prec4modes[k]).clone());
93 }
94
95 for (int k = 0; k < Nphi_prec5; k++)
96 {
97 Prec5modes.append((problem->Prec5modes[k]).clone());
98 }
99
100 for (int k = 0; k < Nphi_prec6; k++)
101 {
102 Prec6modes.append((problem->Prec6modes[k]).clone());
103 }
104
105 for (int k = 0; k < Nphi_prec7; k++)
106 {
107 Prec7modes.append((problem->Prec7modes[k]).clone());
108 }
109
110 for (int k = 0; k < Nphi_prec8; k++)
111 {
112 Prec8modes.append((problem->Prec8modes[k]).clone());
113 }
114
115 for (int k = 0; k < problem->liftfieldT.size(); k++)
116 {
117 Tmodes.append((problem->liftfieldT[k]).clone());
118 }
119
120 for (int k = 0; k < problem->NTmodes; k++)
121 {
122 Tmodes.append((problem->Tmodes[k]).clone());
123 }
124
125 for (int k = 0; k < Nphi_dec1; k++)
126 {
127 Dec1modes.append((problem->Dec1modes[k]).clone());
128 }
129
130 for (int k = 0; k < Nphi_dec2; k++)
131 {
132 Dec2modes.append((problem->Dec2modes[k]).clone());
133 }
134
135 for (int k = 0; k < Nphi_dec3; k++)
136 {
137 Dec3modes.append((problem->Dec3modes[k]).clone());
138 }
139
140 for (int k = 0; k < Nphi_const; k++)
141 {
142 vmodes.append((problem->vmodes[k]).clone());
143 Dmodes.append((problem->Dmodes[k]).clone());
144 NSFmodes.append((problem->NSFmodes[k]).clone());
145 Amodes.append((problem->Amodes[k]).clone());
146 SPmodes.append((problem->SPmodes[k]).clone());
147 TXSmodes.append((problem->TXSmodes[k]).clone());
148 }
149
150 //load the snapshots
151 for (int k = 0; k < problem->Ufield.size(); k++)
152 {
153 Usnapshots.append((problem->Ufield[k]).clone());
154 Psnapshots.append((problem->Pfield[k]).clone());
155 Fluxsnapshots.append((problem->Fluxfield[k]).clone());
156 Prec1snapshots.append((problem->Prec1field[k]).clone());
157 Prec2snapshots.append((problem->Prec2field[k]).clone());
158 Prec3snapshots.append((problem->Prec3field[k]).clone());
159 Prec4snapshots.append((problem->Prec4field[k]).clone());
160 Prec5snapshots.append((problem->Prec5field[k]).clone());
161 Prec6snapshots.append((problem->Prec6field[k]).clone());
162 Prec7snapshots.append((problem->Prec7field[k]).clone());
163 Prec8snapshots.append((problem->Prec8field[k]).clone());
164 Tsnapshots.append((problem->Tfield[k]).clone());
165 Dec1snapshots.append((problem->Dec1field[k]).clone());
166 Dec2snapshots.append((problem->Dec2field[k]).clone());
167 Dec3snapshots.append((problem->Dec3field[k]).clone());
168 vsnapshots.append((problem->vFields[k]).clone());
169 Dsnapshots.append((problem->DFields[k]).clone());
170 NSFsnapshots.append((problem->NSFFields[k]).clone());
171 Asnapshots.append((problem->AFields[k]).clone());
172 SPsnapshots.append((problem->SPFields[k]).clone());
173 TXSsnapshots.append((problem->TXSFields[k]).clone());
174 }
175
180 Nphi_prec6 + Nphi_prec7 + Nphi_prec8, FOMproblem);
182 Nphi_T + Nphi_dec1 + Nphi_dec2 + Nphi_dec3, FOMproblem);
183}
184
185int newton_msr_fd::operator()(const Eigen::VectorXd& x,
186 Eigen::VectorXd& fvec) const
187{
188 Eigen::VectorXd a_tmp(Nphi_u);
189 Eigen::VectorXd b_tmp(Nphi_p);
190 a_tmp = x.head(Nphi_u);
191 b_tmp = x.tail(Nphi_p);
193 // Convective terms
194 Eigen::MatrixXd cc(1, 1);
195 Eigen::MatrixXd gg(1, 1);
196 Eigen::MatrixXd bb(1, 1);
197 // Mom Term
198 Eigen::VectorXd M1 = problem->B_matrix * a_tmp * nu;
199 // Gradient of pressure
200 Eigen::VectorXd M2 = problem->K_matrix * b_tmp;
201 // Pressure Term
202 Eigen::VectorXd M3 = problem->D_matrix * b_tmp;
203 // BC PPE
204 Eigen::VectorXd M6 = problem->BC1_matrix * a_tmp * nu;
205 // BC PPE
206 Eigen::VectorXd M7 = problem->BC3_matrix * a_tmp * nu;
207
208 for (int i = 0; i < Nphi_u; i++)
209 {
210 cc = a_tmp.transpose() * problem->C_matrix[i] * a_tmp;
211 fvec(i) = M1(i) - cc(0, 0) - M2(i);
212 }
213
214 int p_fvec = Nphi_u;
215
216 for (int i = 0; i < Nphi_p; i++)
217 {
218 int k = i + p_fvec;
219 gg = a_tmp.transpose() * problem->G_matrix[i] * a_tmp;
220 //bb = a_tmp.transpose() * problem->BC2_matrix[i] * a_tmp;
221 fvec(k) = M3(i, 0) + gg(0, 0) - M7(i, 0);
222 }
223
224 for (int j = 0; j < N_BC; j++)
225 {
226 fvec(j) = x(j) - BC(j);
227 }
228
229 return 0;
230}
231
232int newton_msr_fd::df(const Eigen::VectorXd& x, Eigen::MatrixXd& fjac) const
233{
234 Eigen::NumericalDiff<newton_msr_fd> numDiff(*this);
235 numDiff.df(x, fjac);
236 return 0;
237}
238
239int newton_msr_n::operator()(const Eigen::VectorXd& n,
240 Eigen::VectorXd& fvecn) const
241{
242 Eigen::VectorXd c_tmp(Nphi_flux); //for flux
243 Eigen::VectorXd d1_tmp(Nphi_prec1); //for prec1
244 Eigen::VectorXd d2_tmp(Nphi_prec2); //for prec2
245 Eigen::VectorXd d3_tmp(Nphi_prec3); //for prec3
246 Eigen::VectorXd d4_tmp(Nphi_prec4); //for prec4
247 Eigen::VectorXd d5_tmp(Nphi_prec5); //for prec5
248 Eigen::VectorXd d6_tmp(Nphi_prec6); //for prec6
249 Eigen::VectorXd d7_tmp(Nphi_prec7); //for prec7
250 Eigen::VectorXd d8_tmp(Nphi_prec8); //for prec8
251 c_tmp = n.head(Nphi_flux);
252 int pos = Nphi_flux;
253 d1_tmp = n.segment(pos, Nphi_prec1);
254 pos = pos + Nphi_prec1;
255 d2_tmp = n.segment(pos, Nphi_prec2);
256 pos = pos + Nphi_prec2;
257 d3_tmp = n.segment(pos, Nphi_prec3);
258 pos = pos + Nphi_prec3;
259 d4_tmp = n.segment(pos, Nphi_prec4);
260 pos = pos + Nphi_prec4;
261 d5_tmp = n.segment(pos, Nphi_prec5);
262 pos = pos + Nphi_prec5;
263 d6_tmp = n.segment(pos, Nphi_prec6);
264 pos = pos + Nphi_prec6;
265 d7_tmp = n.segment(pos, Nphi_prec7);
266 pos = pos + Nphi_prec7;
267 d8_tmp = n.segment(pos, Nphi_prec8);
269 // Laplacian flux term
270 Eigen::MatrixXd lf(1, 1);
271 // flux production term
272 Eigen::MatrixXd pf(1, 1);
273 // flux absorption term
274 Eigen::MatrixXd af(1, 1);
275 // precursor sources
276 Eigen::VectorXd F3_1 = problem->PS1_matrix * d1_tmp * l1;
277 Eigen::VectorXd F3_2 = problem->PS2_matrix * d2_tmp * l2;
278 Eigen::VectorXd F3_3 = problem->PS3_matrix * d3_tmp * l3;
279 Eigen::VectorXd F3_4 = problem->PS4_matrix * d4_tmp * l4;
280 Eigen::VectorXd F3_5 = problem->PS5_matrix * d5_tmp * l5;
281 Eigen::VectorXd F3_6 = problem->PS6_matrix * d6_tmp * l6;
282 Eigen::VectorXd F3_7 = problem->PS7_matrix * d7_tmp * l7;
283 Eigen::VectorXd F3_8 = problem->PS8_matrix * d8_tmp * l8;
284 // Convective terms in prec-eq:
285 Eigen::MatrixXd pp1(1, 1);
286 Eigen::MatrixXd pp2(1, 1);
287 Eigen::MatrixXd pp3(1, 1);
288 Eigen::MatrixXd pp4(1, 1);
289 Eigen::MatrixXd pp5(1, 1);
290 Eigen::MatrixXd pp6(1, 1);
291 Eigen::MatrixXd pp7(1, 1);
292 Eigen::MatrixXd pp8(1, 1);
293 // laplacian of precursor
294 Eigen::VectorXd P1_1 = problem->LP1_matrix * d1_tmp * (nu / Sc);
295 Eigen::VectorXd P1_2 = problem->LP2_matrix * d2_tmp * (nu / Sc);
296 Eigen::VectorXd P1_3 = problem->LP3_matrix * d3_tmp * (nu / Sc);
297 Eigen::VectorXd P1_4 = problem->LP4_matrix * d4_tmp * (nu / Sc);
298 Eigen::VectorXd P1_5 = problem->LP5_matrix * d5_tmp * (nu / Sc);
299 Eigen::VectorXd P1_6 = problem->LP6_matrix * d6_tmp * (nu / Sc);
300 Eigen::VectorXd P1_7 = problem->LP7_matrix * d7_tmp * (nu / Sc);
301 Eigen::VectorXd P1_8 = problem->LP8_matrix * d8_tmp * (nu / Sc);
302 // algebric term
303 Eigen::VectorXd P2_1 = problem->MP1_matrix * d1_tmp * l1;
304 Eigen::VectorXd P2_2 = problem->MP2_matrix * d2_tmp * l2;
305 Eigen::VectorXd P2_3 = problem->MP3_matrix * d3_tmp * l3;
306 Eigen::VectorXd P2_4 = problem->MP4_matrix * d4_tmp * l4;
307 Eigen::VectorXd P2_5 = problem->MP5_matrix * d5_tmp * l5;
308 Eigen::VectorXd P2_6 = problem->MP6_matrix * d6_tmp * l6;
309 Eigen::VectorXd P2_7 = problem->MP7_matrix * d7_tmp * l7;
310 Eigen::VectorXd P2_8 = problem->MP8_matrix * d8_tmp * l8;
311 // flux source term
312 Eigen::MatrixXd fs1(1, 1);
313 Eigen::MatrixXd fs2(1, 1);
314 Eigen::MatrixXd fs3(1, 1);
315 Eigen::MatrixXd fs4(1, 1);
316 Eigen::MatrixXd fs5(1, 1);
317 Eigen::MatrixXd fs6(1, 1);
318 Eigen::MatrixXd fs7(1, 1);
319 Eigen::MatrixXd fs8(1, 1);
320
321 for (int i = 0; i < Nphi_flux; i++)
322 {
323 lf = d_c.transpose() * problem->LF_matrix[i] * c_tmp;
324 pf = nsf_c.transpose() * problem->PF_matrix[i] * c_tmp * (1 - btot);
325 af = a_c.transpose() * problem->AF_matrix[i] * c_tmp;
326 fvecn(i) = lf(0, 0) + pf(0, 0) - af(0,
327 0) + F3_1(i) + F3_2(i) + F3_3(i) + F3_4(i) + F3_5(i) + F3_6(i) + F3_7(i) + F3_8(
328 i);
329 }
330
331 int pfvecn = Nphi_flux;
332
333 for (int i = 0; i < Nphi_prec1; i++)
334 {
335 int k = i + pfvecn;
336 pp1 = a_tmp.transpose() * problem->ST1_matrix[i] * d1_tmp;
337 fs1 = nsf_c.transpose() * problem->FS1_matrix[i] * c_tmp * b1;
338 fvecn(k) = -pp1(0, 0) + P1_1(i) - P2_1(i) + fs1(0, 0);
339 }
340
341 pfvecn += Nphi_prec1;
342
343 for (int i = 0; i < Nphi_prec2; i++)
344 {
345 int k = i + pfvecn;
346 pp2 = a_tmp.transpose() * problem->ST2_matrix[i] * d2_tmp;
347 fs2 = nsf_c.transpose() * problem->FS2_matrix[i] * c_tmp * b2;
348 fvecn(k) = -pp2(0, 0) + P1_2(i) - P2_2(i) + fs2(0, 0);
349 }
350
351 pfvecn += Nphi_prec2;
352
353 for (int i = 0; i < Nphi_prec3; i++)
354 {
355 int k = i + pfvecn;
356 pp3 = a_tmp.transpose() * problem->ST3_matrix[i] * d3_tmp;
357 fs3 = nsf_c.transpose() * problem->FS3_matrix[i] * c_tmp * b3;
358 fvecn(k) = -pp3(0, 0) + P1_3(i) - P2_3(i) + fs3(0, 0);
359 }
360
361 pfvecn += Nphi_prec3;
362
363 for (int i = 0; i < Nphi_prec4; i++)
364 {
365 int k = i + pfvecn;
366 pp4 = a_tmp.transpose() * problem->ST4_matrix[i] * d4_tmp;
367 fs4 = nsf_c.transpose() * problem->FS4_matrix[i] * c_tmp * b4;
368 fvecn(k) = -pp4(0, 0) + P1_4(i) - P2_4(i) + fs4(0, 0);
369 }
370
371 pfvecn += Nphi_prec4;
372
373 for (int i = 0; i < Nphi_prec5; i++)
374 {
375 int k = i + pfvecn;
376 pp5 = a_tmp.transpose() * problem->ST5_matrix[i] * d5_tmp;
377 fs5 = nsf_c.transpose() * problem->FS5_matrix[i] * c_tmp * b5;
378 fvecn(k) = -pp5(0, 0) + P1_5(i) - P2_5(i) + fs5(0, 0);
379 }
380
381 pfvecn += Nphi_prec5;
382
383 for (int i = 0; i < Nphi_prec6; i++)
384 {
385 int k = i + pfvecn;
386 pp6 = a_tmp.transpose() * problem->ST6_matrix[i] * d6_tmp;
387 fs6 = nsf_c.transpose() * problem->FS6_matrix[i] * c_tmp * b6;
388 fvecn(k) = -pp6(0, 0) + P1_6(i) - P2_6(i) + fs6(0, 0);
389 }
390
391 pfvecn += Nphi_prec6;
392
393 for (int i = 0; i < Nphi_prec7; i++)
394 {
395 int k = i + pfvecn;
396 pp7 = a_tmp.transpose() * problem->ST7_matrix[i] * d7_tmp;
397 fs7 = nsf_c.transpose() * problem->FS7_matrix[i] * c_tmp * b7;
398 fvecn(k) = -pp7(0, 0) + P1_7(i) - P2_7(i) + fs7(0, 0);
399 }
400
401 pfvecn += Nphi_prec7;
402
403 for (int i = 0; i < Nphi_prec8; i++)
404 {
405 int k = i + pfvecn;
406 pp8 = a_tmp.transpose() * problem->ST8_matrix[i] * d8_tmp;
407 fs8 = nsf_c.transpose() * problem->FS8_matrix[i] * c_tmp * b8;
408 fvecn(k) = -pp8(0, 0) + P1_8(i) - P2_8(i) + fs8(0, 0);
409 }
410
411 return 0;
412}
413
414int newton_msr_n::df(const Eigen::VectorXd& n,
415 Eigen::MatrixXd& fjacn) const
416{
417 Eigen::NumericalDiff<newton_msr_n> numDiff(*this);
418 numDiff.df(n, fjacn);
419 return 0;
420}
421
422int newton_msr_t::operator()(const Eigen::VectorXd& t,
423 Eigen::VectorXd& fvect) const
424{
425 Eigen::VectorXd e_tmp(Nphi_T); //for T
426 Eigen::VectorXd f1_tmp(Nphi_dec1); //for dec1
427 Eigen::VectorXd f2_tmp(Nphi_dec2); //for dec2
428 Eigen::VectorXd f3_tmp(Nphi_dec3); //for dec3
429 e_tmp = t.head(Nphi_T);
430 int pos = Nphi_T;
431 f1_tmp = t.segment(pos, Nphi_dec1);
432 pos += Nphi_dec1;
433 f2_tmp = t.segment(pos, Nphi_dec2);
434 pos += Nphi_dec2;
435 f3_tmp = t.segment(pos, Nphi_dec3);
437 // convective term in T_eqn
438 Eigen::MatrixXd tt(1, 1);
439 // laplacian of T
440 Eigen::VectorXd T1 = problem->LT_matrix * e_tmp * nu / Pr;
441 // temp flux source
442 Eigen::MatrixXd xsf(1, 1);
443 // decay heat source term (*dli/cp)
444 Eigen::MatrixXd dhs1(1, 1);
445 Eigen::MatrixXd dhs2(1, 1);
446 Eigen::MatrixXd dhs3(1, 1);
447 // convective term in decay heat eq.
448 Eigen::MatrixXd dh1(1, 1);
449 Eigen::MatrixXd dh2(1, 1);
450 Eigen::MatrixXd dh3(1, 1);
451 //laplacian of dh
452 Eigen::VectorXd DH1_1 = problem->LD1_matrix * f1_tmp * nu / Sc;
453 Eigen::VectorXd DH1_2 = problem->LD2_matrix * f2_tmp * nu / Sc;
454 Eigen::VectorXd DH1_3 = problem->LD3_matrix * f3_tmp * nu / Sc;
455 //algebric term in dh eq
456 Eigen::VectorXd DH2_1 = problem->MD1_matrix * f1_tmp * dl1;
457 Eigen::VectorXd DH2_2 = problem->MD2_matrix * f2_tmp * dl2;
458 Eigen::VectorXd DH2_3 = problem->MD3_matrix * f3_tmp * dl3;
459 // flux source in term dh eq (*dbi)
460 Eigen::MatrixXd dfs1(1, 1);
461 Eigen::MatrixXd dfs2(1, 1);
462 Eigen::MatrixXd dfs3(1, 1);
463
464 for (int i = 0; i < Nphi_T; i++)
465 {
466 tt = a_tmp.transpose() * problem->TS_matrix[i] * e_tmp;
467 xsf = txs_c.transpose() * problem->TXS_matrix[i] * c_tmp * ((1 - dbtot) / cp);
468 dhs1 = v_c.transpose() * problem->THS1_matrix[i] * f1_tmp * (dl1 / cp);
469 dhs2 = v_c.transpose() * problem->THS2_matrix[i] * f2_tmp * (dl2 / cp);
470 dhs3 = v_c.transpose() * problem->THS3_matrix[i] * f3_tmp * (dl3 / cp);
471 fvect(i) = -tt(0, 0) + T1(i) + xsf(0, 0) + dhs1(0, 0) + dhs2(0, 0) + dhs3(0, 0);
472 }
473
474 int pfvect = Nphi_T;
475
476 for (int i = 0; i < Nphi_dec1; i++)
477 {
478 int k = i + pfvect;
479 dh1 = a_tmp.transpose() * problem->SD1_matrix[i] * f1_tmp;
480 dfs1 = sp_c.transpose() * problem->DFS1_matrix[i] * c_tmp * db1;
481 fvect(k) = -dh1(0, 0) + DH1_1(i) - DH2_1(i) + dfs1(0, 0);
482 }
483
484 pfvect += Nphi_dec1;
485
486 for (int i = 0; i < Nphi_dec2; i++)
487 {
488 int k = i + pfvect;
489 dh2 = a_tmp.transpose() * problem->SD2_matrix[i] * f2_tmp;
490 dfs2 = sp_c.transpose() * problem->DFS2_matrix[i] * c_tmp * db2;
491 fvect(k) = -dh2(0, 0) + DH1_2(i) - DH2_2(i) + dfs2(0, 0);
492 }
493
494 pfvect += Nphi_dec2;
495
496 for (int i = 0; i < Nphi_dec3; i++)
497 {
498 int k = i + pfvect;
499 dh3 = a_tmp.transpose() * problem->SD3_matrix[i] * f3_tmp;
500 dfs3 = sp_c.transpose() * problem->DFS3_matrix[i] * c_tmp * db3;
501 fvect(k) = -dh3(0, 0) + DH1_3(i) - DH2_3(i) + dfs3(0, 0);
502 }
503
504 for (int i = 0; i < N_BCt; i++)
505 {
506 fvect(i) = t(i) - BCt(i);
507 }
508
509 return 0;
510}
511
512int newton_msr_t::df(const Eigen::VectorXd& t,
513 Eigen::MatrixXd& fjact) const
514{
515 Eigen::NumericalDiff<newton_msr_t> numDiff(*this);
516 numDiff.df(t, fjact);
517 return 0;
518}
519
520
521void reducedMSR::solveOnline(Eigen::MatrixXd vel_now, Eigen::MatrixXd temp_now,
522 Eigen::VectorXd mu_online)
523{
524 Info << "\n Starting online stage...\n" << endl;
525 y.resize(Nphi_u + Nphi_p, 1);
526 y.setZero();
529 w.setZero();
530 z.resize(Nphi_T + Nphi_dec1 + Nphi_dec2 + Nphi_dec3, 1);
531 z.setZero();
532
533 for (int j = 0; j < N_BC; j++)
534 {
535 y(j) = vel_now(j, 0);
536 }
537
538 for (int j = 0; j < N_BCt; j++)
539 {
540 z(j) = temp_now(j, 0);
541 }
542
543 for (int i = 0; i < Nphi_const; i++)
544 {
545 newton_object_n.d_c(i) = problem->rbfsplines_D[i]->eval(mu_online);
546 newton_object_n.nsf_c(i) = problem->rbfsplines_NSF[i]->eval(mu_online);
547 newton_object_n.a_c(i) = problem->rbfsplines_A[i]->eval(mu_online);
548 newton_object_t.v_c(i) = problem->rbfsplines_v[i]->eval(mu_online);
549 newton_object_t.sp_c(i) = problem->rbfsplines_SP[i]->eval(mu_online);
550 newton_object_t.txs_c(i) = problem->rbfsplines_TXS[i]->eval(mu_online);
551 }
552
553 online_solution_fd.resize(1);
554 online_solution_n.resize(1);
555 online_solution_t.resize(1);
556 online_solution_C.resize(1);
557 online_solution_fd[0].resize(y.rows() + 1, 1);
558 online_solution_n[0].resize(w.rows() + 1, 1);
559 online_solution_t[0].resize(z.rows() + 1, 1);
560 online_solution_C[0].resize(6 * Nphi_const + 1, 1);
564 Eigen::HybridNonLinearSolver<newton_msr_fd> hnls_fd(newton_object_fd);
565 Eigen::HybridNonLinearSolver<newton_msr_n> hnls_n(newton_object_n);
566 Eigen::HybridNonLinearSolver<newton_msr_t> hnls_t(newton_object_t);
567 newton_object_fd.BC.resize(N_BC);
568
569 for (int j = 0; j < N_BC; j++)
570 {
571 newton_object_fd.BC(j) = vel_now(j, 0);
572 }
573
577 newton_object_n.l1 = l1; //lambda-ith
585 newton_object_n.b1 = b1; //beta-ith
603 newton_object_t.BCt.resize(N_BCt);
604
605 for (int j = 0; j < N_BCt; j++)
606 {
607 newton_object_t.BCt(j) = temp_now(j, 0);
608 }
609
610 hnls_fd.solve(y);
611 Eigen::VectorXd res_fd(y);
613 hnls_n.solve(w);
614 Eigen::VectorXd res_n(w);
617 hnls_t.solve(z);
618 Eigen::VectorXd res_t(z);
619 newton_object_fd.operator()(y, res_fd);
620 newton_object_n.operator()(w, res_n);
621 newton_object_t.operator()(z, res_t);
622 std::cout << "################## Online solve N° " << count_online_solve <<
623 " ##################" << std::endl;
624
625 if (res_fd.norm() / y.norm() < 1e-5)
626 {
627 std::cout << green << "|F_fd(x)| = " << res_fd.norm() / y.norm() <<
628 " - Minimun reached in " << hnls_fd.iter << " iterations " << def << std::endl
629 << std::endl;
630 }
631 else
632 {
633 std::cout << red << "|F_fd(x)| = " << res_fd.norm() / y.norm() <<
634 " - Minimun reached in " << hnls_fd.iter << " iterations " << def << std::endl
635 << std::endl;
636 }
637
638 if (res_n.norm() / w.norm() < 1e-5)
639 {
640 std::cout << green << "|F_n(x)| = " << res_n.norm() / w.norm() <<
641 " - Minimun reached in " << hnls_n.iter << " iterations " << def << std::endl <<
642 std::endl;
643 }
644 else
645 {
646 std::cout << red << "|F_n(x)| = " << res_n.norm() / w.norm() <<
647 " - Minimun reached in " << hnls_n.iter << " iterations " << def << std::endl <<
648 std::endl;
649 }
650
651 if (res_t.norm() / z.norm() < 1e-5)
652 {
653 std::cout << green << "|F_t(x)| = " << res_t.norm() / z.norm() <<
654 " - Minimun reached in " << hnls_t.iter << " iterations " << def << std::endl <<
655 std::endl;
656 }
657 else
658 {
659 std::cout << red << "|F_t(x)| = " << res_t.norm() / z.norm() <<
660 " - Minimun reached in " << hnls_t.iter << " iterations " << def << std::endl <<
661 std::endl;
662 }
663
665 online_solution_fd[0].col(0).tail(y.rows()) = y;
667 online_solution_n[0].col(0).tail(w.rows()) = w;
669 online_solution_t[0].col(0).tail(z.rows()) = z;
671 int pos_c = 1;
672 online_solution_C[0].col(0).segment(pos_c, Nphi_const) = newton_object_t.v_c;
673 pos_c += Nphi_const;
674 online_solution_C[0].col(0).segment(pos_c, Nphi_const) = newton_object_n.d_c;
675 pos_c += Nphi_const;
676 online_solution_C[0].col(0).segment(pos_c, Nphi_const) = newton_object_n.nsf_c;
677 pos_c += Nphi_const;
678 online_solution_C[0].col(0).segment(pos_c, Nphi_const) = newton_object_n.a_c;
679 pos_c += Nphi_const;
680 online_solution_C[0].col(0).segment(pos_c, Nphi_const) = newton_object_t.sp_c;
681 pos_c += Nphi_const;
682 online_solution_C[0].col(0).segment(pos_c, Nphi_const) = newton_object_t.txs_c;
683 ITHACAstream::exportMatrix(online_solution_fd, "red_coeff_fd", "matlab",
684 "./ITHACAoutput/red_coeff_fd");
685 ITHACAstream::exportMatrix(online_solution_n, "red_coeff_n", "matlab",
686 "./ITHACAoutput/red_coeff_n");
687 ITHACAstream::exportMatrix(online_solution_t, "red_coeff_t", "matlab",
688 "./ITHACAoutput/red_coeff_t");
689 ITHACAstream::exportMatrix(online_solution_C, "red_coeff_C", "matlab",
690 "./ITHACAoutput/red_coeff_C");
692}
693
694void reducedMSR::reconstructAP(fileName folder, int printevery)
695{
696 recall = true;
697 mkDir(folder);
699 reconstruct_fd(folder, printevery);
700 reconstruct_n(folder, printevery);
701 reconstruct_C(folder, printevery);
702 reconstruct_t(folder, printevery);
703 return;
704}
705
706void reducedMSR::reconstruct_fd(fileName folder, int printevery)
707{
708 if (recall == false)
709 {
710 mkDir(folder);
712 }
713
714 Info << "Reconstructing online solution | fluid-dynamics" << endl;
715 int counter = 0;
716 int nextwrite = 0;
717 int counter2 = 1;
718
719 for (int i = 0; i < online_solution_fd.size(); i++)
720 {
721 if (counter == nextwrite)
722 {
723 volVectorField U_rec("U", Umodes[0] * 0);
724
725 for (int j = 0; j < Nphi_u; j++)
726 {
727 U_rec += Umodes[j] * online_solution_fd[i](j + 1, 0);
728 }
729
730 ITHACAstream::exportSolution(U_rec, name(counter2), folder);
731 volScalarField P_rec("p", Pmodes[0] * 0);
732
733 for (int j = 0; j < Nphi_p; j++)
734 {
735 P_rec += Pmodes[j] * online_solution_fd[i](j + Nphi_u + 1, 0);
736 }
737
738 ITHACAstream::exportSolution(P_rec, name(counter2), folder);
739 nextwrite += printevery;
740 counter2 ++;
741 UREC.append(U_rec.clone());
742 PREC.append(P_rec.clone());
743 }
744
745 counter++;
746 }
747
748 Info << "End" << endl;
749}
750
751void reducedMSR::reconstruct_n(fileName folder, int printevery)
752{
753 if (recall == false)
754 {
755 mkDir(folder);
757 }
758
759 Info << "Reconstructing online solution | neutronics" << endl;
760 int counter = 0;
761 int nextwrite = 0;
762 int counter2 = 1;
763
764 for (int i = 0; i < online_solution_fd.size(); i++)
765 {
766 if (counter == nextwrite)
767 {
768 volScalarField Flux_rec("flux", Fluxmodes[0] * 0);
769
770 for (int j = 0; j < Nphi_flux; j++)
771 {
772 Flux_rec += Fluxmodes[j] * online_solution_n[i](j + 1, 0);
773 }
774
775 ITHACAstream::exportSolution(Flux_rec, name(counter2), folder);
776 int pos = Nphi_flux;
777 volScalarField Prec1_rec("prec1", Prec1modes[0] * 0);
778
779 for (int j = 0; j < Nphi_prec1; j++)
780 {
781 Prec1_rec += Prec1modes[j] * online_solution_n[i](j + pos + 1, 0);
782 }
783
784 ITHACAstream::exportSolution(Prec1_rec, name(counter2), folder);
785 pos += Nphi_prec1;
786 volScalarField Prec2_rec("prec2", Prec2modes[0] * 0);
787
788 for (int j = 0; j < Nphi_prec2; j++)
789 {
790 Prec2_rec += Prec2modes[j] * online_solution_n[i](j + pos + 1, 0);
791 }
792
793 ITHACAstream::exportSolution(Prec2_rec, name(counter2), folder);
794 pos += Nphi_prec2;
795 volScalarField Prec3_rec("prec3", Prec3modes[0] * 0);
796
797 for (int j = 0; j < Nphi_prec3; j++)
798 {
799 Prec3_rec += Prec3modes[j] * online_solution_n[i](j + pos + 1, 0);
800 }
801
802 ITHACAstream::exportSolution(Prec3_rec, name(counter2), folder);
803 pos += Nphi_prec3;
804 volScalarField Prec4_rec("prec4", Prec4modes[0] * 0);
805
806 for (int j = 0; j < Nphi_prec4; j++)
807 {
808 Prec4_rec += Prec4modes[j] * online_solution_n[i](j + pos + 1, 0);
809 }
810
811 ITHACAstream::exportSolution(Prec4_rec, name(counter2), folder);
812 pos += Nphi_prec4;
813 volScalarField Prec5_rec("prec5", Prec5modes[0] * 0);
814
815 for (int j = 0; j < Nphi_prec5; j++)
816 {
817 Prec5_rec += Prec5modes[j] * online_solution_n[i](j + pos + 1, 0);
818 }
819
820 ITHACAstream::exportSolution(Prec5_rec, name(counter2), folder);
821 pos += Nphi_prec5;
822 volScalarField Prec6_rec("prec6", Prec6modes[0] * 0);
823
824 for (int j = 0; j < Nphi_prec6; j++)
825 {
826 Prec6_rec += Prec6modes[j] * online_solution_n[i](j + pos + 1, 0);
827 }
828
829 ITHACAstream::exportSolution(Prec6_rec, name(counter2), folder);
830 pos += Nphi_prec6;
831 volScalarField Prec7_rec("prec7", Prec7modes[0] * 0);
832
833 for (int j = 0; j < Nphi_prec7; j++)
834 {
835 Prec7_rec += Prec7modes[j] * online_solution_n[i](j + pos + 1, 0);
836 }
837
838 ITHACAstream::exportSolution(Prec7_rec, name(counter2), folder);
839 pos += Nphi_prec7;
840 volScalarField Prec8_rec("prec8", Prec8modes[0] * 0);
841
842 for (int j = 0; j < Nphi_prec8; j++)
843 {
844 Prec8_rec += Prec8modes[j] * online_solution_n[i](j + pos + 1, 0);
845 }
846
847 ITHACAstream::exportSolution(Prec8_rec, name(counter2), folder);
848 nextwrite += printevery;
849 counter2 ++;
850 FLUXREC.append(Flux_rec.clone());
851 PREC1REC.append(Prec1_rec.clone());
852 PREC2REC.append(Prec2_rec.clone());
853 PREC3REC.append(Prec3_rec.clone());
854 PREC4REC.append(Prec4_rec.clone());
855 PREC5REC.append(Prec5_rec.clone());
856 PREC6REC.append(Prec6_rec.clone());
857 PREC7REC.append(Prec7_rec.clone());
858 PREC8REC.append(Prec8_rec.clone());
859 }
860
861 counter++;
862 }
863
864 Info << "End" << endl;
865}
866
867void reducedMSR::reconstruct_t(fileName folder, int printevery)
868{
869 if (recall == false)
870 {
871 mkDir(folder);
873 }
874
875 Info << "Reconstructing online solution | thermal" << endl;
876 int counter = 0;
877 int nextwrite = 0;
878 int counter2 = 1;
879 dimensionedScalar decLam1("decLam1", dimensionSet(0, 0, -1, 0, 0, 0, 0), dl1);
880 dimensionedScalar decLam2("decLam2", dimensionSet(0, 0, -1, 0, 0, 0, 0), dl2);
881 dimensionedScalar decLam3("decLam3", dimensionSet(0, 0, -1, 0, 0, 0, 0), dl3);
882
883 for (int i = 0; i < online_solution_t.size(); i++)
884 {
885 if (counter == nextwrite)
886 {
887 volScalarField T_rec("T", Tmodes[0] * 0);
888
889 for (int j = 0; j < Nphi_T; j++)
890 {
891 T_rec += Tmodes[j] * online_solution_t[i](j + 1, 0);
892 }
893
894 ITHACAstream::exportSolution(T_rec, name(counter2), folder);
895 int pos = Nphi_T;
896 volScalarField PowerDens_rec("powerDens", Dec1modes[0] * 0 * decLam1);
897 volScalarField Dec1_rec("dec1", Dec1modes[0] * 0);
898
899 for (int j = 0; j < Nphi_dec1; j++)
900 {
901 Dec1_rec += Dec1modes[j] * online_solution_t[i](j + pos + 1, 0);
902 PowerDens_rec += Dec1modes[j] * online_solution_t[i](j + pos + 1, 0) * decLam1;
903 }
904
905 ITHACAstream::exportSolution(Dec1_rec, name(counter2), folder);
906 pos += Nphi_dec1;
907 volScalarField Dec2_rec("dec2", Dec2modes[0] * 0);
908
909 for (int j = 0; j < Nphi_dec2; j++)
910 {
911 Dec2_rec += Dec2modes[j] * online_solution_t[i](j + pos + 1, 0);
912 PowerDens_rec += Dec2modes[j] * online_solution_t[i](j + pos + 1, 0) * decLam2;
913 }
914
915 ITHACAstream::exportSolution(Dec2_rec, name(counter2), folder);
916 pos += Nphi_dec2;
917 volScalarField Dec3_rec("dec3", Dec3modes[0] * 0);
918
919 for (int j = 0; j < Nphi_dec3; j++)
920 {
921 Dec3_rec += Dec3modes[j] * online_solution_t[i](j + pos + 1, 0);
922 PowerDens_rec += Dec3modes[j] * online_solution_t[i](j + pos + 1, 0) * decLam3;
923 }
924
925 ITHACAstream::exportSolution(Dec3_rec, name(counter2), folder);
926 PowerDens_rec += (1 - dbtot) * SPREC[counter2 - 1] * FLUXREC[counter2 - 1];
927 ITHACAstream::exportSolution(PowerDens_rec, name(counter2), folder);
928 nextwrite += printevery;
929 counter2 ++;
930 TREC.append(T_rec.clone());
931 DEC1REC.append(Dec1_rec.clone());
932 DEC2REC.append(Dec2_rec.clone());
933 DEC3REC.append(Dec3_rec.clone());
934 POWERDENSREC.append(PowerDens_rec.clone());
935 }
936
937 counter++;
938 }
939
940 Info << "End" << endl;
941}
942
943void reducedMSR::reconstruct_C(fileName folder, int printevery)
944{
945 if (recall == false)
946 {
947 mkDir(folder);
949 }
950
951 Info << "Reconstructing temperature changing constants" << endl;
952 int counter = 0;
953 int nextwrite = 0;
954 int counter2 = 1;
955
956 for (int i = 0; i < online_solution_C.size(); i++)
957 {
958 if (counter == nextwrite)
959 {
960 volScalarField v_rec("v", vmodes[0] * 0);
961
962 for (int j = 0; j < Nphi_const; j++)
963 {
964 v_rec += vmodes[j] * online_solution_C[i](j + 1, 0);
965 }
966
967 ITHACAstream::exportSolution(v_rec, name(counter2), folder);
968 int pos = Nphi_const;
969 volScalarField D_rec("D", Dmodes[0] * 0);
970
971 for (int j = 0; j < Nphi_const; j++)
972 {
973 D_rec += Dmodes[j] * online_solution_C[i](j + pos + 1, 0);
974 }
975
976 ITHACAstream::exportSolution(D_rec, name(counter2), folder);
977 pos += Nphi_const;
978 volScalarField NSF_rec("NSF", NSFmodes[0] * 0);
979
980 for (int j = 0; j < Nphi_const; j++)
981 {
982 NSF_rec += NSFmodes[j] * online_solution_C[i](j + pos + 1, 0);
983 }
984
985 ITHACAstream::exportSolution(NSF_rec, name(counter2), folder);
986 pos += Nphi_const;
987 volScalarField A_rec("A", Amodes[0] * 0);
988
989 for (int j = 0; j < Nphi_const; j++)
990 {
991 A_rec += Amodes[j] * online_solution_C[i](j + pos + 1, 0);
992 }
993
994 ITHACAstream::exportSolution(A_rec, name(counter2), folder);
995 pos += Nphi_const;
996 volScalarField SP_rec("SP", SPmodes[0] * 0);
997
998 for (int j = 0; j < Nphi_const; j++)
999 {
1000 SP_rec += SPmodes[j] * online_solution_C[i](j + pos + 1, 0);
1001 }
1002
1003 ITHACAstream::exportSolution(SP_rec, name(counter2), folder);
1004 pos += Nphi_const;
1005 volScalarField TXS_rec("TXS", TXSmodes[0] * 0);
1006
1007 for (int j = 0; j < Nphi_const; j++)
1008 {
1009 TXS_rec += TXSmodes[j] * online_solution_C[i](j + pos + 1, 0);
1010 }
1011
1012 ITHACAstream::exportSolution(TXS_rec, name(counter2), folder);
1013 std::ofstream of(folder + "/" + name(counter2) + "/" + name(
1014 online_solution_C[i](0)));
1015 nextwrite += printevery;
1016 counter2 ++;
1017 vREC.append(v_rec.clone());
1018 DREC.append(D_rec.clone());
1019 NSFREC.append(NSF_rec.clone());
1020 AREC.append(A_rec.clone());
1021 SPREC.append(SP_rec.clone());
1022 TXSREC.append(TXS_rec.clone());
1023 }
1024
1025 counter++;
1026 }
1027
1028 Info << "End" << endl;
1029}
1030
1031
1033{
1034 nu = problem->_nu().value();
1035 iv = problem->_IV1().value();
1036 l1 = problem->_lam1().value();
1037 l2 = problem->_lam2().value();
1038 l3 = problem->_lam3().value();
1039 l4 = problem->_lam4().value();
1040 l5 = problem->_lam5().value();
1041 l6 = problem->_lam6().value();
1042 l7 = problem->_lam7().value();
1043 l8 = problem->_lam8().value();
1044 b1 = problem->_beta1().value();
1045 b2 = problem->_beta2().value();
1046 b3 = problem->_beta3().value();
1047 b4 = problem->_beta4().value();
1048 b5 = problem->_beta5().value();
1049 b6 = problem->_beta6().value();
1050 b7 = problem->_beta7().value();
1051 b8 = problem->_beta8().value();
1052 btot = problem->_betaTot().value();
1053 cp = problem->_CpRef().value();
1054 dl1 = problem->_decLam1().value();
1055 dl2 = problem->_decLam2().value();
1056 dl3 = problem->_decLam3().value();
1057 db1 = problem->_decBeta1().value();
1058 db2 = problem->_decBeta2().value();
1059 db3 = problem->_decBeta3().value();
1060 dbtot = problem->_decbetaTot().value();
1061 Pr = problem->_Pr().value();
1062 Sc = problem->_Sc().value();
1063}
1064
1066{
1067 UREC.clear();
1068 PREC.clear();
1069 FLUXREC.clear();
1070 PREC1REC.clear();
1071 PREC2REC.clear();
1072 PREC3REC.clear();
1073 PREC4REC.clear();
1074 PREC5REC.clear();
1075 PREC6REC.clear();
1076 PREC7REC.clear();
1077 PREC8REC.clear();
1078 TREC.clear();
1079 DEC1REC.clear();
1080 DEC2REC.clear();
1081 DEC3REC.clear();
1082 POWERDENSREC.clear();
1083 vREC.clear();
1084 DREC.clear();
1085 NSFREC.clear();
1086 AREC.clear();
1087 SPREC.clear();
1088 TXSREC.clear();
1089}
1090
Class to change color to the output stream.
Definition colormod.H:24
Class to implement Molten Salt Reactor multiphysics problem.
Definition msrProblem.H:36
Eigen::MatrixXd MP7_matrix
precursor mass term-7
Definition msrProblem.H:418
autoPtr< dimensionedScalar > _betaTot
Definition msrProblem.H:130
Eigen::MatrixXd MD1_matrix
decay heat mass term-1
Definition msrProblem.H:464
List< Eigen::MatrixXd > ST5_matrix
precursor stream term-5
Definition msrProblem.H:398
PtrList< volScalarField > Prec6field
List of pointers used to form the prec6 snapshots matrix.
Definition msrProblem.H:219
List< Eigen::MatrixXd > THS2_matrix
temperature decay heat source term-2
Definition msrProblem.H:493
Eigen::MatrixXd LP3_matrix
precursor laplacian term-3
Definition msrProblem.H:426
List< Eigen::MatrixXd > SD1_matrix
decay heat stream term-1
Definition msrProblem.H:458
Eigen::MatrixXd BC1_matrix
PPE BC1.
Definition msrProblem.H:350
PtrList< volScalarField > NSFmodes
List of pointers used to form the NSF snapshosts matrix.
Definition msrProblem.H:312
PtrList< volScalarField > Prec5modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:282
List< Eigen::MatrixXd > PF_matrix
production flux
Definition msrProblem.H:366
autoPtr< dimensionedScalar > _Pr
Definition msrProblem.H:64
PtrList< volScalarField > Prec4modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:279
List< Eigen::MatrixXd > FS3_matrix
precursor flux source term-3
Definition msrProblem.H:442
List< Eigen::MatrixXd > ST7_matrix
precursor stream term-7
Definition msrProblem.H:402
PtrList< volScalarField > Prec8field
List of pointers used to form the prec8 snapshots matrix.
Definition msrProblem.H:225
autoPtr< dimensionedScalar > _beta8
Definition msrProblem.H:129
List< Eigen::MatrixXd > FS1_matrix
precursor flux source term-1
Definition msrProblem.H:438
PtrList< volScalarField > Prec1modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:270
List< Eigen::MatrixXd > TXS_matrix
temperature flux source term TXS
Definition msrProblem.H:489
List< Eigen::MatrixXd > LF_matrix
laplacian_flux
Definition msrProblem.H:362
PtrList< volScalarField > Pmodes
List of pointers used to form the pressure modes.
Definition msrProblem.H:261
label NUmodes
Number of modes adopted during Galerkin projection.
Definition msrProblem.H:500
Eigen::MatrixXd MP1_matrix
precursor mass term-1
Definition msrProblem.H:406
autoPtr< dimensionedScalar > _CpRef
Definition msrProblem.H:68
autoPtr< dimensionedScalar > _decBeta2
Definition msrProblem.H:136
autoPtr< dimensionedScalar > _beta5
Definition msrProblem.H:126
List< Eigen::MatrixXd > ST8_matrix
precursor stream term-8
Definition msrProblem.H:404
List< Eigen::MatrixXd > ST4_matrix
precursor stream term-4
Definition msrProblem.H:396
autoPtr< dimensionedScalar > _lam7
Definition msrProblem.H:120
PtrList< volScalarField > Prec7modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:288
PtrList< volScalarField > vFields
List of pointers used to form the v snapshosts matrix.
Definition msrProblem.H:243
Eigen::MatrixXd PS3_matrix
prec_source 3
Definition msrProblem.H:377
PtrList< volScalarField > Tmodes
List of pointers used to form the temperature modes.
Definition msrProblem.H:294
Eigen::MatrixXd K_matrix
Gradient of pressure matrix.
Definition msrProblem.H:335
List< Eigen::MatrixXd > G_matrix
Divergence of momentum PPE.
Definition msrProblem.H:347
List< Eigen::MatrixXd > AF_matrix
absorption flux
Definition msrProblem.H:368
std::vector< SPLINTER::RBFSpline * > rbfsplines_A
Definition msrProblem.H:548
Eigen::MatrixXd MP2_matrix
precursor mass term-2
Definition msrProblem.H:408
List< Eigen::MatrixXd > FS2_matrix
precursor flux source term-2
Definition msrProblem.H:440
Eigen::MatrixXd LP8_matrix
precursor laplacian term-8
Definition msrProblem.H:436
Eigen::MatrixXd PS6_matrix
prec_source 6
Definition msrProblem.H:383
autoPtr< dimensionedScalar > _lam3
Definition msrProblem.H:116
PtrList< volScalarField > Prec8modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:291
List< Eigen::MatrixXd > FS4_matrix
precursor flux source term-4
Definition msrProblem.H:444
PtrList< volScalarField > Fluxfield
List of pointers used to form the flux snapshots matrix.
Definition msrProblem.H:201
Eigen::MatrixXd BC3_matrix
PPE BC3.
Definition msrProblem.H:356
Eigen::MatrixXd LP4_matrix
precursor laplacian term-4
Definition msrProblem.H:428
Eigen::MatrixXd LP7_matrix
precursor laplacian term-7
Definition msrProblem.H:434
std::vector< SPLINTER::RBFSpline * > rbfsplines_NSF
Definition msrProblem.H:546
List< Eigen::MatrixXd > SD3_matrix
decay heat stream term-3
Definition msrProblem.H:462
PtrList< volScalarField > Prec2modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:273
Eigen::MatrixXd LP6_matrix
precursor laplacian term-6
Definition msrProblem.H:432
List< Eigen::MatrixXd > TS_matrix
temperature stream term
Definition msrProblem.H:485
label NPmodes
Definition msrProblem.H:501
autoPtr< dimensionedScalar > _beta2
Definition msrProblem.H:123
PtrList< volScalarField > Prec4field
List of pointers used to form the prec4 snapshots matrix.
Definition msrProblem.H:213
autoPtr< dimensionedScalar > _Sc
Definition msrProblem.H:148
Eigen::MatrixXd MP3_matrix
precursor mass term-3
Definition msrProblem.H:410
PtrList< volScalarField > DFields
List of pointers used to form the D snapshosts matrix.
Definition msrProblem.H:246
Eigen::MatrixXd D_matrix
Laplacian term PPE.
Definition msrProblem.H:344
List< Eigen::MatrixXd > DFS2_matrix
decay heat flux source term-2
Definition msrProblem.H:478
autoPtr< dimensionedScalar > _lam6
Definition msrProblem.H:119
PtrList< volScalarField > AFields
List of pointers used to form the A snapshosts matrix.
Definition msrProblem.H:252
autoPtr< dimensionedScalar > _beta3
Definition msrProblem.H:124
Eigen::MatrixXd PS7_matrix
prec_source 7
Definition msrProblem.H:385
List< Eigen::MatrixXd > FS7_matrix
precursor flux source term-7
Definition msrProblem.H:450
List< Eigen::MatrixXd > ST6_matrix
precursor stream term-6
Definition msrProblem.H:400
Eigen::MatrixXd LP1_matrix
precursor laplacian term-1
Definition msrProblem.H:422
PtrList< volScalarField > Dec1modes
List of pointers used to form the dec1 modes.
Definition msrProblem.H:297
List< Eigen::MatrixXd > THS1_matrix
temperature decay heat source term-1
Definition msrProblem.H:491
PtrList< volScalarField > Dec3field
List of pointers used to form the dec3 snapshots matrix.
Definition msrProblem.H:237
List< Eigen::MatrixXd > ST1_matrix
precursor stream term-1
Definition msrProblem.H:390
autoPtr< dimensionedScalar > _IV1
Definition msrProblem.H:101
Eigen::MatrixXd LT_matrix
temperature laplacian term
Definition msrProblem.H:487
PtrList< volScalarField > Prec6modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:285
autoPtr< dimensionedScalar > _beta7
Definition msrProblem.H:128
autoPtr< dimensionedScalar > _lam4
Definition msrProblem.H:117
List< Eigen::MatrixXd > FS6_matrix
precursor flux source term-6
Definition msrProblem.H:448
autoPtr< dimensionedScalar > _beta1
Definition msrProblem.H:122
autoPtr< dimensionedScalar > _decLam3
Definition msrProblem.H:134
std::vector< SPLINTER::RBFSpline * > rbfsplines_v
Definition msrProblem.H:542
PtrList< volScalarField > vmodes
List of pointers used to form the v modes.
Definition msrProblem.H:306
autoPtr< dimensionedScalar > _beta4
Definition msrProblem.H:125
PtrList< volScalarField > Dec1field
List of pointers used to form the dec1 snapshots matrix.
Definition msrProblem.H:231
PtrList< volScalarField > TXSmodes
List of pointers used to form the SP snapshosts matrix.
Definition msrProblem.H:321
autoPtr< dimensionedScalar > _lam5
Definition msrProblem.H:118
autoPtr< dimensionedScalar > _lam1
Definition msrProblem.H:114
Eigen::MatrixXd LD1_matrix
decay heat laplacian term-1
Definition msrProblem.H:470
List< Eigen::MatrixXd > SD2_matrix
decay heat stream term-2
Definition msrProblem.H:460
Eigen::MatrixXd MP5_matrix
precursor mass term-5
Definition msrProblem.H:414
PtrList< volScalarField > Prec3modes
List of pointers used to form the prec1 modes.
Definition msrProblem.H:276
Eigen::MatrixXd LP2_matrix
precursor laplacian term-2
Definition msrProblem.H:424
autoPtr< dimensionedScalar > _decBeta3
Definition msrProblem.H:137
Eigen::MatrixXd LD2_matrix
decay heat laplacian term-2
Definition msrProblem.H:472
PtrList< volScalarField > Prec7field
List of pointers used to form the prec7 snapshots matrix.
Definition msrProblem.H:222
Eigen::MatrixXd PS8_matrix
prec_source 8
Definition msrProblem.H:387
Eigen::MatrixXd MP8_matrix
precursor mass term-8
Definition msrProblem.H:420
autoPtr< dimensionedScalar > _lam8
Definition msrProblem.H:121
label NFluxmodes
Definition msrProblem.H:502
autoPtr< dimensionedScalar > _nu
Definition msrProblem.H:63
autoPtr< dimensionedScalar > _decbetaTot
Definition msrProblem.H:138
Eigen::MatrixXd MD2_matrix
decay heat mass term-2
Definition msrProblem.H:466
PtrList< volScalarField > liftfieldT
List of pointers used to form the list of lifting functions.
Definition msrProblem.H:515
PtrList< volScalarField > Dec2modes
List of pointers used to form the dec2 modes.
Definition msrProblem.H:300
PtrList< volVectorField > liftfield
List of pointers used to form the list of lifting functions.
Definition msrProblem.H:513
Eigen::MatrixXd PS4_matrix
prec_source 4
Definition msrProblem.H:379
PtrList< volScalarField > Pfield
List of pointers used to form the pressure snapshots matrix.
Definition msrProblem.H:195
autoPtr< dimensionedScalar > _decBeta1
Definition msrProblem.H:135
autoPtr< dimensionedScalar > _decLam2
Definition msrProblem.H:133
Eigen::MatrixXd MP6_matrix
precursor mass term-6
Definition msrProblem.H:416
autoPtr< dimensionedScalar > _lam2
Definition msrProblem.H:115
PtrList< volScalarField > NSFFields
List of pointers used to form the NSF snapshosts matrix.
Definition msrProblem.H:249
PtrList< volScalarField > Prec3field
List of pointers used to form the prec3 snapshots matrix.
Definition msrProblem.H:210
autoPtr< dimensionedScalar > _decLam1
Definition msrProblem.H:132
PtrList< volVectorField > Umodes
List of pointers used to form the velocity modes.
Definition msrProblem.H:264
PtrList< volScalarField > Dec3modes
List of pointers used to form the dec3 modes.
Definition msrProblem.H:303
PtrList< volScalarField > Tfield
List of pointers used to form the temperature snapshots matrix.
Definition msrProblem.H:228
Eigen::MatrixXd B_matrix
Diffusion term.
Definition msrProblem.H:329
PtrList< volVectorField > Ufield
List of pointers used to form the velocity snapshots matrix.
Definition msrProblem.H:198
PtrList< volScalarField > Prec1field
List of pointers used to form the prec1 snapshots matrix.
Definition msrProblem.H:204
std::vector< SPLINTER::RBFSpline * > rbfsplines_SP
Definition msrProblem.H:550
Eigen::MatrixXd MP4_matrix
precursor mass term-4
Definition msrProblem.H:412
PtrList< volScalarField > SPmodes
List of pointers used to form the SP snapshosts matrix.
Definition msrProblem.H:318
List< Eigen::MatrixXd > ST2_matrix
precursor stream term-2
Definition msrProblem.H:392
List< Eigen::MatrixXd > FS8_matrix
precursor flux source term-8
Definition msrProblem.H:452
PtrList< volScalarField > SPFields
List of pointers used to form the SP snapshosts matrix.
Definition msrProblem.H:255
Eigen::MatrixXd PS1_matrix
prec_source 1
Definition msrProblem.H:373
List< Eigen::MatrixXd > DFS1_matrix
decay heat flux source term-1
Definition msrProblem.H:476
List< Eigen::MatrixXd > DFS3_matrix
decay heat flux source term-3
Definition msrProblem.H:480
List< Eigen::MatrixXd > FS5_matrix
precursor flux source term-5
Definition msrProblem.H:446
List< Eigen::MatrixXd > THS3_matrix
temperature decay heat source term-3
Definition msrProblem.H:495
PtrList< volScalarField > Dec2field
List of pointers used to form the dec2 snapshots matrix.
Definition msrProblem.H:234
PtrList< volScalarField > Prec5field
List of pointers used to form the prec5 snapshots matrix.
Definition msrProblem.H:216
Eigen::MatrixXd LD3_matrix
decay heat laplacian term-3
Definition msrProblem.H:474
List< Eigen::MatrixXd > C_matrix
Non linear term.
Definition msrProblem.H:338
PtrList< volScalarField > TXSFields
List of pointers used to form the SP snapshosts matrix.
Definition msrProblem.H:258
Eigen::MatrixXd LP5_matrix
precursor laplacian term-5
Definition msrProblem.H:430
Eigen::MatrixXd MD3_matrix
decay heat mass term-3
Definition msrProblem.H:468
PtrList< volScalarField > Amodes
List of pointers used to form the A snapshosts matrix.
Definition msrProblem.H:315
Eigen::MatrixXd PS2_matrix
prec_source 2
Definition msrProblem.H:375
PtrList< volScalarField > Fluxmodes
List of pointers used to form the flux modes.
Definition msrProblem.H:267
PtrList< volScalarField > Prec2field
List of pointers used to form the prec2 snapshots matrix.
Definition msrProblem.H:207
PtrList< volScalarField > Dmodes
List of pointers used to form the D modes.
Definition msrProblem.H:309
autoPtr< dimensionedScalar > _beta6
Definition msrProblem.H:127
label NTmodes
Definition msrProblem.H:505
std::vector< SPLINTER::RBFSpline * > rbfsplines_D
Definition msrProblem.H:544
std::vector< SPLINTER::RBFSpline * > rbfsplines_TXS
Definition msrProblem.H:552
List< Eigen::MatrixXd > ST3_matrix
precursor stream term-3
Definition msrProblem.H:394
Eigen::MatrixXd PS5_matrix
prec_source 5
Definition msrProblem.H:381
PtrList< volScalarField > NSFREC
Definition ReducedMSR.H:324
scalar cp
Definition ReducedMSR.H:240
PtrList< volScalarField > Tsnapshots
Definition ReducedMSR.H:294
PtrList< volScalarField > DEC3REC
Definition ReducedMSR.H:320
msrProblem * problem
Pointer to the FOM problem.
Definition ReducedMSR.H:335
scalar Pr
Definition ReducedMSR.H:213
PtrList< volScalarField > vREC
Definition ReducedMSR.H:322
scalar b4
Definition ReducedMSR.H:233
scalar l6
Definition ReducedMSR.H:227
void reconstruct_n(fileName folder="./ITHACAOutput/online_rec", int printevery=1)
reconstruct neutronics
Definition ReducedMSR.C:751
newton_msr_n newton_object_n
Definition ReducedMSR.H:331
PtrList< volScalarField > DEC2REC
Definition ReducedMSR.H:319
PtrList< volScalarField > Dec1modes
Definition ReducedMSR.H:271
PtrList< volScalarField > Pmodes
Definition ReducedMSR.H:260
PtrList< volVectorField > Usnapshots
List of pointers to store the snapshots for each field.
Definition ReducedMSR.H:283
PtrList< volScalarField > Psnapshots
Definition ReducedMSR.H:284
PtrList< volScalarField > FLUXREC
Definition ReducedMSR.H:308
PtrList< volVectorField > Umodes
List of pointers to store the modes for each field.
Definition ReducedMSR.H:259
PtrList< volScalarField > Prec8snapshots
Definition ReducedMSR.H:293
PtrList< volScalarField > Dec2modes
Definition ReducedMSR.H:272
scalar nu
characteristic constants of the problem
Definition ReducedMSR.H:211
PtrList< volScalarField > TXSREC
Definition ReducedMSR.H:327
bool recall
boolean variable to check if the user wants to reconstruct all the three physics of the problem
Definition ReducedMSR.H:357
PtrList< volScalarField > PREC4REC
Definition ReducedMSR.H:312
PtrList< volScalarField > Prec2modes
Definition ReducedMSR.H:263
void reconstruct_C(fileName folder="./ITHACAOutput/online_rec", int printevery=1)
reconstruct temperature dependent constants
Definition ReducedMSR.C:943
PtrList< volScalarField > Prec6snapshots
Definition ReducedMSR.H:291
PtrList< volScalarField > PREC3REC
Definition ReducedMSR.H:311
PtrList< volScalarField > vsnapshots
Definition ReducedMSR.H:298
scalar l7
Definition ReducedMSR.H:228
PtrList< volVectorField > UREC
Recontructed fields.
Definition ReducedMSR.H:306
List< Eigen::MatrixXd > online_solution_n
Definition ReducedMSR.H:254
scalar b2
Definition ReducedMSR.H:231
PtrList< volScalarField > Prec7modes
Definition ReducedMSR.H:268
PtrList< volScalarField > Prec6modes
Definition ReducedMSR.H:267
scalar b1
Definition ReducedMSR.H:230
PtrList< volScalarField > SPmodes
Definition ReducedMSR.H:278
void reconstruct_t(fileName folder="./ITHACAOutput/online_rec", int printevery=1)
reconstruct thermal fields
Definition ReducedMSR.C:867
PtrList< volScalarField > Prec5snapshots
Definition ReducedMSR.H:290
PtrList< volScalarField > TXSsnapshots
Definition ReducedMSR.H:303
scalar b8
Definition ReducedMSR.H:237
scalar dl2
Definition ReducedMSR.H:242
Eigen::VectorXd z
Definition ReducedMSR.H:206
PtrList< volScalarField > Dec3snapshots
Definition ReducedMSR.H:297
PtrList< volScalarField > Prec3modes
Definition ReducedMSR.H:264
scalar Sc
Definition ReducedMSR.H:214
PtrList< volScalarField > Prec3snapshots
Definition ReducedMSR.H:288
PtrList< volScalarField > Prec7snapshots
Definition ReducedMSR.H:292
scalar db1
Definition ReducedMSR.H:244
scalar b3
Definition ReducedMSR.H:232
scalar db2
Definition ReducedMSR.H:245
newton_msr_fd newton_object_fd
Newton object used to solve the non linear problem.
Definition ReducedMSR.H:330
PtrList< volScalarField > Amodes
Definition ReducedMSR.H:277
void loadConstants(msrProblem *problem)
Method to load all the constants needed in the ROM from ///the FOM.
PtrList< volScalarField > DEC1REC
Definition ReducedMSR.H:318
PtrList< volScalarField > NSFmodes
Definition ReducedMSR.H:276
scalar iv
Definition ReducedMSR.H:221
PtrList< volScalarField > Fluxsnapshots
Definition ReducedMSR.H:285
void reconstruct_fd(fileName folder="./ITHACAOutput/online_rec", int printevery=1)
reconstruct fluid-dynamics
Definition ReducedMSR.C:706
scalar dbtot
Definition ReducedMSR.H:247
int N_BC
Number of parametrized boundary conditions.
Definition ReducedMSR.H:360
scalar db3
Definition ReducedMSR.H:246
PtrList< volScalarField > Dec1snapshots
Definition ReducedMSR.H:295
PtrList< volScalarField > SPsnapshots
Definition ReducedMSR.H:302
scalar l8
Definition ReducedMSR.H:229
PtrList< volScalarField > Asnapshots
Definition ReducedMSR.H:301
PtrList< volScalarField > Prec4modes
Definition ReducedMSR.H:265
PtrList< volScalarField > PREC1REC
Definition ReducedMSR.H:309
scalar btot
Definition ReducedMSR.H:238
PtrList< volScalarField > Prec1snapshots
Definition ReducedMSR.H:286
PtrList< volScalarField > Dsnapshots
Definition ReducedMSR.H:299
PtrList< volScalarField > Prec8modes
Definition ReducedMSR.H:269
List< Eigen::MatrixXd > online_solution_fd
List of Eigen matrices to store the online solution.
Definition ReducedMSR.H:253
PtrList< volScalarField > POWERDENSREC
Definition ReducedMSR.H:321
PtrList< volScalarField > PREC6REC
Definition ReducedMSR.H:314
PtrList< volScalarField > TREC
Definition ReducedMSR.H:317
PtrList< volScalarField > NSFsnapshots
Definition ReducedMSR.H:300
PtrList< volScalarField > TXSmodes
Definition ReducedMSR.H:279
PtrList< volScalarField > Dec3modes
Definition ReducedMSR.H:273
scalar dl1
Definition ReducedMSR.H:241
int count_online_solve
Counter to count the online solutions.
Definition ReducedMSR.H:364
PtrList< volScalarField > AREC
Definition ReducedMSR.H:325
PtrList< volScalarField > vmodes
Definition ReducedMSR.H:274
PtrList< volScalarField > Prec4snapshots
Definition ReducedMSR.H:289
PtrList< volScalarField > PREC2REC
Definition ReducedMSR.H:310
Eigen::VectorXd w
Definition ReducedMSR.H:205
PtrList< volScalarField > Tmodes
Definition ReducedMSR.H:270
PtrList< volScalarField > Dmodes
Definition ReducedMSR.H:275
int Nphi_u
Number of modes for each field.
Definition ReducedMSR.H:338
List< Eigen::MatrixXd > online_solution_t
Definition ReducedMSR.H:255
void reconstructAP(fileName folder="./ITHACAOutput/online_rec", int printevery=1)
Methods to reconstruct a solution from an online solve with a PPE stabilisation technique.
Definition ReducedMSR.C:694
PtrList< volScalarField > Prec5modes
Definition ReducedMSR.H:266
PtrList< volScalarField > Prec2snapshots
Definition ReducedMSR.H:287
newton_msr_t newton_object_t
Definition ReducedMSR.H:332
PtrList< volScalarField > PREC
Definition ReducedMSR.H:307
PtrList< volScalarField > SPREC
Definition ReducedMSR.H:326
scalar l4
Definition ReducedMSR.H:225
void clearFields()
Method to clear all the fields of MSR (sets the size to zero)
scalar dl3
Definition ReducedMSR.H:243
PtrList< volScalarField > Dec2snapshots
Definition ReducedMSR.H:296
scalar b6
Definition ReducedMSR.H:235
PtrList< volScalarField > Prec1modes
Definition ReducedMSR.H:262
scalar l5
Definition ReducedMSR.H:226
scalar l2
Definition ReducedMSR.H:223
scalar b5
Definition ReducedMSR.H:234
Eigen::VectorXd y
Vector to store the solution during the Newton procedure.
Definition ReducedMSR.H:204
scalar b7
Definition ReducedMSR.H:236
scalar l1
Definition ReducedMSR.H:222
PtrList< volScalarField > PREC5REC
Definition ReducedMSR.H:313
PtrList< volScalarField > Fluxmodes
Definition ReducedMSR.H:261
PtrList< volScalarField > PREC8REC
Definition ReducedMSR.H:316
PtrList< volScalarField > DREC
Definition ReducedMSR.H:323
List< Eigen::MatrixXd > online_solution_C
Definition ReducedMSR.H:256
PtrList< volScalarField > PREC7REC
Definition ReducedMSR.H:315
scalar l3
Definition ReducedMSR.H:224
virtual void solveOnline()
Virtual Method to perform and online Solve.
Eigen::MatrixXi inletIndexT
Eigen::MatrixXi inletIndex
Matrix that contains informations about the inlet boundaries.
dimensionedScalar & decLam1
dimensionedScalar & decLam3
dimensionedScalar & decLam2
@ FG_GREEN
Definition colormod.H:14
@ FG_DEFAULT
Definition colormod.H:16
@ FG_RED
Definition colormod.H:13
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 createSymLink(word folder)
Creates symbolic links to 0, system and constant.
label i
Definition pEqn.H:46
Structure to implement a newton object for a stationary MSR problem.
Definition ReducedMSR.H:39
Eigen::VectorXd BC
Definition ReducedMSR.H:58
int df(const Eigen::VectorXd &x, Eigen::MatrixXd &fjac) const
Definition ReducedMSR.C:232
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
Definition ReducedMSR.C:185
msrProblem * problem
Definition ReducedMSR.H:59
Eigen::VectorXd a_tmp
Definition ReducedMSR.H:123
int df(const Eigen::VectorXd &n, Eigen::MatrixXd &fjacn) const
Definition ReducedMSR.C:414
Eigen::VectorXd d_c
Definition ReducedMSR.H:120
int operator()(const Eigen::VectorXd &n, Eigen::VectorXd &fvecn) const
Definition ReducedMSR.C:239
Eigen::VectorXd nsf_c
Definition ReducedMSR.H:121
Eigen::VectorXd a_c
Definition ReducedMSR.H:122
msrProblem * problem
Definition ReducedMSR.H:127
Eigen::VectorXd a_tmp
Definition ReducedMSR.H:172
Eigen::VectorXd sp_c
Definition ReducedMSR.H:176
Eigen::VectorXd txs_c
Definition ReducedMSR.H:177
Eigen::VectorXd c_tmp
Definition ReducedMSR.H:173
msrProblem * problem
Definition ReducedMSR.H:181
int df(const Eigen::VectorXd &n, Eigen::MatrixXd &fjacn) const
Definition ReducedMSR.C:512
Eigen::VectorXd BCt
Definition ReducedMSR.H:174
int operator()(const Eigen::VectorXd &n, Eigen::VectorXd &fvecn) const
Definition ReducedMSR.C:422
Eigen::VectorXd v_c
Definition ReducedMSR.H:175