tem_restart_closeWrite Subroutine

public subroutine tem_restart_closeWrite(me, tree, timing, varSys, subTree)

Complete a number of empty writes (due to higher amount of mpi_file_writes from other processes to finalize the write process), close the restart dump file and write the last header.

Arguments

Type IntentOptional Attributes Name
type(tem_restart_type) :: me

the restart information

type(treelmesh_type) :: tree

mesh, provided in treelm format

type(tem_time_type), intent(in) :: timing

The timing object holding the simulation time

type(tem_varSys_type), intent(in) :: varSys

global variable system defined in solver

type(tem_subTree_type), optional :: subTree

optional subTree of given tree


Calls

proc~~tem_restart_closewrite~~CallsGraph proc~tem_restart_closewrite tem_restart_closeWrite mpi_barrier mpi_barrier proc~tem_restart_closewrite->mpi_barrier mpi_file_close mpi_file_close proc~tem_restart_closewrite->mpi_file_close proc~tem_restart_writeheader tem_restart_writeHeader proc~tem_restart_closewrite->proc~tem_restart_writeheader proc~check_mpi_error check_mpi_error proc~tem_restart_closewrite->proc~check_mpi_error proc~tem_restart_writedata tem_restart_writeData proc~tem_restart_closewrite->proc~tem_restart_writedata proc~aot_out_open_table aot_out_open_table proc~tem_restart_writeheader->proc~aot_out_open_table proc~tem_mesh_out tem_mesh_out proc~tem_restart_writeheader->proc~tem_mesh_out proc~aot_out_close_table aot_out_close_table proc~tem_restart_writeheader->proc~aot_out_close_table proc~aot_out_close aot_out_close proc~tem_restart_writeheader->proc~aot_out_close proc~newunit newunit proc~tem_restart_writeheader->proc~newunit proc~tem_open tem_open proc~tem_restart_writeheader->proc~tem_open proc~aot_out_val aot_out_val proc~tem_restart_writeheader->proc~aot_out_val proc~aot_out_open aot_out_open proc~tem_restart_writeheader->proc~aot_out_open proc~tem_time_out tem_time_out proc~tem_restart_writeheader->proc~tem_time_out interface~tem_varsys_out tem_varSys_out proc~tem_restart_writeheader->interface~tem_varsys_out mpi_error_string mpi_error_string proc~check_mpi_error->mpi_error_string proc~tem_abort tem_abort proc~check_mpi_error->proc~tem_abort proc~tem_restart_writedata->proc~check_mpi_error mpi_file_write_all mpi_file_write_all proc~tem_restart_writedata->mpi_file_write_all proc~tem_mesh_out->proc~aot_out_open_table proc~tem_mesh_out->proc~aot_out_close_table proc~tem_mesh_out->proc~aot_out_val proc~tem_open->proc~newunit proc~tem_open->proc~tem_abort proc~upper_to_lower upper_to_lower proc~tem_open->proc~upper_to_lower proc~tem_time_out->proc~aot_out_open_table proc~tem_time_out->proc~aot_out_close_table proc~tem_time_out->proc~aot_out_val proc~tem_varsys_out_single tem_varSys_out_single interface~tem_varsys_out->proc~tem_varsys_out_single proc~tem_varsys_out_vector tem_varSys_out_vector interface~tem_varsys_out->proc~tem_varsys_out_vector mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~tem_varsys_out_single->proc~aot_out_open_table proc~tem_varsys_out_single->proc~aot_out_close_table proc~tem_varsys_out_single->proc~aot_out_val proc~tem_varsys_out_vector->proc~aot_out_open_table proc~tem_varsys_out_vector->proc~aot_out_close_table proc~tem_varsys_out_vector->proc~tem_varsys_out_single

Called by

proc~~tem_restart_closewrite~~CalledByGraph proc~tem_restart_closewrite tem_restart_closeWrite proc~hvs_output_close hvs_output_close proc~hvs_output_close->proc~tem_restart_closewrite proc~tem_tracker tem_tracker proc~tem_tracker->proc~hvs_output_close

Contents


Source Code

  subroutine tem_restart_closeWrite( me, tree, timing, varSys, subTree )
    ! -------------------------------------------------------------------- !
    !> the restart information
    type(tem_restart_type) :: me
    !> mesh, provided in treelm format
    type(treelmesh_type) :: tree
    !> The timing object holding the simulation time
    type(tem_time_type), intent(in) :: timing
    !> global variable system defined in solver
    type(tem_varSys_type), intent(in) :: varSys
    !> optional subTree of given tree
    type(tem_subTree_type), optional :: subTree
    ! -------------------------------------------------------------------- !
    ! variables to catch possible MPI I/O errors
    integer :: iError
    integer :: iChunk ! chunk counter
    ! temporary buffer array for empty writes
    real(kind=rk) :: chunk(1)
    ! -------------------------------------------------------------------- !
    ! Check, if the number of calls to mpi_file_write_all corresponds to
    ! the maximum number throughout all processes
    ! if local process has performed less writes, we need to complete
    ! as many empty writes as the difference to maxnChunks
    me%nChunkElems = 0
    do iChunk = me%write_file%nChunks+1, me%write_file%maxnChunks
      call tem_restart_writeData( restart = me, chunk = chunk )
    end do

    ! now close the binary file
    call MPI_File_close(me%binaryUnit, iError)
    call check_mpi_error( iError,'File close in tem_restart_closeWrite')
    call MPI_Barrier( me%comm%comm, iError )

    ! Now write out the 'last' header which points to the last successful
    ! restart file.
    call tem_restart_writeHeader( me         = me,      &
      &                           tree       = tree,    &
      &                           subTree    = subTree, &
      &                           timing     = timing,  &
      &                           varSys     = varSys,  &
      &                           lastHeader = .true.   )

  end subroutine tem_restart_closeWrite