Subroutine that defines or loads from restart file the time stepping parameters.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(inout) | :: | params | |||
type(FIELDS), | intent(inout) | :: | F | Core KORC simulation parameters. |
subroutine define_time_step(params,F)
!! @note Subroutine that defines or loads from restart file the time
!! stepping parameters. @endnote
TYPE(KORC_PARAMS), INTENT(INOUT) :: params
TYPE(FIELDS), INTENT(INOUT) :: F
!! Core KORC simulation parameters.
if (params%restart) then
call load_time_stepping_params(params)
else if (params%proceed.or.params%reinit) then
call load_prev_time(params)
params%ito = 1_ip
params%dt = params%dt*(2.0_rp*C_PI*params%cpp%time_r)
params%t_steps = CEILING((params%simulation_time-params%init_time)/ &
params%dt,ip)
params%output_cadence = CEILING(params%snapshot_frequency/params%dt,ip)
if (params%output_cadence.EQ.0_ip) params%output_cadence = 1_ip
params%num_snapshots = params%t_steps/params%output_cadence
if (params%t_steps.gt.params%output_cadence) then
params%dt=params%snapshot_frequency/float(params%output_cadence)
endif
params%restart_output_cadence = CEILING(params%restart_overwrite_frequency/ &
params%dt,ip)
params%t_skip=min(params%t_steps,params%output_cadence)
params%t_skip=max(1_ip,params%t_skip)
else
params%ito = 1_ip
params%dt = params%dt*(2.0_rp*C_PI*params%cpp%time_r)
params%t_steps = CEILING(params%simulation_time/params%dt,ip)
params%output_cadence = CEILING(params%snapshot_frequency/params%dt,ip)
if (params%output_cadence.EQ.0_ip) params%output_cadence = 1_ip
params%num_snapshots = params%t_steps/params%output_cadence
if (params%t_steps.gt.params%output_cadence) then
params%dt=params%snapshot_frequency/float(params%output_cadence)
endif
params%restart_output_cadence = CEILING(params%restart_overwrite_frequency/ &
params%dt,ip)
params%t_skip=min(params%t_steps,params%output_cadence)
params%t_skip=max(1_ip,params%t_skip)
end if
! write(output_unit_write,*) 'dt',params%dt,'t_skip',params%t_skip
if (params%mpi_params%rank .EQ. 0) then
write(output_unit_write,'(/,"* * * * * TIME STEPPING PARAMETERS * * * * *")')
write(output_unit_write,'("Simulation time: ",E17.10," s")') params%simulation_time
write(output_unit_write,'("Initial time: ",E17.10," s")') params%init_time
write(output_unit_write,'("Output frequency: ",E17.10," s")') params%snapshot_frequency
write(output_unit_write,'("Relativistic gyro-period: ",E17.10)') 2.0_rp*C_PI* &
params%cpp%time_r
write(output_unit_write,'("Time step: ",E17.10)') params%dt
write(output_unit_write,'("Number of time steps: ",I16)') params%t_steps
write(output_unit_write,'("Starting simulation at time step: ",I16)') params%ito
write(output_unit_write,'("Output cadence: ",I16)') params%output_cadence
write(output_unit_write,'("Restart cadence: ",I16)') params%restart_output_cadence
write(output_unit_write,'("Number of outputs: ",I16)') params%num_snapshots
write(output_unit_write,'("* * * * * * * * * * * * * * * * * * * * * * *",/)')
end if
end subroutine define_time_step