Subroutine that loads KORC parameters that control the time stepping in main.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(KORC_PARAMS), | intent(inout) | :: | params | Core KORC simulation parameters. |
subroutine load_prev_time(params)
!! @note Subroutine that loads KORC parameters that control the time
!! stepping in [[main]].
TYPE(KORC_PARAMS), INTENT(INOUT) :: params
!! Core KORC simulation parameters.
CHARACTER(MAX_STRING_LENGTH) :: filename
!! String containing the name of the HDF5 file.
CHARACTER(MAX_STRING_LENGTH) :: dset
!! Name of data set to be read from file.
INTEGER(HID_T) :: h5file_id
!! HDF5 file identifier.
REAL(KIND=8) :: real_number
!! A temporary real number.
CHARACTER(19) :: tmp_str
!! Temporary string used to manipulate various strings.
INTEGER :: h5error
!! HDF5 error status.
INTEGER :: mpierr
!! MPI error status.
INTEGER :: ss
!! Electron species iterator.
if (params%mpi_params%rank.EQ.0_idef) then
filename = TRIM(params%path_to_outputs) // "restart_file.h5"
call h5fopen_f(filename, H5F_ACC_RDONLY_F, h5file_id, h5error)
if (h5error .EQ. -1) then
write(output_unit_write,'("KORC ERROR: Something went wrong in: &
&load_prev_time --> h5fopen_f")')
call KORC_ABORT(14)
end if
dset = "/time"
call load_from_hdf5(h5file_id,dset,params%init_time)
dset = "/num_mpi"
call load_from_hdf5(h5file_id,dset,real_number)
params%mpi_params%nmpi_prev = INT(real_number,ip)
call h5fclose_f(h5file_id, h5error)
end if
CALL MPI_BCAST(params%init_time,1,MPI_REAL8,0,MPI_COMM_WORLD,mpierr)
CALL MPI_BCAST(params%mpi_params%nmpi_prev,1,MPI_INTEGER8,0, &
MPI_COMM_WORLD,mpierr)
! Not sure why, but params%mpi_params%rank is reset to zero in the above
! call to MPI_BCAST (but not other mpi_params values). Added the following
! MPI_COMM_RANK to reintialize
call MPI_COMM_RANK(MPI_COMM_WORLD, params%mpi_params%rank, mpierr)
end subroutine load_prev_time