From c8ef18138b904b9bbb8eb0246463edc121f3088e Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Fri, 26 Jul 2024 19:13:05 -0400 Subject: [PATCH 01/10] fix true-SDC compilation due to namespace changes in Microphysics (#2932) --- Source/sdc/sdc_react_util.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/sdc/sdc_react_util.H b/Source/sdc/sdc_react_util.H index dffd1dd1f0..b174dd8d03 100644 --- a/Source/sdc/sdc_react_util.H +++ b/Source/sdc/sdc_react_util.H @@ -35,7 +35,7 @@ single_zone_react_source(burn_t& burn_state, eos(eos_input_re, burn_state); // eos_get_small_temp(&small_temp); - burn_state.T = amrex::min(MAX_TEMP, amrex::max(burn_state.T, small_temp)); + burn_state.T = std::clamp(burn_state.T, small_temp, integrator_rp::MAX_TEMP); Array1D ydot; From df7e675f967229479b5eca4025697579197d609d Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Fri, 26 Jul 2024 19:22:17 -0400 Subject: [PATCH 02/10] if we have USE_GPU_PRINTF = TRUE, then fflush the output after burn (#2928) this will catch the prints from the burner that were added to Microphysics --- Source/reactions/Castro_react.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/reactions/Castro_react.cpp b/Source/reactions/Castro_react.cpp index 7fc8e069b9..ee9807dfb9 100644 --- a/Source/reactions/Castro_react.cpp +++ b/Source/reactions/Castro_react.cpp @@ -417,6 +417,11 @@ Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int stra #if defined(AMREX_USE_HIP) Gpu::streamSynchronize(); // otherwise HIP may fail to allocate the necessary resources. #endif + +#ifdef ALLOW_GPU_PRINTF + std::fflush(nullptr); +#endif + } #if defined(AMREX_USE_GPU) @@ -812,6 +817,11 @@ Castro::react_state(Real time, Real dt) #if defined(AMREX_USE_HIP) Gpu::streamSynchronize(); // otherwise HIP may fail to allocate the necessary resources. #endif + +#ifdef ALLOW_GPU_PRINTF + std::fflush(nullptr); +#endif + } #if defined(AMREX_USE_GPU) From d8dd29e85faed7a067f1902647d4a50e3adf7aaa Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Fri, 26 Jul 2024 19:22:44 -0400 Subject: [PATCH 03/10] when running on GPUs, have job_info output "GPU time used" (#2930) this is basically just MPI hours, but now the output is more clear --- Source/driver/Castro.H | 4 ++-- Source/driver/Castro_io.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/driver/Castro.H b/Source/driver/Castro.H index 8c7b9c13f8..b0882ec2d0 100644 --- a/Source/driver/Castro.H +++ b/Source/driver/Castro.H @@ -1418,8 +1418,8 @@ protected: /// -/// for keeping track of the amount of CPU time used -- this will persist -/// after restarts +/// for keeping track of the amount of CPU or GPU time used -- this will persist +/// after restarts /// static amrex::Real previousCPUTimeUsed; static amrex::Real startCPUTime; diff --git a/Source/driver/Castro_io.cpp b/Source/driver/Castro_io.cpp index b0c58b5da2..93ea8d7ab6 100644 --- a/Source/driver/Castro_io.cpp +++ b/Source/driver/Castro_io.cpp @@ -564,8 +564,13 @@ Castro::writeJobInfo (const std::string& dir, const Real io_time) jobInfoFile << "hydro tile size: " << hydro_tile_size << "\n"; jobInfoFile << "\n"; +#ifdef AMREX_USE_GPU + jobInfoFile << "GPU time used since start of simulation (GPU-hours): " << + getCPUTime()/3600.0; +#else jobInfoFile << "CPU time used since start of simulation (CPU-hours): " << getCPUTime()/3600.0; +#endif jobInfoFile << "\n\n"; From d9c95025f2fd79047d03e6f7e453b217da611851 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jul 2024 11:02:40 -0400 Subject: [PATCH 04/10] update CI after Microphysics autodiff updates (#2933) --- .../sdc_det_plt00040_extrema.out | 130 +++++++++--------- .../ci-benchmarks/wdmerger_collision_2D.out | 14 +- 2 files changed, 72 insertions(+), 72 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 51ab093e30..b072c6e901 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.1558159140336702e-06 variables minimum value maximum value - density 185259874.21 216582994.41 - xmom -87234240329 2.9512596512e+16 + density 185257544.55 216468146.43 + xmom -37913405153 2.9568274388e+16 ymom 0 0 zmom 0 0 - rho_E 1.3062473821e+26 2.7893784326e+26 - rho_e 1.3062473821e+26 2.7751188263e+26 - Temp 50000000.026 7845854662.6 - rho_H1 2.1207307865e-22 0.020000135717 - rho_He3 0.0017225013714 0.02102428438 - rho_He4 94358881.486 200001799.59 - rho_C12 0.020000000216 21276964.112 - rho_N14 1.9999983474e-22 197.76685905 - rho_O16 0.02 19209.489937 - rho_Ne20 0.02 4937.0489429 - rho_Mg24 0.02 23322.104606 - rho_Si28 0.02 2015343.4134 - rho_S32 0.02 1656264.8265 - rho_Ar36 0.02 821829.69632 - rho_Ca40 0.02 725030.13946 - rho_Ti44 0.02 34172.699418 - rho_Cr48 0.02 78131.560865 - rho_Fe52 0.02 277298.50875 - rho_Fe54 0.02 94994585.838 - rho_Ni56 0.02 2238978.4894 - rho_n 2.1207307865e-22 234580.14761 - rho_p 0.019999995438 3609721.5282 - rho_enuc -4.6900452682e+29 3.5791669148e+32 - pressure 5.5236728651e+25 1.1610544319e+26 - kineng 0 2.0455630311e+24 - soundspeed 612864631.21 895226067.36 - Gamma_1 1.3599756137 1.3820271358 - MachNumber 0 0.16114390973 - uplusc 612864631.21 999569362.18 - uminusc -895226468.14 -612860078.6 - entropy 98214767.758 336273451.62 + rho_E 1.3062473821e+26 2.7893330499e+26 + rho_e 1.3062473821e+26 2.77508064e+26 + Temp 50000000.026 7845891849.2 + rho_H1 2.1211722106e-22 0.020000096415 + rho_He3 0.0017224293869 0.021023770747 + rho_He4 94366787.107 200001406.23 + rho_C12 0.020000000216 21736627.589 + rho_N14 1.9999999481e-22 0.020000141427 + rho_O16 0.02 21564.50879 + rho_Ne20 0.02 4189.5544151 + rho_Mg24 0.02 23323.799421 + rho_Si28 0.02 2015729.7513 + rho_S32 0.02 1656696.6915 + rho_Ar36 0.02 822096.59228 + rho_Ca40 0.02 724138.29448 + rho_Ti44 0.02 34187.547129 + rho_Cr48 0.02 78085.100557 + rho_Fe52 0.02 278150.27827 + rho_Fe54 0.02 94990080.243 + rho_Ni56 0.02 2242328.7066 + rho_n 2.1211722106e-22 234640.58163 + rho_p 0.019999995438 3609403.7361 + rho_enuc -4.7086157677e+29 3.5777644631e+32 + pressure 5.5236728651e+25 1.1610599873e+26 + kineng 0 2.0519264828e+24 + soundspeed 612864631.21 895228345.47 + Gamma_1 1.3599756425 1.3822442674 + MachNumber 0 0.16119509216 + uplusc 612864631.21 999919125.29 + uminusc -895228523.09 -612861073.53 + entropy 98214767.758 336273484.2 magvort 0 0 - divu -97746.019905 33801.828895 - eint_E 6.5312369103e+17 1.3804343879e+18 - eint_e 6.5312369103e+17 1.3804343879e+18 - logden 8.2677813648 8.3356243538 - StateErr_0 185259874.21 216582994.41 - StateErr_1 50000000.026 7845854662.6 + divu -97996.218171 33763.099005 + eint_E 6.5312369103e+17 1.3804410664e+18 + eint_e 6.5312369103e+17 1.3804410664e+18 + logden 8.2677759035 8.3353939984 + StateErr_0 185257544.55 216468146.43 + StateErr_1 50000000.026 7845891849.2 StateErr_2 1e-30 9.9999779324e-11 X(H1) 1e-30 9.9999779324e-11 - X(He3) 8.9857380636e-12 9.9999601254e-11 - X(He4) 0.48403393423 0.9999999982 - X(C12) 1.0000000108e-10 0.10032845398 - X(N14) 1e-30 9.3254108586e-07 - X(O16) 1e-10 9.604742181e-05 - X(Ne20) 1e-10 2.3279941869e-05 - X(Mg24) 1e-10 0.00011116921103 - X(Si28) 1e-10 0.01005607083 - X(S32) 1e-10 0.0083471961707 - X(Ar36) 1e-10 0.0041657025725 - X(Ca40) 1e-10 0.0037098568497 - X(Ti44) 1e-10 0.00017298041086 - X(Cr48) 1e-10 0.00040079244474 - X(Fe52) 1e-10 0.0013382570124 - X(Fe54) 1e-10 0.46490351089 - X(Ni56) 1e-10 0.010337739099 - X(n) 1e-30 0.0011729003976 - X(p) 9.9999977071e-11 0.017596365447 - abar 4.000000001 6.7314014168 - Ye 0.49998670317 0.50001557187 - x_velocity -436.17123215 138623047.3 + X(He3) 8.985892423e-12 9.9999601254e-11 + X(He4) 0.48406961191 0.9999999982 + X(C12) 1.0000000108e-10 0.10247460098 + X(N14) 1e-30 1.0000000384e-10 + X(O16) 1e-10 0.00010166316852 + X(Ne20) 1e-10 1.9751128146e-05 + X(Mg24) 1e-10 0.00011117683475 + X(Si28) 1e-10 0.010049207028 + X(S32) 1e-10 0.0083399755634 + X(Ar36) 1e-10 0.0041613939849 + X(Ca40) 1e-10 0.003708082998 + X(Ti44) 1e-10 0.00017289116777 + X(Cr48) 1e-10 0.00040055008209 + X(Fe52) 1e-10 0.0013373223366 + X(Fe54) 1e-10 0.46488586209 + X(Ni56) 1e-10 0.010358700546 + X(n) 1e-30 0.0011732028047 + X(p) 9.9999977002e-11 0.017592025438 + abar 4.000000001 6.7312151705 + Ye 0.49998627651 0.50001570244 + x_velocity -189.56702545 138792440.56 y_velocity 0 0 z_velocity 0 0 - t_sound_t_enuc 3.4412406685e-13 0.97531384976 - enuc -2.4936491578e+21 1.6525613771e+24 - magvel 0 138623047.3 - radvel -436.17123215 138623047.3 + t_sound_t_enuc 3.4412406685e-13 0.97569821534 + enuc -2.5034688832e+21 1.6527902706e+24 + magvel 0 138792440.56 + radvel -189.56702545 138792440.56 circvel 0 2 - magmom 0 2.9512596512e+16 + magmom 0 2.9568274388e+16 angular_momentum_x 0 0 angular_momentum_y 0 0 angular_momentum_z 0 0 diff --git a/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out b/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out index 6d11ada2e9..79afb42eba 100644 --- a/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out +++ b/Exec/science/wdmerger/ci-benchmarks/wdmerger_collision_2D.out @@ -7,14 +7,14 @@ zmom 0 0 rho_E 7.4982062146e+11 5.0669247218e+24 rho_e 7.1077581849e+11 5.0640768325e+24 - Temp 242288.68588 1409652233.5 - rho_He4 8.693611703e-17 3.5999032981 + Temp 242288.68588 1409652233.4 + rho_He4 8.693611703e-17 3.5999032939 rho_C12 3.4774446812e-05 7825956.6934 rho_O16 5.2161670217e-05 11739149.75 - rho_Ne20 8.693611703e-17 181951.05664 - rho_Mg24 8.693611703e-17 1192.7969626 - rho_Si28 8.693611703e-17 6.6913702458 - rho_S32 8.693611703e-17 0.00019493291444 + rho_Ne20 8.693611703e-17 181951.05614 + rho_Mg24 8.693611703e-17 1192.7969442 + rho_Si28 8.693611703e-17 6.6913701534 + rho_S32 8.693611703e-17 0.00019493290914 rho_Ar36 8.693611703e-17 1.9565534609e-05 rho_Ca40 8.693611703e-17 1.9565534331e-05 rho_Ti44 8.693611703e-17 1.9565534308e-05 @@ -25,5 +25,5 @@ grav_x -684991644 -51428.243166 grav_y -739606241.84 739606820.44 grav_z 0 0 - rho_enuc -1.9506340641e+12 7.6429034765e+23 + rho_enuc -3.2975004417e+12 7.6429034637e+23 From 3fd2d9c357520eda058d2948b8480d107a5360e6 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jul 2024 11:03:02 -0400 Subject: [PATCH 05/10] wdmerger: disable hybrid momentum by default (#2931) we are not using it, so we shouldn't bother computing and storing the hybrid components --- Exec/science/wdmerger/GNUmakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Exec/science/wdmerger/GNUmakefile b/Exec/science/wdmerger/GNUmakefile index 45866a9d03..bd78251741 100644 --- a/Exec/science/wdmerger/GNUmakefile +++ b/Exec/science/wdmerger/GNUmakefile @@ -20,10 +20,10 @@ NUM_MODELS = 2 # define the location of the CASTRO top directory CASTRO_HOME ?= ../../.. -# Turn on hybrid momentum, but note that it only is used in 3D at present. +# Turn on hybrid momentum? but note that it only is used in 3D at present. ifeq ($(DIM), 3) - USE_HYBRID_MOMENTUM ?= TRUE + USE_HYBRID_MOMENTUM ?= FALSE endif # Set the default integrator for the burner. From bb30ff41ecf8285d53bacc34bf556a39ba78b045 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jul 2024 11:03:26 -0400 Subject: [PATCH 06/10] turn on lazy QueueReduction for the timing reductions (#2926) --- Exec/Make.Castro | 3 +++ Source/diffusion/Castro_diffusion.cpp | 17 +++++++------ Source/driver/Castro.cpp | 6 +++-- Source/gravity/Castro_gravity.cpp | 30 ++++++++++++++--------- Source/gravity/Gravity.cpp | 6 +++-- Source/hydro/Castro_ctu_hydro.cpp | 11 ++++++--- Source/hydro/Castro_hybrid.cpp | 8 +++--- Source/hydro/Castro_mol_hydro.cpp | 4 +-- Source/problems/Castro_problem_source.cpp | 8 +++--- Source/reactions/Castro_react.cpp | 14 +++++++---- Source/rotation/Castro_rotation.cpp | 6 +++-- Source/sources/Castro_geom.cpp | 4 +-- Source/sources/Castro_sources.cpp | 13 ++++++---- 13 files changed, 80 insertions(+), 50 deletions(-) diff --git a/Exec/Make.Castro b/Exec/Make.Castro index 5b1575820b..106ef51cc0 100644 --- a/Exec/Make.Castro +++ b/Exec/Make.Castro @@ -55,6 +55,9 @@ endif # Require C++17 CXXSTD := c++17 +# Use Lazy QueueReduction for the timing outputs +LAZY := TRUE + # default integrator INTEGRATOR_DIR ?= VODE diff --git a/Source/diffusion/Castro_diffusion.cpp b/Source/diffusion/Castro_diffusion.cpp index c02fc3f611..0a2a98fbce 100644 --- a/Source/diffusion/Castro_diffusion.cpp +++ b/Source/diffusion/Castro_diffusion.cpp @@ -22,15 +22,16 @@ Castro::construct_old_diff_source(MultiFab& source, MultiFab& state_in, Real tim if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; - + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_old_diff_source() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_old_diff_source() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif @@ -59,15 +60,17 @@ Castro::construct_new_diff_source(MultiFab& source, MultiFab& state_old, MultiFa if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_new_diff_source() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_new_diff_source() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif diff --git a/Source/driver/Castro.cpp b/Source/driver/Castro.cpp index 3108b7794f..283cdf1e11 100644 --- a/Source/driver/Castro.cpp +++ b/Source/driver/Castro.cpp @@ -3048,14 +3048,16 @@ Castro::reflux (int crse_level, int fine_level, bool in_post_timestep) if (verbose) { const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real end = ParallelDescriptor::second() - strt; + amrex::Real end = ParallelDescriptor::second() - strt; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(end,IOProc); if (ParallelDescriptor::IOProcessor()) { - std::cout << "Castro::reflux() at level " << level << " : time = " << end << std::endl; + std::cout << "Castro::reflux() at level " << llevel + << " : time = " << end << std::endl; } #ifdef BL_LAZY }); diff --git a/Source/gravity/Castro_gravity.cpp b/Source/gravity/Castro_gravity.cpp index bf9dc4f6b7..395e0e675e 100644 --- a/Source/gravity/Castro_gravity.cpp +++ b/Source/gravity/Castro_gravity.cpp @@ -122,15 +122,17 @@ Castro::construct_old_gravity (Real time) if (verbose > 0) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_old_gravity() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_old_gravity() time = " << run_time << " on level " + << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif @@ -278,15 +280,17 @@ Castro::construct_new_gravity (Real time) if (verbose > 0) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_new_gravity() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_new_gravity() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif @@ -431,14 +435,16 @@ void Castro::construct_old_gravity_source(MultiFab& source, MultiFab& state_in, if (castro::verbose > 1) { const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_old_gravity_source() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_old_gravity_source() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif @@ -667,15 +673,17 @@ void Castro::construct_new_gravity_source(MultiFab& source, MultiFab& state_old, if (castro::verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_new_gravity_source() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_new_gravity_source() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif diff --git a/Source/gravity/Gravity.cpp b/Source/gravity/Gravity.cpp index 72a2565935..18eebefbfc 100644 --- a/Source/gravity/Gravity.cpp +++ b/Source/gravity/Gravity.cpp @@ -457,13 +457,15 @@ Gravity::solve_for_phi (int level, if (gravity::verbose) { const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real end = ParallelDescriptor::second() - strt; + amrex::Real end = ParallelDescriptor::second() - strt; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(end,IOProc); - amrex::Print() << "Gravity::solve_for_phi() time = " << end << " on level " << level << std::endl << std::endl; + amrex::Print() << "Gravity::solve_for_phi() time = " << end << " on level " + << llevel << std::endl << std::endl; #ifdef BL_LAZY }); #endif diff --git a/Source/hydro/Castro_ctu_hydro.cpp b/Source/hydro/Castro_ctu_hydro.cpp index 68c93bf857..d443bbe060 100644 --- a/Source/hydro/Castro_ctu_hydro.cpp +++ b/Source/hydro/Castro_ctu_hydro.cpp @@ -1419,12 +1419,13 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co #ifdef RADIATION if (radiation->verbose>=1) { + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceIntMax(nstep_fsp, ParallelDescriptor::IOProcessorNumber()); if (ParallelDescriptor::IOProcessor() && nstep_fsp > 0) { - std::cout << "Radiation f-space advection on level " << level + std::cout << "Radiation f-space advection on level " << llevel << " takes as many as " << nstep_fsp; if (nstep_fsp == 1) { std::cout<< " substep.\n"; @@ -1482,15 +1483,17 @@ Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-co if (verbose > 0) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_ctu_hydro_source() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_ctu_hydro_source() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif diff --git a/Source/hydro/Castro_hybrid.cpp b/Source/hydro/Castro_hybrid.cpp index b1bdabc4f9..0191587b6f 100644 --- a/Source/hydro/Castro_hybrid.cpp +++ b/Source/hydro/Castro_hybrid.cpp @@ -22,8 +22,8 @@ Castro::construct_old_hybrid_source(MultiFab& source, MultiFab& state_old, Real if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { @@ -65,8 +65,8 @@ Castro::construct_new_hybrid_source(MultiFab& source, MultiFab& state_old, Multi if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { diff --git a/Source/hydro/Castro_mol_hydro.cpp b/Source/hydro/Castro_mol_hydro.cpp index 6eb352ac14..9fee21334d 100644 --- a/Source/hydro/Castro_mol_hydro.cpp +++ b/Source/hydro/Castro_mol_hydro.cpp @@ -743,8 +743,8 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update) if (verbose > 0) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { diff --git a/Source/problems/Castro_problem_source.cpp b/Source/problems/Castro_problem_source.cpp index dc4d08f575..68a48c64df 100644 --- a/Source/problems/Castro_problem_source.cpp +++ b/Source/problems/Castro_problem_source.cpp @@ -24,8 +24,8 @@ Castro::construct_old_ext_source(MultiFab& source, MultiFab& state_in, Real time if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { @@ -95,8 +95,8 @@ Castro::construct_new_ext_source(MultiFab& source, MultiFab& state_old, MultiFab if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { diff --git a/Source/reactions/Castro_react.cpp b/Source/reactions/Castro_react.cpp index ee9807dfb9..b7a422f1dd 100644 --- a/Source/reactions/Castro_react.cpp +++ b/Source/reactions/Castro_react.cpp @@ -449,14 +449,16 @@ Castro::react_state(MultiFab& s, MultiFab& r, Real time, Real dt, const int stra if (verbose > 0) { const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::react_state() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::react_state() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif @@ -852,15 +854,17 @@ Castro::react_state(Real time, Real dt) amrex::Print() << "... Leaving burner on level " << level << " after completing full timestep of burning." << std::endl << std::endl; - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time, IOProc); - amrex::Print() << "Castro::react_state() time = " << run_time << " on level " << level << std::endl << std::endl; + amrex::Print() << "Castro::react_state() time = " << run_time + << " on level " << llevel << std::endl << std::endl; #ifdef BL_LAZY }); #endif diff --git a/Source/rotation/Castro_rotation.cpp b/Source/rotation/Castro_rotation.cpp index cfc6a2edc5..9c98f878ca 100644 --- a/Source/rotation/Castro_rotation.cpp +++ b/Source/rotation/Castro_rotation.cpp @@ -34,14 +34,16 @@ Castro::construct_old_rotation_source(MultiFab& source, MultiFab& state_in, Real if (verbose > 1) { const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::construct_old_rotation_source() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::construct_old_rotation_source() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif diff --git a/Source/sources/Castro_geom.cpp b/Source/sources/Castro_geom.cpp index 282c52b3b1..e3c92732e0 100644 --- a/Source/sources/Castro_geom.cpp +++ b/Source/sources/Castro_geom.cpp @@ -33,8 +33,8 @@ Castro::construct_old_geom_source(MultiFab& source, MultiFab& state_in, Real tim if (verbose > 1) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { diff --git a/Source/sources/Castro_sources.cpp b/Source/sources/Castro_sources.cpp index 9a0be7b695..1c4981a7db 100644 --- a/Source/sources/Castro_sources.cpp +++ b/Source/sources/Castro_sources.cpp @@ -159,14 +159,16 @@ Castro::do_old_sources( if (verbose > 0) { const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::do_old_sources() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::do_old_sources() time = " << run_time + << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif @@ -242,15 +244,16 @@ Castro::do_new_sources( if (verbose > 0) { - const int IOProc = ParallelDescriptor::IOProcessorNumber(); - Real run_time = ParallelDescriptor::second() - strt_time; + const int IOProc = ParallelDescriptor::IOProcessorNumber(); + amrex::Real run_time = ParallelDescriptor::second() - strt_time; + amrex::Real llevel = level; #ifdef BL_LAZY Lazy::QueueReduction( [=] () mutable { #endif ParallelDescriptor::ReduceRealMax(run_time,IOProc); - amrex::Print() << "Castro::do_new_sources() time = " << run_time << " on level " << level << "\n" << "\n"; + amrex::Print() << "Castro::do_new_sources() time = " << run_time << " on level " << llevel << "\n" << "\n"; #ifdef BL_LAZY }); #endif From a06534aaa2aed09aabe1006291f77a2cca49f6f2 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jul 2024 14:16:09 -0400 Subject: [PATCH 07/10] initialize keep_prev_state in the Castro (#2901) --- Source/driver/Castro.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/driver/Castro.H b/Source/driver/Castro.H index b0882ec2d0..a3c6983c4a 100644 --- a/Source/driver/Castro.H +++ b/Source/driver/Castro.H @@ -1341,7 +1341,7 @@ protected: /// /// Flag for indicating that we want to save prev_state until the reflux. /// - bool keep_prev_state; + bool keep_prev_state{}; #ifdef TRUE_SDC From ae3a07148b50c996f0b57a680551e882b70f5e38 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jul 2024 17:00:12 -0400 Subject: [PATCH 08/10] clean up the artifical viscosity routines (#2934) we just need to compute divu on the face once this is prep for limiting the artifical viscosity coefficient for species conservation --- Source/hydro/advection_util.cpp | 122 +++++++++++++++++--------------- 1 file changed, 65 insertions(+), 57 deletions(-) diff --git a/Source/hydro/advection_util.cpp b/Source/hydro/advection_util.cpp index ec7505a438..095192931b 100644 --- a/Source/hydro/advection_util.cpp +++ b/Source/hydro/advection_util.cpp @@ -302,49 +302,52 @@ Castro::apply_av(const Box& bx, Real diff_coeff = difmag; - amrex::ParallelFor(bx, NUM_STATE, - [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept + amrex::ParallelFor(bx, + [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - if (n == UTEMP) { - return; - } + Real div1; + if (idir == 0) { + div1 = 0.25_rt * (div(i,j,k) + div(i,j+dg1,k) + + div(i,j,k+dg2) + div(i,j+dg1,k+dg2)); + } else if (idir == 1) { + div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + + div(i,j,k+dg2) + div(i+1,j,k+dg2)); + } else { + div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + + div(i,j+dg1,k) + div(i+1,j+dg1,k)); + } + + div1 = diff_coeff * std::min(0.0_rt, div1); + + for (int n = 0; n < NUM_STATE; ++n) { + + if (n == UTEMP) { + continue; + } #ifdef SHOCK_VAR - if (n == USHK) { - return; - } + if (n == USHK) { + continue; + } #endif - #ifdef NSE_NET - if (n == UMUP || n == UMUN) { - return; - } + if (n == UMUP || n == UMUN) { + continue; + } #endif - Real div1; - if (idir == 0) { - div1 = 0.25_rt * (div(i,j,k) + div(i,j+dg1,k) + - div(i,j,k+dg2) + div(i,j+dg1,k+dg2)); - div1 = diff_coeff * amrex::min(0.0_rt, div1); - div1 = div1 * (uin(i,j,k,n) - uin(i-1,j,k,n)); - - } else if (idir == 1) { - - div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + - div(i,j,k+dg2) + div(i+1,j,k+dg2)); - div1 = diff_coeff * amrex::min(0.0_rt, div1); - div1 = div1 * (uin(i,j,k,n) - uin(i,j-dg1,k,n)); - - } else { + Real div_var{}; - div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + - div(i,j+dg1,k) + div(i+1,j+dg1,k)); - div1 = diff_coeff * amrex::min(0.0_rt, div1); - div1 = div1 * (uin(i,j,k,n) - uin(i,j,k-dg2,n)); + if (idir == 0) { + div_var = div1 * (uin(i,j,k,n) - uin(i-1,j,k,n)); + } else if (idir == 1) { + div_var = div1 * (uin(i,j,k,n) - uin(i,j-dg1,k,n)); + } else { + div_var = div1 * (uin(i,j,k,n) - uin(i,j,k-dg2,n)); + } - } - - flux(i,j,k,n) += dx[idir] * div1; + flux(i,j,k,n) += dx[idir] * div_var; + } }); } @@ -359,37 +362,42 @@ Castro::apply_av_rad(const Box& bx, const auto dx = geom.CellSizeArray(); - Real diff_coeff = difmag; - - amrex::ParallelFor(bx, Radiation::nGroups, - [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept - { + amrex::Real diff_coeff = difmag; - Real div1; - if (idir == 0) { + int ngroups = Radiation::nGroups; - div1 = 0.25_rt * (div(i,j,k) + div(i,j+dg1,k) + - div(i,j,k+dg2) + div(i,j+dg1,k+dg2)); - div1 = diff_coeff * amrex::min(0.0_rt, div1); - div1 = div1 * (Erin(i,j,k,n) - Erin(i-1,j,k,n)); + amrex::ParallelFor(bx, + [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept + { - } else if (idir == 1) { + Real div1; + if (idir == 0) { + div1 = 0.25_rt * (div(i,j,k) + div(i,j+dg1,k) + + div(i,j,k+dg2) + div(i,j+dg1,k+dg2)); + } else if (idir == 1) { + div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + + div(i,j,k+dg2) + div(i+1,j,k+dg2)); + } else { + div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + + div(i,j+dg1,k) + div(i+1,j+dg1,k)); + } - div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + - div(i,j,k+dg2) + div(i+1,j,k+dg2)); - div1 = diff_coeff * amrex::min(0.0_rt, div1); - div1 = div1 * (Erin(i,j,k,n) - Erin(i,j-dg1,k,n)); + div1 = diff_coeff * std::min(0.0_rt, div1); - } else { + for (int n = 0; n < ngroups; ++n) { - div1 = 0.25_rt * (div(i,j,k) + div(i+1,j,k) + - div(i,j+dg1,k) + div(i+1,j+dg1,k)); - div1 = diff_coeff * amrex::min(0.0_rt, div1); - div1 = div1 * (Erin(i,j,k,n) - Erin(i,j,k-dg2,n)); + Real div_var{}; - } + if (idir == 0) { + div_var = div1 * (Erin(i,j,k,n) - Erin(i-1,j,k,n)); + } else if (idir == 1) { + div_var = div1 * (Erin(i,j,k,n) - Erin(i,j-dg1,k,n)); + } else { + div_var = div1 * (Erin(i,j,k,n) - Erin(i,j,k-dg2,n)); + } - radflux(i,j,k,n) += dx[idir] * div1; + radflux(i,j,k,n) += dx[idir] * div_var; + } }); } #endif From dbc6f6b138f37eaf1294e0c63d9da8074dec6ed5 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Sun, 28 Jul 2024 17:04:21 -0400 Subject: [PATCH 09/10] make allow_non_unit_aspect_zones bool instead of int (#2936) --- Source/driver/_cpp_parameters | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/driver/_cpp_parameters b/Source/driver/_cpp_parameters index f5cdc29bd3..44f78e6ebf 100644 --- a/Source/driver/_cpp_parameters +++ b/Source/driver/_cpp_parameters @@ -29,7 +29,7 @@ update_sources_after_reflux bool 1 # Castro was originally written assuming dx = dy = dz. This assumption is # enforced at runtime. Setting allow_non_unit_aspect_zones = 1 opts out. -allow_non_unit_aspect_zones int 0 +allow_non_unit_aspect_zones bool 0 #----------------------------------------------------------------------------- From c7c6acad23cdd19edf00a59d005c1eba76ae74d7 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 29 Jul 2024 18:53:52 -0400 Subject: [PATCH 10/10] fix compilation issues due to EOS namespace (#2938) --- Exec/hydro_tests/Noh/problem_bc_fill.H | 2 +- .../RT/problem_initialize_state_data.H | 8 ++++---- .../Vortices_LWAcoustics/problem_initialize.H | 4 ++-- .../problem_initialize_state_data.H | 2 +- .../problem_initialize_state_data.H | 4 ++-- .../gamma_law_bubble/Problem_Derive.cpp | 4 ++-- .../hydro_tests/gamma_law_bubble/initial_model.H | 4 ++-- Exec/hydro_tests/gamma_law_bubble/prob_util.H | 4 ++-- .../riemann_2d/problem_initialize_state_data.H | 16 ++++++++-------- .../mhd_tests/RT/problem_initialize_state_data.H | 9 ++++----- 10 files changed, 28 insertions(+), 29 deletions(-) diff --git a/Exec/hydro_tests/Noh/problem_bc_fill.H b/Exec/hydro_tests/Noh/problem_bc_fill.H index 3a6470744f..ea58ac7f35 100644 --- a/Exec/hydro_tests/Noh/problem_bc_fill.H +++ b/Exec/hydro_tests/Noh/problem_bc_fill.H @@ -29,7 +29,7 @@ void problem_bc_fill(int i, int j, int k, eos_t zone_state; zone_state.rho = rho_init * std::pow(1.0_rt + time / r, AMREX_SPACEDIM - 1); - zone_state.p = pres_init * std::pow(zone_state.rho / rho_init, 1.0_rt + eos_gamma); + zone_state.p = pres_init * std::pow(zone_state.rho / rho_init, 1.0_rt + eos_rp::eos_gamma); for (int n = 0; n < NumSpec; ++n) { zone_state.xn[n] = 1.0_rt / static_cast(NumSpec); } diff --git a/Exec/hydro_tests/RT/problem_initialize_state_data.H b/Exec/hydro_tests/RT/problem_initialize_state_data.H index 5c76f05ba3..ef1867125e 100644 --- a/Exec/hydro_tests/RT/problem_initialize_state_data.H +++ b/Exec/hydro_tests/RT/problem_initialize_state_data.H @@ -29,13 +29,13 @@ void problem_initialize_state_data (int i, int j, int k, if (r[AMREX_SPACEDIM-1] < problem::split[AMREX_SPACEDIM-1]) { Real pres = problem::p0_base - problem::rho_1 * r[AMREX_SPACEDIM-1]; - state(i,j,k,UEDEN) = pres / (eos_gamma - 1.0_rt); - state(i,j,k,UEINT) = pres / (eos_gamma - 1.0_rt); + state(i,j,k,UEDEN) = pres / (eos_rp::eos_gamma - 1.0_rt); + state(i,j,k,UEINT) = pres / (eos_rp::eos_gamma - 1.0_rt); } else { Real pres = presmid - problem::rho_2 * (r[AMREX_SPACEDIM-1] - problem::split[AMREX_SPACEDIM-1]); - state(i,j,k,UEDEN) = pres / (eos_gamma - 1.0_rt); - state(i,j,k,UEINT) = pres / (eos_gamma - 1.0_rt); + state(i,j,k,UEDEN) = pres / (eos_rp::eos_gamma - 1.0_rt); + state(i,j,k,UEINT) = pres / (eos_rp::eos_gamma - 1.0_rt); } Real pertheight; diff --git a/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize.H b/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize.H index fcb2e675d8..ac7925209c 100644 --- a/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize.H +++ b/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize.H @@ -13,11 +13,11 @@ void problem_initialize () // Define rho_0 - problem::rho_0 = std::pow(problem::p_ref, 1.0_rt/eos_gamma); + problem::rho_0 = std::pow(problem::p_ref, 1.0_rt/eos_rp::eos_gamma); // Define c_0 - problem::c_0 = std::sqrt(eos_gamma * problem::p_ref / problem::rho_0); + problem::c_0 = std::sqrt(eos_rp::eos_gamma * problem::p_ref / problem::rho_0); // Define r_c, radius of each vortex diff --git a/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize_state_data.H b/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize_state_data.H index 4ad9d2f6d6..19ffcbe555 100644 --- a/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize_state_data.H +++ b/Exec/hydro_tests/Vortices_LWAcoustics/problem_initialize_state_data.H @@ -60,7 +60,7 @@ void problem_initialize_state_data (int i, int j, int k, // internal energy - state(i,j,k,UEINT) = problem::p_ref / (eos_gamma - 1.0_rt); + state(i,j,k,UEINT) = problem::p_ref / (eos_rp::eos_gamma - 1.0_rt); // Total energy diff --git a/Exec/hydro_tests/acoustic_pulse/problem_initialize_state_data.H b/Exec/hydro_tests/acoustic_pulse/problem_initialize_state_data.H index 6ea18ace62..d63c4a8ffc 100644 --- a/Exec/hydro_tests/acoustic_pulse/problem_initialize_state_data.H +++ b/Exec/hydro_tests/acoustic_pulse/problem_initialize_state_data.H @@ -60,8 +60,8 @@ void problem_initialize_state_data (int i, int j, int k, state(i,j,k,UMZ) = 0.0_rt; // we are isentropic, so p = (dens/rho0)**Gamma_1 - Real p = std::pow(state(i,j,k,URHO) / problem::rho0, eos_gamma); - Real eint = p / (eos_gamma - 1.0_rt); + Real p = std::pow(state(i,j,k,URHO) / problem::rho0, eos_rp::eos_gamma); + Real eint = p / (eos_rp::eos_gamma - 1.0_rt); state(i,j,k,UEDEN) = eint; state(i,j,k,UEINT) = eint; diff --git a/Exec/hydro_tests/gamma_law_bubble/Problem_Derive.cpp b/Exec/hydro_tests/gamma_law_bubble/Problem_Derive.cpp index 5c82caa1a8..128640929d 100644 --- a/Exec/hydro_tests/gamma_law_bubble/Problem_Derive.cpp +++ b/Exec/hydro_tests/gamma_law_bubble/Problem_Derive.cpp @@ -177,8 +177,8 @@ void ca_derrhopert(const Box& bx, FArrayBox& derfab, int dcomp, int /*ncomp*/, if (problem::do_isentropic) { Real z = static_cast(j) * dx[AMREX_SPACEDIM-1]; density[j] = problem::dens_base * - std::pow((gravity::const_grav * problem::dens_base * (eos_gamma - 1.0_rt) * z/ - (eos_gamma * problem::pres_base) + 1.0_rt), 1.0_rt/(eos_gamma - 1.0_rt)); + std::pow((gravity::const_grav * problem::dens_base * (eos_rp::eos_gamma - 1.0_rt) * z/ + (eos_rp::eos_gamma * problem::pres_base) + 1.0_rt), 1.0_rt/(eos_rp::eos_gamma - 1.0_rt)); } else { Real z = (static_cast(j) + 0.5_rt) * dx[AMREX_SPACEDIM-1]; density[j] = problem::dens_base * std::exp(-z/H); diff --git a/Exec/hydro_tests/gamma_law_bubble/initial_model.H b/Exec/hydro_tests/gamma_law_bubble/initial_model.H index 2ab295d96b..1335d8414d 100644 --- a/Exec/hydro_tests/gamma_law_bubble/initial_model.H +++ b/Exec/hydro_tests/gamma_law_bubble/initial_model.H @@ -66,8 +66,8 @@ generate_initial_model(const int npts_model, const Real xmin, const Real xmax, density = model_params.dens_base * std::pow(gravity::const_grav * model_params.dens_base * - (eos_gamma - 1.0) * z / - (eos_gamma * model_params.p_base) + 1.0_rt, 1.0_rt/(eos_gamma - 1.0_rt)); + (eos_rp::eos_gamma - 1.0) * z / + (eos_rp::eos_gamma * model_params.p_base) + 1.0_rt, 1.0_rt/(eos_rp::eos_gamma - 1.0_rt)); } else { Real z = xmin + (static_cast(i) + 0.5_rt) * dx; diff --git a/Exec/hydro_tests/gamma_law_bubble/prob_util.H b/Exec/hydro_tests/gamma_law_bubble/prob_util.H index 96c0ebd21c..b67f2182c5 100644 --- a/Exec/hydro_tests/gamma_law_bubble/prob_util.H +++ b/Exec/hydro_tests/gamma_law_bubble/prob_util.H @@ -29,8 +29,8 @@ gamma_law_initial_model(Real* const pressure, Real* const density, Real* const t if (problem::do_isentropic) { Real z = static_cast(j) * dx[AMREX_SPACEDIM-1]; density[j] = problem::dens_base * - std::pow((gravity::const_grav * problem::dens_base * (eos_gamma - 1.0_rt) * z/ - (eos_gamma * problem::pres_base) + 1.0_rt), 1.0_rt/(eos_gamma - 1.0_rt)); + std::pow((gravity::const_grav * problem::dens_base * (eos_rp::eos_gamma - 1.0_rt) * z/ + (eos_rp::eos_gamma * problem::pres_base) + 1.0_rt), 1.0_rt/(eos_rp::eos_gamma - 1.0_rt)); } else { Real z = (static_cast(j) + 0.5_rt) * dx[AMREX_SPACEDIM-1]; density[j] = problem::dens_base * std::exp(-z/H); diff --git a/Exec/hydro_tests/riemann_2d/problem_initialize_state_data.H b/Exec/hydro_tests/riemann_2d/problem_initialize_state_data.H index 95cc0b33f4..7f33ea2373 100644 --- a/Exec/hydro_tests/riemann_2d/problem_initialize_state_data.H +++ b/Exec/hydro_tests/riemann_2d/problem_initialize_state_data.H @@ -54,8 +54,8 @@ void problem_initialize_state_data(int i, int j, int k, state(i, j, k, UMX) = state(i, j, k, URHO) * problem::ux_3; state(i, j, k, UMY) = state(i, j, k, URHO) * problem::uy_3; - state(i, j, k, UEINT) = problem::p_3 / (eos_gamma - 1.0_rt); - state(i, j, k, UEDEN) = problem::p_3 / (eos_gamma - 1.0_rt) + state(i, j, k, UEINT) = problem::p_3 / (eos_rp::eos_gamma - 1.0_rt); + state(i, j, k, UEDEN) = problem::p_3 / (eos_rp::eos_gamma - 1.0_rt) + 0.5 * problem::rho_3 * problem::ux_3 * problem::ux_3 + 0.5 * problem::rho_3 * problem::uy_3 * problem::uy_3; @@ -66,9 +66,9 @@ void problem_initialize_state_data(int i, int j, int k, state(i, j, k, UMX) = state(i, j, k, URHO) * problem::ux_4; state(i, j, k, UMY) = state(i, j, k, URHO) * problem::uy_4; - state(i, j, k, UEINT) = problem::p_4 / (eos_gamma - 1.0_rt); + state(i, j, k, UEINT) = problem::p_4 / (eos_rp::eos_gamma - 1.0_rt); - state(i, j, k, UEDEN) = problem::p_4 / (eos_gamma - 1.0_rt) + state(i, j, k, UEDEN) = problem::p_4 / (eos_rp::eos_gamma - 1.0_rt) + 0.5 * problem::rho_4 * problem::ux_4 * problem::ux_4 + 0.5 * problem::rho_4 * problem::uy_4 * problem::uy_4; @@ -79,9 +79,9 @@ void problem_initialize_state_data(int i, int j, int k, state(i, j, k, UMX) = state(i, j, k, URHO) * problem::ux_2; state(i, j, k, UMY) = state(i, j, k, URHO) * problem::uy_2; - state(i, j, k, UEINT) = problem::p_2 / (eos_gamma - 1.0_rt); + state(i, j, k, UEINT) = problem::p_2 / (eos_rp::eos_gamma - 1.0_rt); - state(i, j, k, UEDEN) = problem::p_2 / (eos_gamma - 1.0_rt) + state(i, j, k, UEDEN) = problem::p_2 / (eos_rp::eos_gamma - 1.0_rt) + 0.5 * problem::rho_2 * problem::ux_2 * problem::ux_2 + 0.5 * problem::rho_2 * problem::uy_2 * problem::uy_2; } else if (xx > problem::center[0] & yy > problem::center[1]) @@ -91,9 +91,9 @@ void problem_initialize_state_data(int i, int j, int k, state(i, j, k, UMX) = state(i, j, k, URHO) * problem::ux_1; state(i, j, k, UMY) = state(i, j, k, URHO) * problem::uy_1; - state(i, j, k, UEINT) = problem::p_1 / (eos_gamma - 1.0_rt); + state(i, j, k, UEINT) = problem::p_1 / (eos_rp::eos_gamma - 1.0_rt); - state(i, j, k, UEDEN) = problem::p_1 / (eos_gamma - 1.0_rt) + state(i, j, k, UEDEN) = problem::p_1 / (eos_rp::eos_gamma - 1.0_rt) + 0.5 * problem::rho_1 * problem::ux_1 * problem::ux_1 + 0.5 * problem::rho_1 * problem::uy_1 * problem::uy_1; } diff --git a/Exec/mhd_tests/RT/problem_initialize_state_data.H b/Exec/mhd_tests/RT/problem_initialize_state_data.H index bb0aed8046..ee35b672b8 100644 --- a/Exec/mhd_tests/RT/problem_initialize_state_data.H +++ b/Exec/mhd_tests/RT/problem_initialize_state_data.H @@ -29,12 +29,12 @@ void problem_initialize_state_data (int i, int j, int k, Real pres; if (r[AMREX_SPACEDIM-1] < problem::split[AMREX_SPACEDIM-1]) { pres = problem::p0_base - problem::rho_1 * r[AMREX_SPACEDIM-1]; - state(i,j,k,UEDEN) = pres / (eos_gamma - 1.0_rt); - state(i,j,k,UEINT) = pres / (eos_gamma - 1.0_rt); + state(i,j,k,UEDEN) = pres / (eos_rp::eos_gamma - 1.0_rt); + state(i,j,k,UEINT) = pres / (eos_rp::eos_gamma - 1.0_rt); } else { pres = presmid - problem::rho_2 * (r[AMREX_SPACEDIM-1] - problem::split[AMREX_SPACEDIM-1]); - state(i,j,k,UEDEN) = pres / (eos_gamma - 1.0_rt); - state(i,j,k,UEINT) = pres / (eos_gamma - 1.0_rt); + state(i,j,k,UEDEN) = pres / (eos_rp::eos_gamma - 1.0_rt); + state(i,j,k,UEINT) = pres / (eos_rp::eos_gamma - 1.0_rt); } // doing it similar to 2d, will be something in x-z though @@ -61,4 +61,3 @@ void problem_initialize_state_data (int i, int j, int k, } #endif -