Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/simulation/m_sim_helpers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,17 @@ contains
if (grid_geometry == 3) then
fltr_dtheta = f_compute_filtered_dtheta(k, l)
vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) &
/minval(1/(rho*Re_l))
/maxval(1/(rho*Re_l))
Comment on lines 279 to +280
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Prevent a potential division-by-zero error by adding a small epsilon value to the denominator rho*Re_l inside the maxval function call. [possible issue, importance: 8]

Suggested change
vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) &
/minval(1/(rho*Re_l))
/maxval(1/(rho*Re_l))
vcfl_dt = cfl_target*(min(dx(j), dy(k), fltr_dtheta)**2._wp) &
/maxval(1/(rho*Re_l + epsilon(0.0_wp)))

else
vcfl_dt = cfl_target*(min(dx(j), dy(k), dz(l))**2._wp) &
/minval(1/(rho*Re_l))
/maxval(1/(rho*Re_l))
end if
elseif (n > 0) then
!2D
vcfl_dt = cfl_target*(min(dx(j), dy(k))**2._wp)/maxval((1/Re_l)/rho)
else
!1D
vcfl_dt = cfl_target*(dx(j)**2._wp)/minval(1/(rho*Re_l))
vcfl_dt = cfl_target*(dx(j)**2._wp)/maxval(1/(rho*Re_l))
end if
end if

Expand Down
Loading