SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
close_fileout_ol.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE close_fileout_ol
7 ! #######################################################
8 !!**** *CLOSE_FILEOUT_OL* - closes netcdf files writen by surface
9 !!
10 !! PURPOSE
11 !! -------
12 !!
13 !!** METHOD
14 !! ------
15 !!
16 !! EXTERNAL
17 !! --------
18 !!
19 !!
20 !! IMPLICIT ARGUMENTS
21 !! ------------------
22 !!
23 !! REFERENCE
24 !! ---------
25 !!
26 !!
27 !! AUTHOR
28 !! ------
29 !! S. Faroux *Meteo France*
30 !!
31 !! MODIFICATIONS
32 !! -------------
33 !! Original 06/2010
34 !-------------------------------------------------------------------------------
35 !
36 USE modd_surfex_mpi, ONLY : nrank, npio
37 !
38 USE modd_ol_fileid, ONLY: xid_surf, xid_nature, xid_water, xid_sea, xid_town
39 !
40 !* 0. DECLARATIONS
41 ! ------------
42 !
43 USE yomhook ,ONLY : lhook, dr_hook
44 USE parkind1 ,ONLY : jprb
45 !
46 IMPLICIT NONE
47 include "netcdf.inc"
48 
49 REAL(KIND=JPRB) :: zhook_handle
50 
51 IF (lhook) CALL dr_hook('CLOSE_FILEOUT_OL',0,zhook_handle)
52 !
53 IF (nrank==npio) THEN
54 !$OMP SINGLE
55  IF (ASSOCIATED(xid_surf)) CALL close_each_file(xid_surf)
56  IF (ASSOCIATED(xid_nature)) CALL close_each_file(xid_nature)
57  IF (ASSOCIATED(xid_sea)) CALL close_each_file(xid_sea)
58  IF (ASSOCIATED(xid_water)) CALL close_each_file(xid_water)
59  IF (ASSOCIATED(xid_town)) CALL close_each_file(xid_town)
60 !$OMP END SINGLE
61 ENDIF
62 !
63 IF (lhook) CALL dr_hook('CLOSE_FILEOUT_OL',1,zhook_handle)
64  CONTAINS
65 
66 !-----------------------------------------------
67 
68 SUBROUTINE close_each_file(NVAR)
69 
70 IMPLICIT NONE
71 
72 INTEGER,DIMENSION(:),INTENT(IN)::nvar
73 INTEGER::jret,jj
74 REAL(KIND=JPRB) :: zhook_handle
75 
76 IF (lhook) CALL dr_hook('CLOSE_EACH_FILE',0,zhook_handle)
77 jret=nf_close(nvar(1))
78 DO jj=2,SIZE(nvar)
79  IF (nvar(jj).NE.nvar(jj-1)) THEN
80  jret=nf_close(nvar(jj))
81  ENDIF
82 ENDDO
83 IF (lhook) CALL dr_hook('CLOSE_EACH_FILE',1,zhook_handle)
84 
85 END SUBROUTINE close_each_file
86 
87 !-----------------------------------------------
88 
89 END SUBROUTINE close_fileout_ol
subroutine close_fileout_ol
subroutine close_each_file(NVAR)