Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions src/simulation/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ module m_global_parameters
!> @{
!> @}

real(wp) :: mytime !< Current simulation time
real(wp) :: finaltime !< Final simulation time
real(wp) :: mytime !< Current simulation time
type(pres_field), allocatable, dimension(:) :: pb_ts
type(pres_field), allocatable, dimension(:) :: mv_ts

Expand Down
17 changes: 10 additions & 7 deletions src/simulation/m_start_up.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,16 +601,13 @@ contains
end if
end if

! Land exactly on t_stop. A fixed dt already lands on t_step_stop by step count; trimming it to t_step_stop*dt - mytime
! would only change the run's last dt by round-off, which a run continuing past that step does not see
if (cfl_dt) then
if ((mytime + dt) >= t_stop) then
dt = t_stop - mytime
$:GPU_UPDATE(device='[dt]')
end if
Comment thread
sbryngelson marked this conversation as resolved.
else
if ((mytime + dt) >= finaltime) then
dt = finaltime - mytime
$:GPU_UPDATE(device='[dt]')
end if
end if

if (cfl_dt) then
Expand Down Expand Up @@ -652,8 +649,14 @@ contains
call s_tvd_rk(t_step, time_avg, time_stepper)
end if

! Advance time after RK so source terms see current-step time
mytime = mytime + dt
! Advance time after RK so source terms see current-step time. With a fixed dt, use the same t_step*dt a restart
! starts from (p_main): a running sum drifts from it (1290 ulps by step 27000), so a restarted run would see the
! prescribed IB kinematics, inflow ramps and forcing at slightly different times than the run it continues
if (cfl_dt) then
mytime = mytime + dt
else
mytime = (t_step + 1)*dt
end if
Comment thread
sbryngelson marked this conversation as resolved.

if (relax) call s_infinite_relaxation_k(q_cons_ts(1)%vf)

Expand Down
16 changes: 11 additions & 5 deletions src/simulation/m_time_steppers.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ contains
if (ib) then
! check if any IBMS are moving, and if so, update the markers, ghost points, levelsets, and levelset norms
if (moving_immersed_boundary_flag) then
call s_propagate_immersed_boundaries(s)
call s_propagate_immersed_boundaries(s, t_step)
end if

! update the ghost fluid properties point values based on IB state
Expand Down Expand Up @@ -831,9 +831,9 @@ contains
end subroutine s_apply_synthetic_turbulence_force

!> Update immersed boundary positions and velocities at the current Runge-Kutta stage
subroutine s_propagate_immersed_boundaries(s)
subroutine s_propagate_immersed_boundaries(s, t_step)

integer, intent(in) :: s
integer, intent(in) :: s, t_step
integer :: i
integer :: gbl_id ! used for analytic ib patch motion
real(wp) :: t_stage ! time of the state produced by RK stage s (used by prescribed kinematics)
Expand All @@ -842,8 +842,14 @@ contains

if (moving_immersed_boundary_flag) call s_compute_ib_forces(q_prim_vf, fluid_pp)

t_stage = mytime + dt
if (time_stepper == time_stepper_rk3 .and. s == 2) t_stage = mytime + 0.5_wp*dt
if (cfl_dt) then
t_stage = mytime + dt
if (time_stepper == time_stepper_rk3 .and. s == 2) t_stage = mytime + 0.5_wp*dt
else
! The same t_step*dt form a restart evaluates the kinematics at, so a restart sees bitwise the same body
t_stage = (t_step + 1)*dt
if (time_stepper == time_stepper_rk3 .and. s == 2) t_stage = (t_step + 0.5_wp)*dt
Comment thread
sbryngelson marked this conversation as resolved.
end if

$:GPU_PARALLEL_LOOP(private='[i, gbl_id]', copyin='[s, t_stage]')
do i = 1, num_ibs
Expand Down
1 change: 0 additions & 1 deletion src/simulation/p_main.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ program p_main
else
mytime = t_step*dt
end if
finaltime = t_step_stop*dt
end if

call nvtxEndRange ! INIT
Expand Down
Loading