From 21c2bc578acb482cc89988cb5f72e0c3cc3e0c9f Mon Sep 17 00:00:00 2001 From: "Eric T. Johnson" Date: Wed, 27 Mar 2024 16:45:31 -0400 Subject: [PATCH] Fix initial He4 mass fraction in Detonation (#2806) There were two separate issues with the helium mass fraction calculation: If any of cfrac, nfrac, or ofrac were zero, the corresponding mass fractions would be clamped to smallx, but the helium mass fraction didn't account for this. The number of remaining species was one too high, as it should also exclude He4. --- .../sdc_det_plt00040_extrema.out | 138 +++++++++--------- Exec/science/Detonation/problem_initialize.H | 9 +- 2 files changed, 76 insertions(+), 71 deletions(-) diff --git a/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out b/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out index b23a288448..5d48f26c1b 100644 --- a/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out +++ b/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out @@ -1,79 +1,79 @@ plotfile = det_x_plt00040 - time = 5.1558159133685604e-06 + time = 5.1558159140336702e-06 variables minimum value maximum value - density 185259613.21 216639295.98 - xmom -76364812859 2.9487648003e+16 + density 185259659.3 216625503.34 + xmom -13760057465 2.9527146771e+16 ymom 0 0 zmom 0 0 - rho_E 1.3062473824e+26 2.7890630574e+26 - rho_e 1.3062473824e+26 2.7748033958e+26 - Temp 50000004.458 7845854782 - rho_H1 2.1207015241e-22 0.020000144873 - rho_He3 0.0017224909604 0.021023115362 - rho_He4 94365290.111 200001891.25 - rho_C12 0.020000000212 21243051.967 - rho_N14 1.9999977239e-22 0.020000190213 - rho_O16 0.019999999996 19209.485639 - rho_Ne20 0.019999999996 9734.6358293 - rho_Mg24 0.019999999996 23306.635461 - rho_Si28 0.019999999996 2013766.0467 - rho_S32 0.019999999996 1654854.387 - rho_Ar36 0.019999999996 821077.40202 - rho_Ca40 0.019999999996 724428.55057 - rho_Ti44 0.019999999996 34137.672926 - rho_Cr48 0.019999999996 78094.207516 - rho_Fe52 0.019999999996 277975.05929 - rho_Fe54 0.019999999996 94999519.274 - rho_Ni56 0.019999999996 2236723.6985 - rho_n 2.1207015241e-22 234580.251 - rho_p 0.019999995434 3609846.1745 - rho_enuc -4.6916352344e+29 3.5793978339e+32 - pressure 5.5236728673e+25 1.1610546577e+26 - kineng 0 2.0430835425e+24 - soundspeed 612864631.35 895226082.4 - Gamma_1 1.359975607 1.3820247131 - MachNumber 0 0.16100811998 - uplusc 612864631.35 999536286.21 - uminusc -895226453.03 -612859846.92 - entropy 98214771.47 336273518.24 + rho_E 1.3062473821e+26 2.7889438781e+26 + rho_e 1.3062473821e+26 2.7747059271e+26 + Temp 50000000.026 7845854559 + rho_H1 2.1203665799e-22 0.020000114043 + rho_He3 0.0017224849005 0.021021778892 + rho_He4 94384549.451 200001582.65 + rho_C12 0.020000000216 21181006.118 + rho_N14 1.9999997268e-22 0.020000159166 + rho_O16 0.02 19209.472033 + rho_Ne20 0.02 3403.302453 + rho_Mg24 0.02 23330.215568 + rho_Si28 0.02 2016074.1508 + rho_S32 0.02 1656865.76 + rho_Ar36 0.02 822126.88981 + rho_Ca40 0.02 725125.60248 + rho_Ti44 0.02 34184.806642 + rho_Cr48 0.02 78126.082381 + rho_Fe52 0.02 278040.09021 + rho_Fe54 0.02 94986843.638 + rho_Ni56 0.02 2239055.987 + rho_n 0.020000004562 234580.08802 + rho_p 0.019999995438 3609282.9073 + rho_enuc -4.6902991452e+29 3.5778382148e+32 + pressure 5.5236728651e+25 1.1610543806e+26 + kineng 0 2.047804488e+24 + soundspeed 612864631.21 895226062.8 + Gamma_1 1.3599756296 1.3819790602 + MachNumber 0 0.16114515958 + uplusc 612864631.21 999634014.46 + uminusc -895226128.14 -612860627.32 + entropy 98214767.758 336273492.62 magvort 0 0 - divu -97902.982158 33744.686211 - eint_E 6.5312369121e+17 1.3804344246e+18 - eint_e 6.5312369121e+17 1.3804344246e+18 - logden 8.267780753 8.3357372357 - StateErr_0 185259613.21 216639295.98 - StateErr_1 50000004.458 7845854782 - StateErr_2 1e-30 9.9999779304e-11 - X(H1) 1e-30 9.9999779304e-11 - X(He3) 8.9859771063e-12 9.9999601234e-11 - X(He4) 0.48406305162 0.9999999982 - X(C12) 1.0000000106e-10 0.10016992833 - X(N14) 1e-30 1.0000000525e-10 - X(O16) 9.999999998e-11 9.6047401986e-05 - X(Ne20) 9.999999998e-11 4.5902903915e-05 - X(Mg24) 9.999999998e-11 0.00011109993006 - X(Si28) 9.999999998e-11 0.010051430746 - X(S32) 9.999999998e-11 0.0083423100958 - X(Ar36) 9.999999998e-11 0.004162785426 - X(Ca40) 9.999999998e-11 0.0037083550771 - X(Ti44) 9.999999998e-11 0.00017290662768 - X(Cr48) 9.999999998e-11 0.00040059772358 - X(Fe52) 9.999999998e-11 0.001337522714 - X(Fe54) 9.999999998e-11 0.46488979858 - X(Ni56) 9.999999998e-11 0.010324644421 - X(n) 1e-30 0.0011729007238 - X(p) 9.9999977087e-11 0.017592929732 - abar 4.000000001 6.7312458561 - Ye 0.49998677577 0.50001556472 - x_velocity -381.82392939 138572160.27 + divu -97879.954761 33763.419428 + eint_E 6.5312369103e+17 1.3804343698e+18 + eint_e 6.5312369103e+17 1.3804343698e+18 + logden 8.267780861 8.3357095848 + StateErr_0 185259659.3 216625503.34 + StateErr_1 50000000.026 7845854559 + StateErr_2 1e-30 9.9999779324e-11 + X(H1) 1e-30 9.9999779324e-11 + X(He3) 8.9862145938e-12 9.9999601254e-11 + X(He4) 0.48407561714 0.9999999982 + X(C12) 1.0000000108e-10 0.099893133188 + X(N14) 1e-30 1.0000000432e-10 + X(O16) 1e-10 9.6047335509e-05 + X(Ne20) 1e-10 1.6050538078e-05 + X(Mg24) 1e-10 0.00011120690546 + X(Si28) 1e-10 0.010059247336 + X(S32) 1e-10 0.0083490446432 + X(Ar36) 1e-10 0.0041662673673 + X(Ca40) 1e-10 0.0037091533301 + X(Ti44) 1e-10 0.00017295101573 + X(Cr48) 1e-10 0.00040068985616 + X(Fe52) 1e-10 0.0013377863567 + X(Fe54) 1e-10 0.46486808681 + X(Ni56) 1e-10 0.010336068249 + X(n) 1.0000002281e-10 0.001172900139 + X(p) 9.9999977027e-11 0.017594951746 + abar 4.000000001 6.7310197958 + Ye 0.49998669648 0.50001557929 + x_velocity -68.800275809 138706560.7 y_velocity 0 0 z_velocity 0 0 - t_sound_t_enuc 3.4412406672e-13 0.97497430527 - enuc -2.4944881551e+21 1.6522384906e+24 - magvel 0 138572160.27 - radvel -381.82392939 138572160.27 - circvel 0 2 - magmom 0 2.9487648003e+16 + t_sound_t_enuc 3.4412406685e-13 0.97470686938 + enuc -2.4937801624e+21 1.6516237283e+24 + magvel 0 138706560.7 + radvel -68.800275809 138706560.7 + circvel 0 2.8284271247 + magmom 0 2.9527146771e+16 angular_momentum_x 0 0 angular_momentum_y 0 0 angular_momentum_z 0 0 diff --git a/Exec/science/Detonation/problem_initialize.H b/Exec/science/Detonation/problem_initialize.H index 58205bbf24..c625a16440 100644 --- a/Exec/science/Detonation/problem_initialize.H +++ b/Exec/science/Detonation/problem_initialize.H @@ -55,10 +55,15 @@ void problem_initialize () if (problem::in14 >= 0) { problem::xn[problem::in14] = amrex::max(problem::nfrac, problem::smallx); - problem::xn[problem::ihe4] = 1.0_rt - problem::cfrac - problem::nfrac - problem::ofrac - (NumSpec - 3) * problem::smallx; + problem::xn[problem::ihe4] = 1.0_rt - problem::xn[problem::ic12] + - problem::xn[problem::in14] + - problem::xn[problem::io16] + - (NumSpec - 4) * problem::smallx; } else { - problem::xn[problem::ihe4] = 1.0_rt - problem::cfrac - problem::ofrac - (NumSpec - 2) * problem::smallx; + problem::xn[problem::ihe4] = 1.0_rt - problem::xn[problem::ic12] + - problem::xn[problem::io16] + - (NumSpec - 3) * problem::smallx; } // Set the ambient material