load_prev_time Subroutine

public subroutine load_prev_time(params)

Arguments

Type IntentOptional AttributesName
type(KORC_PARAMS), intent(inout) :: params

Core KORC simulation parameters.


Calls

proc~~load_prev_time~~CallsGraph proc~load_prev_time load_prev_time mpi_bcast mpi_bcast proc~load_prev_time->mpi_bcast mpi_comm_rank mpi_comm_rank proc~load_prev_time->mpi_comm_rank h5fclose_f h5fclose_f proc~load_prev_time->h5fclose_f proc~korc_abort korc_abort proc~load_prev_time->proc~korc_abort h5fopen_f h5fopen_f proc~load_prev_time->h5fopen_f interface~load_from_hdf5 load_from_hdf5 proc~load_prev_time->interface~load_from_hdf5 mpi_abort mpi_abort proc~korc_abort->mpi_abort proc~rload_from_hdf5 rload_from_hdf5 interface~load_from_hdf5->proc~rload_from_hdf5 proc~iload_from_hdf5 iload_from_hdf5 interface~load_from_hdf5->proc~iload_from_hdf5 proc~rload_from_hdf5->proc~korc_abort h5dclose_f h5dclose_f proc~rload_from_hdf5->h5dclose_f h5dread_f h5dread_f proc~rload_from_hdf5->h5dread_f proc~iload_from_hdf5->proc~korc_abort proc~iload_from_hdf5->h5dclose_f proc~iload_from_hdf5->h5dread_f

Called by

proc~~load_prev_time~~CalledByGraph proc~load_prev_time load_prev_time proc~define_time_step define_time_step proc~define_time_step->proc~load_prev_time program~main main program~main->proc~define_time_step

Contents

Source Code


Source Code

  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