Juan 13/01/2014: add header SURFEX_LIC to all SURFEX files
[MNH-git_open_source-lfs.git] / src / SURFEX / writesurf_seafluxn.F90
1 !SURFEX_LIC Copyright 1994-2014 Meteo-France 
2 !SURFEX_LIC This is part of the SURFEX software governed by the CeCILL-C  licence
3 !SURFEX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SURFEX_LIC for details. version 1.
5 !     #########
6       SUBROUTINE WRITESURF_SEAFLUX_n(HPROGRAM)
7 !     ########################################
8 !
9 !!****  *WRITE_SEAFLUX_n* - writes SEAFLUX fields
10 !!
11 !!    PURPOSE
12 !!    -------
13 !!
14 !!**  METHOD
15 !!    ------
16 !!
17 !!    EXTERNAL
18 !!    --------
19 !!
20 !!
21 !!    IMPLICIT ARGUMENTS
22 !!    ------------------
23 !!
24 !!    REFERENCE
25 !!    ---------
26 !!
27 !!
28 !!    AUTHOR
29 !!    ------
30 !!      V. Masson   *Meteo France*      
31 !!
32 !!    MODIFICATIONS
33 !!    -------------
34 !!      Original    01/2003 
35 !-------------------------------------------------------------------------------
36 !
37 !*       0.    DECLARATIONS
38 !              ------------
39 !
40 USE MODD_SEAFLUX_n,      ONLY : XSST, XZ0, TTIME,  &
41                                   LINTERPOL_SST, XSST_MTH  
42 !
43 USE MODI_WRITE_SURF
44 USE MODI_WRITESURF_OCEAN_n
45 !
46 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
47 USE PARKIND1  ,ONLY : JPRB
48 !
49 IMPLICIT NONE
50 !
51 !*       0.1   Declarations of arguments
52 !              -------------------------
53 !
54  CHARACTER(LEN=6),  INTENT(IN)  :: HPROGRAM ! program calling
55
56 !
57 !*       0.2   Declarations of local variables
58 !              -------------------------------
59 !
60 INTEGER           :: JMTH, INMTH
61  CHARACTER(LEN=2 ) :: YMTH
62 !
63 INTEGER           :: IRESP          ! IRESP  : return-code if a problem appears
64  CHARACTER(LEN=12) :: YRECFM         ! Name of the article to be read
65  CHARACTER(LEN=100):: YCOMMENT       ! Comment string
66 REAL(KIND=JPRB) :: ZHOOK_HANDLE
67 !
68 !-------------------------------------------------------------------------------
69 !
70 !
71 IF (LHOOK) CALL DR_HOOK('WRITESURF_SEAFLUX_N',0,ZHOOK_HANDLE)
72  CALL WRITESURF_OCEAN_n(HPROGRAM)
73 !
74 !*       3.     Prognostic fields:
75 !               -----------------
76 !
77 !* water temperature
78 !
79 IF(LINTERPOL_SST)THEN
80 !
81   INMTH=SIZE(XSST_MTH,2)
82 !
83   DO JMTH=1,INMTH
84      WRITE(YMTH,'(I2)') (JMTH-1)
85      YRECFM='SST_MTH'//ADJUSTL(YMTH(:LEN_TRIM(YMTH)))
86      YCOMMENT='SST month t'//ADJUSTL(YMTH(:LEN_TRIM(YMTH)))
87      CALL WRITE_SURF(HPROGRAM,YRECFM,XSST_MTH(:,JMTH),IRESP,HCOMMENT=YCOMMENT)
88   ENDDO
89 !
90 ENDIF
91 !
92 YRECFM='SST'
93 YCOMMENT='SST'
94  CALL WRITE_SURF(HPROGRAM,YRECFM,XSST(:),IRESP,HCOMMENT=YCOMMENT)  
95 !
96 !-------------------------------------------------------------------------------
97 !
98 !*       4.     Semi-prognostic fields:
99 !               ----------------------
100 !
101 !* roughness length
102 !
103 YRECFM='Z0SEA'
104 YCOMMENT='Z0SEA (m)'
105  CALL WRITE_SURF(HPROGRAM,YRECFM,XZ0(:),IRESP,HCOMMENT=YCOMMENT)
106 !
107 !-------------------------------------------------------------------------------
108 !
109 !*       5.  Time
110 !            ----
111 !
112 YRECFM='DTCUR'
113 YCOMMENT='s'
114  CALL WRITE_SURF(HPROGRAM,YRECFM,TTIME,IRESP,HCOMMENT=YCOMMENT)
115 IF (LHOOK) CALL DR_HOOK('WRITESURF_SEAFLUX_N',1,ZHOOK_HANDLE)
116 !
117 !
118 !-------------------------------------------------------------------------------
119 !
120 END SUBROUTINE WRITESURF_SEAFLUX_n