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