From 66a8b4a8c13717f08a9a609587764ea4feeff50a Mon Sep 17 00:00:00 2001 From: SamG-01 <103982805+SamG-01@users.noreply.github.com> Date: Sun, 19 Jan 2025 09:10:50 -0500 Subject: [PATCH 1/2] Implement Debye Huckel Screening (#1688) Implements weak screening as per equation A1 of Chugunov 2009 (see below). Also adds an optional check against debye_huckel and computes the full screening factor if the check exceeds a supplied threshold, which can significantly improve runtimes (disabled by default). --- screening/_parameters | 2 ++ screening/screen.H | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/screening/_parameters b/screening/_parameters index ca5a6b79d1..672c0a9a41 100644 --- a/screening/_parameters +++ b/screening/_parameters @@ -1,3 +1,5 @@ @namespace: screening enable_chabrier1998_quantum_corr bool 0 +enable_debye_huckel_skip bool 0 +debye_huckel_skip_threshold real 1.01e0 diff --git a/screening/screen.H b/screening/screen.H index ffeacc374f..54999aaddf 100644 --- a/screening/screen.H +++ b/screening/screen.H @@ -7,6 +7,7 @@ #define SCREEN_METHOD_chugunov2007 2 #define SCREEN_METHOD_chugunov2009 3 #define SCREEN_METHOD_chabrier1998 4 +#define SCREEN_METHOD_debye_huckel 5 #include #include @@ -152,6 +153,33 @@ fill_plasma_state(plasma_state_t& state, const number_t& temp, state.gamma_e_fac = gamma_e_constants * std::cbrt(state.n_e); } +template +AMREX_GPU_HOST_DEVICE AMREX_INLINE +number_t debye_huckel (const plasma_state_t& state, + const scrn::screen_factors_t& scn_fac) +{ + // Calculates the Debye-Huckel enhancement factor for weak Coloumb coupling, + // as listed in the Appendix of Chugunov and DeWitt 2009, PhRvC, 80, 014611 + + // input: + // state = plasma state (T, rho, abar, zbar, etc.) + // scn_fac = screening factors for A and Z + + amrex::Real z1z2 = scn_fac.z1 * scn_fac.z2; + amrex::Real z_ratio = state.z2bar / state.zbar; + + // Gamma_e from eq. 6 + number_t Gamma_e = state.gamma_e_fac / state.temp; + + // eq. A1 + number_t h_DH = z1z2 * admath::sqrt(3 * amrex::Math::powi<3>(Gamma_e) * z_ratio); + + // machine limit the output + constexpr amrex::Real h_max = 300.e0_rt; + number_t h = admath::min(h_DH, h_max); + return admath::exp(h); +} + #if SCREEN_METHOD == SCREEN_METHOD_screen5 template AMREX_GPU_HOST_DEVICE AMREX_INLINE @@ -620,11 +648,20 @@ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE number_t actual_screen(const plasma_state_t& state, const scrn::screen_factors_t& scn_fac) { - number_t scor; + number_t scor = 1.0_rt; #if SCREEN_METHOD == SCREEN_METHOD_null // null screening amrex::ignore_unused(state, scn_fac); - scor = 1.0_rt; + return scor; +#endif + if (screening_rp::enable_debye_huckel_skip) { + scor = debye_huckel(state, scn_fac); + if (scor <= screening_rp::debye_huckel_skip_threshold) { + return scor; + } + } +#if SCREEN_METHOD == SCREEN_METHOD_debye_huckel + scor = debye_huckel(state, scn_fac); #elif SCREEN_METHOD == SCREEN_METHOD_screen5 scor = actual_screen5(state, scn_fac); #elif SCREEN_METHOD == SCREEN_METHOD_chugunov2007 From e3b281a9b1be431d5c2f8c585f139eb60e86ae0b Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 20 Jan 2025 12:38:53 -0500 Subject: [PATCH 2/2] clean up test_react README.md + remove TODO (#1722) the timings in the README.md were very out of date and not useful anymore --- unit_test/test_react/README.md | 37 ---------------------------------- unit_test/test_react/TODO | 1 - 2 files changed, 38 deletions(-) delete mode 100644 unit_test/test_react/TODO diff --git a/unit_test/test_react/README.md b/unit_test/test_react/README.md index cada1e5784..798b024def 100644 --- a/unit_test/test_react/README.md +++ b/unit_test/test_react/README.md @@ -3,40 +3,3 @@ This is a unit test that sets up a cube of data (rho, T, and X varying along dimensions) and calls the burner on it. You can specify the integrator via `INTEGRATOR_DIR` and the network via `NETWORK_DIR` in the `GNUmakefile` - -## CPU Status - -This table summarizes tests run with gfortran. - - -| network | VODE | VODE90 | BS | Rosenbrock | -|------------------------|-------------------------|-------------------------|-------------------------|---------------| -| aprox13 | works
(6:1517:2393) | works
(6:1517:23793) | works
(126:858:4678) | crashes | -| aprox19 | works
(27:152:8127) | works
(27:152:8127) | works
(72:297:2869) | runs too long | -| triple_alpha_plus_cago | works
(6:32:1950) | works
(6:32:1950) | works
(126:148:3044) | crashes | -| ignition_chamulak | works
(6:6:28) | works
(6:6:28) | works
(144:144:153) | works (252:252:252) | - - -## Running on GPUs with VODE - -To run a GPU test with the VODE integrator and aprox13, do: - -``` -make -j COMP=PGI USE_CUDA=TRUE AMREX_USE_CUDA=TRUE USE_GPU_PRAGMA=TRUE NETWORK_DIR=aprox13 EOS_DIR=helmholtz -``` - -Tested with PGI 18.10 and CUDA 9.2.148. - -To run in a different directory, the following files are necessary to -run in addition to the executable: - -- `helm_table.dat` (will be symlinked in at compile time) -- `inputs_aprox13` -- `probin.aprox13` -- `xin.aprox13` - -Then in an interactive session, (e.g. on Summit), do: - -``` -jsrun -n 1 -a 1 -g 1 ./[executable] inputs_aprox13 -``` diff --git a/unit_test/test_react/TODO b/unit_test/test_react/TODO deleted file mode 100644 index 02ceb37947..0000000000 --- a/unit_test/test_react/TODO +++ /dev/null @@ -1 +0,0 @@ -Note: this has no OpenMP or OpenACC directives yet \ No newline at end of file