Modified IO functions

This commit is contained in:
rastogi 2025-10-17 15:37:49 +02:00
parent af6462409b
commit d1d6211c30
83 changed files with 493 additions and 62 deletions

View File

@ -115,17 +115,21 @@ setup <- list(
Chemistry = chemistry_setup # Parameters related to the chemistry process
)
iterations <- 20
dt <- 100
control_iteration <- 10
species_epsilon <- rep(0.001, length(dht_species))
iterations <- 500
dt <- 200
checkpoint_interval <- 50
control_interval <- 100
mape_threshold <- c(.0, .0, 1e-12, 1e-1, 1e-1, 1e-2, 1e-2, 1e+1, 1e+1, 1e-3, 0, 1e-1, .0)
rrmse_threshold <- c(.0, .0, 1e-12, 1e-4, 1e-1, 1e-2, 1e-2, 1e+1, 1e+1, 1e-3, 0, 1e-1, .0)
#out_save <- seq(50, iterations, by = 50)
list(
timesteps = rep(dt, iterations),
store_result = TRUE,
store_result = FALSE,
#out_save = out_save,
control_iteration = control_iteration,
species_epsilon = species_epsilon
checkpoint_interval = checkpoint_interval,
control_interval = control_interval,
mape_threshold = mape_threshold,
rrmse_threshold = rrmse_threshold
)

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,72 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
100 0 cell_ID 0 0
100 0 ID 0 0
100 0 H 3.12231e-14 1.1509e-15
100 0 O 5.71631e-09 1.52456e-10
100 0 Charge 0.00277434 0.000180148
100 0 C 0.000123678 2.12884e-05
100 0 Ca 0.00012359 2.12719e-05
100 0 Cl 52.4183 0.723995
100 0 Mg 0.25793 0.0507445
100 0 Calcite 7.41077e-06 1.27769e-06
100 0 Calcite_p1 0 0
100 0 Dolomite 0 0
100 0 Dolomite_p1 0 0
200 1 cell_ID 0 0
200 1 ID 0 0
200 1 H 2.95859e-14 9.60014e-16
200 1 O 5.02824e-09 6.20613e-11
200 1 Charge 0.00161321 8.9929e-05
200 1 C 2.83375e-05 3.68986e-06
200 1 Ca 2.82814e-05 3.6869e-06
200 1 Cl 4.33261 0.208132
200 1 Mg 0.261454 0.0511126
200 1 Calcite 1.69344e-06 2.19948e-07
200 1 Calcite_p1 0 0
200 1 Dolomite 2.12138e-07 4.39278e-07
200 1 Dolomite_p1 0 0
300 1 cell_ID 0 0
300 1 ID 0 0
300 1 H 2.61483e-14 8.44115e-16
300 1 O 4.20912e-09 5.28953e-11
300 1 Charge 0.00111694 4.8082e-05
300 1 C 9.01588e-06 1.37917e-06
300 1 Ca 8.98915e-06 1.37725e-06
300 1 Cl 0.0250508 0.0158114
300 1 Mg 0.0368942 0.0192029
300 1 Calcite 5.42801e-07 8.23432e-08
300 1 Calcite_p1 0 0
300 1 Dolomite 1.34065e-05 1.50929e-05
300 1 Dolomite_p1 0 0
400 1 cell_ID 0 0
400 1 ID 0 0
400 1 H 2.52669e-14 7.70988e-16
400 1 O 3.13537e-09 4.41261e-11
400 1 Charge 0.00111045 4.73189e-05
400 1 C 5.21852e-06 4.67209e-07
400 1 Ca 5.28321e-06 4.7664e-07
400 1 Cl 1.88383e-08 1.72516e-08
400 1 Mg 1.6654e-07 7.23985e-08
400 1 Calcite 3.29709e-07 3.02443e-08
400 1 Calcite_p1 0 0
400 1 Dolomite 0.000108165 7.44989e-05
400 1 Dolomite_p1 0 0
500 1 cell_ID 0 0
500 1 ID 0 0
500 1 H 2.5648e-14 8.49637e-16
500 1 O 2.06816e-09 3.48582e-11
500 1 Charge 0.00117171 7.1904e-05
500 1 C 4.68561e-06 3.1246e-07
500 1 Ca 4.847e-06 3.29307e-07
500 1 Cl 8.19957e-11 4.15952e-11
500 1 Mg 2.88349e-07 1.01377e-07
500 1 Calcite 3.12577e-07 2.30026e-08
500 1 Calcite_p1 0 0
500 1 Dolomite 7.6329e-05 3.37797e-05
500 1 Dolomite_p1 0 0

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,72 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
100 0 cell_ID 0 0
100 0 ID 0 0
100 0 H 3.47278e-14 1.28046e-15
100 0 O 3.91041e-09 1.46205e-10
100 0 Charge 0.00341346 0.000209852
100 0 C 0.00012351 2.10537e-05
100 0 Ca 0.00012342 2.10371e-05
100 0 Cl 51.8517 0.720026
100 0 Mg 0.0164251 0.0119904
100 0 Calcite 7.40172e-06 1.26365e-06
100 0 Calcite_p1 0 0
100 0 Dolomite 0 0
100 0 Dolomite_p1 0 0
200 1 cell_ID 0 0
200 1 ID 0 0
200 1 H 2.85412e-14 9.17937e-16
200 1 O 4.25235e-09 5.35197e-11
200 1 Charge 0.00115635 6.27422e-05
200 1 C 2.84308e-05 3.72039e-06
200 1 Ca 2.83753e-05 3.71755e-06
200 1 Cl 4.21085 0.205107
200 1 Mg 0.0583267 0.0238491
200 1 Calcite 1.6987e-06 2.21727e-07
200 1 Calcite_p1 0 0
200 1 Dolomite 1.4852e-07 2.49534e-07
200 1 Dolomite_p1 0 0
300 1 cell_ID 0 0
300 1 ID 0 0
300 1 H 3.09033e-14 1.04628e-15
300 1 O 3.61033e-09 4.49029e-11
300 1 Charge 0.00199629 0.000104649
300 1 C 8.92201e-06 1.3502e-06
300 1 Ca 8.88482e-06 1.34813e-06
300 1 Cl 0.0252149 0.0158115
300 1 Mg 0.0271398 0.0163938
300 1 Calcite 5.36046e-07 8.05148e-08
300 1 Calcite_p1 0 0
300 1 Dolomite 8.76776e-06 8.08383e-06
300 1 Dolomite_p1 0 0
400 1 cell_ID 0 0
400 1 ID 0 0
400 1 H 2.47784e-14 8.02966e-16
400 1 O 2.77372e-09 3.82347e-11
400 1 Charge 0.00109769 4.46829e-05
400 1 C 5.18807e-06 4.53038e-07
400 1 Ca 5.25706e-06 4.58743e-07
400 1 Cl 7.98413e-08 6.88159e-08
400 1 Mg 3.17154e-07 1.76467e-07
400 1 Calcite 3.28375e-07 2.88573e-08
400 1 Calcite_p1 0 0
400 1 Dolomite 9.74408e-05 5.10781e-05
400 1 Dolomite_p1 0 0
500 1 cell_ID 0 0
500 1 ID 0 0
500 1 H 2.58635e-14 8.70649e-16
500 1 O 1.81852e-09 2.99676e-11
500 1 Charge 0.00140547 7.9273e-05
500 1 C 4.61893e-06 3.09187e-07
500 1 Ca 4.79576e-06 3.21992e-07
500 1 Cl 2.35937e-10 1.70544e-10
500 1 Mg 3.04927e-07 9.42059e-08
500 1 Calcite 3.10603e-07 2.22112e-08
500 1 Calcite_p1 0 0
500 1 Dolomite 7.05202e-05 2.85239e-05
500 1 Dolomite_p1 0 0

