SURFEX v8.1
General documentation of Surfex
writesurf_seafluxn.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 writesurf_seaflux_n (HSELECT, O, OR, S, 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 !! Modified 01/2014 : S. Senesi : handle seaice scheme
36 !! S. Belamari 03/2014 Include sea surface salinity XSSS
37 !! R. Séférian 01/2015 : introduce interactive ocean surface albedo
38 !! S. Senesi 08/2015 : fix units in some HCOMMENTs
39 !-------------------------------------------------------------------------------
40 !
41 !* 0. DECLARATIONS
42 ! ------------
43 !
44 !
45 USE modd_surf_atm_n, ONLY : surf_atm_t
46 !
47 USE modd_ocean_n, ONLY : ocean_t
48 USE modd_ocean_rel_n, ONLY : ocean_rel_t
49 USE modd_seaflux_n, ONLY : seaflux_t
50 !
52 USE modi_writesurf_ocean_n
53 USE modi_writesurf_seaice_n
54 !
55 USE yomhook ,ONLY : lhook, dr_hook
56 USE parkind1 ,ONLY : jprb
57 !
58 IMPLICIT NONE
59 !
60 !* 0.1 Declarations of arguments
61 ! -------------------------
62 !
63  CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: HSELECT
64 !
65 TYPE(ocean_t), INTENT(INOUT) :: O
66 TYPE(ocean_rel_t), INTENT(INOUT) :: OR
67 TYPE(seaflux_t), INTENT(INOUT) :: S
68 !
69  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling
70 
71 !
72 !* 0.2 Declarations of local variables
73 ! -------------------------------
74 !
75 INTEGER :: JMTH, INMTH
76  CHARACTER(LEN=2 ) :: YMTH
77 !
78 INTEGER :: IRESP ! IRESP : return-code if a problem appears
79  CHARACTER(LEN=12) :: YRECFM ! Name of the article to be read
80  CHARACTER(LEN=100):: YCOMMENT ! Comment string
81 REAL(KIND=JPRB) :: ZHOOK_HANDLE
82 !
83 !-------------------------------------------------------------------------------
84 !
85 !
86 IF (lhook) CALL dr_hook('WRITESURF_SEAFLUX_N',0,zhook_handle)
87 !
88  CALL writesurf_ocean_n(hselect, o, or, hprogram)
89 !
90 !* 2. Sea-ice prognostic fields:
91 ! --------------------------
92 !
93 !* flag to tell if Sea Ice model is used
94 !
95 ycomment='flag to handle sea ice cover'
96  CALL write_surf(hselect, hprogram,'HANDLE_SIC',s%LHANDLE_SIC,iresp,ycomment)
97 !
98 IF (s%LHANDLE_SIC) CALL writesurf_seaice_n(hselect, s, hprogram)
99 !
100 !
101 !* 3. Prognostic fields:
102 ! -----------------
103 !
104 !* water temperature
105 !
106 IF(s%LINTERPOL_SST)THEN
107 !
108  inmth=SIZE(s%XSST_MTH,2)
109 !
110  DO jmth=1,inmth
111  WRITE(ymth,'(I2)') (jmth-1)
112  yrecfm='SST_MTH'//adjustl(ymth(:len_trim(ymth)))
113  ycomment='SST at month t'//adjustl(ymth(:len_trim(ymth)))//' (K)'
114  CALL write_surf(hselect, hprogram,yrecfm,s%XSST_MTH(:,jmth),iresp,hcomment=ycomment)
115  ENDDO
116 !
117 ENDIF
118 !
119 yrecfm='SST'
120 ycomment='SST (K)'
121  CALL write_surf(hselect, hprogram,yrecfm,s%XSST(:),iresp,hcomment=ycomment)
122 !
123 !-------------------------------------------------------------------------------
124 !
125 !* 4. Semi-prognostic fields:
126 ! ----------------------
127 !
128 !* roughness length
129 !
130 yrecfm='Z0SEA'
131 ycomment='Z0SEA (m)'
132  CALL write_surf(hselect, hprogram,yrecfm,s%XZ0(:),iresp,hcomment=ycomment)
133 !
134 !
135 !* sea surface salinity
136 !
137 IF(s%LINTERPOL_SSS)THEN
138  !
139  inmth=SIZE(s%XSSS_MTH,2)
140  !
141  DO jmth=1,inmth
142  WRITE(ymth,'(I2)') (jmth-1)
143  yrecfm='SSS_MTH'//adjustl(ymth(:len_trim(ymth)))
144  ycomment='Sea Surface Salinity at month t'//adjustl(ymth(:len_trim(ymth)))//' (psu)'
145  CALL write_surf(hselect, hprogram,yrecfm,s%XSSS_MTH(:,jmth),iresp,hcomment=ycomment)
146  ENDDO
147 !
148 ENDIF
149 !
150 yrecfm='SSS'
151 ycomment='Sea Surface Salinity (psu)'
152  CALL write_surf(hselect, hprogram,yrecfm,s%XSSS(:),iresp,hcomment=ycomment)
153 !
154 !
155 !* ocean surface albedo (direct and diffuse fraction)
156 !
157 IF(s%CSEA_ALB=='RS14')THEN
158 !
159  yrecfm='OSA_DIR'
160  ycomment='direct ocean surface albedo (-)'
161  CALL write_surf(hselect, hprogram,yrecfm,s%XDIR_ALB(:),iresp,hcomment=ycomment)
162 !
163  yrecfm='OSA_SCA'
164  ycomment='diffuse ocean surface albedo (-)'
165  CALL write_surf(hselect, hprogram,yrecfm,s%XSCA_ALB(:),iresp,hcomment=ycomment)
166 !
167 ENDIF
168 !
169 !-------------------------------------------------------------------------------
170 !
171 !* 5. Time
172 ! ----
173 !
174 yrecfm='DTCUR'
175 ycomment='s'
176  CALL write_surf(hselect, hprogram,yrecfm,s%TTIME,iresp,hcomment=ycomment)
177 !
178 IF (lhook) CALL dr_hook('WRITESURF_SEAFLUX_N',1,zhook_handle)
179 !
180 !
181 !-------------------------------------------------------------------------------
182 !
183 END SUBROUTINE writesurf_seaflux_n
subroutine writesurf_ocean_n(HSELECT, O, OR, HPROGRAM)
integer, parameter jprb
Definition: parkind1.F90:32
logical lhook
Definition: yomhook.F90:15
subroutine writesurf_seaice_n(HSELECT, S, HPROGRAM)
subroutine writesurf_seaflux_n(HSELECT, O, OR, S, HPROGRAM)