sfc_climo_gen 1.14.0
Loading...
Searching...
No Matches
utils.f90
Go to the documentation of this file.
1
4
8module utils
9
10 private
11
12 public :: netcdf_err
13 public :: error_handler
14
15 contains
16
22 subroutine netcdf_err( err, string )
23
24 use mpi
25 use netcdf
26
27 implicit none
28 integer, intent(in) :: err
29 character(len=*), intent(in) :: string
30 character(len=256) :: errmsg
31 integer :: ierr
32
33 if( err.EQ.nf90_noerr )return
34 errmsg = nf90_strerror(err)
35 print*,''
36 print*,'FATAL ERROR: ', trim(string), ': ', trim(errmsg)
37 print*,'STOP.'
38 call mpi_abort(mpi_comm_world, 999, ierr)
39
40 return
41 end subroutine netcdf_err
42
48 subroutine error_handler(string, rc)
49
50 use mpi
51
52 implicit none
53
54 character(len=*), intent(in) :: string
55
56 integer, optional, intent(in) :: rc
57
58 integer :: ierr
59
60 print*,"- FATAL ERROR: ", string
61 if (present(rc)) print*,"- IOSTAT IS: ", rc
62 call mpi_abort(mpi_comm_world, 999, ierr)
63
64 end subroutine error_handler
65
66 end module utils
Utilities.
Definition utils.f90:8
subroutine, public netcdf_err(err, string)
Handle netCDF error codes.
Definition utils.f90:23
subroutine, public error_handler(string, rc)
Handle errors.
Definition utils.f90:49