SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
writesurf_seaicen.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_seaice_n (DGU, U, &
7  s, &
8  hprogram)
9 ! #########################################
10 !
11 !!**** *WRITESURF_SEAICE_n* - write seaice scheme variables
12 !!
13 !!
14 !! PURPOSE : writes state variable and 'domain' structure
15 !! -------
16 !!
17 !!** METHOD :
18 !! ------
19 !! For now, only Gelato scheme is handled
20 !!
21 !! quite standard in Surfex : use WRITE_SURF with
22 !! relevant field names (same names as in genuine gelato restarts)
23 !!
24 !! EXTERNALS : WRITE_SURF, GLT_ALLOC, GET_TYPE_DIM
25 !! --------
26 !!
27 !! IMPLICIT ARGUMENTS : Gelato state variable, and some namelist parameters
28 !! ------------------
29 !!
30 !! REFERENCE :
31 !! ---------
32 !!
33 !! AUTHOR : S. Sénési *Meteo France*
34 !! ------
35 !!
36 !! MODIFICATIONS
37 !! -------------
38 !! Original 01/2014
39 !!
40 !-------------------------------------------------------------------------------
41 !
42 !* 0. DECLARATIONS
43 ! ------------
44 !
45 !
46 !
47 !
48 !
50 USE modd_surf_atm_n, ONLY : surf_atm_t
51 !
52 USE modd_seaflux_n, ONLY : seaflux_t
53 !
54 USE modd_glt_param, ONLY : nl, nt
55 USE modd_types_glt, ONLY : t_glt
56 !
58 !
59 !
60 USE yomhook ,ONLY : lhook, dr_hook
61 USE parkind1 ,ONLY : jprb
62 !
63 USE modi_get_type_dim_n
64 !
65 IMPLICIT NONE
66 !
67 !* 0.1 Declarations of arguments
68 ! -------------------------
69 !
70 !
71 !
72 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
73 TYPE(surf_atm_t), INTENT(INOUT) :: u
74 !
75 TYPE(seaflux_t), INTENT(INOUT) :: s
76 !
77  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! calling program
78 !
79 !* 0.2 Declarations of local variables
80 ! -------------------------------
81 !
82 INTEGER :: iresp ! Error code after reading
83 !
84 INTEGER :: jmth, inmth
85  CHARACTER(LEN=2 ) :: ymth
86  CHARACTER(LEN=5) :: ylvl
87 !
88  CHARACTER(LEN=6) :: yicecat
89  CHARACTER(LEN=20) :: yform
90  CHARACTER(LEN=12) :: yrecfm ! Name of the article to be read
91  CHARACTER(LEN=12) :: ycateg ! Category to write
92  CHARACTER(LEN=12) :: ylevel ! Level to write
93  CHARACTER(LEN=100):: ycomment ! Error Message
94 !
95 INTEGER :: jk,jl ! loop counter on ice categories and layes
96 !
97 REAL(KIND=JPRB) :: zhook_handle
98 !
99 !-------------------------------------------------------------------------------
100 IF (lhook) CALL dr_hook('WRITESURF_SEAICE_n',0,zhook_handle)
101 !
102 !
103 ycomment='(-)'
104  CALL write_surf(dgu, u, &
105  hprogram,'SEAICE_SCHEM',s%CSEAICE_SCHEME,iresp,ycomment)
106 !
107 !
108 IF (s%CSEAICE_SCHEME == 'GELATO') THEN
109  ycomment='Number of sea-ice layers'
110  CALL write_surf(dgu, u, &
111  hprogram,'ICENL',nl,iresp,ycomment)
112  ycomment='Number of ice categories'
113  CALL write_surf(dgu, u, &
114  hprogram,'ICENT',nt,iresp,ycomment)
115  !
116  !* 1. Prognostic fields with only space dimension(s) :
117  !
118  ycomment='ICEUSTAR ()'
119  CALL write_surf(dgu, u, &
120  hprogram,'ICEUSTAR',s%TGLT%ust(:,1),iresp,ycomment)
121  !
122  !* 2. Prognostic fields with space and ice-category dimension(s) :
123  !
124  DO jk=1,nt
125  WRITE(yicecat,'(I2)') jk
126  ycateg='_'//adjustl(yicecat)
127  ! .. Write sea ice age for type JK
128  ycomment='X_Y_ICEAGE'//ycateg//' (s)'
129  CALL write_surf(dgu, u, &
130  hprogram,'ICEAGE'//ycateg,s%TGLT%sit(jk,:,1)%age,iresp,ycomment)
131  ! .. Write melt pond volume for type JK
132  ycomment='X_Y_ICEVMP'//ycateg//' (m3)'
133  CALL write_surf(dgu, u, &
134  hprogram,'ICEVMP'//ycateg,s%TGLT%sit(jk,:,1)%vmp,iresp,ycomment)
135  ! .. Write sea ice surface albedo for type JK
136  ycomment='X_Y_ICEASN'//ycateg//' ([0-1])'
137  CALL write_surf(dgu, u, &
138  hprogram,'ICEASN'//ycateg,s%TGLT%sit(jk,:,1)%asn,iresp,ycomment)
139  ! .. Write sea ice fraction for type JK
140  ycomment='X_Y_ICEFSI'//ycateg//' ([0-1])'
141  CALL write_surf(dgu, u, &
142  hprogram,'ICEFSI'//ycateg, s%TGLT%sit(jk,:,1)%fsi,iresp,ycomment)
143  ! .. Write sea ice thickness for type JK
144  ycomment='X_Y_ICEHSI'//ycateg//' (m)'
145  CALL write_surf(dgu, u, &
146  hprogram,'ICEHSI'//ycateg, s%TGLT%sit(jk,:,1)%hsi,iresp,ycomment)
147  ! .. Write sea ice salinity for type JK
148  ycomment='X_Y_ICESSI'//ycateg//' (psu)'
149  CALL write_surf(dgu, u, &
150  hprogram,'ICESSI'//ycateg, s%TGLT%sit(jk,:,1)%ssi,iresp,ycomment)
151  ! .. Write sea ice surface temperature for type JK
152  ycomment='X_Y_ICETSF'//ycateg//' (K)'
153  CALL write_surf(dgu, u, &
154  hprogram,'ICETSF'//ycateg, s%TGLT%sit(jk,:,1)%tsf,iresp,ycomment)
155  ! .. Write snow thickness for type JK
156  ycomment='X_Y_ICEHSN'//ycateg//' (m)'
157  CALL write_surf(dgu, u, &
158  hprogram,'ICEHSN'//ycateg, s%TGLT%sit(jk,:,1)%hsn,iresp,ycomment)
159  ! .. Write snow density for type JK
160  ycomment='X_Y_ICERSN'//ycateg//' (kg m-3)'
161  CALL write_surf(dgu, u, &
162  hprogram,'ICERSN'//ycateg, s%TGLT%sit(jk,:,1)%rsn,iresp,ycomment)
163  !
164  !* 3. Prognostic fields with space and ice-category and layer dimension(s) :
165  !
166  DO jl=1,nl
167  WRITE(ylvl,'(I2)') jl
168  ylevel=ycateg(1:len_trim(ycateg))//'_'//adjustl(ylvl)
169  yform='(A6,I1.1,A4)'
170  IF (jl >= 10) yform='(A6,I2.2,A4)'
171  WRITE(ycomment,fmt=yform) 'X_Y_ICEH',jl,' (J/kg)'
172  ! .. Write sea ice vertical gltools_enthalpy profile for type JK and level JL
173  CALL write_surf(dgu, u, &
174  hprogram,'ICEH'//ylevel, s%TGLT%sil(jl,jk,:,1)%ent,iresp,ycomment)
175  END DO
176  END DO
177 ELSE
178  ! This is a placeholder for writing state variables for another seaice scheme
179 ENDIF
180 !
181 !
182 !-------------------------------------------------------------------------------
183 !
184 !* sea ice cover
185 !
186 IF(s%LINTERPOL_SIC)THEN
187 !
188  inmth=SIZE(s%XSIC_MTH,2)
189 !
190  DO jmth=1,inmth
191  WRITE(ymth,'(I2)') (jmth-1)
192  yrecfm='SIC_MTH'//adjustl(ymth(:len_trim(ymth)))
193  ycomment='Sea ice coverage at month t'//adjustl(ymth(:len_trim(ymth)))
194  CALL write_surf(dgu, u, &
195  hprogram,yrecfm,s%XSIC_MTH(:,jmth),iresp,hcomment=ycomment)
196  ENDDO
197 !
198 ENDIF
199 !
200 yrecfm='SIC'
201 ycomment='Sea ice coverage'
202  CALL write_surf(dgu, u, &
203  hprogram,yrecfm,s%XSIC(:),iresp,hcomment=ycomment)
204 !
205 !
206 !* sea ice thickness constraint
207 !
208 IF(s%LINTERPOL_SIT)THEN
209 !
210  inmth=SIZE(s%XSIT_MTH,2)
211 !
212  DO jmth=1,inmth
213  WRITE(ymth,'(I2)') (jmth-1)
214  yrecfm='SIT_MTH'//adjustl(ymth(:len_trim(ymth)))
215  ycomment='Sea ice thickness constraint at month t'//adjustl(ymth(:len_trim(ymth)))
216  CALL write_surf(dgu, u, &
217  hprogram,yrecfm,s%XSIT_MTH(:,jmth),iresp,hcomment=ycomment)
218  ENDDO
219 !
220 ENDIF
221 !
222 IF (lhook) CALL dr_hook('WRITESURF_SEAICE_n',1,zhook_handle)
223 !
224 !------------------------------------------------------------------------------
225 END SUBROUTINE writesurf_seaice_n
subroutine writesurf_seaice_n(DGU, U, S, HPROGRAM)