source: LMDZ6/branches/Amaury_dev/tools/netcdf95/nf95_abort.f90 @ 5086

Last change on this file since 5086 was 5081, checked in by abarral, 5 months ago

Commit linked to correcting relevant warnings during gfortran compilation

[minor]
Correct remnants of fixed-form "+" in massbarxy.F90
Correct COMMON alignment in clesphys.h, flux_arp.h, cv*param.h, YOECUMF.h, alpale.h
Correct obsolete logical operators
Restrict use of iso_fortran_env in nf95_abort.f90
Remove redundant save in module declarations
Remove <continue> without labels
Fix nonstandard kind selectors

File size: 1.1 KB
Line 
1module nf95_abort_m
2
3  implicit none
4
5contains
6
7  subroutine nf95_abort(message, ncerr, ncid, varid)
8
9    use, intrinsic:: iso_fortran_env, ONLY: error_unit
10
11    ! Libraries:mod_phys_lmdz_mpi_transfert
12    use lmdz_netcdf, only: nf90_strerror
13
14    use nf95_close_m, only: nf95_close
15    use nf95_inq_file_ncid_m, only: nf95_inq_file_ncid
16
17    character(len=*), intent(in):: message
18    ! (should include name of calling procedure)
19
20    integer, intent(in):: ncerr
21
22    integer, intent(in), optional :: ncid
23    ! This can be the file ncid or a group ncid. Provide this argument
24    ! if you want nf95_abort to try to close the file.
25
26    integer, intent(in), optional :: varid
27
28    ! Local:
29    integer ncid_local
30
31    !-------------------
32
33    write(error_unit, fmt = *) message, ":"
34    if (present(varid)) write(error_unit, fmt = *) "varid = ", varid
35    write(error_unit, fmt = *) trim(nf90_strerror(ncerr))
36
37    if (present(ncid)) then
38       ! Try to close, to leave the file in a consistent state:
39       call nf95_inq_file_ncid(ncid_local, ncid)
40       call nf95_close(ncid_local)
41    end if
42
43    stop 1
44
45  end subroutine nf95_abort
46
47end module nf95_abort_m
Note: See TracBrowser for help on using the repository browser.