regrid_sfc  1.13.0
utils.F90
Go to the documentation of this file.
1 
4 
5 module utilities
6 
7 contains
8 
13  subroutine error_handler(string, rc)
14 
15  use mpi_f08
16 
17  implicit none
18 
19  character(len=*), intent(in) :: string
20 
21  integer, intent(in) :: rc
22 
23  integer :: ierr
24 
25  print*,"- FATAL ERROR: ", trim(string)
26  print*,"- IOSTAT IS: ", rc
27  call mpi_abort(mpi_comm_world, 999, ierr)
28 
29  end subroutine error_handler
30 
35  subroutine netcdf_err( err, string )
36 
37  use mpi_f08
38  use netcdf
39 
40  implicit none
41  integer, intent(in) :: err
42  character(len=*), intent(in) :: string
43  character(len=256) :: errmsg
44  integer :: iret
45 
46  if( err.EQ.nf90_noerr )return
47  errmsg = nf90_strerror(err)
48  print*,''
49  print*,'FATAL ERROR: ', trim(string), ': ', trim(errmsg)
50  print*,'STOP.'
51  call mpi_abort(mpi_comm_world, 999, iret)
52 
53  return
54  end subroutine netcdf_err
55 
56 end module utilities