@@ -14,7 +14,7 @@ module m_sim_helpers
1414
1515 implicit none
1616
17- private; public :: s_compute_enthalpy, s_compute_stability_from_dt, s_compute_dt_from_cfl
17+ private; public :: s_compute_enthalpy, s_compute_stability_from_dt, s_compute_dt_from_cfl, f_compute_multidim_cfl_terms
1818
1919contains
2020
@@ -218,19 +218,17 @@ contains
218218 end subroutine s_compute_stability_from_dt
219219
220220 !> Computes dt for a specified CFL number. When acoustic_substepping is true, icfl_dt is the per- dimension advective CFL limit
221- !! (dropping the sound speed c), and acou_dt_sf (if present) is filled with the per- cell acoustic CFL dt limit min_i
222- !! dx_i/ (|u_i|+ c) -- the SAME quantity that sets dt in the .not. acoustic_substepping path. The caller reduces acou_dt_sf with a
223- !! global MIN and divides the (already globally reduced) advective dt by cfl_target* acou_dt_min to get the substep count,
224- !! guaranteeing the acoustic microstep CFL (|u_i|+ c)* dtau/ dx_i <= cfl_target everywhere (see s_compute_dt).
225- subroutine s_compute_dt_from_cfl (vel , c , max_dt , rho , Re_l , j , k , l , acou_dt_sf , acoustic_sub )
221+ !! (dropping the sound speed c); the caller (s_compute_dt) separately fills acou_dt_sf with the per- cell acoustic CFL dt limit
222+ !! min_i dx_i/ (|u_i|+ c) inline (keeping a single 3 - D array, max_dt, in this routine' s signature). Only the scalar acoustic_sub
223+ !! selects the advective-vs-acoustic inviscid speed here.
224+ subroutine s_compute_dt_from_cfl(vel, c, max_dt, rho, Re_l, j, k, l, acoustic_sub)
226225
227226 $:GPU_ROUTINE(parallelism=' [seq]' )
228227 real(wp), dimension(num_vels), intent(in) :: vel
229228 real(wp), intent(in) :: c, rho
230229 real(wp), dimension(0:m,0:n,0:p), intent(inout) :: max_dt
231230 real(wp), dimension(2), intent(in) :: Re_l
232231 integer, intent(in) :: j, k, l
233- real (wp), dimension (0 :m,0 :n,0 :p), intent (inout ) :: acou_dt_sf
234232 ! Passed by value (not read from the module) so this `acc routine seq` does not require the
235233 ! acoustic_substepping module variable to be in `acc declare create` (nvfortran W-1054 -> nvlink undefined ref).
236234 logical, intent(in) :: acoustic_sub
@@ -250,17 +248,6 @@ contains
250248 adv_speed = sum(abs(vel(1:num_vels)))
251249 icfl_dt = cfl_target*(dx(j)/max(adv_speed, sgm_eps))
252250 end if
253- if (acoustic_sub) then
254- ! Per- cell acoustic CFL dt limit min_i dx_i/ (|u_i|+ c). The caller reduces this with a GLOBAL MIN
255- ! (NOT a per- cell ratio with the advective dt -- that would blow up at near- stagnation cells, where
256- ! adv_dt is huge but the cell does not limit dt). Using independently reduced minima of the advective
257- ! and acoustic dt limits is what makes n_substeps the correct field- wide microstep count.
258- if (p > 0 .or. n > 0 ) then
259- acou_dt_sf(j, k, l) = f_compute_multidim_cfl_terms(vel, c, j, k, l)
260- else
261- acou_dt_sf(j, k, l) = dx(j)/ (abs (vel(1 )) + c)
262- end if
263- end if
264251 else
265252 if (p > 0 .or. n > 0) then
266253 ! 2D/3D cases
0 commit comments