Update the simulation clock
It is sometimes useful to know what the simulation time is at every iteration so that a comparison with an analytical solution is possible. Since, the global timesteps used may not be uniform, we need to track this explicitly.
Of course, it makes sense to track this only if the time stepping is global and not local. If the time stepping is local, the simulation clock is set to -1. If it is global it is incremented according to the time step found.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(1:dims%imx-1, 1:dims%jmx-1, 1:dims%kmx-1) | :: | delta_t | Local time increment value at each cell center |
|
type(schemetype), | intent(in) | :: | scheme | finite-volume Schemes: time stepping methods |
||
type(extent), | intent(in) | :: | dims | Extent of the domain:imx,jmx,kmx |
subroutine update_simulation_clock(delta_t, scheme, dims)
!< Update the simulation clock
!<
!< It is sometimes useful to know what the simulation time is
!< at every iteration so that a comparison with an analytical
!< solution is possible. Since, the global timesteps used may
!< not be uniform, we need to track this explicitly.
!<
!< Of course, it makes sense to track this only if the time
!< stepping is global and not local. If the time stepping is
!< local, the simulation clock is set to -1. If it is global
!< it is incremented according to the time step found.
!-----------------------------------------------------------
implicit none
type(extent), intent(in) :: dims
!< Extent of the domain:imx,jmx,kmx
type(schemetype), intent(in) :: scheme
!< finite-volume Schemes: time stepping methods
real(wp) , dimension(1:dims%imx-1, 1:dims%jmx-1, 1:dims%kmx-1), intent(in) :: delta_t
!< Local time increment value at each cell center
if (scheme%time_stepping_method .eq. 'g' .and. sim_clock >= 0.) then
sim_clock = sim_clock + minval(delta_t)
else if (scheme%time_stepping_method .eq. 'l') then
sim_clock = -1
end if
end subroutine update_simulation_clock