From 340a1a593b0a33479147323d1004526500c00c9a Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 17 Dec 2023 20:26:51 -0500 Subject: [PATCH] more cleaning --- .../flame_wave/ci-benchmarks/grid_diag.out | 4 +- .../flame_wave/ci-benchmarks/species_diag.out | 2 +- .../ci-benchmarks/wdmerger_collision_2D.out | 46 +++++++------- Util/model_parser/model_parser.H | 62 +++++-------------- 4 files changed, 40 insertions(+), 74 deletions(-) diff --git a/Exec/science/flame_wave/ci-benchmarks/grid_diag.out b/Exec/science/flame_wave/ci-benchmarks/grid_diag.out index 5ed4426db5..2f054f110b 100644 --- a/Exec/science/flame_wave/ci-benchmarks/grid_diag.out +++ b/Exec/science/flame_wave/ci-benchmarks/grid_diag.out @@ -1,5 +1,5 @@ # COLUMN 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 # TIMESTEP TIME MASS XMOM YMOM ZMOM ANG. MOM. X ANG. MOM. Y ANG. MOM. Z KIN. ENERGY INT. ENERGY GAS ENERGY GRAV. ENERGY TOTAL ENERGY CENTER OF MASS X-LOC CENTER OF MASS Y-LOC CENTER OF MASS Z-LOC CENTER OF MASS X-VEL CENTER OF MASS Y-VEL CENTER OF MASS Z-VEL MAXIMUM TEMPERATURE MAXIMUM DENSITY MAXIMUM T_S / T_E 0 0.0000000000000000 1.4902024346464787e+20 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 2.9583337617665660e+37 2.9583337617665660e+37 0.0000000000000000e+00 2.9583337617665660e+37 2.7306640614148750e+04 6.8067773166795473e+02 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 1.0000000000156899e+08 3.1017131702472486e+07 0.0000000000000000e+00 - 1 5.9694928185132600e-08 1.4902038799260451e+20 -9.8852813993167483e+18 7.0758681407801181e+23 -3.7077151117729030e+15 -7.8559831399077499e+18 7.9789428545426686e+19 1.9321854546506737e+28 2.7622571688141327e+29 2.9583392229687520e+37 2.9583392505913144e+37 0.0000000000000000e+00 2.9583392505913144e+37 2.7306640614147251e+04 6.8067725884159722e+02 0.0000000000000000e+00 -6.6335093690719216e-02 4.7482550784469004e+03 -2.4880589573803199e-05 1.0000972452748042e+08 3.1017431302318867e+07 1.9852339015703824e-12 - 2 1.2535934918877847e-07 1.4902056479398973e+20 -2.0759055840781603e+19 1.4862415462814482e+24 -1.6351019859135748e+16 -3.4644556495600996e+19 3.5187152213757382e+20 4.0584338401784393e+28 5.5823502529134965e+29 2.9583452181108320e+37 2.9583452739343134e+37 0.0000000000000000e+00 2.9583452739343134e+37 2.7306640614140473e+04 6.8067697458181988e+02 0.0000000000000000e+00 -1.3930329595435043e-01 9.9733989623249036e+03 -1.0972324445112568e-04 1.0003863648020169e+08 3.1017667549506564e+07 1.9917944188178796e-12 + 1 5.9694928185132600e-08 1.4902038799260451e+20 -9.8852814000373391e+18 7.0758681407801342e+23 -3.7077151119947915e+15 -7.8559831403383900e+18 7.9789428550115738e+19 1.9321854546506743e+28 2.7622571688115688e+29 2.9583392229687520e+37 2.9583392505913144e+37 0.0000000000000000e+00 2.9583392505913144e+37 2.7306640614147251e+04 6.8067725884159722e+02 0.0000000000000000e+00 -6.6335093695554737e-02 4.7482550784469113e+03 -2.4880589575292177e-05 1.0000972452758998e+08 3.1017431302318867e+07 2.1834522208251888e-12 + 2 1.2535934918877847e-07 1.4902056479398969e+20 -2.0759055857352421e+19 1.4862415462814437e+24 -1.6351019861504854e+16 -3.4644556500407476e+19 3.5187152219157529e+20 4.0584338401784253e+28 5.5823502529036681e+29 2.9583452181108315e+37 2.9583452739343125e+37 0.0000000000000000e+00 2.9583452739343125e+37 2.7306640614140484e+04 6.8067697458182033e+02 0.0000000000000000e+00 -1.3930329606554864e-01 9.9733989623248763e+03 -1.0972324446702355e-04 1.0003863648118678e+08 3.1017667549506564e+07 1.8217100523183610e-12 diff --git a/Exec/science/flame_wave/ci-benchmarks/species_diag.out b/Exec/science/flame_wave/ci-benchmarks/species_diag.out index 6c23a8e48e..b56e8bb348 100644 --- a/Exec/science/flame_wave/ci-benchmarks/species_diag.out +++ b/Exec/science/flame_wave/ci-benchmarks/species_diag.out @@ -2,4 +2,4 @@ # TIMESTEP TIME Mass He4 Mass C12 Mass O16 Mass Ne20 Mass Mg24 Mass Si28 Mass S32 Mass Ar36 Mass Ca40 Mass Ti44 Mass Cr48 Mass Fe52 Mass Ni56 0 0.0000000000000000 3.5899765861250859e-15 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.4944801491560746e-24 7.1354824912929246e-14 1 5.9694928185132600e-08 3.5899765861251656e-15 7.4944874211898590e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.4944874177116286e-24 7.1354897598484802e-14 - 2 1.2535934918877847e-07 3.5899765861253060e-15 7.4944963166333664e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.1354986514892610e-14 + 2 1.2535934918877847e-07 3.5899765861253060e-15 7.4944963166333664e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.4944963093524191e-24 7.1354986514892597e-14 diff --git a/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out b/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out index a933d102df..6bdddfb49a 100644 --- a/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out +++ b/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out @@ -1,29 +1,29 @@ plotfile = plt00095 time = 1.25 variables minimum value maximum value - density 8.7136176158e-05 13348283.786 - xmom -4.4636648292e+14 1.4969028735e+15 - ymom -1.8931343553e+15 1.9807937913e+15 + density 8.7136170328e-05 13347626.831 + xmom -4.4623942798e+14 1.4982725823e+15 + ymom -1.8879302767e+15 1.980304858e+15 zmom 0 0 - rho_E 7.7947390767e+11 5.6568077669e+24 - rho_e 7.4321344551e+11 5.6343409475e+24 - Temp 100000 3972527783.9 - rho_He4 8.7136176158e-17 1473.9666386 - rho_C12 3.4854470463e-05 5030539.1488 - rho_O16 5.2281705694e-05 7778301.6377 - rho_Ne20 8.7136176158e-17 1023673.1153 - rho_Mg24 8.7136176158e-17 1040419.2782 - rho_Si28 8.7136176158e-17 4251082.0739 - rho_S32 8.7136176158e-17 2179431.2961 - rho_Ar36 8.7136176158e-17 497747.48798 - rho_Ca40 8.7136176158e-17 382056.037 - rho_Ti44 8.7136176158e-17 1576.0930955 - rho_Cr48 8.7136176158e-17 1467.9139369 - rho_Fe52 8.7136176158e-17 14831.710059 - rho_Ni56 8.7136176158e-17 182702.27304 - phiGrav -4.6147467267e+17 -2.2055818332e+16 - grav_x -461195258.85 -48603.568291 - grav_y -444709392.81 392306861.64 + rho_E 7.7948360809e+11 5.64675518e+24 + rho_e 7.4322366401e+11 5.6244082614e+24 + Temp 100000 3969215375.1 + rho_He4 8.7136170328e-17 1473.6068478 + rho_C12 3.4854468131e-05 5028784.2519 + rho_O16 5.2281702196e-05 7774667.7686 + rho_Ne20 8.7136170328e-17 448739.14288 + rho_Mg24 8.7136170328e-17 1131012.4412 + rho_Si28 8.7136170328e-17 4244213.8084 + rho_S32 8.7136170328e-17 2178795.6667 + rho_Ar36 8.7136170328e-17 496791.83986 + rho_Ca40 8.7136170328e-17 381536.89513 + rho_Ti44 8.7136170328e-17 1576.1652647 + rho_Cr48 8.7136170328e-17 1467.4931808 + rho_Fe52 8.7136170328e-17 14841.830382 + rho_Ni56 8.7136170328e-17 182905.91385 + phiGrav -4.6146743474e+17 -2.2055817929e+16 + grav_x -461199998.92 -48603.52543 + grav_y -444710966.19 392312565.37 grav_z 0 0 - rho_enuc -7.6356851771e+21 5.7259582003e+26 + rho_enuc -7.4954583352e+21 6.7150736332e+26 diff --git a/Util/model_parser/model_parser.H b/Util/model_parser/model_parser.H index 8c880c91b1..c88337d2da 100644 --- a/Util/model_parser/model_parser.H +++ b/Util/model_parser/model_parser.H @@ -106,59 +106,25 @@ AMREX_INLINE AMREX_GPU_HOST_DEVICE Real interpolate(const Real r, const int var_index, const int model_index=0) { + // this gives us an index suck that profile.r(id) < r < profile.r(id+1) + int id = locate(r, model_index); Real slope; Real interp; - if (id == 0) { - - slope = (model::profile(model_index).state(id+1, var_index) - - model::profile(model_index).state(id, var_index)) / - (model::profile(model_index).r(id+1) - model::profile(model_index).r(id)); - interp = slope * (r - model::profile(model_index).r(id)) + model::profile(model_index).state(id, var_index); - - // safety check to make sure interp lies within the bounding points - Real minvar = std::min(model::profile(model_index).state(id+1, var_index), - model::profile(model_index).state(id, var_index)); - Real maxvar = std::max(model::profile(model_index).state(id+1, var_index), - model::profile(model_index).state(id, var_index)); - interp = std::clamp(interp, minvar, maxvar); - - } else if (id == model::npts-1) { - - slope = (model::profile(model_index).state(id, var_index) - - model::profile(model_index).state(id-1, var_index)) / - (model::profile(model_index).r(id) - model::profile(model_index).r(id-1)); - interp = slope * (r - model::profile(model_index).r(id)) + model::profile(model_index).state(id, var_index); - - - // safety check to make sure interp lies within the bounding points - Real minvar = std::min(model::profile(model_index).state(id-1, var_index), - model::profile(model_index).state(id, var_index)); - Real maxvar = std::max(model::profile(model_index).state(id-1, var_index), - model::profile(model_index).state(id, var_index)); - interp = std::clamp(interp, minvar, maxvar); - - } else { - - if (r >= model::profile(model_index).r(id)) { - - slope = (model::profile(model_index).state(id+1, var_index) - - model::profile(model_index).state(id, var_index)) / - (model::profile(model_index).r(id+1) - model::profile(model_index).r(id)); - interp = slope * (r - model::profile(model_index).r(id)) + model::profile(model_index).state(id, var_index); - - } else { - - slope = (model::profile(model_index).state(id, var_index) - - model::profile(model_index).state(id-1, var_index)) / - (model::profile(model_index).r(id) - model::profile(model_index).r(id-1)); - interp = slope * (r - model::profile(model_index).r(id)) + model::profile(model_index).state(id, var_index); - - } - - } + slope = (model::profile(model_index).state(id+1, var_index) - + model::profile(model_index).state(id, var_index)) / + (model::profile(model_index).r(id+1) - model::profile(model_index).r(id)); + interp = slope * (r - model::profile(model_index).r(id)) + + model::profile(model_index).state(id, var_index); + + // safety check to make sure interp lies within the bounding points + Real minvar = std::min(model::profile(model_index).state(id+1, var_index), + model::profile(model_index).state(id, var_index)); + Real maxvar = std::max(model::profile(model_index).state(id+1, var_index), + model::profile(model_index).state(id, var_index)); + interp = std::clamp(interp, minvar, maxvar); return interp;