Timestep hook which is called at each timestep to determine whether or not to terminate timestep iterations.
92 type(model_state_type),
target,
intent(inout) :: current_state
94 integer :: ierr, file_message_status
96 if (max_timesteps .gt. 0)
then 97 current_state%continue_timestep=mod(current_state%timestep, max_timesteps) /= 0
98 if (.not. current_state%continue_timestep) current_state%termination_reason=timestep_termination_reason
100 current_state%continue_timestep=.true.
102 if (current_state%continue_timestep)
then 103 current_state%continue_timestep = current_state%time .lt. termination_time
104 if (.not. current_state%continue_timestep) current_state%termination_reason=time_termination_reason
106 if (current_state%continue_timestep .and. check_for_walltime .and. &
107 mod(current_state%timestep, check_walltime_frequency) == 0)
then 108 current_state%continue_timestep=int(mpi_wtime() - current_state%model_start_wtime) .lt. max_walltime_secs
109 call mpi_allreduce(mpi_in_place, current_state%continue_timestep, 1, mpi_logical, mpi_lor, &
110 current_state%parallel%monc_communicator, ierr)
111 if (.not. current_state%continue_timestep) current_state%termination_reason=walltime_termination_reason
114 if (current_state%continue_timestep .and. mod(current_state%timestep, check_messages_file_frequency) == 0)
then 115 if (current_state%parallel%my_rank == 0)
then 116 file_message_status=check_messages_file(current_state)
117 call mpi_bcast(file_message_status, 1, mpi_int, 0, current_state%parallel%monc_communicator, ierr)
119 call mpi_bcast(file_message_status, 1, mpi_int, 0, current_state%parallel%monc_communicator, ierr)
120 if (file_message_status == 1) current_state%continue_timestep=.false.
122 if (.not. current_state%continue_timestep) current_state%termination_reason=message_termination_reason