-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathlaghos.cpp
More file actions
2884 lines (2642 loc) · 114 KB
/
laghos.cpp
File metadata and controls
2884 lines (2642 loc) · 114 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
// the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
// reserved. See files LICENSE and NOTICE for details.
//
// This file is part of CEED, a collection of benchmarks, miniapps, software
// libraries and APIs for efficient high-order finite element and spectral
// element discretizations for exascale applications. For more information and
// source code availability see http://github.com/ceed.
//
// The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
// a collaborative effort of two U.S. Department of Energy organizations (Office
// of Science and the National Nuclear Security Administration) responsible for
// the planning and preparation of a capable exascale ecosystem, including
// software, applications, hardware, advanced system engineering and early
// testbed platforms, in support of the nation's exascale computing imperative.
//
// __ __
// / / ____ ____ / /_ ____ _____
// / / / __ `/ __ `/ __ \/ __ \/ ___/
// / /___/ /_/ / /_/ / / / / /_/ (__ )
// /_____/\__,_/\__, /_/ /_/\____/____/
// /____/
//
// High-order Lagrangian Hydrodynamics Miniapp
//
// Laghos(LAGrangian High-Order Solver) is a miniapp that solves the
// time-dependent Euler equation of compressible gas dynamics in a moving
// Lagrangian frame using unstructured high-order finite element spatial
// discretization and explicit high-order time-stepping. Laghos is based on the
// numerical algorithm described in the following article:
//
// V. Dobrev, Tz. Kolev and R. Rieben, "High-order curvilinear finite element
// methods for Lagrangian hydrodynamics", SIAM Journal on Scientific
// Computing, (34) 2012, pp. B606–B641, https://doi.org/10.1137/120864672.
//
// Test problems:
// p = 0 --> Taylor-Green vortex (smooth problem).
// p = 1 --> Sedov blast.
// p = 2 --> 1D Sod shock tube.
// p = 3 --> Triple point.
// p = 4 --> Gresho vortex (smooth problem).
// p = 5 --> 2D Riemann problem, config. 12 of doi.org/10.1002/num.10025
// p = 6 --> 2D Riemann problem, config. 6 of doi.org/10.1002/num.10025
// p = 7 --> 2D Rayleigh-Taylor instability problem.//
//
// Sample runs: see README.md, section 'Verification of Results'.
//
// Combinations resulting in 3D uniform Cartesian MPI partitionings of the mesh:
// -m data/cube01_hex.mesh -pt 211 for 2 / 16 / 128 / 1024 ... tasks.
// -m data/cube_922_hex.mesh -pt 921 for / 18 / 144 / 1152 ... tasks.
// -m data/cube_522_hex.mesh -pt 522 for / 20 / 160 / 1280 ... tasks.
// -m data/cube_12_hex.mesh -pt 311 for 3 / 24 / 192 / 1536 ... tasks.
// -m data/cube01_hex.mesh -pt 221 for 4 / 32 / 256 / 2048 ... tasks.
// -m data/cube_922_hex.mesh -pt 922 for / 36 / 288 / 2304 ... tasks.
// -m data/cube_522_hex.mesh -pt 511 for 5 / 40 / 320 / 2560 ... tasks.
// -m data/cube_12_hex.mesh -pt 321 for 6 / 48 / 384 / 3072 ... tasks.
// -m data/cube01_hex.mesh -pt 111 for 8 / 64 / 512 / 4096 ... tasks.
// -m data/cube_922_hex.mesh -pt 911 for 9 / 72 / 576 / 4608 ... tasks.
// -m data/cube_522_hex.mesh -pt 521 for 10 / 80 / 640 / 5120 ... tasks.
// -m data/cube_12_hex.mesh -pt 322 for 12 / 96 / 768 / 6144 ... tasks.
#include "algo/greedy/GreedyRandomSampler.h"
#include "algo/AdaptiveDMD.h"
#include "algo/NonuniformDMD.h"
#include "laghos_solver.hpp"
#include "laghos_timeinteg.hpp"
#include "laghos_rom.hpp"
#include "laghos_utils.hpp"
#include <fstream>
#include <limits.h>
#ifndef _WIN32
#include <sys/stat.h> // mkdir
#else
#include <direct.h> // _mkdir
#define mkdir(dir, mode) _mkdir(dir)
#endif
using namespace std;
using namespace mfem;
using namespace mfem::hydrodynamics;
// Choice for the problem setup.
static int problem, dim;
static double rhoRatio; // For Rayleigh-Taylor instability problem
double rho0(const Vector &);
void v0(const Vector &, Vector &);
double e0(const Vector &);
double gamma_func(const Vector &);
void display_banner(ostream & os);
int main(int argc, char *argv[])
{
// Initialize MPI.
MPI_Session mpi(argc, argv);
int myid = mpi.WorldRank();
int nprocs = mpi.WorldSize();
// Print the banner.
if (mpi.Root()) {
display_banner(cout);
}
// Parse command-line options.
problem = 1;
const char *mesh_file = "data/cube01_hex.mesh";
int rs_levels = 2;
int rp_levels = 0;
int order_v = 2;
int order_e = 1;
int ode_solver_type = 4;
double t_final = 0.6;
double cfl = 0.5;
double cg_tol = 1e-8;
double ftz_tol = 0.0;
int cg_max_iter = 300;
int max_tsteps = -1;
bool p_assembly = true;
bool impose_visc = false;
bool visualization = false;
int vis_steps = 5;
bool visit = false;
bool gfprint = false;
const char *visit_basename = "Laghos";
const char *basename = "";
const char *twfile = "tw.csv";
const char *twpfile = "twp.csv";
const char *initSamples_basename = "initSamples";
const char *basisIdentifier = "";
int partition_type = 0;
double blast_energy = 0.25;
double blast_position[] = {0.0, 0.0, 0.0};
double dt_factor = 1.0;
bool rom_build_database = false;
bool rom_use_database = false;
bool rom_sample_stages = false;
bool rom_offline = false;
bool rom_online = false;
bool rom_restore = false;
double sFactorX = 2.0;
double sFactorV = 20.0;
double sFactorE = 2.0;
int numWindows = 0;
int windowNumSamples = 0;
int windowOverlapSamples = 0;
double dtc = 0.0;
int visitDiffCycle = -1;
bool writeSol = false;
bool solDiff = false;
bool match_end_time = false;
const char *normtype_char = "l2";
const char *testing_parameter_basename = "";
const char *hyperreductionSamplingType = "gnat";
const char *spaceTimeMethod = "spatial";
const char *offsetType = "initial";
const char *indicatorType = "time";
const char *greedyParam = "bef";
const char *greedySamplingType = "random";
const char *greedyErrorIndicatorType = "useLastLifted";
Array<double> twep;
Array2D<int> twparam;
ROM_Options romOptions;
OptionsParser args(argc, argv);
args.AddOption(&mesh_file, "-m", "--mesh",
"Mesh file to use.");
args.AddOption(&rs_levels, "-rs", "--refine-serial",
"Number of times to refine the mesh uniformly in serial.");
args.AddOption(&rp_levels, "-rp", "--refine-parallel",
"Number of times to refine the mesh uniformly in parallel.");
args.AddOption(&problem, "-p", "--problem", "Problem setup to use.");
args.AddOption(&order_v, "-ok", "--order-kinematic",
"Order (degree) of the kinematic finite element space.");
args.AddOption(&order_e, "-ot", "--order-thermo",
"Order (degree) of the thermodynamic finite element space.");
args.AddOption(&ode_solver_type, "-s", "--ode-solver",
"ODE solver: 1 - Forward Euler,\n\t"
" 2 - RK2 SSP, 3 - RK3 SSP, 4 - RK4, 6 - RK6,\n\t"
" 7 - RK2Avg.");
args.AddOption(&t_final, "-tf", "--t-final",
"Final time; start time is 0.");
args.AddOption(&cfl, "-cfl", "--cfl", "CFL-condition number.");
args.AddOption(&cg_tol, "-cgt", "--cg-tol",
"Relative CG tolerance (velocity linear solve).");
args.AddOption(&ftz_tol, "-ftz", "--ftz-tol",
"Absolute flush-to-zero tolerance.");
args.AddOption(&cg_max_iter, "-cgm", "--cg-max-steps",
"Maximum number of CG iterations (velocity linear solve).");
args.AddOption(&max_tsteps, "-ms", "--max-steps",
"Maximum number of steps (negative means no restriction).");
args.AddOption(&p_assembly, "-pa", "--partial-assembly", "-fa",
"--full-assembly",
"Activate 1D tensor-based assembly (partial assembly).");
args.AddOption(&impose_visc, "-iv", "--impose-viscosity", "-niv",
"--no-impose-viscosity",
"Use active viscosity terms even for smooth problems.");
args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
"--no-visualization",
"Enable or disable GLVis visualization.");
args.AddOption(&vis_steps, "-vs", "--visualization-steps",
"Visualize every n-th timestep.");
args.AddOption(&match_end_time, "-met", "--match-end-time", "-no-met", "--no-match-end-time",
"Match the end time of each window.");
args.AddOption(&visit, "-visit", "--visit", "-no-visit", "--no-visit",
"Enable or disable VisIt visualization.");
args.AddOption(&gfprint, "-print", "--print", "-no-print", "--no-print",
"Enable or disable result output (files in mfem format).");
args.AddOption(&basename, "-o", "--outputfilename",
"Name of the sub-folder to dump files within the run directory");
args.AddOption(&visit_basename, "-k", "--visitfilename",
"Name of the visit dump files");
args.AddOption(&testing_parameter_basename, "-pardir", "--param_dir",
"Name of the subdirectory containing testing parameter files");
args.AddOption(&twfile, "-tw", "--timewindowfilename",
"Name of the CSV file defining offline time windows");
args.AddOption(&twpfile, "-twp", "--timewindowparamfilename",
"Name of the CSV file defining online time window parameters");
args.AddOption(&initSamples_basename, "-is", "--initsamplesfilename",
"Prefix of the CSV file defining prescribed sample points");
args.AddOption(&partition_type, "-pt", "--partition",
"Customized x/y/z Cartesian MPI partitioning of the serial mesh.\n\t"
"Here x,y,z are relative task ratios in each direction.\n\t"
"Example: with 48 mpi tasks and -pt 321, one would get a Cartesian\n\t"
"partition of the serial mesh by (6,4,2) MPI tasks in (x,y,z).\n\t"
"NOTE: the serially refined mesh must have the appropriate number\n\t"
"of zones in each direction, e.g., the number of zones in direction x\n\t"
"must be divisible by the number of MPI tasks in direction x.\n\t"
"Available options: 11, 21, 111, 211, 221, 311, 321, 322, 432.");
args.AddOption(&rom_build_database, "-build-database", "--build-database", "-no-build-database", "--no-build-database",
"Enable or disable ROM database building.");
args.AddOption(&rom_use_database, "-use-database", "--use-database", "-no-use-database", "--no-use-database",
"Enable or disable ROM database usage.");
args.AddOption(&rom_sample_stages, "-sample-stages", "--sample-stages", "-no-sample-stages", "--no-sample-stages",
"Enable or disable sampling of intermediate Runge Kutta stages in ROM offline phase.");
args.AddOption(&rom_offline, "-offline", "--offline", "-no-offline", "--no-offline",
"Enable or disable ROM offline computations and output.");
args.AddOption(&rom_online, "-online", "--online", "-no-online", "--no-online",
"Enable or disable ROM online computations and output.");
args.AddOption(&rom_restore, "-restore", "--restore", "-no-restore", "--no-restore",
"Enable or disable ROM restoration phase where ROM solution is lifted to FOM size.");
args.AddOption(&romOptions.dimX, "-rdimx", "--rom_dimx", "ROM dimension for X.\n\t"
"Ceiling ROM dimension for X over all time windows.");
args.AddOption(&romOptions.dimV, "-rdimv", "--rom_dimv", "ROM dimension for V.\n\t"
"Ceiling ROM dimension for V over all time windows.");
args.AddOption(&romOptions.dimE, "-rdime", "--rom_dime", "ROM dimension for E.\n\t"
"Ceiling ROM dimension for E over all time windows.");
args.AddOption(&romOptions.dimFv, "-rdimfv", "--rom_dimfv", "ROM dimension for Fv.\n\t"
"Ceiling ROM dimension for Fv over all time windows.");
args.AddOption(&romOptions.dimFe, "-rdimfe", "--rom_dimfe", "ROM dimension for Fe.\n\t"
"Ceiling ROM dimension for Fe over all time windows.");
args.AddOption(&romOptions.sampX, "-nsamx", "--numsamplex", "number of samples for X.");
args.AddOption(&romOptions.sampV, "-nsamv", "--numsamplev", "number of samples for V.");
args.AddOption(&romOptions.sampE, "-nsame", "--numsamplee", "number of samples for E.");
args.AddOption(&romOptions.tsampV, "-ntsamv", "--numtsamplev", "number of time samples for V.");
args.AddOption(&romOptions.tsampE, "-ntsame", "--numtsamplee", "number of time samples for E.");
args.AddOption(&sFactorX, "-sfacx", "--sfactorx", "sample factor for X.");
args.AddOption(&sFactorV, "-sfacv", "--sfactorv", "sample factor for V.");
args.AddOption(&sFactorE, "-sface", "--sfactore", "sample factor for E.");
args.AddOption(&romOptions.energyFraction, "-ef", "--rom-ef",
"Energy fraction for recommended ROM basis sizes.");
args.AddOption(&romOptions.energyFraction_X, "-efx", "--rom-efx",
"Energy fraction for recommended X ROM basis size.");
args.AddOption(&romOptions.sv_shift, "-sv-shift", "--sv-shift",
"Number of shifted singular values in energy fraction calculation when window-dependent offsets are not used.");
args.AddOption(&basisIdentifier, "-bi", "--bi", "Basis identifier for parametric case.");
args.AddOption(&numWindows, "-nwin", "--numwindows", "Number of ROM time windows.");
args.AddOption(&windowNumSamples, "-nwinsamp", "--numwindowsamples", "Number of samples in ROM windows.");
args.AddOption(&windowOverlapSamples, "-nwinover", "--numwindowoverlap", "Number of samples for ROM window overlap.");
args.AddOption(&dt_factor, "-dtFactor", "--dtFactor", "Scaling factor for dt.");
args.AddOption(&dtc, "-dtc", "--dtc", "Fixed (constant) dt.");
args.AddOption(&romOptions.dmd, "-dmd", "--dmd", "-dmd", "--dmd",
"Do DMD calculations.");
args.AddOption(&romOptions.dmd_tbegin, "-dmdtbegin", "--dmdtbegin",
"Time to begin DMD. If DMD starts from t = 0, it will not work due to an zero initial vectors.");
args.AddOption(&romOptions.desired_dt, "-ddt", "--dtime-step",
"Desired Time step.");
args.AddOption(&romOptions.dmd_closest_rbf, "-dmdcrbf", "--dmdcrbf",
"DMD RBF value between two closes training parameter points.");
args.AddOption(&romOptions.dmd_nonuniform, "-dmdnuf", "--dmdnuf", "-no-dmdnuf", "--no-dmdnuf",
"Use NonuniformDMD rather than AdaptiveDMD.");
args.AddOption(&visitDiffCycle, "-visdiff", "--visdiff", "VisIt DC cycle to diff.");
args.AddOption(&writeSol, "-writesol", "--writesol", "-no-writesol", "--no-writesol",
"Enable or disable write solution.");
args.AddOption(&solDiff, "-soldiff", "--soldiff", "-no-soldiff", "--no-soldiff",
"Enable or disable solution difference norm computation.");
args.AddOption(&romOptions.hyperreduce, "-romhr", "--romhr", "-no-romhr", "--no-romhr",
"Enable or disable ROM hyperreduction.");
args.AddOption(&romOptions.hyperreduce_prep, "-romhrprep", "--romhrprep", "-no-romhrprep", "--no-romhrprep",
"Enable or disable ROM hyperreduction preprocessing.");
args.AddOption(&romOptions.staticSVD, "-romsvds", "--romsvdstatic", "-no-romsvds", "--no-romsvds",
"Enable or disable ROM static SVD.");
args.AddOption(&romOptions.randomizedSVD, "-romsvdrm", "--romsvdrandom", "-no-romsvdrm", "--no-romsvdrm",
"Enable or disable ROM randomized SVD.");
args.AddOption(&romOptions.randdimX, "-randdimx", "--rand_dimx", "Randomized SVD subspace dimension for X.");
args.AddOption(&romOptions.randdimV, "-randdimv", "--rand_dimv", "Randomized SVD subspace dimension for V.");
args.AddOption(&romOptions.randdimE, "-randdime", "--rand_dime", "Randomized SVD subspace dimension for E.");
args.AddOption(&romOptions.randdimFv, "-randdimfv", "--rand_dimfv", "Randomized SVD subspace dimension for Fv.");
args.AddOption(&romOptions.randdimFe, "-randdimfe", "--rand_dimfe", "Randomized SVD subspace dimension for Fe.");
args.AddOption(&romOptions.useOffset, "-romos", "--romoffset", "-no-romoffset", "--no-romoffset",
"Enable or disable initial state offset for ROM.");
args.AddOption(&normtype_char, "-normtype", "--norm_type", "Norm type for relative error computation.");
args.AddOption(&romOptions.max_dim, "-sdim", "--sdim", "ROM max sample dimension");
args.AddOption(&romOptions.incSVD_linearity_tol, "-lintol", "--linearitytol", "The incremental SVD model linearity tolerance.");
args.AddOption(&romOptions.incSVD_singular_value_tol, "-svtol", "--singularvaluetol", "The incremental SVD model singular value tolerance.");
args.AddOption(&romOptions.incSVD_sampling_tol, "-samptol", "--samplingtol", "The incremental SVD model sampling tolerance.");
args.AddOption(&greedyParam, "-greedy-param", "--greedy-param", "The domain to parameterize.");
args.AddOption(&romOptions.greedyParamSpaceMin, "-greedy-param-min", "--greedy-param-min", "The minimum value of the parameter point space.");
args.AddOption(&romOptions.greedyParamSpaceMax, "-greedy-param-max", "--greedy-param-max", "The maximum value of the parameter point space.");
args.AddOption(&romOptions.greedyParamSpaceSize, "-greedy-param-size", "--greedy-param-size", "The number of values to search in the parameter point space.");
args.AddOption(&romOptions.greedytf, "-greedytf", "--greedytf", "The greedy algorithm error indicator final time.");
args.AddOption(&romOptions.greedyTol, "-greedytol", "--greedytol", "The greedy algorithm tolerance.");
args.AddOption(&romOptions.greedyAlpha, "-greedyalpha", "--greedyalpha", "The greedy algorithm alpha constant.");
args.AddOption(&romOptions.greedyMaxClamp, "-greedymaxclamp", "--greedymaxclamp", "The greedy algorithm max clamp constant.");
args.AddOption(&romOptions.greedySubsetSize, "-greedysubsize", "--greedysubsize", "The greedy algorithm subset size.");
args.AddOption(&romOptions.greedyConvergenceSubsetSize, "-greedyconvsize", "--greedyconvsize", "The greedy algorithm convergence subset size.");
args.AddOption(&greedySamplingType, "-greedysamptype", "--greedysamplingtype",
"Sampling type for the greedy algorithm.");
args.AddOption(&greedyErrorIndicatorType, "-greedyerrindtype", "--greedyerrorindtype",
"Error indicator type for the greedy algorithm.");
args.AddOption(&romOptions.SNS, "-romsns", "--romsns", "-no-romsns", "--no-romsns",
"Enable or disable SNS in hyperreduction on Fv and Fe");
args.AddOption(&romOptions.GramSchmidt, "-romgs", "--romgramschmidt", "-no-romgs", "--no-romgramschmidt",
"Enable or disable Gram-Schmidt orthonormalization on V and E induced by mass matrices.");
args.AddOption(&romOptions.rhoFactor, "-rhof", "--rhofactor", "Factor for scaling rho.");
args.AddOption(&romOptions.atwoodFactor, "-af", "--atwoodfactor", "Factor for Atwood number in Rayleigh-Taylor instability problem.");
args.AddOption(&romOptions.blast_energyFactor, "-bef", "--blastefactor", "Factor for scaling blast energy.");
args.AddOption(&romOptions.parameterID, "-rpar", "--romparam", "ROM offline parameter index.");
args.AddOption(&offsetType, "-rostype", "--romoffsettype",
"Offset type for initializing ROM windows.");
args.AddOption(&indicatorType, "-loctype", "--romindicatortype",
"Indicator type for partitioning ROM windows.");
args.AddOption(&spaceTimeMethod, "-romst", "--romspacetimetype",
"Space-time method.");
args.AddOption(&romOptions.useXV, "-romxv", "--romusexv", "-no-romxv", "--no-romusexv",
"Enable or disable use of V basis for X-X0.");
args.AddOption(&romOptions.useVX, "-romvx", "--romusevx", "-no-romvx", "--no-romusevx",
"Enable or disable use of X-X0 basis for V.");
args.AddOption(&romOptions.mergeXV, "-romxandv", "--romusexandv", "-no-romxandv", "--no-romusexandv",
"Enable or disable merging of X-X0 and V bases.");
args.AddOption(&hyperreductionSamplingType, "-hrsamptype", "--hrsamplingtype",
"Sampling type for the hyperreduction.");
args.AddOption(&romOptions.maxNNLSnnz, "-maxnnls", "--max-nnls",
"Maximum nnz for NNLS");
args.Parse();
if (!args.Good())
{
if (mpi.Root()) {
args.PrintUsage(cout);
}
return 1;
}
std::string outputPath = "run";
if (std::string(basename) != "") {
outputPath += "/" + std::string(basename);
}
std::string testing_parameter_outputPath = outputPath;
if (std::string(testing_parameter_basename) != "") {
testing_parameter_outputPath += "/" + std::string(testing_parameter_basename);
}
std::string hyperreduce_outputPath = (problem == 7) ? testing_parameter_outputPath : outputPath;
romOptions.basename = &outputPath;
romOptions.testing_parameter_basename = &testing_parameter_outputPath;
romOptions.hyperreduce_basename = &hyperreduce_outputPath;
romOptions.initSamples_basename = std::string(initSamples_basename);
if (mpi.Root()) {
const char path_delim = '/';
std::string::size_type pos = 0;
do {
pos = outputPath.find(path_delim, pos+1);
std::string subdir = outputPath.substr(0, pos);
mkdir(subdir.c_str(), 0777);
}
while (pos != std::string::npos);
if (std::string(testing_parameter_basename) != "")
mkdir(testing_parameter_outputPath.c_str(), 0777);
mkdir((testing_parameter_outputPath + "/ROMoffset").c_str(), 0777);
mkdir((testing_parameter_outputPath + "/ROMsol").c_str(), 0777);
}
MFEM_VERIFY(!(romOptions.useXV && romOptions.useVX), "");
MFEM_VERIFY(!(romOptions.useXV && romOptions.mergeXV) && !(romOptions.useVX && romOptions.mergeXV), "");
MFEM_VERIFY(!(romOptions.hyperreduce && romOptions.hyperreduce_prep), "");
if (romOptions.useXV) romOptions.dimX = romOptions.dimV;
if (romOptions.useVX) romOptions.dimV = romOptions.dimX;
romOptions.basisIdentifier = std::string(basisIdentifier);
romOptions.hyperreductionSamplingType = getHyperreductionSamplingType(hyperreductionSamplingType);
romOptions.use_sample_mesh = romOptions.hyperreduce && (romOptions.hyperreductionSamplingType != eqp);
MFEM_VERIFY(!(romOptions.SNS) || (romOptions.hyperreductionSamplingType != eqp), "Using SNS with EQP is prohibited");
romOptions.spaceTimeMethod = getSpaceTimeMethod(spaceTimeMethod);
const bool spaceTime = (romOptions.spaceTimeMethod != no_space_time);
const bool fom_data = spaceTime || !(rom_online && romOptions.use_sample_mesh); // Whether to construct FOM data structures
static std::map<std::string, NormType> localmap;
localmap["l2"] = l2norm;
localmap["l1"] = l1norm;
localmap["max"] = maxnorm;
NormType normtype = localmap[normtype_char];
bool usingWindows = (numWindows > 0 || windowNumSamples > 0);
CAROM::GreedySampler* parameterPointGreedySampler = NULL;
bool rom_calc_error_indicator = false;
bool rom_calc_rel_error = false;
bool rom_calc_rel_error_nonlocal = false;
bool rom_calc_rel_error_local = false;
bool rom_calc_rel_error_nonlocal_completed = false;
bool rom_calc_rel_error_local_completed = false;
bool greedy_write_solution = false;
bool rom_read_greedy_twparam = false;
// If using the greedy algorithm, initialize the parameter point greedy sampler.
if (rom_build_database)
{
MFEM_VERIFY(!rom_offline && !rom_online && !rom_restore, "-offline, -online, -restore should be off when using -build-database");
parameterPointGreedySampler = BuildROMDatabase(romOptions, t_final, myid, outputPath, rom_offline, rom_online, rom_restore, usingWindows, rom_calc_error_indicator, rom_calc_rel_error_nonlocal, rom_calc_rel_error_local, rom_read_greedy_twparam, greedyParam, greedyErrorIndicatorType, greedySamplingType);
rom_calc_rel_error = rom_calc_rel_error_local || rom_calc_rel_error_nonlocal;
rom_calc_rel_error_nonlocal_completed = rom_calc_rel_error_nonlocal && (rom_restore || (rom_online && !romOptions.use_sample_mesh));
rom_calc_rel_error_local_completed = rom_calc_rel_error_local && (rom_restore || (rom_online && !romOptions.use_sample_mesh));
greedy_write_solution = rom_offline || rom_calc_rel_error_nonlocal_completed;
if (rom_offline)
{
if (romOptions.parameterID != -1)
{
if (windowNumSamples > 0)
{
windowNumSamples = 0;
usingWindows = false;
}
}
}
if (rom_online || rom_restore)
{
romOptions.parameterID = -1;
if (usingWindows)
{
windowNumSamples = 0;
numWindows = countNumLines(outputPath + "/" + std::string(twpfile) + romOptions.basisIdentifier);
}
}
}
if (mpi.Root()) {
const char path_delim = '/';
std::string::size_type pos = 0;
do {
pos = outputPath.find(path_delim, pos+1);
std::string subdir = outputPath.substr(0, pos);
mkdir(subdir.c_str(), 0777);
}
while (pos != std::string::npos);
if (std::string(testing_parameter_basename) != "")
mkdir(testing_parameter_outputPath.c_str(), 0777);
mkdir((testing_parameter_outputPath + "/ROMoffset" + romOptions.basisIdentifier).c_str(), 0777);
mkdir((testing_parameter_outputPath + "/ROMsol").c_str(), 0777);
}
// Use the ROM database to run the parametric case on another parameter point.
if (rom_use_database)
{
MFEM_VERIFY(!rom_offline, "-offline should be off when -use-database is turned on");
MFEM_VERIFY(!rom_build_database, "-build-database should be off when -use-database is turned on");
parameterPointGreedySampler = UseROMDatabase(romOptions, myid, outputPath, greedyParam);
}
if (mpi.Root())
{
args.PrintOptions(cout);
}
MFEM_VERIFY(windowNumSamples == 0 || rom_offline, "-nwinsamp should be specified only in offline mode");
MFEM_VERIFY(windowNumSamples == 0 || numWindows == 0, "-nwinsamp and -nwin cannot both be set");
if (usingWindows)
{
if (romOptions.dimX > 0) romOptions.max_dimX = romOptions.dimX;
if (romOptions.dimV > 0) romOptions.max_dimV = romOptions.dimV;
if (romOptions.dimE > 0) romOptions.max_dimE = romOptions.dimE;
if (romOptions.dimFv > 0) romOptions.max_dimFv = romOptions.dimFv;
if (romOptions.dimFe > 0) romOptions.max_dimFe = romOptions.dimFe;
if (rom_online || rom_restore)
{
double sFactor[] = {sFactorX, sFactorV, sFactorE};
const int err = ReadTimeWindowParameters(numWindows, outputPath + "/" + std::string(twpfile) + romOptions.basisIdentifier, twep, twparam, sFactor, myid == 0, romOptions.SNS);
MFEM_VERIFY(err == 0, "Error in ReadTimeWindowParameters");
if (rom_build_database && rom_read_greedy_twparam)
{
ReadGreedyTimeWindowParameters(romOptions, numWindows, twparam, outputPath);
}
}
else if (rom_offline && windowNumSamples == 0)
{
const int err = ReadTimeWindows(numWindows, twfile, twep, myid == 0);
MFEM_VERIFY(err == 0, "Error in ReadTimeWindows");
}
}
else // not using windows
{
numWindows = 1; // one window for the entire simulation
if (romOptions.SNS)
{
romOptions.dimFv = max(romOptions.dimFv, romOptions.dimV);
romOptions.dimFe = max(romOptions.dimFe, romOptions.dimE);
}
}
if (windowNumSamples > 0) romOptions.max_dim = windowNumSamples + windowOverlapSamples + 2;
MFEM_VERIFY(windowOverlapSamples >= 0, "Negative window overlap");
MFEM_VERIFY(windowOverlapSamples <= windowNumSamples, "Too many ROM window overlap samples.");
StopWatch totalTimer;
totalTimer.Start();
// Read the serial mesh from the given mesh file on all processors.
// Refine the mesh in serial to increase the resolution.
Mesh* mesh = NULL;
dim = 0;
if (fom_data)
{
mesh = new Mesh(mesh_file, 1, 1);
dim = mesh->Dimension();
for (int lev = 0; lev < rs_levels; lev++) {
mesh->UniformRefinement();
}
if (p_assembly && dim == 1)
{
p_assembly = false;
if (mpi.Root())
{
cout << "Laghos does not support PA in 1D. Switching to FA." << endl;
}
}
}
// Parallel partitioning of the mesh.
ParMesh* pmesh = NULL;
if (fom_data)
{
const int num_tasks = mpi.WorldSize();
int unit = 1;
int *nxyz = new int[dim];
switch (partition_type)
{
case 0:
for (int d = 0; d < dim; d++) {
nxyz[d] = unit;
}
break;
case 11:
case 111:
unit = floor(pow(num_tasks, 1.0 / dim) + 1e-2);
for (int d = 0; d < dim; d++) {
nxyz[d] = unit;
}
break;
case 21: // 2D
unit = floor(pow(num_tasks / 2, 1.0 / 2) + 1e-2);
nxyz[0] = 2 * unit;
nxyz[1] = unit;
break;
case 211: // 3D.
unit = floor(pow(num_tasks / 2, 1.0 / 3) + 1e-2);
nxyz[0] = 2 * unit;
nxyz[1] = unit;
nxyz[2] = unit;
break;
case 221: // 3D.
unit = floor(pow(num_tasks / 4, 1.0 / 3) + 1e-2);
nxyz[0] = 2 * unit;
nxyz[1] = 2 * unit;
nxyz[2] = unit;
break;
case 311: // 3D.
unit = floor(pow(num_tasks / 3, 1.0 / 3) + 1e-2);
nxyz[0] = 3 * unit;
nxyz[1] = unit;
nxyz[2] = unit;
break;
case 321: // 3D.
unit = floor(pow(num_tasks / 6, 1.0 / 3) + 1e-2);
nxyz[0] = 3 * unit;
nxyz[1] = 2 * unit;
nxyz[2] = unit;
break;
case 322: // 3D.
unit = floor(pow(2 * num_tasks / 3, 1.0 / 3) + 1e-2);
nxyz[0] = 3 * unit / 2;
nxyz[1] = unit;
nxyz[2] = unit;
break;
case 432: // 3D.
unit = floor(pow(num_tasks / 3, 1.0 / 3) + 1e-2);
nxyz[0] = 2 * unit;
nxyz[1] = 3 * unit / 2;
nxyz[2] = unit;
break;
case 511: // 3D.
unit = floor(pow(num_tasks / 5, 1.0 / 3) + 1e-2);
nxyz[0] = 5 * unit;
nxyz[1] = unit;
nxyz[2] = unit;
break;
case 521: // 3D.
unit = floor(pow(num_tasks / 10, 1.0 / 3) + 1e-2);
nxyz[0] = 5 * unit;
nxyz[1] = 2 * unit;
nxyz[2] = unit;
break;
case 522: // 3D.
unit = floor(pow(num_tasks / 20, 1.0 / 3) + 1e-2);
nxyz[0] = 5 * unit;
nxyz[1] = 2 * unit;
nxyz[2] = 2 * unit;
break;
case 911: // 3D.
unit = floor(pow(num_tasks / 9, 1.0 / 3) + 1e-2);
nxyz[0] = 9 * unit;
nxyz[1] = unit;
nxyz[2] = unit;
break;
case 921: // 3D.
unit = floor(pow(num_tasks / 18, 1.0 / 3) + 1e-2);
nxyz[0] = 9 * unit;
nxyz[1] = 2 * unit;
nxyz[2] = unit;
break;
case 922: // 3D.
unit = floor(pow(num_tasks / 36, 1.0 / 3) + 1e-2);
nxyz[0] = 9 * unit;
nxyz[1] = 2 * unit;
nxyz[2] = 2 * unit;
break;
default:
if (myid == 0)
{
cout << "Unknown partition type: " << partition_type << '\n';
}
delete mesh;
MPI_Finalize();
return 3;
}
int product = 1;
for (int d = 0; d < dim; d++) {
product *= nxyz[d];
}
if (product == num_tasks)
{
int *partitioning = mesh->CartesianPartitioning(nxyz);
pmesh = new ParMesh(MPI_COMM_WORLD, *mesh, partitioning);
delete [] partitioning;
}
else
{
if (myid == 0)
{
cout << "Non-Cartesian partitioning through METIS will be used.\n";
#ifndef MFEM_USE_METIS
cout << "MFEM was built without METIS. "
<< "Adjust the number of tasks to use a Cartesian split." << endl;
#endif
}
#ifndef MFEM_USE_METIS
return 1;
#endif
pmesh = new ParMesh(MPI_COMM_WORLD, *mesh);
}
delete [] nxyz;
delete mesh;
// Refine the mesh further in parallel to increase the resolution.
for (int lev = 0; lev < rp_levels; lev++) {
pmesh->UniformRefinement();
}
int nzones = pmesh->GetNE(), nzones_min, nzones_max;
MPI_Reduce(&nzones, &nzones_min, 1, MPI_INT, MPI_MIN, 0, pmesh->GetComm());
MPI_Reduce(&nzones, &nzones_max, 1, MPI_INT, MPI_MAX, 0, pmesh->GetComm());
if (myid == 0)
{
cout << "Zones min/max: " << nzones_min << " " << nzones_max << endl;
}
}
int source = 0;
double dt = 0.0;
std::string offlineParam_outputPath = outputPath + "/offline_param" + romOptions.basisIdentifier + ".csv";
romOptions.offsetType = getOffsetStyle(offsetType);
romOptions.indicatorType = getlocalROMIndicator(indicatorType);
if (rom_online)
{
std::string filename = testing_parameter_outputPath + "/ROMsol/romS_1";
std::ifstream infile_romS(filename.c_str());
MFEM_VERIFY(!infile_romS.good(), "ROMsol files already exist.")
VerifyOfflineParam(dim, dt, romOptions, numWindows, twfile, offlineParam_outputPath, false);
}
// Define the parallel finite element spaces. We use:
// - H1 (Gauss-Lobatto, continuous) for position and velocity.
// - L2 (Bernstein, discontinuous) for specific internal energy.
L2_FECollection L2FEC(order_e, dim, BasisType::Positive);
H1_FECollection H1FEC(order_v, dim);
ParFiniteElementSpace* L2FESpace = NULL;
ParFiniteElementSpace* H1FESpace = NULL;
if (fom_data)
{
L2FESpace = new ParFiniteElementSpace(pmesh, &L2FEC);
H1FESpace = new ParFiniteElementSpace(pmesh, &H1FEC, pmesh->Dimension());
}
// Boundary conditions: all tests use v.n = 0 on the boundary, and we assume
// that the boundaries are straight.
Array<int> ess_tdofs, ess_vdofs;
if (fom_data)
{
{
Array<int> ess_bdr(pmesh->bdr_attributes.Max()), dofs_marker, dofs_list;
for (int d = 0; d < pmesh->Dimension(); d++)
{
// Attributes 1/2/3 correspond to fixed-x/y/z boundaries, i.e., we must
// enforce v_x/y/z = 0 for the velocity components.
ess_bdr = 0;
ess_bdr[d] = 1;
H1FESpace->GetEssentialTrueDofs(ess_bdr, dofs_list, d);
ess_tdofs.Append(dofs_list);
H1FESpace->GetEssentialVDofs(ess_bdr, dofs_marker, d);
FiniteElementSpace::MarkerToList(dofs_marker, dofs_list);
ess_vdofs.Append(dofs_list);
}
}
}
// Define the explicit ODE solver used for time integration.
ODESolver *ode_solver = NULL;
int RKStepNumSamples;
ODESolver *ode_solver_dat = NULL;
HydroODESolver *ode_solver_samp = NULL;
switch (ode_solver_type)
{
case 1:
rom_sample_stages = false;
ode_solver = new ForwardEulerSolver;
if (rom_build_database) ode_solver_dat = new ForwardEulerSolver;
break;
case 2:
rom_sample_stages = false;
ode_solver = new RK2Solver(0.5);
if (rom_build_database) ode_solver_dat = new RK2Solver(0.5);
break;
case 3:
rom_sample_stages = false;
ode_solver = new RK3SSPSolver;
if (rom_build_database) ode_solver_dat = new RK3SSPSolver;
break;
case 4:
if (rom_sample_stages) RKStepNumSamples = 3;
ode_solver = new RK4ROMSolver(rom_online, RKStepNumSamples);
if (rom_build_database) ode_solver_dat = new RK4ROMSolver();
break;
case 6:
rom_sample_stages = false;
ode_solver = new RK6Solver;
if (rom_build_database) ode_solver_dat = new RK6Solver;
break;
case 7:
if (rom_sample_stages) RKStepNumSamples = 1;
ode_solver = new RK2AvgSolver(rom_online, H1FESpace, L2FESpace, RKStepNumSamples);
if (rom_build_database) ode_solver_dat = new RK2AvgSolver(rom_online, H1FESpace, L2FESpace);
break;
default:
if (myid == 0)
{
cout << "Unknown ODE solver type: " << ode_solver_type << '\n';
}
delete pmesh;
MPI_Finalize();
return 3;
}
if (rom_sample_stages) ode_solver_samp = dynamic_cast<HydroODESolver*> (ode_solver);
romOptions.RK2AvgSolver = (ode_solver_type == 7);
if (fom_data)
{
HYPRE_Int glob_size_l2 = L2FESpace->GlobalTrueVSize();
HYPRE_Int glob_size_h1 = H1FESpace->GlobalTrueVSize();
if (mpi.Root())
{
cout << "Number of kinematic (position, velocity) dofs: "
<< glob_size_h1 << endl;
cout << "Number of specific internal energy dofs: "
<< glob_size_l2 << endl;
}
}
int Vsize_l2 = 0;
int Vsize_h1 = 0;
int tVsize_l2 = 0;
int tVsize_h1 = 0;
if (fom_data)
{
Vsize_l2 = L2FESpace->GetVSize();
Vsize_h1 = H1FESpace->GetVSize();
tVsize_l2 = L2FESpace->GetTrueVSize();
tVsize_h1 = H1FESpace->GetTrueVSize();
}
// The monolithic BlockVector stores unknown fields as:
// - 0 -> position
// - 1 -> velocity
// - 2 -> specific internal energy
Array<int> true_offset(4);
if (fom_data)
{
true_offset[0] = 0;
true_offset[1] = true_offset[0] + Vsize_h1;
true_offset[2] = true_offset[1] + Vsize_h1;
true_offset[3] = true_offset[2] + Vsize_l2;
}
BlockVector* S = fom_data ? new BlockVector(true_offset) : NULL;
// Define GridFunction objects for the position, velocity and specific
// internal energy. There is no function for the density, as we can always
// compute the density values given the current mesh position, using the
// property of pointwise mass conservation.
ParGridFunction* x_gf = NULL;
ParGridFunction* v_gf = NULL;
ParGridFunction* e_gf = NULL;
if (fom_data)
{
x_gf = new ParGridFunction();
v_gf = new ParGridFunction();
e_gf = new ParGridFunction();
x_gf->MakeRef(H1FESpace, *S, true_offset[0]);
v_gf->MakeRef(H1FESpace, *S, true_offset[1]);
e_gf->MakeRef(L2FESpace, *S, true_offset[2]);
// Initialize x_gf using the starting mesh coordinates.
pmesh->SetNodalGridFunction(x_gf);
}
// Initialize the velocity.
VectorFunctionCoefficient* v_coeff = NULL;
if (fom_data)
{
v_coeff = new VectorFunctionCoefficient(pmesh->Dimension(), v0);
v_gf->ProjectCoefficient(*v_coeff);
for (int i = 0; i < ess_vdofs.Size(); i++)
{
(*v_gf)(ess_vdofs[i]) = 0.0;
}
}
if (rom_offline) // Set VTos
{
Vector Vtdof(tVsize_h1);
v_gf->GetTrueDofs(Vtdof);
CAROM::Vector VtdofDist(Vtdof.GetData(), tVsize_h1, true, false);
const double vnorm = VtdofDist.norm();
romOptions.VTos = (vnorm == 0.0);
}
// Initialize density and specific internal energy values. We interpolate in
// a non-positive basis to get the correct values at the dofs. Then we do an
// L2 projection to the positive basis in which we actually compute. The goal
// is to get a high-order representation of the initial condition. Note that
// this density is a temporary function and it will not be updated during the
// time evolution.
ParGridFunction* rho = NULL;
rhoRatio = (1.0 + romOptions.atwoodFactor) / (1.0 - romOptions.atwoodFactor); // Rayleigh-Taylor initial density
FunctionCoefficient rho_coeff0(rho0);
ProductCoefficient rho_coeff(romOptions.rhoFactor, rho_coeff0);
if (fom_data)
{
rho = new ParGridFunction(L2FESpace);
L2_FECollection l2_fec(order_e, pmesh->Dimension());
ParFiniteElementSpace l2_fes(pmesh, &l2_fec);
ParGridFunction l2_rho(&l2_fes), l2_e(&l2_fes);
l2_rho.ProjectCoefficient(rho_coeff);
rho->ProjectGridFunction(l2_rho);
if (problem == 1)
{
// For the Sedov test, we use a delta function at the origin.
DeltaCoefficient e_coeff(blast_position[0], blast_position[1],
blast_position[2], romOptions.blast_energyFactor*blast_energy);
l2_e.ProjectCoefficient(e_coeff);
}
else
{
FunctionCoefficient e_coeff0(e0);
ProductCoefficient e_coeff(1.0 / romOptions.rhoFactor, e_coeff0);
l2_e.ProjectCoefficient(e_coeff);
}
e_gf->ProjectGridFunction(l2_e);
}
// Piecewise constant ideal gas coefficient over the Lagrangian mesh. The
// gamma values are projected on a function that stays constant on the moving
// mesh.
L2_FECollection* mat_fec = NULL;
ParFiniteElementSpace* mat_fes = NULL;
ParGridFunction* mat_gf = NULL;
FunctionCoefficient mat_coeff(gamma_func);
GridFunctionCoefficient *mat_gf_coeff = NULL;
if (fom_data)
{
mat_fec = new L2_FECollection(0, pmesh->Dimension());
mat_fes = new ParFiniteElementSpace(pmesh, mat_fec);
mat_gf = new ParGridFunction(mat_fes);
mat_gf->ProjectCoefficient(mat_coeff);
mat_gf_coeff = new GridFunctionCoefficient(mat_gf);
}
// Additional details, depending on the problem.
bool visc = true, vort = false;
switch (problem)
{
case 0:
if (pmesh && pmesh->Dimension() == 2) {
source = 1;
}
visc = false;
break;
case 1:
visc = true;
break;
case 2:
visc = true;
break;
case 3:
visc = true;
break;
case 4:
visc = false;
break;
case 5:
visc = true;
break;
case 6:
visc = true;
break;
case 7:
visc = true;
vort = true;
source = 2;
break;
default:
MFEM_ABORT("Wrong problem specification!");
}
if (impose_visc) {
visc = true;
}
// Finding kinematic DOF on the end of the interface
// which measure penetration distance in 2D Rayleigh-Taylor instability (problem 7)
int pd1_vdof = -1, pd2_vdof = -1;
if (problem == 7)
{
std::string pd_idx_outPath = outputPath + "/pd_idx";
if (fom_data)
{
for (int i = 0; i < Vsize_h1/2; ++i)
{
if ((*S)(i) == 0.0 && (*S)(Vsize_h1/2+i) == 0.0)
pd1_vdof = Vsize_h1/2+i;
if ((*S)(i) == 0.5 && (*S)(Vsize_h1/2+i) == 0.0)
pd2_vdof = Vsize_h1/2+i;
if (pd1_vdof >= 0 && pd2_vdof >= 0)
break;
}
}
}
LagrangianHydroOperator* oper = NULL;
if (fom_data)
{
const bool noMassSolve = rom_online && (romOptions.hyperreductionSamplingType == eqp);