1 | MODULE limrst |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE limrst *** |
---|
4 | !! Ice restart : write the ice restart file |
---|
5 | !!====================================================================== |
---|
6 | #if defined key_ice_lim |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | !! 'key_ice_lim' : LIM sea-ice model |
---|
9 | !!---------------------------------------------------------------------- |
---|
10 | !! lim_rst_write : write of the restart file |
---|
11 | !! lim_rst_read : read the restart file |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! * Modules used |
---|
14 | USE in_out_manager |
---|
15 | USE ice |
---|
16 | USE ioipsl |
---|
17 | USE dom_oce |
---|
18 | USE ice_oce ! ice variables |
---|
19 | USE daymod |
---|
20 | |
---|
21 | IMPLICIT NONE |
---|
22 | PRIVATE |
---|
23 | |
---|
24 | !! * Accessibility |
---|
25 | PUBLIC lim_rst_write ! routine called by lim_step.F90 |
---|
26 | PUBLIC lim_rst_read ! routine called by lim_init.F90 |
---|
27 | |
---|
28 | !!---------------------------------------------------------------------- |
---|
29 | !! LIM 2.0 , UCL-LODYC-IPSL (2003) |
---|
30 | !!---------------------------------------------------------------------- |
---|
31 | |
---|
32 | CONTAINS |
---|
33 | |
---|
34 | # if defined key_fdir |
---|
35 | !!---------------------------------------------------------------------- |
---|
36 | !! 'key_fdir' : direct access file |
---|
37 | !!---------------------------------------------------------------------- |
---|
38 | # include "limrst_fdir.h90" |
---|
39 | |
---|
40 | # elif ( defined key_mpp_mpi || defined key_mpp_shmem ) && defined key_dimgout |
---|
41 | !!---------------------------------------------------------------------- |
---|
42 | !! 'key_mpp_mpi' OR |
---|
43 | !! 'key_mpp_shmem' |
---|
44 | !! 'key_dimgout' : clipper type restart file |
---|
45 | !! : can be used in mpp |
---|
46 | !!---------------------------------------------------------------------- |
---|
47 | # include "limrst_dimg.h90" |
---|
48 | |
---|
49 | # else |
---|
50 | !!---------------------------------------------------------------------- |
---|
51 | !! Default option NetCDF file |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | |
---|
54 | SUBROUTINE lim_rst_write( niter ) |
---|
55 | !!---------------------------------------------------------------------- |
---|
56 | !! *** lim_rst_write *** |
---|
57 | !! |
---|
58 | !! ** purpose : output of sea-ice variable in a netcdf file |
---|
59 | !! |
---|
60 | !!---------------------------------------------------------------------- |
---|
61 | ! Arguments |
---|
62 | INTEGER :: niter ! number of iteration |
---|
63 | |
---|
64 | !- dummy variables : |
---|
65 | LOGICAL :: & |
---|
66 | llbon |
---|
67 | INTEGER :: & |
---|
68 | ji, jj |
---|
69 | INTEGER :: & |
---|
70 | inumwrs, it0, itime |
---|
71 | REAL(wp), DIMENSION(1) :: & |
---|
72 | zdept |
---|
73 | REAL(wp), DIMENSION(2) :: & |
---|
74 | zinfo |
---|
75 | REAL(wp),DIMENSION(jpi,jpj,35) :: & |
---|
76 | zmoment |
---|
77 | REAL(wp) :: & |
---|
78 | zsec, zdate0, zdt |
---|
79 | |
---|
80 | CHARACTER(len=45) :: & |
---|
81 | ccfile = 'restart_ice_out.nc' |
---|
82 | |
---|
83 | inumwrs = 61 |
---|
84 | INQUIRE ( FILE = ccfile, EXIST = llbon ) |
---|
85 | IF( llbon ) THEN |
---|
86 | OPEN ( UNIT = inumwrs , FILE = ccfile, STATUS = 'old' ) |
---|
87 | CLOSE( inumwrs , STATUS = 'delete' ) |
---|
88 | ENDIF |
---|
89 | |
---|
90 | |
---|
91 | it0 = niter |
---|
92 | zinfo(1) = FLOAT( nfice ) ! coupling frequency OPA ICELLN nfice |
---|
93 | zinfo(2) = FLOAT( it0 ) ! iteration number |
---|
94 | |
---|
95 | zsec = 0.e0 |
---|
96 | itime = 0 |
---|
97 | zdept(1) = 0.e0 |
---|
98 | zdt = rdt_ice * nstock |
---|
99 | |
---|
100 | ! Write in inumwrs |
---|
101 | |
---|
102 | DO jj = 1, jpj ! 3D array: 10 time faster than 35 restput |
---|
103 | DO ji = 1, jpi |
---|
104 | zmoment(ji,jj,1) = sxice(ji,jj) |
---|
105 | zmoment(ji,jj,2) = syice(ji,jj) |
---|
106 | zmoment(ji,jj,3) = sxxice(ji,jj) |
---|
107 | zmoment(ji,jj,4) = syyice(ji,jj) |
---|
108 | zmoment(ji,jj,5) = sxyice(ji,jj) |
---|
109 | zmoment(ji,jj,6) = sxsn(ji,jj) |
---|
110 | zmoment(ji,jj,7) = sysn(ji,jj) |
---|
111 | zmoment(ji,jj,8) = sxxsn(ji,jj) |
---|
112 | zmoment(ji,jj,9) = syysn(ji,jj) |
---|
113 | zmoment(ji,jj,10) = sxysn(ji,jj) |
---|
114 | zmoment(ji,jj,11) = sxa(ji,jj) |
---|
115 | zmoment(ji,jj,12) = sya(ji,jj) |
---|
116 | zmoment(ji,jj,13) = sxxa(ji,jj) |
---|
117 | zmoment(ji,jj,14) = syya(ji,jj) |
---|
118 | zmoment(ji,jj,15) = sxya(ji,jj) |
---|
119 | zmoment(ji,jj,16) = sxc0(ji,jj) |
---|
120 | zmoment(ji,jj,17) = syc0(ji,jj) |
---|
121 | zmoment(ji,jj,18) = sxxc0(ji,jj) |
---|
122 | zmoment(ji,jj,19) = syyc0(ji,jj) |
---|
123 | zmoment(ji,jj,20) = sxyc0(ji,jj) |
---|
124 | zmoment(ji,jj,21) = sxc1(ji,jj) |
---|
125 | zmoment(ji,jj,22) = syc1(ji,jj) |
---|
126 | zmoment(ji,jj,23) = sxxc1(ji,jj) |
---|
127 | zmoment(ji,jj,24) = syyc1(ji,jj) |
---|
128 | zmoment(ji,jj,25) = sxyc1(ji,jj) |
---|
129 | zmoment(ji,jj,26) = sxc2(ji,jj) |
---|
130 | zmoment(ji,jj,27) = syc2(ji,jj) |
---|
131 | zmoment(ji,jj,28) = sxxc2(ji,jj) |
---|
132 | zmoment(ji,jj,29) = syyc2(ji,jj) |
---|
133 | zmoment(ji,jj,30) = sxyc2(ji,jj) |
---|
134 | zmoment(ji,jj,31) = sxst(ji,jj) |
---|
135 | zmoment(ji,jj,32) = syst(ji,jj) |
---|
136 | zmoment(ji,jj,33) = sxxst(ji,jj) |
---|
137 | zmoment(ji,jj,34) = syyst(ji,jj) |
---|
138 | zmoment(ji,jj,35) = sxyst(ji,jj) |
---|
139 | END DO |
---|
140 | END DO |
---|
141 | |
---|
142 | CALL ymds2ju( nyear, nmonth, nday, zsec, zdate0 ) |
---|
143 | CALL restini( 'NONE', jpi, jpj, glamt, gphit, 1 , zdept, ccfile, itime, zdate0, zdt, inumwrs ) |
---|
144 | |
---|
145 | CALL restput( inumwrs, 'info' , 1, 1, 2 , 0, zinfo ) ! restart informations |
---|
146 | |
---|
147 | CALL restput( inumwrs, 'hicif' , jpi, jpj, 1 , 0, hicif ) ! prognostic variables |
---|
148 | CALL restput( inumwrs, 'hsnif' , jpi, jpj, 1 , 0, hsnif ) |
---|
149 | CALL restput( inumwrs, 'frld' , jpi, jpj, 1 , 0, frld ) |
---|
150 | CALL restput( inumwrs, 'sist' , jpi, jpj, 1 , 0, sist ) |
---|
151 | # if defined key_coupled |
---|
152 | CALL restput( inumwrs, 'albege' , jpi, jpj, 1 , 0, albege ) |
---|
153 | # endif |
---|
154 | CALL restput( inumwrs, 'tbif' , jpi, jpj, 3 , 0, tbif ) |
---|
155 | CALL restput( inumwrs, 'u_ice' , jpi, jpj, 1 , 0, u_ice ) |
---|
156 | CALL restput( inumwrs, 'v_ice' , jpi, jpj, 1 , 0, v_ice ) |
---|
157 | CALL restput( inumwrs, 'gtaux' , jpi, jpj, 1 , 0, gtaux ) |
---|
158 | CALL restput( inumwrs, 'gtauy' , jpi, jpj, 1 , 0, gtauy ) |
---|
159 | CALL restput( inumwrs, 'qstoif' , jpi, jpj, 1 , 0, qstoif ) |
---|
160 | CALL restput( inumwrs, 'fsbbq' , jpi, jpj, 1 , 0, fsbbq ) |
---|
161 | CALL restput( inumwrs, 'moment' , jpi, jpj, 35, 0, zmoment ) |
---|
162 | |
---|
163 | |
---|
164 | CALL restclo( inumwrs ) |
---|
165 | |
---|
166 | END SUBROUTINE lim_rst_write |
---|
167 | |
---|
168 | |
---|
169 | SUBROUTINE lim_rst_read( niter ) |
---|
170 | !----------------------------------------------------------------------- |
---|
171 | ! restart from a state defined in a binary file |
---|
172 | !----------------------------------------------------------------------- |
---|
173 | ! Arguments |
---|
174 | INTEGER :: niter ! number of iteration |
---|
175 | |
---|
176 | !- dummy variables : |
---|
177 | CHARACTER(len=45) :: & |
---|
178 | ccfile = 'restart_ice_in.nc' |
---|
179 | INTEGER :: & |
---|
180 | ji, jj |
---|
181 | INTEGER :: & |
---|
182 | inumrst, it0, it1, itime, ibvar, ifice |
---|
183 | LOGICAL :: & |
---|
184 | llog |
---|
185 | REAL(wp),DIMENSION(jpi,jpj) :: & |
---|
186 | zlamt, zphit |
---|
187 | REAL(wp),DIMENSION(jpi,jpj,35) :: & |
---|
188 | zmoment |
---|
189 | REAL(wp),DIMENSION(1) :: & |
---|
190 | zdept |
---|
191 | REAL(wp),DIMENSION(2) :: & |
---|
192 | zinfo |
---|
193 | REAL(wp) :: & |
---|
194 | zdate0, zdt |
---|
195 | CHARACTER ( len = 10 ) :: & |
---|
196 | clvnames(60) |
---|
197 | |
---|
198 | |
---|
199 | !Initialisations |
---|
200 | inumrst = 71 |
---|
201 | it0 = nit000 |
---|
202 | itime = 0 |
---|
203 | llog = .FALSE. |
---|
204 | zlamt(:,:) = 0. |
---|
205 | zphit(:,:) = 0. |
---|
206 | zdept(1) = 0. |
---|
207 | |
---|
208 | CALL restini(ccfile , jpi, jpj, zlamt, zphit, 1 , zdept, ccfile, itime, zdate0, zdt, inumrst ) |
---|
209 | CALL ioget_vname( inumrst, ibvar, clvnames ) |
---|
210 | |
---|
211 | CALL restget ( inumrst,'info', 1, 1 , 2, 0, llog, zinfo ) |
---|
212 | |
---|
213 | ifice = INT( zinfo(1) ) |
---|
214 | it1 = INT( zinfo(2) ) |
---|
215 | |
---|
216 | IF(lwp) THEN |
---|
217 | WRITE(numout,*) |
---|
218 | WRITE(numout,*) 'lim_rst_read : READ restart file name ', ccfile,' at time step : ', it1 |
---|
219 | WRITE(numout,*) '~~~~~~~~~~~~ number of variables : ', ibvar |
---|
220 | WRITE(numout,*) ' NetCDF variables : ', clvnames(1:ibvar) |
---|
221 | ENDIF |
---|
222 | |
---|
223 | |
---|
224 | !Control of date |
---|
225 | |
---|
226 | IF( ( it0 - it1 ) /= 1 .AND. ABS( nrstdt ) == 1 ) THEN |
---|
227 | IF(lwp) THEN |
---|
228 | WRITE(numout,cform_err) |
---|
229 | WRITE(numout,*) 'lim_rst_read ===>>>> : problem with nit000 for the restart' |
---|
230 | WRITE(numout,*) ' we stop. verify the file or rerun with the value 0 for the' |
---|
231 | WRITE(numout,*) ' control of time parameter nrstdt' |
---|
232 | nstop = nstop + 1 |
---|
233 | ENDIF |
---|
234 | ENDIF |
---|
235 | |
---|
236 | CALL restget( inumrst, 'hicif' , jpi, jpj, 1 , 0, llog, hicif ) |
---|
237 | CALL restget( inumrst, 'hsnif' , jpi, jpj, 1 , 0, llog, hsnif ) |
---|
238 | CALL restget( inumrst, 'frld' , jpi, jpj, 1 , 0, llog, frld ) |
---|
239 | CALL restget( inumrst, 'sist' , jpi, jpj, 1 , 0, llog, sist ) |
---|
240 | # if defined key_coupled |
---|
241 | CALL restget( inumrst, 'albege' , jpi, jpj, 1 , 0, llog, albege ) |
---|
242 | # endif |
---|
243 | CALL restget( inumrst, 'tbif' , jpi, jpj, 3 , 0, llog, tbif ) |
---|
244 | CALL restget( inumrst, 'u_ice' , jpi, jpj, 1 , 0, llog, u_ice ) |
---|
245 | CALL restget( inumrst, 'v_ice' , jpi, jpj, 1 , 0, llog, v_ice ) |
---|
246 | CALL restget( inumrst, 'gtaux' , jpi, jpj, 1 , 0, llog, gtaux ) |
---|
247 | CALL restget( inumrst, 'gtauy' , jpi, jpj, 1 , 0, llog, gtauy ) |
---|
248 | CALL restget( inumrst, 'qstoif' , jpi, jpj, 1 , 0, llog, qstoif ) |
---|
249 | CALL restget( inumrst, 'fsbbq' , jpi, jpj, 1 , 0, llog, fsbbq ) |
---|
250 | CALL restget( inumrst, 'moment' , jpi, jpj, 35, 0, llog, zmoment ) |
---|
251 | |
---|
252 | CALL restclo( inumrst ) |
---|
253 | |
---|
254 | niter = it1 |
---|
255 | DO jj = 1, jpj |
---|
256 | DO ji = 1, jpi |
---|
257 | sxice(ji,jj) = zmoment(ji,jj,1) |
---|
258 | syice(ji,jj) = zmoment(ji,jj,2) |
---|
259 | sxxice(ji,jj) = zmoment(ji,jj,3) |
---|
260 | syyice(ji,jj) = zmoment(ji,jj,4) |
---|
261 | sxyice(ji,jj) = zmoment(ji,jj,5) |
---|
262 | sxsn(ji,jj) = zmoment(ji,jj,6) |
---|
263 | sysn(ji,jj) = zmoment(ji,jj,7) |
---|
264 | sxxsn(ji,jj) = zmoment(ji,jj,8) |
---|
265 | syysn(ji,jj) = zmoment(ji,jj,9) |
---|
266 | sxysn(ji,jj) = zmoment(ji,jj,10) |
---|
267 | sxa(ji,jj) = zmoment(ji,jj,11) |
---|
268 | sya(ji,jj) = zmoment(ji,jj,12) |
---|
269 | sxxa(ji,jj) = zmoment(ji,jj,13) |
---|
270 | syya(ji,jj) = zmoment(ji,jj,14) |
---|
271 | sxya(ji,jj) = zmoment(ji,jj,15) |
---|
272 | sxc0(ji,jj) = zmoment(ji,jj,16) |
---|
273 | syc0(ji,jj) = zmoment(ji,jj,17) |
---|
274 | sxxc0(ji,jj) = zmoment(ji,jj,18) |
---|
275 | syyc0(ji,jj) = zmoment(ji,jj,19) |
---|
276 | sxyc0(ji,jj) = zmoment(ji,jj,20) |
---|
277 | sxc1(ji,jj) = zmoment(ji,jj,21) |
---|
278 | syc1(ji,jj) = zmoment(ji,jj,22) |
---|
279 | sxxc1(ji,jj) = zmoment(ji,jj,23) |
---|
280 | syyc1(ji,jj) = zmoment(ji,jj,24) |
---|
281 | sxyc1(ji,jj) = zmoment(ji,jj,25) |
---|
282 | sxc2(ji,jj) = zmoment(ji,jj,26) |
---|
283 | syc2(ji,jj) = zmoment(ji,jj,27) |
---|
284 | sxxc2(ji,jj) = zmoment(ji,jj,28) |
---|
285 | syyc2(ji,jj) = zmoment(ji,jj,29) |
---|
286 | sxyc2(ji,jj) = zmoment(ji,jj,30) |
---|
287 | sxst(ji,jj) = zmoment(ji,jj,31) |
---|
288 | syst(ji,jj) = zmoment(ji,jj,32) |
---|
289 | sxxst(ji,jj) = zmoment(ji,jj,33) |
---|
290 | syyst(ji,jj) = zmoment(ji,jj,34) |
---|
291 | sxyst(ji,jj) = zmoment(ji,jj,35) |
---|
292 | END DO |
---|
293 | END DO |
---|
294 | |
---|
295 | |
---|
296 | END SUBROUTINE lim_rst_read |
---|
297 | |
---|
298 | # endif |
---|
299 | |
---|
300 | #else |
---|
301 | !!---------------------------------------------------------------------- |
---|
302 | !! Default option : Empty module NO LIM sea-ice model |
---|
303 | !!---------------------------------------------------------------------- |
---|
304 | CONTAINS |
---|
305 | SUBROUTINE lim_rst_read ! Empty routine |
---|
306 | END SUBROUTINE lim_rst_read |
---|
307 | SUBROUTINE lim_rst_write ! Empty routine |
---|
308 | END SUBROUTINE lim_rst_write |
---|
309 | #endif |
---|
310 | |
---|
311 | !!====================================================================== |
---|
312 | END MODULE limrst |
---|