Binary file not shown.

View File

@ -2,14 +2,14 @@ iterations <- 1000
dt <- 200
checkpoint_interval <- 100
control_interval <- 200
mape_threshold <- c(.0, .0, 1e-12, 1e-1, 1e-1, 1e-2, 1e-2, 1e+1, 1e+1, 1e-3, 0, 1e-1, .0, 0.12, .0)
rrmse_threshold <- c(.0, .0, 1e-12, 1e-4, 1e-1, 1e-2, 1e-2, 1e+1, 1e+1, 1e-3, 0, 1e-1, .0, 0.12, .0)
out_save <- seq(50, iterations, by = 50)
mape_threshold <- c(.0, .0, 1e-12, .0, 1e-1, 1e-2, 1e-2, 1e+1, 1e+1, 1e-3, 0, 1e-1, .0, .0, .0)
rrmse_threshold <- c(.0, .0, 1e-12, 1e-1, 1e-1, 1e-2, 1e-2, 1e+1, 1e+1, 1e-3, 0, 1e-1, .0, 1e-1, .0)
#out_save <- seq(50, iterations, by = 50)
list(
timesteps = rep(dt, iterations),
store_result = TRUE,
out_save = out_save,
store_result = FALSE,
#out_save = out_save,
checkpoint_interval = checkpoint_interval,
control_interval = control_interval,
mape_threshold = mape_threshold,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,18 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
40 0 cell_ID 0 0
40 0 ID 0 0
40 0 H 1.97536e-14 3.39767e-16
40 0 O 0.108667 0.00113058
40 0 Charge 0.0149527 0.000159859
40 0 C 0.000320855 3.77065e-05
40 0 Ca 0.000320918 3.77053e-05
40 0 Cl 2.94255 0.0564879
40 0 Mg 2.99364 0.058404
40 0 Calcite 0.000193155 2.27958e-05
40 0 Calcite_p1 0 0
40 0 Dolomite 5.53123e-06 7.32342e-06
40 0 Dolomite_p1 0 0
40 0 O2g_eq 0.292811 0.0030472
40 0 O2g_si 0 0

BIN
bin/poet

Binary file not shown.

View File

View File

@ -0,0 +1,82 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
200 0 cell_ID 0 0
200 0 ID 0 0
200 0 H 4.24216e-14 7.93767e-16
200 0 O 0.266416 0.00345942
200 0 Charge 0.0108553 0.00016141
200 0 C 0.00105879 4.62528e-05
200 0 Ca 0.00106128 4.64714e-05
200 0 Cl 0.183638 0.0281206
200 0 Mg 0.357623 0.068502
200 0 Calcite 0.000660749 3.05684e-05
200 0 Calcite_p1 0 0
200 0 Dolomite 0.0377868 0.018717
200 0 Dolomite_p1 0 0
200 0 O2g_eq 0.727525 0.00942789
200 0 O2g_si 0 0
400 1 cell_ID 0 0
400 1 ID 0 0
400 1 H 4.96116e-14 1.03074e-15
400 1 O 0.0625096 0.00089073
400 1 Charge 0.00179685 5.81218e-05
400 1 C 0.00138513 4.19276e-05
400 1 Ca 0.00138939 4.22617e-05
400 1 Cl 2.01049e-10 1.12062e-11
400 1 Mg 1.73388e-05 1.58885e-06
400 1 Calcite 0.000887349 3.09872e-05
400 1 Calcite_p1 0 0
400 1 Dolomite 0.0508038 0.0422224
400 1 Dolomite_p1 0 0
400 1 O2g_eq 0.169632 0.00241576
400 1 O2g_si 0 0
600 2 cell_ID 0 0
600 2 ID 0 0
600 2 H 5.02907e-14 1.04743e-15
600 2 O 0.0339388 0.000529191
600 2 Charge 0.000872335 3.88643e-05
600 2 C 0.00161187 4.55169e-05
600 2 Ca 0.00161202 4.55691e-05
600 2 Cl 2.00968e-10 7.09682e-12
600 2 Mg 1.78737e-05 1.52671e-06
600 2 Calcite 0.00112915 5.57669e-05
600 2 Calcite_p1 0 0
600 2 Dolomite 0.0464188 0.020625
600 2 Dolomite_p1 0 0
600 2 O2g_eq 0.0916364 0.00144097
600 2 O2g_si 0 0
800 3 cell_ID 0 0
800 3 ID 0 0
800 3 H 5.02456e-14 1.07954e-15
800 3 O 0.0348835 0.000593709
800 3 Charge 0.000981333 4.59987e-05
800 3 C 0.00188335 5.51043e-05
800 3 Ca 0.00187866 5.48754e-05
800 3 Cl 1.91647e-10 6.80693e-12
800 3 Mg 1.99396e-05 1.4224e-06
800 3 Calcite 0.00133831 7.37938e-05
800 3 Calcite_p1 0 0
800 3 Dolomite 0.0122079 0.00910585
800 3 Dolomite_p1 0 0
800 3 O2g_eq 0.094699 0.00161554
800 3 O2g_si 0 0
1000 4 cell_ID 0 0
1000 4 ID 0 0
1000 4 H 4.58333e-14 9.19552e-16
1000 4 O 0.03928 0.000658637
1000 4 Charge 0.000850352 3.64268e-05
1000 4 C 0.00162933 4.32013e-05
1000 4 Ca 0.00162399 4.31629e-05
1000 4 Cl 1.78469e-10 6.32135e-12
1000 4 Mg 2.54679e-05 1.5059e-06
1000 4 Calcite 0.00110095 3.85726e-05
1000 4 Calcite_p1 0 0
1000 4 Dolomite 0.115066 0.0336203
1000 4 Dolomite_p1 0 0
1000 4 O2g_eq 0.10644 0.00178803
1000 4 O2g_si 0 0

Binary file not shown.

View File

@ -0,0 +1,82 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
200 0 cell_ID 0 0
200 0 ID 0 0
200 0 H 4.35833e-14 7.81087e-16
200 0 O 0.265974 0.00345273
200 0 Charge 0.0139127 0.00021089
200 0 C 0.00106544 4.68727e-05
200 0 Ca 0.00106775 4.71101e-05
200 0 Cl 0.153803 0.0309734
200 0 Mg 0.259249 0.0557173
200 0 Calcite 0.000666058 3.09596e-05
200 0 Calcite_p1 0 0
200 0 Dolomite 0.0378628 0.0187185
200 0 Dolomite_p1 0 0
200 0 O2g_eq 0.726346 0.00940997
200 0 O2g_si 0 0
400 1 cell_ID 0 0
400 1 ID 0 0
400 1 H 4.96779e-14 1.02625e-15
400 1 O 0.0612117 0.000885574
400 1 Charge 0.00211885 7.23582e-05
400 1 C 0.0013936 4.246e-05
400 1 Ca 0.00139683 4.27607e-05
400 1 Cl 1.92492e-10 7.96912e-12
400 1 Mg 1.72798e-05 1.57044e-06
400 1 Calcite 0.000893972 3.23061e-05
400 1 Calcite_p1 0 0
400 1 Dolomite 0.0508392 0.0424705
400 1 Dolomite_p1 0 0
400 1 O2g_eq 0.166295 0.00240305
400 1 O2g_si 0 0
600 2 cell_ID 0 0
600 2 ID 0 0
600 2 H 4.98299e-14 1.03244e-15
600 2 O 0.0337469 0.000532858
600 2 Charge 0.000886747 3.95933e-05
600 2 C 0.00157754 4.32746e-05
600 2 Ca 0.0015787 4.33921e-05
600 2 Cl 1.99043e-10 6.97877e-12
600 2 Mg 1.78781e-05 1.51655e-06
600 2 Calcite 0.00112008 9.94027e-05
600 2 Calcite_p1 0 0
600 2 Dolomite 0.0440381 0.0200137
600 2 Dolomite_p1 0 0
600 2 O2g_eq 0.0911647 0.00145098
600 2 O2g_si 0 0
800 3 cell_ID 0 0
800 3 ID 0 0
800 3 H 4.95687e-14 1.04941e-15
800 3 O 0.0342771 0.000595825
800 3 Charge 0.000999783 4.79781e-05
800 3 C 0.00187815 5.36255e-05
800 3 Ca 0.00187373 5.34439e-05
800 3 Cl 1.90419e-10 6.73422e-12
800 3 Mg 2.00131e-05 1.42672e-06
800 3 Calcite 0.00127536 4.6846e-05
800 3 Calcite_p1 0 0
800 3 Dolomite 0.0116904 0.00900077
800 3 Dolomite_p1 0 0
800 3 O2g_eq 0.092918 0.00162017
800 3 O2g_si 0 0
1000 4 cell_ID 0 0
1000 4 ID 0 0
1000 4 H 4.46262e-14 8.84025e-16
1000 4 O 0.0393243 0.000668632
1000 4 Charge 0.000823168 3.55208e-05
1000 4 C 0.00163087 4.28808e-05
1000 4 Ca 0.00162568 4.28564e-05
1000 4 Cl 1.74767e-10 6.13816e-12
1000 4 Mg 2.51858e-05 1.49617e-06
1000 4 Calcite 0.00109436 3.63441e-05
1000 4 Calcite_p1 0 0
1000 4 Dolomite 0.115761 0.0351099
1000 4 Dolomite_p1 0 0
1000 4 O2g_eq 0.106644 0.00181596
1000 4 O2g_si 0 0

Binary file not shown.

View File

@ -0,0 +1,82 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
200 0 cell_ID 0 0
200 0 ID 0 0
200 0 H 4.40607e-14 7.90085e-16
200 0 O 0.26477 0.0034449
200 0 Charge 0.0152426 0.000228736
200 0 C 0.00106749 4.69434e-05
200 0 Ca 0.00106988 4.71795e-05
200 0 Cl 0.19963 0.0417236
200 0 Mg 0.302507 0.109754
200 0 Calcite 0.000668562 3.12626e-05
200 0 Calcite_p1 0 0
200 0 Dolomite 0.022869 0.0141522
200 0 Dolomite_p1 0 0
200 0 O2g_eq 0.723052 0.0093885
200 0 O2g_si 0 0
400 1 cell_ID 0 0
400 1 ID 0 0
400 1 H 5.10132e-14 1.04621e-15
400 1 O 0.0620153 0.000909136
400 1 Charge 0.00227654 7.76102e-05
400 1 C 0.00140883 4.26784e-05
400 1 Ca 0.00141118 4.30019e-05
400 1 Cl 1.98506e-10 6.90649e-12
400 1 Mg 1.76159e-05 1.60076e-06
400 1 Calcite 0.000905335 3.16292e-05
400 1 Calcite_p1 0 0
400 1 Dolomite 0.0596336 0.0492175
400 1 Dolomite_p1 0 0
400 1 O2g_eq 0.168173 0.00246656
400 1 O2g_si 0 0
600 2 cell_ID 0 0
600 2 ID 0 0
600 2 H 5.0337e-14 1.03769e-15
600 2 O 0.0321049 0.000508398
600 2 Charge 0.000888608 3.9048e-05
600 2 C 0.00157038 4.35036e-05
600 2 Ca 0.00157147 4.36029e-05
600 2 Cl 2.03573e-10 7.1497e-12
600 2 Mg 1.78228e-05 1.51293e-06
600 2 Calcite 0.00110004 5.90231e-05
600 2 Calcite_p1 0 0
600 2 Dolomite 0.0444966 0.0200246
600 2 Dolomite_p1 0 0
600 2 O2g_eq 0.0867418 0.00138316
600 2 O2g_si 0 0
800 3 cell_ID 0 0
800 3 ID 0 0
800 3 H 5.07032e-14 1.07836e-15
800 3 O 0.0304553 0.000543198
800 3 Charge 0.000987327 4.5855e-05
800 3 C 0.00189037 5.46494e-05
800 3 Ca 0.00188634 5.4454e-05
800 3 Cl 1.9489e-10 6.83318e-12
800 3 Mg 2.04861e-05 1.45815e-06
800 3 Calcite 0.00129733 5.02191e-05
800 3 Calcite_p1 0 0
800 3 Dolomite 0.0132718 0.0097894
800 3 Dolomite_p1 0 0
800 3 O2g_eq 0.0823463 0.00147483
800 3 O2g_si 0 0
1000 4 cell_ID 0 0
1000 4 ID 0 0
1000 4 H 4.5926e-14 8.98972e-16
1000 4 O 0.0346924 0.000605097
1000 4 Charge 0.000854348 3.62669e-05
1000 4 C 0.00165366 4.37053e-05
1000 4 Ca 0.00164887 4.36839e-05
1000 4 Cl 1.81984e-10 6.37135e-12
1000 4 Mg 2.50557e-05 1.50812e-06
1000 4 Calcite 0.0011238 4.37014e-05
1000 4 Calcite_p1 0 0
1000 4 Dolomite 0.111075 0.0348126
1000 4 Dolomite_p1 0 0
1000 4 O2g_eq 0.0937111 0.00164022
1000 4 O2g_si 0 0

Binary file not shown.

View File

@ -1,16 +1,20 @@
#!/bin/bash
#SBATCH --job-name=poet_dolo_interp
#SBATCH --output=poet_dolo_interp_%j.out
#SBATCH --error=poet_dolo_interp_%j.err
#SBATCH --nodes=2
#SBATCH --job-name=poet_dolo_interp_NOroll
#SBATCH --output=poet_dolo_interp_NOroll%j.out
#SBATCH --error=poet_dolo_interp_NOroll%j.err
#SBATCH --partition=long
#SBATCH --nodes=4
#SBATCH --ntasks=48
#SBATCH --ntasks-per-node=24
#SBATCH --ntasks-per-node=12
#SBATCH --time=02:00:00
#SBATCH --exclusive
#SBATCH --mail-user=vasudha.rastogi@uni-potsdam.de
#SBATCH --mail-type=END,FAIL
module load cmake gcc openmpi
source /etc/profile.d/modules.sh
module purge
module load cmake gcc openmpi R
mpirun -n 48 ./poet --interp dolo_interp_rt.R dolo_interp.qs2 dolo_interp
mpirun -n 48 ./poet --interp dolo_interp_rt.R dolo_interp.qs2 poet_dolo_interp_iter1000_n4_NOroll
#mpirun -n 48 ./poet --interp dolo_fgcs_3.R dolo_fgcs_3.qs2 dolo_fgcs_3_iter500_n2_roll

View File

@ -1,34 +1,30 @@
Iteration Rollback Species MAPE RRSME
---------------------------------------------------------------------------
20 0 cell_ID 0 0
20 0 ID 0 0
20 0 H 1.77731e-14 2.7095e-16
20 0 O 0.0553364 0.000567638
20 0 Charge 0.0138864 0.000147021
20 0 C 8.81221e-05 1.41354e-05
20 0 Ca 8.8185e-05 1.41354e-05
20 0 Cl 6.02029 0.0873663
20 0 Mg 6.08272 0.0883807
20 0 Calcite 5.26812e-05 8.46394e-06
20 0 Calcite_p1 0 0
20 0 Dolomite 5.3721e-07 1.14804e-06
20 0 Dolomite_p1 0 0
20 0 O2g_eq 0.145109 0.00148947
20 0 O2g_si 0 0
100 0 cell_ID 0 0
100 0 ID 0 0
100 0 H 6.12118e-14 2.16243e-15
100 0 O 1.82053e-09 1.46339e-10
100 0 Charge 0.00858644 0.000361839
100 0 C 0.00012588 2.14455e-05
100 0 Ca 0.000125782 2.14299e-05
100 0 Cl 52.1566 0.722171
100 0 Mg 0.490336 0.0697317
100 0 Calcite 7.54079e-06 1.28674e-06
100 0 Calcite_p1 0 0
100 0 Dolomite 3.89779e-08 1.55912e-07
100 0 Dolomite_p1 0 0
40 1 cell_ID 0 0
40 1 ID 0 0
40 1 H 1.70761e-14 3.24997e-16
40 1 O 0.0285341 0.000295504
40 1 Charge 0.012912 0.000140398
40 1 C 0.000332495 3.36477e-05
40 1 Ca 0.000332544 3.36467e-05
40 1 Cl 4.03557 0.0764422
40 1 Mg 4.11227 0.0777245
40 1 Calcite 0.000199586 2.02213e-05
40 1 Calcite_p1 0 0
40 1 Dolomite 1.50815e-06 1.98748e-06
40 1 Dolomite_p1 0 0
40 1 O2g_eq 0.0708157 0.000734877
40 1 O2g_si 0 0
200 1 cell_ID 0 0
200 1 ID 0 0
200 1 H 3.48099e-14 1.01368e-15
200 1 O 3.22418e-09 4.60101e-11
200 1 Charge 0.00171817 0.000117133
200 1 C 3.02114e-05 4.34024e-06
200 1 Ca 3.01505e-05 4.33741e-06
200 1 Cl 4.29804 0.207274
200 1 Mg 0.367412 0.0605187
200 1 Calcite 1.80463e-06 2.58645e-07
200 1 Calcite_p1 0 0
200 1 Dolomite 0 0
200 1 Dolomite_p1 0 0

Binary file not shown.

View File

@ -3,7 +3,7 @@
#include <string>
#include "Datatypes.hpp"
int write_checkpoint(const std::string &file_path, struct Checkpoint_s &&checkpoint);
int read_checkpoint(const std::string &file_path, struct Checkpoint_s &checkpoint);
int write_checkpoint(const std::string &dir_path, const std::string &file_name, struct Checkpoint_s &&checkpoint);
int read_checkpoint(const std::string &dir_path, const std::string &file_name, struct Checkpoint_s &checkpoint);

View File

@ -2,15 +2,19 @@
#include <fstream>
#include <iostream>
#include <string>
#include <iomanip> // for std::setw and std::setprecision
#include <iomanip>
#include <filesystem>
namespace poet
{
void writeStatsToCSV(const std::vector<ChemistryModule::SimulationErrorStats> &all_stats,
const std::vector<std::string> &species_names,
const std::string &out_dir,
const std::string &filename)
{
std::ofstream out(filename);
std::filesystem::path full_path = std::filesystem::path(out_dir) / filename;
std::ofstream out(full_path);
if (!out.is_open())
{
std::cerr << "Could not open " << filename << " !" << std::endl;
@ -24,7 +28,7 @@ namespace poet
<< std::setw(15) << "MAPE"
<< std::setw(15) << "RRSME" << "\n";
out << std::string(75, '-') << "\n"; // separator line
out << std::string(75, '-') << "\n";
// data rows
for (size_t i = 0; i < all_stats.size(); ++i)
@ -39,7 +43,7 @@ namespace poet
<< std::setw(15) << all_stats[i].rrmse[j]
<< "\n";
}
out << "\n"; // blank line between iterations
out << "\n";
}
out.close();

View File

@ -5,5 +5,6 @@ namespace poet
{
void writeStatsToCSV(const std::vector<ChemistryModule::SimulationErrorStats> &all_stats,
const std::vector<std::string> &species_names,
const std::string &out_dir,
const std::string &filename);
} // namespace poet

View File

@ -1,13 +1,20 @@
#include "IO/Datatypes.hpp"
#include <cstdint>
#include <highfive/H5Easy.hpp>
#include <filesystem>
int write_checkpoint(const std::string &file_path, struct Checkpoint_s &&checkpoint){
namespace fs = std::filesystem;
int write_checkpoint(const std::string &dir_path, const std::string &file_name, struct Checkpoint_s &&checkpoint){
if (!fs::exists(dir_path)) {
std::cerr << "Directory does not exist: " << dir_path << std::endl;
return -1;
}
fs::path file_path = fs::path(dir_path) / file_name;
// TODO: errorhandling
H5Easy::File file(file_path, H5Easy::File::Overwrite);
H5Easy::dump(file, "/MetaParam/Iterations", checkpoint.iteration);
H5Easy::dump(file, "/Grid/Names", checkpoint.field.GetProps());
H5Easy::dump(file, "/Grid/Chemistry", checkpoint.field.As2DVector());
@ -15,9 +22,16 @@ int write_checkpoint(const std::string &file_path, struct Checkpoint_s &&checkpo
return 0;
}
int read_checkpoint(const std::string &file_path, struct Checkpoint_s &checkpoint){
int read_checkpoint(const std::string &dir_path, const std::string &file_name, struct Checkpoint_s &checkpoint){
fs::path file_path = fs::path(dir_path) / file_name;
H5Easy::File file(file_path, H5Easy::File::ReadOnly);
if (!fs::exists(file_path)) {
std::cerr << "File does not exist: " << file_path << std::endl;
return -1;
}
H5Easy::File file(file_path, H5Easy::File::ReadOnly);
checkpoint.iteration = H5Easy::load<uint32_t>(file, "/MetaParam/Iterations");

View File

@ -330,7 +330,7 @@ bool triggerRollbackIfExceeded(ChemistryModule &chem, RuntimeParameters &params,
" → rolling back to iteration " + std::to_string(rollback_iter));
Checkpoint_s checkpoint_read{.field = chem.getField()};
read_checkpoint("checkpoint" + std::to_string(rollback_iter) + ".hdf5", checkpoint_read);
read_checkpoint(params.out_dir, "checkpoint" + std::to_string(rollback_iter) + ".hdf5", checkpoint_read);
current_iteration = checkpoint_read.iteration;
return true; // rollback happened
}
@ -490,13 +490,13 @@ static Rcpp::List RunMasterLoop(RInsidePOET &R, RuntimeParameters &params,
if(iter % params.checkpoint_interval == 0){
MSG("Writing checkpoint of iteration " + std::to_string(iter));
write_checkpoint("checkpoint" + std::to_string(iter) + ".hdf5",
write_checkpoint(params.out_dir, "checkpoint" + std::to_string(iter) + ".hdf5",
{.field = chem.getField(), .iteration = iter});
}
if (params.control_interval_enabled && !params.rollback_enabled)
{
writeStatsToCSV(chem.error_history, chem.getField().GetProps(), "stats_overview");
writeStatsToCSV(chem.error_history, chem.getField().GetProps(), params.out_dir,"stats_overview");
if(triggerRollbackIfExceeded(chem, params, iter)){
params.rollback_enabled = true;