1 | MODULE limwri_2 |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE limwri_2 *** |
---|
4 | !! Ice diagnostics : write ice output files |
---|
5 | !!====================================================================== |
---|
6 | !! history : 2.0 ! 03-08 (C. Ethe) original code |
---|
7 | !! 2.0 ! 04-10 (C. Ethe ) 1D configuration |
---|
8 | !!------------------------------------------------------------------- |
---|
9 | #if defined key_lim2 |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! 'key_lim2' LIM 2.0 sea-ice model |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | !! lim_wri_2 : write of the diagnostics variables in ouput file |
---|
15 | !! lim_wri_init_2 : initialization and namelist read |
---|
16 | !!---------------------------------------------------------------------- |
---|
17 | USE phycst |
---|
18 | USE dom_oce |
---|
19 | USE daymod |
---|
20 | USE sbc_oce |
---|
21 | USE sbc_ice |
---|
22 | USE dom_ice_2 |
---|
23 | USE ice_2 |
---|
24 | |
---|
25 | USE lbclnk |
---|
26 | USE dianam ! build name of file (routine) |
---|
27 | USE in_out_manager |
---|
28 | USE iom |
---|
29 | USE ioipsl |
---|
30 | |
---|
31 | IMPLICIT NONE |
---|
32 | PRIVATE |
---|
33 | |
---|
34 | PUBLIC lim_wri_2 ! routine called by sbc_ice_lim_2 |
---|
35 | |
---|
36 | INTEGER, PARAMETER :: jpnoumax = 40 ! maximum number of variable for ice output |
---|
37 | INTEGER :: noumef ! number of fields |
---|
38 | REAL(wp) , DIMENSION(jpnoumax) :: cmulti , & ! multiplicative constant |
---|
39 | & cadd ! additive constant |
---|
40 | CHARACTER(len = 35), DIMENSION(jpnoumax) :: titn ! title of the field |
---|
41 | CHARACTER(len = 8 ), DIMENSION(jpnoumax) :: nam ! name of the field |
---|
42 | CHARACTER(len = 8 ), DIMENSION(jpnoumax) :: uni ! unit of the field |
---|
43 | INTEGER , DIMENSION(jpnoumax) :: nc ! switch for saving field ( = 1 ) or not ( = 0 ) |
---|
44 | |
---|
45 | INTEGER :: nice, nhorid, ndim, niter, ndepid ! ???? |
---|
46 | INTEGER , DIMENSION( jpij ) :: ndex51 ! ???? |
---|
47 | |
---|
48 | REAL(wp) :: & ! constant values |
---|
49 | epsi16 = 1.e-16 , & |
---|
50 | zzero = 0.e0 , & |
---|
51 | zone = 1.e0 |
---|
52 | |
---|
53 | !! * Substitutions |
---|
54 | # include "vectopt_loop_substitute.h90" |
---|
55 | !!---------------------------------------------------------------------- |
---|
56 | !! LIM 2.0, UCL-LOCEAN-IPSL (2006) |
---|
57 | !! $Id$ |
---|
58 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
59 | !!---------------------------------------------------------------------- |
---|
60 | |
---|
61 | CONTAINS |
---|
62 | |
---|
63 | #if defined key_dimgout |
---|
64 | !!---------------------------------------------------------------------- |
---|
65 | !! 'key_dimgout' Direct Access file |
---|
66 | !!---------------------------------------------------------------------- |
---|
67 | # include "limwri_dimg_2.h90" |
---|
68 | #else |
---|
69 | !!---------------------------------------------------------------------- |
---|
70 | !! Default option NetCDF file |
---|
71 | !!---------------------------------------------------------------------- |
---|
72 | |
---|
73 | SUBROUTINE lim_wri_2( kt ) |
---|
74 | !!------------------------------------------------------------------- |
---|
75 | !! *** ROUTINE lim_wri_2 *** |
---|
76 | !! |
---|
77 | !! ** Purpose : write the sea-ice output file in NetCDF |
---|
78 | !! |
---|
79 | !! ** Method : computes the average of some variables and write |
---|
80 | !! it in the NetCDF ouput files |
---|
81 | !! CAUTION: the sea-ice time-step must be an integer fraction |
---|
82 | !! of a day |
---|
83 | !!------------------------------------------------------------------- |
---|
84 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
85 | !! |
---|
86 | INTEGER :: ji, jj, jf ! dummy loop indices |
---|
87 | CHARACTER(len = 40) :: clhstnam, clop |
---|
88 | REAL(wp) :: zsto, zjulian, zout, & ! temporary scalars |
---|
89 | & zindh, zinda, zindb, ztmu |
---|
90 | REAL(wp), DIMENSION(1) :: zdept |
---|
91 | REAL(wp), DIMENSION(jpi,jpj) :: zfield |
---|
92 | REAL(wp), DIMENSION(jpi,jpj,jpnoumax) :: zcmo |
---|
93 | !!------------------------------------------------------------------- |
---|
94 | |
---|
95 | CALL iom_setkt( kt + nn_fsbc - 1 ) |
---|
96 | ! !--------------------! |
---|
97 | IF( kt == nit000 ) THEN ! Initialisation ! |
---|
98 | ! !--------------------! |
---|
99 | CALL lim_wri_init_2 |
---|
100 | |
---|
101 | zsto = rdt_ice |
---|
102 | IF( ln_mskland ) THEN ; clop = "ave(only(x))" ! put 1.e+20 on land (very expensive!!) |
---|
103 | ELSE ; clop = "ave(x)" ! no use of the mask value (require less cpu time) |
---|
104 | ENDIF |
---|
105 | zout = nwrite * rdt_ice / nn_fsbc |
---|
106 | niter = ( nit000 - 1 ) / nn_fsbc |
---|
107 | zdept(1) = 0. |
---|
108 | |
---|
109 | CALL ymds2ju ( nyear, nmonth, nday, rdt, zjulian ) |
---|
110 | zjulian = zjulian - adatrj ! set calendar origin to the beginning of the experiment |
---|
111 | CALL dia_nam ( clhstnam, nwrite, 'icemod' ) |
---|
112 | CALL histbeg ( clhstnam, jpi, glamt, jpj, gphit, & |
---|
113 | & 1, jpi, 1, jpj, niter, zjulian, rdt_ice, nhorid, nice , domain_id=nidom) |
---|
114 | CALL histvert( nice, "deptht", "Vertical T levels", "m", 1, zdept, ndepid, "down") |
---|
115 | CALL wheneq ( jpij , tmask(:,:,1), 1, 1., ndex51, ndim) |
---|
116 | |
---|
117 | DO jf = 1, noumef |
---|
118 | IF( nc(jf) == 1 ) CALL histdef( nice, nam(jf), titn(jf), uni(jf), jpi, jpj & |
---|
119 | & , nhorid, 1, 1, 1, -99, 32, clop, zsto, zout ) |
---|
120 | END DO |
---|
121 | CALL histend( nice ) |
---|
122 | ! |
---|
123 | ENDIF |
---|
124 | ! !--------------------! |
---|
125 | ! ! Cumulate at kt ! |
---|
126 | ! !--------------------! |
---|
127 | |
---|
128 | !-- Store instantaneous values in zcmo |
---|
129 | |
---|
130 | zcmo(:,:, 1:jpnoumax ) = 0.e0 |
---|
131 | DO jj = 2 , jpjm1 |
---|
132 | DO ji = 1 , jpim1 ! NO vector opt. |
---|
133 | zindh = MAX( zzero , SIGN( zone , hicif(ji,jj) * (1.0 - frld(ji,jj) ) - 0.10 ) ) |
---|
134 | zinda = MAX( zzero , SIGN( zone , ( 1.0 - frld(ji,jj) ) - 0.10 ) ) |
---|
135 | zindb = zindh * zinda |
---|
136 | ztmu = MAX( 0.5 * zone , ( tmu(ji,jj) + tmu(ji+1,jj) + tmu(ji,jj+1) + tmu(ji+1,jj+1) ) ) |
---|
137 | zcmo(ji,jj,1) = hsnif (ji,jj) |
---|
138 | zcmo(ji,jj,2) = hicif (ji,jj) |
---|
139 | zcmo(ji,jj,3) = hicifp(ji,jj) |
---|
140 | zcmo(ji,jj,4) = frld (ji,jj) |
---|
141 | zcmo(ji,jj,5) = sist (ji,jj) |
---|
142 | zcmo(ji,jj,6) = fbif (ji,jj) |
---|
143 | zcmo(ji,jj,7) = zindb * ( u_ice(ji,jj ) * tmu(ji,jj ) + u_ice(ji+1,jj ) * tmu(ji+1,jj ) & |
---|
144 | + u_ice(ji,jj+1) * tmu(ji,jj+1) + u_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) & |
---|
145 | / ztmu |
---|
146 | |
---|
147 | zcmo(ji,jj,8) = zindb * ( v_ice(ji,jj ) * tmu(ji,jj ) + v_ice(ji+1,jj ) * tmu(ji+1,jj ) & |
---|
148 | + v_ice(ji,jj+1) * tmu(ji,jj+1) + v_ice(ji+1,jj+1) * tmu(ji+1,jj+1) ) & |
---|
149 | / ztmu |
---|
150 | zcmo(ji,jj,9) = sst_m(ji,jj) |
---|
151 | zcmo(ji,jj,10) = sss_m(ji,jj) |
---|
152 | zcmo(ji,jj,11) = qns(ji,jj) + qsr(ji,jj) |
---|
153 | zcmo(ji,jj,12) = qsr(ji,jj) |
---|
154 | zcmo(ji,jj,13) = qns(ji,jj) |
---|
155 | ! See thersf for the coefficient |
---|
156 | zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce !!gm ??? |
---|
157 | zcmo(ji,jj,15) = utau_ice(ji,jj) |
---|
158 | zcmo(ji,jj,16) = vtau_ice(ji,jj) |
---|
159 | zcmo(ji,jj,17) = qsr_ice(ji,jj,1) |
---|
160 | zcmo(ji,jj,18) = qns_ice(ji,jj,1) |
---|
161 | zcmo(ji,jj,19) = sprecip(ji,jj) |
---|
162 | END DO |
---|
163 | END DO |
---|
164 | ! |
---|
165 | ! Write the netcdf file |
---|
166 | ! |
---|
167 | niter = niter + 1 |
---|
168 | DO jf = 1 , noumef |
---|
169 | DO jj = 1 , jpj |
---|
170 | DO ji = 1 , jpi |
---|
171 | zfield(ji,jj) = zcmo(ji,jj,jf) * cmulti(jf) + cadd(jf) |
---|
172 | END DO |
---|
173 | END DO |
---|
174 | |
---|
175 | IF( jf == 7 .OR. jf == 8 .OR. jf == 15 .OR. jf == 16 ) THEN |
---|
176 | CALL lbc_lnk( zfield, 'T', -1. ) |
---|
177 | ELSE |
---|
178 | CALL lbc_lnk( zfield, 'T', 1. ) |
---|
179 | ENDIF |
---|
180 | |
---|
181 | IF( nc(jf) == 1 ) CALL histwrite( nice, nam(jf), niter, zfield, ndim, ndex51 ) |
---|
182 | CALL iom_put( nam(jf), zfield ) |
---|
183 | |
---|
184 | END DO |
---|
185 | |
---|
186 | IF( ( nn_fsbc * niter ) >= nitend ) CALL histclo( nice ) |
---|
187 | ! |
---|
188 | CALL iom_setkt( kt ) |
---|
189 | |
---|
190 | END SUBROUTINE lim_wri_2 |
---|
191 | |
---|
192 | #endif |
---|
193 | |
---|
194 | SUBROUTINE lim_wri_init_2 |
---|
195 | !!------------------------------------------------------------------- |
---|
196 | !! *** ROUTINE lim_wri_init_2 *** |
---|
197 | !! |
---|
198 | !! ** Purpose : intialisation of LIM sea-ice output |
---|
199 | !! |
---|
200 | !! ** Method : Read the namicewri namelist and check the parameter |
---|
201 | !! values called at the first timestep (nit000) |
---|
202 | !! |
---|
203 | !! ** input : Namelist namicewri |
---|
204 | !!------------------------------------------------------------------- |
---|
205 | INTEGER :: nf ! ??? |
---|
206 | TYPE FIELD |
---|
207 | CHARACTER(len = 35) :: ztitle |
---|
208 | CHARACTER(len = 8 ) :: zname |
---|
209 | CHARACTER(len = 8 ) :: zunit |
---|
210 | INTEGER :: znc |
---|
211 | REAL :: zcmulti |
---|
212 | REAL :: zcadd |
---|
213 | END TYPE FIELD |
---|
214 | TYPE(FIELD) :: & |
---|
215 | field_1 , field_2 , field_3 , field_4 , field_5 , field_6 , & |
---|
216 | field_7 , field_8 , field_9 , field_10, field_11, field_12, & |
---|
217 | field_13, field_14, field_15, field_16, field_17, field_18, & |
---|
218 | field_19 |
---|
219 | TYPE(FIELD) , DIMENSION(jpnoumax) :: zfield |
---|
220 | |
---|
221 | NAMELIST/namiceout/ noumef, & |
---|
222 | field_1 , field_2 , field_3 , field_4 , field_5 , field_6 , & |
---|
223 | field_7 , field_8 , field_9 , field_10, field_11, field_12, & |
---|
224 | field_13, field_14, field_15, field_16, field_17, field_18, & |
---|
225 | field_19 |
---|
226 | !!------------------------------------------------------------------- |
---|
227 | |
---|
228 | REWIND ( numnam_ice ) ! Read Namelist namicewri |
---|
229 | READ ( numnam_ice , namiceout ) |
---|
230 | |
---|
231 | zfield( 1) = field_1 |
---|
232 | zfield( 2) = field_2 |
---|
233 | zfield( 3) = field_3 |
---|
234 | zfield( 4) = field_4 |
---|
235 | zfield( 5) = field_5 |
---|
236 | zfield( 6) = field_6 |
---|
237 | zfield( 7) = field_7 |
---|
238 | zfield( 8) = field_8 |
---|
239 | zfield( 9) = field_9 |
---|
240 | zfield(10) = field_10 |
---|
241 | zfield(11) = field_11 |
---|
242 | zfield(12) = field_12 |
---|
243 | zfield(13) = field_13 |
---|
244 | zfield(14) = field_14 |
---|
245 | zfield(15) = field_15 |
---|
246 | zfield(16) = field_16 |
---|
247 | zfield(17) = field_17 |
---|
248 | zfield(18) = field_18 |
---|
249 | zfield(19) = field_19 |
---|
250 | |
---|
251 | DO nf = 1, noumef |
---|
252 | titn (nf) = zfield(nf)%ztitle |
---|
253 | nam (nf) = zfield(nf)%zname |
---|
254 | uni (nf) = zfield(nf)%zunit |
---|
255 | nc (nf) = zfield(nf)%znc |
---|
256 | cmulti(nf) = zfield(nf)%zcmulti |
---|
257 | cadd (nf) = zfield(nf)%zcadd |
---|
258 | END DO |
---|
259 | |
---|
260 | IF(lwp) THEN |
---|
261 | WRITE(numout,*) |
---|
262 | WRITE(numout,*) 'lim_wri_init_2 : Ice parameters for outputs' |
---|
263 | WRITE(numout,*) '~~~~~~~~~~~~~~' |
---|
264 | WRITE(numout,*) ' number of fields to be stored noumef = ', noumef |
---|
265 | WRITE(numout,*) ' title name unit Saving (1/0) ', & |
---|
266 | & ' multiplicative constant additive constant ' |
---|
267 | DO nf = 1 , noumef |
---|
268 | WRITE(numout,*) ' ', titn(nf), ' ', nam(nf),' ', uni(nf),' ', nc(nf),' ', cmulti(nf), & |
---|
269 | & ' ', cadd(nf) |
---|
270 | END DO |
---|
271 | ENDIF |
---|
272 | ! |
---|
273 | END SUBROUTINE lim_wri_init_2 |
---|
274 | |
---|
275 | #else |
---|
276 | !!---------------------------------------------------------------------- |
---|
277 | !! Default option : Empty module NO LIM 2.0 sea-ice model |
---|
278 | !!---------------------------------------------------------------------- |
---|
279 | CONTAINS |
---|
280 | SUBROUTINE lim_wri_2 ! Empty routine |
---|
281 | END SUBROUTINE lim_wri_2 |
---|
282 | #endif |
---|
283 | |
---|
284 | !!====================================================================== |
---|
285 | END MODULE limwri_2 |
---|