1 | !====================================================================== |
---|
2 | SUBROUTINE read_togacoare(fich_toga,nlev_toga,nt_toga & |
---|
3 | & ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga & |
---|
4 | & ,ht_toga,vt_toga,hq_toga,vq_toga) |
---|
5 | implicit none |
---|
6 | |
---|
7 | !------------------------------------------------------------------------- |
---|
8 | ! Read TOGA-COARE forcing data |
---|
9 | !------------------------------------------------------------------------- |
---|
10 | |
---|
11 | integer nlev_toga,nt_toga |
---|
12 | real ts_toga(nt_toga),plev_toga(nlev_toga,nt_toga) |
---|
13 | real t_toga(nlev_toga,nt_toga),q_toga(nlev_toga,nt_toga) |
---|
14 | real u_toga(nlev_toga,nt_toga),v_toga(nlev_toga,nt_toga) |
---|
15 | real w_toga(nlev_toga,nt_toga) |
---|
16 | real ht_toga(nlev_toga,nt_toga),vt_toga(nlev_toga,nt_toga) |
---|
17 | real hq_toga(nlev_toga,nt_toga),vq_toga(nlev_toga,nt_toga) |
---|
18 | character*80 fich_toga |
---|
19 | |
---|
20 | integer k,ip |
---|
21 | real bid |
---|
22 | |
---|
23 | integer iy,im,id,ih |
---|
24 | |
---|
25 | real plev_min |
---|
26 | |
---|
27 | plev_min = 55. ! pas de tendance de vap. d eau au-dessus de 55 hPa |
---|
28 | |
---|
29 | open(21,file=trim(fich_toga),form='formatted') |
---|
30 | read(21,'(a)') |
---|
31 | do ip = 1, nt_toga |
---|
32 | read(21,'(a)') |
---|
33 | read(21,'(a)') |
---|
34 | read(21,223) iy, im, id, ih, bid, ts_toga(ip), bid,bid,bid,bid |
---|
35 | read(21,'(a)') |
---|
36 | read(21,'(a)') |
---|
37 | |
---|
38 | do k = 1, nlev_toga |
---|
39 | read(21,230) plev_toga(k,ip), t_toga(k,ip), q_toga(k,ip) & |
---|
40 | & ,u_toga(k,ip), v_toga(k,ip), w_toga(k,ip) & |
---|
41 | & ,ht_toga(k,ip), vt_toga(k,ip), hq_toga(k,ip), vq_toga(k,ip) |
---|
42 | |
---|
43 | ! conversion in SI units: |
---|
44 | t_toga(k,ip)=t_toga(k,ip)+273.15 ! K |
---|
45 | q_toga(k,ip)=q_toga(k,ip)*0.001 ! kg/kg |
---|
46 | w_toga(k,ip)=w_toga(k,ip)*100./3600. ! Pa/s |
---|
47 | ! no water vapour tendency above 55 hPa |
---|
48 | if (plev_toga(k,ip) .lt. plev_min) then |
---|
49 | q_toga(k,ip) = 0. |
---|
50 | hq_toga(k,ip) = 0. |
---|
51 | vq_toga(k,ip) =0. |
---|
52 | endif |
---|
53 | enddo |
---|
54 | |
---|
55 | ts_toga(ip)=ts_toga(ip)+273.15 ! K |
---|
56 | enddo |
---|
57 | close(21) |
---|
58 | |
---|
59 | 223 format(4i3,6f8.2) |
---|
60 | 230 format(6f9.3,4e11.3) |
---|
61 | |
---|
62 | return |
---|
63 | end |
---|
64 | |
---|
65 | !------------------------------------------------------------------------- |
---|
66 | SUBROUTINE read_sandu(fich_sandu,nlev_sandu,nt_sandu,ts_sandu) |
---|
67 | implicit none |
---|
68 | |
---|
69 | !------------------------------------------------------------------------- |
---|
70 | ! Read I.SANDU case forcing data |
---|
71 | !------------------------------------------------------------------------- |
---|
72 | |
---|
73 | integer nlev_sandu,nt_sandu |
---|
74 | real ts_sandu(nt_sandu) |
---|
75 | character*80 fich_sandu |
---|
76 | |
---|
77 | integer ip |
---|
78 | integer iy,im,id,ih |
---|
79 | |
---|
80 | real plev_min |
---|
81 | |
---|
82 | print*,'nlev_sandu',nlev_sandu |
---|
83 | plev_min = 55000. ! pas de tendance de vap. d eau au-dessus de 55 hPa |
---|
84 | |
---|
85 | open(21,file=trim(fich_sandu),form='formatted') |
---|
86 | read(21,'(a)') |
---|
87 | do ip = 1, nt_sandu |
---|
88 | read(21,'(a)') |
---|
89 | read(21,'(a)') |
---|
90 | read(21,223) iy, im, id, ih, ts_sandu(ip) |
---|
91 | print *,'ts=',iy,im,id,ih,ip,ts_sandu(ip) |
---|
92 | enddo |
---|
93 | close(21) |
---|
94 | |
---|
95 | 223 format(4i3,f8.2) |
---|
96 | |
---|
97 | return |
---|
98 | end |
---|
99 | |
---|
100 | !===================================================================== |
---|
101 | !------------------------------------------------------------------------- |
---|
102 | SUBROUTINE read_astex(fich_astex,nlev_astex,nt_astex,div_astex, & |
---|
103 | & ts_astex,ug_astex,vg_astex,ufa_astex,vfa_astex) |
---|
104 | implicit none |
---|
105 | |
---|
106 | !------------------------------------------------------------------------- |
---|
107 | ! Read Astex case forcing data |
---|
108 | !------------------------------------------------------------------------- |
---|
109 | |
---|
110 | integer nlev_astex,nt_astex |
---|
111 | real div_astex(nt_astex),ts_astex(nt_astex),ug_astex(nt_astex) |
---|
112 | real vg_astex(nt_astex),ufa_astex(nt_astex),vfa_astex(nt_astex) |
---|
113 | character*80 fich_astex |
---|
114 | |
---|
115 | integer ip |
---|
116 | integer iy,im,id,ih |
---|
117 | |
---|
118 | real plev_min |
---|
119 | |
---|
120 | print*,'nlev_astex',nlev_astex |
---|
121 | plev_min = 55000. ! pas de tendance de vap. d eau au-dessus de 55 hPa |
---|
122 | |
---|
123 | open(21,file=trim(fich_astex),form='formatted') |
---|
124 | read(21,'(a)') |
---|
125 | read(21,'(a)') |
---|
126 | do ip = 1, nt_astex |
---|
127 | read(21,'(a)') |
---|
128 | read(21,'(a)') |
---|
129 | read(21,223) iy, im, id, ih, div_astex(ip),ts_astex(ip), & |
---|
130 | &ug_astex(ip),vg_astex(ip),ufa_astex(ip),vfa_astex(ip) |
---|
131 | ts_astex(ip)=ts_astex(ip)+273.15 |
---|
132 | print *,'ts=',iy,im,id,ih,ip,div_astex(ip),ts_astex(ip), & |
---|
133 | &ug_astex(ip),vg_astex(ip),ufa_astex(ip),vg_astex(ip) |
---|
134 | enddo |
---|
135 | close(21) |
---|
136 | |
---|
137 | 223 format(4i3,e13.2,f7.2,f7.3,f7.2,f7.3,f7.2) |
---|
138 | |
---|
139 | return |
---|
140 | end |
---|
141 | !===================================================================== |
---|
142 | subroutine read_twpice(fich_twpice,nlevel,ntime & |
---|
143 | & ,T_srf,plev,T,q,u,v,omega & |
---|
144 | & ,T_adv_h,T_adv_v,q_adv_h,q_adv_v) |
---|
145 | |
---|
146 | !program reading forcings of the TWP-ICE experiment |
---|
147 | |
---|
148 | USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,& |
---|
149 | nf90_inq_dimid,nf90_inquire_dimension |
---|
150 | |
---|
151 | implicit none |
---|
152 | |
---|
153 | integer ntime,nlevel |
---|
154 | integer l,k |
---|
155 | character*80 :: fich_twpice |
---|
156 | real*8 time(ntime) |
---|
157 | real*8 lat, lon, alt, phis |
---|
158 | real*8 lev(nlevel) |
---|
159 | real*8 plev(nlevel,ntime) |
---|
160 | |
---|
161 | real*8 T(nlevel,ntime) |
---|
162 | real*8 q(nlevel,ntime),u(nlevel,ntime) |
---|
163 | real*8 v(nlevel,ntime) |
---|
164 | real*8 omega(nlevel,ntime), div(nlevel,ntime) |
---|
165 | real*8 T_adv_h(nlevel,ntime) |
---|
166 | real*8 T_adv_v(nlevel,ntime), q_adv_h(nlevel,ntime) |
---|
167 | real*8 q_adv_v(nlevel,ntime) |
---|
168 | real*8 s(nlevel,ntime), s_adv_h(nlevel,ntime) |
---|
169 | real*8 s_adv_v(nlevel,ntime) |
---|
170 | real*8 p_srf_aver(ntime), p_srf_center(ntime) |
---|
171 | real*8 T_srf(ntime) |
---|
172 | |
---|
173 | integer nid, ierr |
---|
174 | integer nbvar3d |
---|
175 | parameter(nbvar3d=20) |
---|
176 | integer var3didin(nbvar3d) |
---|
177 | |
---|
178 | ierr = nf90_open(fich_twpice,nf90_nowrite,nid) |
---|
179 | if (ierr.NE.nf90_noerr) then |
---|
180 | write(*,*) 'ERROR: Pb opening forcings cdf file ' |
---|
181 | write(*,*) nf90_strerror(ierr) |
---|
182 | stop "" |
---|
183 | endif |
---|
184 | |
---|
185 | ierr=nf90_inq_varid(nid,"lat",var3didin(1)) |
---|
186 | if(ierr/=nf90_noerr) then |
---|
187 | write(*,*) nf90_strerror(ierr) |
---|
188 | stop 'lat' |
---|
189 | endif |
---|
190 | |
---|
191 | ierr=nf90_inq_varid(nid,"lon",var3didin(2)) |
---|
192 | if(ierr/=nf90_noerr) then |
---|
193 | write(*,*) nf90_strerror(ierr) |
---|
194 | stop 'lon' |
---|
195 | endif |
---|
196 | |
---|
197 | ierr=nf90_inq_varid(nid,"alt",var3didin(3)) |
---|
198 | if(ierr/=nf90_noerr) then |
---|
199 | write(*,*) nf90_strerror(ierr) |
---|
200 | stop 'alt' |
---|
201 | endif |
---|
202 | |
---|
203 | ierr=nf90_inq_varid(nid,"phis",var3didin(4)) |
---|
204 | if(ierr/=nf90_noerr) then |
---|
205 | write(*,*) nf90_strerror(ierr) |
---|
206 | stop 'phis' |
---|
207 | endif |
---|
208 | |
---|
209 | ierr=nf90_inq_varid(nid,"T",var3didin(5)) |
---|
210 | if(ierr/=nf90_noerr) then |
---|
211 | write(*,*) nf90_strerror(ierr) |
---|
212 | stop 'T' |
---|
213 | endif |
---|
214 | |
---|
215 | ierr=nf90_inq_varid(nid,"q",var3didin(6)) |
---|
216 | if(ierr/=nf90_noerr) then |
---|
217 | write(*,*) nf90_strerror(ierr) |
---|
218 | stop 'q' |
---|
219 | endif |
---|
220 | |
---|
221 | ierr=nf90_inq_varid(nid,"u",var3didin(7)) |
---|
222 | if(ierr/=nf90_noerr) then |
---|
223 | write(*,*) nf90_strerror(ierr) |
---|
224 | stop 'u' |
---|
225 | endif |
---|
226 | |
---|
227 | ierr=nf90_inq_varid(nid,"v",var3didin(8)) |
---|
228 | if(ierr/=nf90_noerr) then |
---|
229 | write(*,*) nf90_strerror(ierr) |
---|
230 | stop 'v' |
---|
231 | endif |
---|
232 | |
---|
233 | ierr=nf90_inq_varid(nid,"omega",var3didin(9)) |
---|
234 | if(ierr/=nf90_noerr) then |
---|
235 | write(*,*) nf90_strerror(ierr) |
---|
236 | stop 'omega' |
---|
237 | endif |
---|
238 | |
---|
239 | ierr=nf90_inq_varid(nid,"div",var3didin(10)) |
---|
240 | if(ierr/=nf90_noerr) then |
---|
241 | write(*,*) nf90_strerror(ierr) |
---|
242 | stop 'div' |
---|
243 | endif |
---|
244 | |
---|
245 | ierr=nf90_inq_varid(nid,"T_adv_h",var3didin(11)) |
---|
246 | if(ierr/=nf90_noerr) then |
---|
247 | write(*,*) nf90_strerror(ierr) |
---|
248 | stop 'T_adv_h' |
---|
249 | endif |
---|
250 | |
---|
251 | ierr=nf90_inq_varid(nid,"T_adv_v",var3didin(12)) |
---|
252 | if(ierr/=nf90_noerr) then |
---|
253 | write(*,*) nf90_strerror(ierr) |
---|
254 | stop 'T_adv_v' |
---|
255 | endif |
---|
256 | |
---|
257 | ierr=nf90_inq_varid(nid,"q_adv_h",var3didin(13)) |
---|
258 | if(ierr/=nf90_noerr) then |
---|
259 | write(*,*) nf90_strerror(ierr) |
---|
260 | stop 'q_adv_h' |
---|
261 | endif |
---|
262 | |
---|
263 | ierr=nf90_inq_varid(nid,"q_adv_v",var3didin(14)) |
---|
264 | if(ierr/=nf90_noerr) then |
---|
265 | write(*,*) nf90_strerror(ierr) |
---|
266 | stop 'q_adv_v' |
---|
267 | endif |
---|
268 | |
---|
269 | ierr=nf90_inq_varid(nid,"s",var3didin(15)) |
---|
270 | if(ierr/=nf90_noerr) then |
---|
271 | write(*,*) nf90_strerror(ierr) |
---|
272 | stop 's' |
---|
273 | endif |
---|
274 | |
---|
275 | ierr=nf90_inq_varid(nid,"s_adv_h",var3didin(16)) |
---|
276 | if(ierr/=nf90_noerr) then |
---|
277 | write(*,*) nf90_strerror(ierr) |
---|
278 | stop 's_adv_h' |
---|
279 | endif |
---|
280 | |
---|
281 | ierr=nf90_inq_varid(nid,"s_adv_v",var3didin(17)) |
---|
282 | if(ierr/=nf90_noerr) then |
---|
283 | write(*,*) nf90_strerror(ierr) |
---|
284 | stop 's_adv_v' |
---|
285 | endif |
---|
286 | |
---|
287 | ierr=nf90_inq_varid(nid,"p_srf_aver",var3didin(18)) |
---|
288 | if(ierr/=nf90_noerr) then |
---|
289 | write(*,*) nf90_strerror(ierr) |
---|
290 | stop 'p_srf_aver' |
---|
291 | endif |
---|
292 | |
---|
293 | ierr=nf90_inq_varid(nid,"p_srf_center",var3didin(19)) |
---|
294 | if(ierr/=nf90_noerr) then |
---|
295 | write(*,*) nf90_strerror(ierr) |
---|
296 | stop 'p_srf_center' |
---|
297 | endif |
---|
298 | |
---|
299 | ierr=nf90_inq_varid(nid,"T_srf",var3didin(20)) |
---|
300 | if(ierr/=nf90_noerr) then |
---|
301 | write(*,*) nf90_strerror(ierr) |
---|
302 | stop 'T_srf' |
---|
303 | endif |
---|
304 | |
---|
305 | !dimensions lecture |
---|
306 | call catchaxis(nid,ntime,nlevel,time,lev,ierr) |
---|
307 | |
---|
308 | !pressure |
---|
309 | do l=1,ntime |
---|
310 | do k=1,nlevel |
---|
311 | plev(k,l)=lev(k) |
---|
312 | enddo |
---|
313 | enddo |
---|
314 | |
---|
315 | ierr = NF90_GET_VAR(nid,var3didin(1),lat) |
---|
316 | if(ierr/=nf90_noerr) then |
---|
317 | write(*,*) nf90_strerror(ierr) |
---|
318 | stop "getvarup" |
---|
319 | endif |
---|
320 | ! write(*,*)'lecture lat ok',lat |
---|
321 | |
---|
322 | ierr = NF90_GET_VAR(nid,var3didin(2),lon) |
---|
323 | if(ierr/=nf90_noerr) then |
---|
324 | write(*,*) nf90_strerror(ierr) |
---|
325 | stop "getvarup" |
---|
326 | endif |
---|
327 | ! write(*,*)'lecture lon ok',lon |
---|
328 | |
---|
329 | ierr = NF90_GET_VAR(nid,var3didin(3),alt) |
---|
330 | if(ierr/=nf90_noerr) then |
---|
331 | write(*,*) nf90_strerror(ierr) |
---|
332 | stop "getvarup" |
---|
333 | endif |
---|
334 | ! write(*,*)'lecture alt ok',alt |
---|
335 | |
---|
336 | ierr = NF90_GET_VAR(nid,var3didin(4),phis) |
---|
337 | if(ierr/=nf90_noerr) then |
---|
338 | write(*,*) nf90_strerror(ierr) |
---|
339 | stop "getvarup" |
---|
340 | endif |
---|
341 | ! write(*,*)'lecture phis ok',phis |
---|
342 | |
---|
343 | ierr = NF90_GET_VAR(nid,var3didin(5),T) |
---|
344 | if(ierr/=nf90_noerr) then |
---|
345 | write(*,*) nf90_strerror(ierr) |
---|
346 | stop "getvarup" |
---|
347 | endif |
---|
348 | ! write(*,*)'lecture T ok' |
---|
349 | |
---|
350 | ierr = NF90_GET_VAR(nid,var3didin(6),q) |
---|
351 | if(ierr/=nf90_noerr) then |
---|
352 | write(*,*) nf90_strerror(ierr) |
---|
353 | stop "getvarup" |
---|
354 | endif |
---|
355 | ! write(*,*)'lecture q ok' |
---|
356 | !q in kg/kg |
---|
357 | do l=1,ntime |
---|
358 | do k=1,nlevel |
---|
359 | q(k,l)=q(k,l)/1000. |
---|
360 | enddo |
---|
361 | enddo |
---|
362 | ierr = NF90_GET_VAR(nid,var3didin(7),u) |
---|
363 | if(ierr/=nf90_noerr) then |
---|
364 | write(*,*) nf90_strerror(ierr) |
---|
365 | stop "getvarup" |
---|
366 | endif |
---|
367 | ! write(*,*)'lecture u ok' |
---|
368 | |
---|
369 | ierr = NF90_GET_VAR(nid,var3didin(8),v) |
---|
370 | if(ierr/=nf90_noerr) then |
---|
371 | write(*,*) nf90_strerror(ierr) |
---|
372 | stop "getvarup" |
---|
373 | endif |
---|
374 | ! write(*,*)'lecture v ok' |
---|
375 | |
---|
376 | ierr = NF90_GET_VAR(nid,var3didin(9),omega) |
---|
377 | if(ierr/=nf90_noerr) then |
---|
378 | write(*,*) nf90_strerror(ierr) |
---|
379 | stop "getvarup" |
---|
380 | endif |
---|
381 | ! write(*,*)'lecture omega ok' |
---|
382 | !omega in mb/hour |
---|
383 | do l=1,ntime |
---|
384 | do k=1,nlevel |
---|
385 | omega(k,l)=omega(k,l)*100./3600. |
---|
386 | enddo |
---|
387 | enddo |
---|
388 | |
---|
389 | ierr = NF90_GET_VAR(nid,var3didin(10),div) |
---|
390 | if(ierr/=nf90_noerr) then |
---|
391 | write(*,*) nf90_strerror(ierr) |
---|
392 | stop "getvarup" |
---|
393 | endif |
---|
394 | ! write(*,*)'lecture div ok' |
---|
395 | |
---|
396 | ierr = NF90_GET_VAR(nid,var3didin(11),T_adv_h) |
---|
397 | if(ierr/=nf90_noerr) then |
---|
398 | write(*,*) nf90_strerror(ierr) |
---|
399 | stop "getvarup" |
---|
400 | endif |
---|
401 | ! write(*,*)'lecture T_adv_h ok' |
---|
402 | !T adv in K/s |
---|
403 | do l=1,ntime |
---|
404 | do k=1,nlevel |
---|
405 | T_adv_h(k,l)=T_adv_h(k,l)/3600. |
---|
406 | enddo |
---|
407 | enddo |
---|
408 | |
---|
409 | |
---|
410 | ierr = NF90_GET_VAR(nid,var3didin(12),T_adv_v) |
---|
411 | if(ierr/=nf90_noerr) then |
---|
412 | write(*,*) nf90_strerror(ierr) |
---|
413 | stop "getvarup" |
---|
414 | endif |
---|
415 | ! write(*,*)'lecture T_adv_v ok' |
---|
416 | !T adv in K/s |
---|
417 | do l=1,ntime |
---|
418 | do k=1,nlevel |
---|
419 | T_adv_v(k,l)=T_adv_v(k,l)/3600. |
---|
420 | enddo |
---|
421 | enddo |
---|
422 | |
---|
423 | ierr = NF90_GET_VAR(nid,var3didin(13),q_adv_h) |
---|
424 | if(ierr/=nf90_noerr) then |
---|
425 | write(*,*) nf90_strerror(ierr) |
---|
426 | stop "getvarup" |
---|
427 | endif |
---|
428 | ! write(*,*)'lecture q_adv_h ok' |
---|
429 | !q adv in kg/kg/s |
---|
430 | do l=1,ntime |
---|
431 | do k=1,nlevel |
---|
432 | q_adv_h(k,l)=q_adv_h(k,l)/1000./3600. |
---|
433 | enddo |
---|
434 | enddo |
---|
435 | |
---|
436 | |
---|
437 | ierr = NF90_GET_VAR(nid,var3didin(14),q_adv_v) |
---|
438 | if(ierr/=nf90_noerr) then |
---|
439 | write(*,*) nf90_strerror(ierr) |
---|
440 | stop "getvarup" |
---|
441 | endif |
---|
442 | ! write(*,*)'lecture q_adv_v ok' |
---|
443 | !q adv in kg/kg/s |
---|
444 | do l=1,ntime |
---|
445 | do k=1,nlevel |
---|
446 | q_adv_v(k,l)=q_adv_v(k,l)/1000./3600. |
---|
447 | enddo |
---|
448 | enddo |
---|
449 | |
---|
450 | |
---|
451 | ierr = NF90_GET_VAR(nid,var3didin(15),s) |
---|
452 | if(ierr/=nf90_noerr) then |
---|
453 | write(*,*) nf90_strerror(ierr) |
---|
454 | stop "getvarup" |
---|
455 | endif |
---|
456 | |
---|
457 | ierr = NF90_GET_VAR(nid,var3didin(16),s_adv_h) |
---|
458 | if(ierr/=nf90_noerr) then |
---|
459 | write(*,*) nf90_strerror(ierr) |
---|
460 | stop "getvarup" |
---|
461 | endif |
---|
462 | |
---|
463 | ierr = NF90_GET_VAR(nid,var3didin(17),s_adv_v) |
---|
464 | if(ierr/=nf90_noerr) then |
---|
465 | write(*,*) nf90_strerror(ierr) |
---|
466 | stop "getvarup" |
---|
467 | endif |
---|
468 | |
---|
469 | ierr = NF90_GET_VAR(nid,var3didin(18),p_srf_aver) |
---|
470 | if(ierr/=nf90_noerr) then |
---|
471 | write(*,*) nf90_strerror(ierr) |
---|
472 | stop "getvarup" |
---|
473 | endif |
---|
474 | |
---|
475 | ierr = NF90_GET_VAR(nid,var3didin(19),p_srf_center) |
---|
476 | if(ierr/=nf90_noerr) then |
---|
477 | write(*,*) nf90_strerror(ierr) |
---|
478 | stop "getvarup" |
---|
479 | endif |
---|
480 | |
---|
481 | ierr = NF90_GET_VAR(nid,var3didin(20),T_srf) |
---|
482 | if(ierr/=nf90_noerr) then |
---|
483 | write(*,*) nf90_strerror(ierr) |
---|
484 | stop "getvarup" |
---|
485 | endif |
---|
486 | ! write(*,*)'lecture T_srf ok', T_srf |
---|
487 | |
---|
488 | return |
---|
489 | end subroutine read_twpice |
---|
490 | !===================================================================== |
---|
491 | subroutine catchaxis(nid,ttm,llm,time,lev,ierr) |
---|
492 | |
---|
493 | USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,& |
---|
494 | nf90_inq_dimid,nf90_inquire_dimension |
---|
495 | |
---|
496 | implicit none |
---|
497 | integer nid,ttm,llm |
---|
498 | real*8 time(ttm) |
---|
499 | real*8 lev(llm) |
---|
500 | integer ierr |
---|
501 | |
---|
502 | integer timevar,levvar |
---|
503 | integer timelen,levlen |
---|
504 | integer timedimin,levdimin |
---|
505 | |
---|
506 | ! Control & lecture on dimensions |
---|
507 | ! =============================== |
---|
508 | ierr=nf90_inq_dimid(nid,"time",timedimin) |
---|
509 | ierr=nf90_inq_varid(nid,"time",timevar) |
---|
510 | if (ierr.NE.nf90_noerr) then |
---|
511 | write(*,*) 'ERROR: Field <time> is missing' |
---|
512 | stop "" |
---|
513 | endif |
---|
514 | ierr=nf90_inquire_dimension(nid,timedimin,len=timelen) |
---|
515 | |
---|
516 | ierr=nf90_inq_dimid(nid,"lev",levdimin) |
---|
517 | ierr=nf90_inq_varid(nid,"lev",levvar) |
---|
518 | if (ierr.NE.nf90_noerr) then |
---|
519 | write(*,*) 'ERROR: Field <lev> is lacking' |
---|
520 | stop "" |
---|
521 | endif |
---|
522 | ierr=nf90_inquire_dimension(nid,levdimin,len=levlen) |
---|
523 | |
---|
524 | if((timelen/=ttm).or.(levlen/=llm)) then |
---|
525 | write(*,*) 'ERROR: Not the good lenght for axis' |
---|
526 | write(*,*) 'longitude: ',timelen,ttm+1 |
---|
527 | write(*,*) 'latitude: ',levlen,llm |
---|
528 | stop "" |
---|
529 | endif |
---|
530 | |
---|
531 | ierr = NF90_GET_VAR(nid,timevar,time) |
---|
532 | ierr = NF90_GET_VAR(nid,levvar,lev) |
---|
533 | |
---|
534 | return |
---|
535 | end |
---|
536 | !===================================================================== |
---|
537 | |
---|
538 | SUBROUTINE interp_sandu_vertical(play,nlev_sandu,plev_prof & |
---|
539 | & ,t_prof,thl_prof,q_prof,u_prof,v_prof,w_prof & |
---|
540 | & ,omega_prof,o3mmr_prof & |
---|
541 | & ,t_mod,thl_mod,q_mod,u_mod,v_mod,w_mod & |
---|
542 | & ,omega_mod,o3mmr_mod,mxcalc) |
---|
543 | |
---|
544 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
545 | implicit none |
---|
546 | |
---|
547 | |
---|
548 | |
---|
549 | !------------------------------------------------------------------------- |
---|
550 | ! Vertical interpolation of SANDUREF forcing data onto model levels |
---|
551 | !------------------------------------------------------------------------- |
---|
552 | |
---|
553 | integer nlevmax |
---|
554 | parameter (nlevmax=41) |
---|
555 | integer nlev_sandu,mxcalc |
---|
556 | ! real play(llm), plev_prof(nlevmax) |
---|
557 | ! real t_prof(nlevmax),q_prof(nlevmax) |
---|
558 | ! real u_prof(nlevmax),v_prof(nlevmax), w_prof(nlevmax) |
---|
559 | ! real ht_prof(nlevmax),vt_prof(nlevmax) |
---|
560 | ! real hq_prof(nlevmax),vq_prof(nlevmax) |
---|
561 | |
---|
562 | real play(llm), plev_prof(nlev_sandu) |
---|
563 | real t_prof(nlev_sandu),thl_prof(nlev_sandu),q_prof(nlev_sandu) |
---|
564 | real u_prof(nlev_sandu),v_prof(nlev_sandu), w_prof(nlev_sandu) |
---|
565 | real omega_prof(nlev_sandu),o3mmr_prof(nlev_sandu) |
---|
566 | |
---|
567 | real t_mod(llm),thl_mod(llm),q_mod(llm) |
---|
568 | real u_mod(llm),v_mod(llm), w_mod(llm) |
---|
569 | real omega_mod(llm),o3mmr_mod(llm) |
---|
570 | |
---|
571 | integer l,k,k1,k2 |
---|
572 | real frac,frac1,frac2,fact |
---|
573 | |
---|
574 | do l = 1, llm |
---|
575 | |
---|
576 | if (play(l).ge.plev_prof(nlev_sandu)) then |
---|
577 | |
---|
578 | mxcalc=l |
---|
579 | k1=0 |
---|
580 | k2=0 |
---|
581 | |
---|
582 | if (play(l).le.plev_prof(1)) then |
---|
583 | |
---|
584 | do k = 1, nlev_sandu-1 |
---|
585 | if (play(l).le.plev_prof(k).and. play(l).gt.plev_prof(k+1)) then |
---|
586 | k1=k |
---|
587 | k2=k+1 |
---|
588 | endif |
---|
589 | enddo |
---|
590 | |
---|
591 | if (k1.eq.0 .or. k2.eq.0) then |
---|
592 | write(*,*) 'PB! k1, k2 = ',k1,k2 |
---|
593 | write(*,*) 'l,play(l) = ',l,play(l)/100 |
---|
594 | do k = 1, nlev_sandu-1 |
---|
595 | write(*,*) 'k,plev_prof(k) = ',k,plev_prof(k)/100 |
---|
596 | enddo |
---|
597 | endif |
---|
598 | |
---|
599 | frac = (plev_prof(k2)-play(l))/(plev_prof(k2)-plev_prof(k1)) |
---|
600 | t_mod(l)= t_prof(k2) - frac*(t_prof(k2)-t_prof(k1)) |
---|
601 | thl_mod(l)= thl_prof(k2) - frac*(thl_prof(k2)-thl_prof(k1)) |
---|
602 | q_mod(l)= q_prof(k2) - frac*(q_prof(k2)-q_prof(k1)) |
---|
603 | u_mod(l)= u_prof(k2) - frac*(u_prof(k2)-u_prof(k1)) |
---|
604 | v_mod(l)= v_prof(k2) - frac*(v_prof(k2)-v_prof(k1)) |
---|
605 | w_mod(l)= w_prof(k2) - frac*(w_prof(k2)-w_prof(k1)) |
---|
606 | omega_mod(l)=omega_prof(k2)-frac*(omega_prof(k2)-omega_prof(k1)) |
---|
607 | o3mmr_mod(l)=o3mmr_prof(k2)-frac*(o3mmr_prof(k2)-o3mmr_prof(k1)) |
---|
608 | |
---|
609 | else !play>plev_prof(1) |
---|
610 | |
---|
611 | k1=1 |
---|
612 | k2=2 |
---|
613 | frac1 = (play(l)-plev_prof(k2))/(plev_prof(k1)-plev_prof(k2)) |
---|
614 | frac2 = (play(l)-plev_prof(k1))/(plev_prof(k1)-plev_prof(k2)) |
---|
615 | t_mod(l)= frac1*t_prof(k1) - frac2*t_prof(k2) |
---|
616 | thl_mod(l)= frac1*thl_prof(k1) - frac2*thl_prof(k2) |
---|
617 | q_mod(l)= frac1*q_prof(k1) - frac2*q_prof(k2) |
---|
618 | u_mod(l)= frac1*u_prof(k1) - frac2*u_prof(k2) |
---|
619 | v_mod(l)= frac1*v_prof(k1) - frac2*v_prof(k2) |
---|
620 | w_mod(l)= frac1*w_prof(k1) - frac2*w_prof(k2) |
---|
621 | omega_mod(l)= frac1*omega_prof(k1) - frac2*omega_prof(k2) |
---|
622 | o3mmr_mod(l)= frac1*o3mmr_prof(k1) - frac2*o3mmr_prof(k2) |
---|
623 | |
---|
624 | endif ! play.le.plev_prof(1) |
---|
625 | |
---|
626 | else ! above max altitude of forcing file |
---|
627 | |
---|
628 | !jyg |
---|
629 | fact=20.*(plev_prof(nlev_sandu)-play(l))/plev_prof(nlev_sandu) !jyg |
---|
630 | fact = max(fact,0.) !jyg |
---|
631 | fact = exp(-fact) !jyg |
---|
632 | t_mod(l)= t_prof(nlev_sandu) !jyg |
---|
633 | thl_mod(l)= thl_prof(nlev_sandu) !jyg |
---|
634 | q_mod(l)= q_prof(nlev_sandu)*fact !jyg |
---|
635 | u_mod(l)= u_prof(nlev_sandu)*fact !jyg |
---|
636 | v_mod(l)= v_prof(nlev_sandu)*fact !jyg |
---|
637 | w_mod(l)= w_prof(nlev_sandu)*fact !jyg |
---|
638 | omega_mod(l)= omega_prof(nlev_sandu)*fact !jyg |
---|
639 | o3mmr_mod(l)= o3mmr_prof(nlev_sandu)*fact !jyg |
---|
640 | |
---|
641 | endif ! play |
---|
642 | |
---|
643 | enddo ! l |
---|
644 | |
---|
645 | do l = 1,llm |
---|
646 | ! print *,'t_mod(l),thl_mod(l),q_mod(l),u_mod(l),v_mod(l) ', |
---|
647 | ! $ l,t_mod(l),thl_mod(l),q_mod(l),u_mod(l),v_mod(l) |
---|
648 | enddo |
---|
649 | |
---|
650 | return |
---|
651 | end |
---|
652 | !===================================================================== |
---|
653 | SUBROUTINE interp_astex_vertical(play,nlev_astex,plev_prof & |
---|
654 | & ,t_prof,thl_prof,qv_prof,ql_prof,qt_prof,u_prof,v_prof & |
---|
655 | & ,w_prof,tke_prof,o3mmr_prof & |
---|
656 | & ,t_mod,thl_mod,qv_mod,ql_mod,qt_mod,u_mod,v_mod,w_mod & |
---|
657 | & ,tke_mod,o3mmr_mod,mxcalc) |
---|
658 | |
---|
659 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
660 | implicit none |
---|
661 | |
---|
662 | |
---|
663 | |
---|
664 | !------------------------------------------------------------------------- |
---|
665 | ! Vertical interpolation of Astex forcing data onto model levels |
---|
666 | !------------------------------------------------------------------------- |
---|
667 | |
---|
668 | integer nlevmax |
---|
669 | parameter (nlevmax=41) |
---|
670 | integer nlev_astex,mxcalc |
---|
671 | ! real play(llm), plev_prof(nlevmax) |
---|
672 | ! real t_prof(nlevmax),qv_prof(nlevmax) |
---|
673 | ! real u_prof(nlevmax),v_prof(nlevmax), w_prof(nlevmax) |
---|
674 | ! real ht_prof(nlevmax),vt_prof(nlevmax) |
---|
675 | ! real hq_prof(nlevmax),vq_prof(nlevmax) |
---|
676 | |
---|
677 | real play(llm), plev_prof(nlev_astex) |
---|
678 | real t_prof(nlev_astex),thl_prof(nlev_astex),qv_prof(nlev_astex) |
---|
679 | real u_prof(nlev_astex),v_prof(nlev_astex), w_prof(nlev_astex) |
---|
680 | real o3mmr_prof(nlev_astex),ql_prof(nlev_astex) |
---|
681 | real qt_prof(nlev_astex),tke_prof(nlev_astex) |
---|
682 | |
---|
683 | real t_mod(llm),thl_mod(llm),qv_mod(llm) |
---|
684 | real u_mod(llm),v_mod(llm), w_mod(llm),tke_mod(llm) |
---|
685 | real o3mmr_mod(llm),ql_mod(llm),qt_mod(llm) |
---|
686 | |
---|
687 | integer l,k,k1,k2 |
---|
688 | real frac,frac1,frac2,fact |
---|
689 | |
---|
690 | do l = 1, llm |
---|
691 | |
---|
692 | if (play(l).ge.plev_prof(nlev_astex)) then |
---|
693 | |
---|
694 | mxcalc=l |
---|
695 | k1=0 |
---|
696 | k2=0 |
---|
697 | |
---|
698 | if (play(l).le.plev_prof(1)) then |
---|
699 | |
---|
700 | do k = 1, nlev_astex-1 |
---|
701 | if (play(l).le.plev_prof(k).and. play(l).gt.plev_prof(k+1)) then |
---|
702 | k1=k |
---|
703 | k2=k+1 |
---|
704 | endif |
---|
705 | enddo |
---|
706 | |
---|
707 | if (k1.eq.0 .or. k2.eq.0) then |
---|
708 | write(*,*) 'PB! k1, k2 = ',k1,k2 |
---|
709 | write(*,*) 'l,play(l) = ',l,play(l)/100 |
---|
710 | do k = 1, nlev_astex-1 |
---|
711 | write(*,*) 'k,plev_prof(k) = ',k,plev_prof(k)/100 |
---|
712 | enddo |
---|
713 | endif |
---|
714 | |
---|
715 | frac = (plev_prof(k2)-play(l))/(plev_prof(k2)-plev_prof(k1)) |
---|
716 | t_mod(l)= t_prof(k2) - frac*(t_prof(k2)-t_prof(k1)) |
---|
717 | thl_mod(l)= thl_prof(k2) - frac*(thl_prof(k2)-thl_prof(k1)) |
---|
718 | qv_mod(l)= qv_prof(k2) - frac*(qv_prof(k2)-qv_prof(k1)) |
---|
719 | ql_mod(l)= ql_prof(k2) - frac*(ql_prof(k2)-ql_prof(k1)) |
---|
720 | qt_mod(l)= qt_prof(k2) - frac*(qt_prof(k2)-qt_prof(k1)) |
---|
721 | u_mod(l)= u_prof(k2) - frac*(u_prof(k2)-u_prof(k1)) |
---|
722 | v_mod(l)= v_prof(k2) - frac*(v_prof(k2)-v_prof(k1)) |
---|
723 | w_mod(l)= w_prof(k2) - frac*(w_prof(k2)-w_prof(k1)) |
---|
724 | tke_mod(l)= tke_prof(k2) - frac*(tke_prof(k2)-tke_prof(k1)) |
---|
725 | o3mmr_mod(l)=o3mmr_prof(k2)-frac*(o3mmr_prof(k2)-o3mmr_prof(k1)) |
---|
726 | |
---|
727 | else !play>plev_prof(1) |
---|
728 | |
---|
729 | k1=1 |
---|
730 | k2=2 |
---|
731 | frac1 = (play(l)-plev_prof(k2))/(plev_prof(k1)-plev_prof(k2)) |
---|
732 | frac2 = (play(l)-plev_prof(k1))/(plev_prof(k1)-plev_prof(k2)) |
---|
733 | t_mod(l)= frac1*t_prof(k1) - frac2*t_prof(k2) |
---|
734 | thl_mod(l)= frac1*thl_prof(k1) - frac2*thl_prof(k2) |
---|
735 | qv_mod(l)= frac1*qv_prof(k1) - frac2*qv_prof(k2) |
---|
736 | ql_mod(l)= frac1*ql_prof(k1) - frac2*ql_prof(k2) |
---|
737 | qt_mod(l)= frac1*qt_prof(k1) - frac2*qt_prof(k2) |
---|
738 | u_mod(l)= frac1*u_prof(k1) - frac2*u_prof(k2) |
---|
739 | v_mod(l)= frac1*v_prof(k1) - frac2*v_prof(k2) |
---|
740 | w_mod(l)= frac1*w_prof(k1) - frac2*w_prof(k2) |
---|
741 | tke_mod(l)= frac1*tke_prof(k1) - frac2*tke_prof(k2) |
---|
742 | o3mmr_mod(l)= frac1*o3mmr_prof(k1) - frac2*o3mmr_prof(k2) |
---|
743 | |
---|
744 | endif ! play.le.plev_prof(1) |
---|
745 | |
---|
746 | else ! above max altitude of forcing file |
---|
747 | |
---|
748 | !jyg |
---|
749 | fact=20.*(plev_prof(nlev_astex)-play(l))/plev_prof(nlev_astex) !jyg |
---|
750 | fact = max(fact,0.) !jyg |
---|
751 | fact = exp(-fact) !jyg |
---|
752 | t_mod(l)= t_prof(nlev_astex) !jyg |
---|
753 | thl_mod(l)= thl_prof(nlev_astex) !jyg |
---|
754 | qv_mod(l)= qv_prof(nlev_astex)*fact !jyg |
---|
755 | ql_mod(l)= ql_prof(nlev_astex)*fact !jyg |
---|
756 | qt_mod(l)= qt_prof(nlev_astex)*fact !jyg |
---|
757 | u_mod(l)= u_prof(nlev_astex)*fact !jyg |
---|
758 | v_mod(l)= v_prof(nlev_astex)*fact !jyg |
---|
759 | w_mod(l)= w_prof(nlev_astex)*fact !jyg |
---|
760 | tke_mod(l)= tke_prof(nlev_astex)*fact !jyg |
---|
761 | o3mmr_mod(l)= o3mmr_prof(nlev_astex)*fact !jyg |
---|
762 | |
---|
763 | endif ! play |
---|
764 | |
---|
765 | enddo ! l |
---|
766 | |
---|
767 | do l = 1,llm |
---|
768 | ! print *,'t_mod(l),thl_mod(l),qv_mod(l),u_mod(l),v_mod(l) ', |
---|
769 | ! $ l,t_mod(l),thl_mod(l),qv_mod(l),u_mod(l),v_mod(l) |
---|
770 | enddo |
---|
771 | |
---|
772 | return |
---|
773 | end |
---|
774 | |
---|
775 | !====================================================================== |
---|
776 | SUBROUTINE read_rico(fich_rico,nlev_rico,ps_rico,play & |
---|
777 | & ,ts_rico,t_rico,q_rico,u_rico,v_rico,w_rico & |
---|
778 | & ,dth_dyn,dqh_dyn) |
---|
779 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
780 | implicit none |
---|
781 | |
---|
782 | !------------------------------------------------------------------------- |
---|
783 | ! Read RICO forcing data |
---|
784 | !------------------------------------------------------------------------- |
---|
785 | |
---|
786 | |
---|
787 | |
---|
788 | integer nlev_rico |
---|
789 | real ts_rico,ps_rico |
---|
790 | real t_rico(llm),q_rico(llm) |
---|
791 | real u_rico(llm),v_rico(llm) |
---|
792 | real w_rico(llm) |
---|
793 | real dth_dyn(llm) |
---|
794 | real dqh_dyn(llm) |
---|
795 | |
---|
796 | |
---|
797 | real play(llm),zlay(llm) |
---|
798 | |
---|
799 | |
---|
800 | real prico(nlev_rico),zrico(nlev_rico) |
---|
801 | |
---|
802 | character*80 fich_rico |
---|
803 | |
---|
804 | integer k,l |
---|
805 | |
---|
806 | |
---|
807 | print*,fich_rico |
---|
808 | open(21,file=trim(fich_rico),form='formatted') |
---|
809 | do k=1,llm |
---|
810 | zlay(k)=0. |
---|
811 | enddo |
---|
812 | |
---|
813 | read(21,*) ps_rico,ts_rico |
---|
814 | prico(1)=ps_rico |
---|
815 | zrico(1)=0.0 |
---|
816 | do l=2,nlev_rico |
---|
817 | read(21,*) k,prico(l),zrico(l) |
---|
818 | enddo |
---|
819 | close(21) |
---|
820 | |
---|
821 | do k=1,llm |
---|
822 | do l=1,80 |
---|
823 | if(prico(l)>play(k)) then |
---|
824 | if(play(k)>prico(l+1)) then |
---|
825 | zlay(k)=zrico(l)+(play(k)-prico(l)) * & |
---|
826 | & (zrico(l+1)-zrico(l))/(prico(l+1)-prico(l)) |
---|
827 | else |
---|
828 | zlay(k)=zrico(l)+(play(k)-prico(80))* & |
---|
829 | & (zrico(81)-zrico(80))/(prico(81)-prico(80)) |
---|
830 | endif |
---|
831 | endif |
---|
832 | enddo |
---|
833 | print*,k,zlay(k) |
---|
834 | ! U |
---|
835 | if(0 < zlay(k) .and. zlay(k) < 4000) then |
---|
836 | u_rico(k)=-9.9 + (-1.9 + 9.9)*zlay(k)/4000 |
---|
837 | elseif(4000 < zlay(k) .and. zlay(k) < 12000) then |
---|
838 | u_rico(k)= -1.9 + (30.0 + 1.9) / & |
---|
839 | & (12000 - 4000) * (zlay(k) - 4000) |
---|
840 | elseif(12000 < zlay(k) .and. zlay(k) < 13000) then |
---|
841 | u_rico(k)=30.0 |
---|
842 | elseif(13000 < zlay(k) .and. zlay(k) < 20000) then |
---|
843 | u_rico(k)=30.0 - (30.0) / & |
---|
844 | & (20000 - 13000) * (zlay(k) - 13000) |
---|
845 | else |
---|
846 | u_rico(k)=0.0 |
---|
847 | endif |
---|
848 | |
---|
849 | !Q_v |
---|
850 | if(0 < zlay(k) .and. zlay(k) < 740) then |
---|
851 | q_rico(k)=16.0 + (13.8 - 16.0) / (740) * zlay(k) |
---|
852 | elseif(740 < zlay(k) .and. zlay(k) < 3260) then |
---|
853 | q_rico(k)=13.8 + (2.4 - 13.8) / & |
---|
854 | & (3260 - 740) * (zlay(k) - 740) |
---|
855 | elseif(3260 < zlay(k) .and. zlay(k) < 4000) then |
---|
856 | q_rico(k)=2.4 + (1.8 - 2.4) / & |
---|
857 | & (4000 - 3260) * (zlay(k) - 3260) |
---|
858 | elseif(4000 < zlay(k) .and. zlay(k) < 9000) then |
---|
859 | q_rico(k)=1.8 + (0 - 1.8) / & |
---|
860 | & (9000 - 4000) * (zlay(k) - 4000) |
---|
861 | else |
---|
862 | q_rico(k)=0.0 |
---|
863 | endif |
---|
864 | |
---|
865 | !T |
---|
866 | if(0 < zlay(k) .and. zlay(k) < 740) then |
---|
867 | t_rico(k)=299.2 + (292.0 - 299.2) / (740) * zlay(k) |
---|
868 | elseif(740 < zlay(k) .and. zlay(k) < 4000) then |
---|
869 | t_rico(k)=292.0 + (278.0 - 292.0) / & |
---|
870 | & (4000 - 740) * (zlay(k) - 740) |
---|
871 | elseif(4000 < zlay(k) .and. zlay(k) < 15000) then |
---|
872 | t_rico(k)=278.0 + (203.0 - 278.0) / & |
---|
873 | & (15000 - 4000) * (zlay(k) - 4000) |
---|
874 | elseif(15000 < zlay(k) .and. zlay(k) < 17500) then |
---|
875 | t_rico(k)=203.0 + (194.0 - 203.0) / & |
---|
876 | & (17500 - 15000)* (zlay(k) - 15000) |
---|
877 | elseif(17500 < zlay(k) .and. zlay(k) < 20000) then |
---|
878 | t_rico(k)=194.0 + (206.0 - 194.0) / & |
---|
879 | & (20000 - 17500)* (zlay(k) - 17500) |
---|
880 | elseif(20000 < zlay(k) .and. zlay(k) < 60000) then |
---|
881 | t_rico(k)=206.0 + (270.0 - 206.0) / & |
---|
882 | & (60000 - 20000)* (zlay(k) - 20000) |
---|
883 | endif |
---|
884 | |
---|
885 | ! W |
---|
886 | if(0 < zlay(k) .and. zlay(k) < 2260 ) then |
---|
887 | w_rico(k)=- (0.005/2260) * zlay(k) |
---|
888 | elseif(2260 < zlay(k) .and. zlay(k) < 4000 ) then |
---|
889 | w_rico(k)=- 0.005 |
---|
890 | elseif(4000 < zlay(k) .and. zlay(k) < 5000 ) then |
---|
891 | w_rico(k)=- 0.005 + (0.005/ (5000 - 4000)) * (zlay(k) - 4000) |
---|
892 | else |
---|
893 | w_rico(k)=0.0 |
---|
894 | endif |
---|
895 | |
---|
896 | ! dThrz+dTsw0+dTlw0 |
---|
897 | if(0 < zlay(k) .and. zlay(k) < 4000) then |
---|
898 | dth_dyn(k)=- 2.51 / 86400 + (-2.18 + 2.51 )/ & |
---|
899 | & (86400*4000) * zlay(k) |
---|
900 | elseif(4000 < zlay(k) .and. zlay(k) < 5000) then |
---|
901 | dth_dyn(k)=- 2.18 / 86400 + ( 2.18 ) / & |
---|
902 | & (86400*(5000 - 4000)) * (zlay(k) - 4000) |
---|
903 | else |
---|
904 | dth_dyn(k)=0.0 |
---|
905 | endif |
---|
906 | ! dQhrz |
---|
907 | if(0 < zlay(k) .and. zlay(k) < 3000) then |
---|
908 | dqh_dyn(k)=-1.0 / 86400 + (0.345 + 1.0)/ & |
---|
909 | & (86400*3000) * (zlay(k)) |
---|
910 | elseif(3000 < zlay(k) .and. zlay(k) < 4000) then |
---|
911 | dqh_dyn(k)=0.345 / 86400 |
---|
912 | elseif(4000 < zlay(k) .and. zlay(k) < 5000) then |
---|
913 | dqh_dyn(k)=0.345 / 86400 + & |
---|
914 | & (-0.345)/(86400 * (5000 - 4000)) * (zlay(k)-4000) |
---|
915 | else |
---|
916 | dqh_dyn(k)=0.0 |
---|
917 | endif |
---|
918 | |
---|
919 | !? if(play(k)>6e4) then |
---|
920 | !? ratqs0(1,k)=ratqsbas*(plev(1)-play(k))/(plev(1)-6e4) |
---|
921 | !? elseif((play(k)>3e4).and.(play(k)<6e4)) then |
---|
922 | !? ratqs0(1,k)=ratqsbas+(ratqshaut-ratqsbas)& |
---|
923 | !? *(6e4-play(k))/(6e4-3e4) |
---|
924 | !? else |
---|
925 | !? ratqs0(1,k)=ratqshaut |
---|
926 | !? endif |
---|
927 | |
---|
928 | enddo |
---|
929 | |
---|
930 | do k=1,llm |
---|
931 | q_rico(k)=q_rico(k)/1e3 |
---|
932 | dqh_dyn(k)=dqh_dyn(k)/1e3 |
---|
933 | v_rico(k)=-3.8 |
---|
934 | enddo |
---|
935 | |
---|
936 | return |
---|
937 | end |
---|
938 | |
---|
939 | !====================================================================== |
---|
940 | SUBROUTINE interp_sandu_time(day,day1,annee_ref & |
---|
941 | & ,year_ini_sandu,day_ini_sandu,nt_sandu,dt_sandu & |
---|
942 | & ,nlev_sandu,ts_sandu,ts_prof) |
---|
943 | implicit none |
---|
944 | |
---|
945 | !--------------------------------------------------------------------------------------- |
---|
946 | ! Time interpolation of a 2D field to the timestep corresponding to day |
---|
947 | ! |
---|
948 | ! day: current julian day (e.g. 717538.2) |
---|
949 | ! day1: first day of the simulation |
---|
950 | ! nt_sandu: total nb of data in the forcing (e.g. 13 for Sanduref) |
---|
951 | ! dt_sandu: total time interval (in sec) between 2 forcing data (e.g. 6h for Sanduref) |
---|
952 | !--------------------------------------------------------------------------------------- |
---|
953 | ! inputs: |
---|
954 | integer annee_ref |
---|
955 | integer nt_sandu,nlev_sandu |
---|
956 | integer year_ini_sandu |
---|
957 | real day, day1,day_ini_sandu,dt_sandu |
---|
958 | real ts_sandu(nt_sandu) |
---|
959 | ! outputs: |
---|
960 | real ts_prof |
---|
961 | ! local: |
---|
962 | integer it_sandu1, it_sandu2 |
---|
963 | real timeit,time_sandu1,time_sandu2,frac |
---|
964 | ! Check that initial day of the simulation consistent with SANDU period: |
---|
965 | if (annee_ref.ne.2006 ) then |
---|
966 | print*,'Pour SANDUREF, annee_ref doit etre 2006 ' |
---|
967 | print*,'Changer annee_ref dans run.def' |
---|
968 | stop |
---|
969 | endif |
---|
970 | ! if (annee_ref.eq.2006 .and. day1.lt.day_ini_sandu) then |
---|
971 | ! print*,'SANDUREF debute le 15 Juillet 2006 (jour julien=196)' |
---|
972 | ! print*,'Changer dayref dans run.def' |
---|
973 | ! stop |
---|
974 | ! endif |
---|
975 | |
---|
976 | ! Determine timestep relative to the 1st day of TOGA-COARE: |
---|
977 | ! timeit=(day-day1)*86400. |
---|
978 | ! if (annee_ref.eq.1992) then |
---|
979 | ! timeit=(day-day_ini_sandu)*86400. |
---|
980 | ! else |
---|
981 | ! timeit=(day+61.-1.)*86400. ! 61 days between Nov01 and Dec31 1992 |
---|
982 | ! endif |
---|
983 | timeit=(day-day_ini_sandu)*86400 |
---|
984 | |
---|
985 | ! Determine the closest observation times: |
---|
986 | it_sandu1=INT(timeit/dt_sandu)+1 |
---|
987 | it_sandu2=it_sandu1 + 1 |
---|
988 | time_sandu1=(it_sandu1-1)*dt_sandu |
---|
989 | time_sandu2=(it_sandu2-1)*dt_sandu |
---|
990 | print *,'timeit day day_ini_sandu',timeit,day,day_ini_sandu |
---|
991 | print *,'it_sandu1,it_sandu2,time_sandu1,time_sandu2', & |
---|
992 | & it_sandu1,it_sandu2,time_sandu1,time_sandu2 |
---|
993 | |
---|
994 | if (it_sandu1 .ge. nt_sandu) then |
---|
995 | write(*,*) 'PB-stop: day, it_sandu1, it_sandu2, timeit: ' & |
---|
996 | & ,day,it_sandu1,it_sandu2,timeit/86400. |
---|
997 | stop |
---|
998 | endif |
---|
999 | |
---|
1000 | ! time interpolation: |
---|
1001 | frac=(time_sandu2-timeit)/(time_sandu2-time_sandu1) |
---|
1002 | frac=max(frac,0.0) |
---|
1003 | |
---|
1004 | ts_prof = ts_sandu(it_sandu2) & |
---|
1005 | & -frac*(ts_sandu(it_sandu2)-ts_sandu(it_sandu1)) |
---|
1006 | |
---|
1007 | print*, & |
---|
1008 | &'day,annee_ref,day_ini_sandu,timeit,it_sandu1,it_sandu2,SST:', & |
---|
1009 | &day,annee_ref,day_ini_sandu,timeit/86400.,it_sandu1, & |
---|
1010 | &it_sandu2,ts_prof |
---|
1011 | |
---|
1012 | return |
---|
1013 | END |
---|
1014 | !===================================================================== |
---|
1015 | !------------------------------------------------------------------------- |
---|
1016 | SUBROUTINE read_armcu(fich_armcu,nlev_armcu,nt_armcu, & |
---|
1017 | & sens,flat,adv_theta,rad_theta,adv_qt) |
---|
1018 | implicit none |
---|
1019 | |
---|
1020 | !------------------------------------------------------------------------- |
---|
1021 | ! Read ARM_CU case forcing data |
---|
1022 | !------------------------------------------------------------------------- |
---|
1023 | |
---|
1024 | integer nlev_armcu,nt_armcu |
---|
1025 | real sens(nt_armcu),flat(nt_armcu) |
---|
1026 | real adv_theta(nt_armcu),rad_theta(nt_armcu),adv_qt(nt_armcu) |
---|
1027 | character*80 fich_armcu |
---|
1028 | |
---|
1029 | integer ip |
---|
1030 | |
---|
1031 | integer iy,im,id,ih,in |
---|
1032 | |
---|
1033 | print*,'nlev_armcu',nlev_armcu |
---|
1034 | |
---|
1035 | open(21,file=trim(fich_armcu),form='formatted') |
---|
1036 | read(21,'(a)') |
---|
1037 | do ip = 1, nt_armcu |
---|
1038 | read(21,'(a)') |
---|
1039 | read(21,'(a)') |
---|
1040 | read(21,223) iy, im, id, ih, in, sens(ip),flat(ip), & |
---|
1041 | & adv_theta(ip),rad_theta(ip),adv_qt(ip) |
---|
1042 | print *,'forcages=',iy,im,id,ih,in, sens(ip),flat(ip), & |
---|
1043 | & adv_theta(ip),rad_theta(ip),adv_qt(ip) |
---|
1044 | enddo |
---|
1045 | close(21) |
---|
1046 | |
---|
1047 | 223 format(5i3,5f8.3) |
---|
1048 | |
---|
1049 | return |
---|
1050 | end |
---|
1051 | |
---|
1052 | !===================================================================== |
---|
1053 | SUBROUTINE interp_toga_vertical(play,nlev_toga,plev_prof & |
---|
1054 | & ,t_prof,q_prof,u_prof,v_prof,w_prof & |
---|
1055 | & ,ht_prof,vt_prof,hq_prof,vq_prof & |
---|
1056 | & ,t_mod,q_mod,u_mod,v_mod,w_mod & |
---|
1057 | & ,ht_mod,vt_mod,hq_mod,vq_mod,mxcalc) |
---|
1058 | |
---|
1059 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
1060 | implicit none |
---|
1061 | |
---|
1062 | |
---|
1063 | |
---|
1064 | !------------------------------------------------------------------------- |
---|
1065 | ! Vertical interpolation of TOGA-COARE forcing data onto model levels |
---|
1066 | !------------------------------------------------------------------------- |
---|
1067 | |
---|
1068 | integer nlevmax |
---|
1069 | parameter (nlevmax=41) |
---|
1070 | integer nlev_toga,mxcalc |
---|
1071 | ! real play(llm), plev_prof(nlevmax) |
---|
1072 | ! real t_prof(nlevmax),q_prof(nlevmax) |
---|
1073 | ! real u_prof(nlevmax),v_prof(nlevmax), w_prof(nlevmax) |
---|
1074 | ! real ht_prof(nlevmax),vt_prof(nlevmax) |
---|
1075 | ! real hq_prof(nlevmax),vq_prof(nlevmax) |
---|
1076 | |
---|
1077 | real play(llm), plev_prof(nlev_toga) |
---|
1078 | real t_prof(nlev_toga),q_prof(nlev_toga) |
---|
1079 | real u_prof(nlev_toga),v_prof(nlev_toga), w_prof(nlev_toga) |
---|
1080 | real ht_prof(nlev_toga),vt_prof(nlev_toga) |
---|
1081 | real hq_prof(nlev_toga),vq_prof(nlev_toga) |
---|
1082 | |
---|
1083 | real t_mod(llm),q_mod(llm) |
---|
1084 | real u_mod(llm),v_mod(llm), w_mod(llm) |
---|
1085 | real ht_mod(llm),vt_mod(llm) |
---|
1086 | real hq_mod(llm),vq_mod(llm) |
---|
1087 | |
---|
1088 | integer l,k,k1,k2 |
---|
1089 | real frac,frac1,frac2,fact |
---|
1090 | |
---|
1091 | do l = 1, llm |
---|
1092 | |
---|
1093 | if (play(l).ge.plev_prof(nlev_toga)) then |
---|
1094 | |
---|
1095 | mxcalc=l |
---|
1096 | k1=0 |
---|
1097 | k2=0 |
---|
1098 | |
---|
1099 | if (play(l).le.plev_prof(1)) then |
---|
1100 | |
---|
1101 | do k = 1, nlev_toga-1 |
---|
1102 | if (play(l).le.plev_prof(k).and. play(l).gt.plev_prof(k+1)) then |
---|
1103 | k1=k |
---|
1104 | k2=k+1 |
---|
1105 | endif |
---|
1106 | enddo |
---|
1107 | |
---|
1108 | if (k1.eq.0 .or. k2.eq.0) then |
---|
1109 | write(*,*) 'PB! k1, k2 = ',k1,k2 |
---|
1110 | write(*,*) 'l,play(l) = ',l,play(l)/100 |
---|
1111 | do k = 1, nlev_toga-1 |
---|
1112 | write(*,*) 'k,plev_prof(k) = ',k,plev_prof(k)/100 |
---|
1113 | enddo |
---|
1114 | endif |
---|
1115 | |
---|
1116 | frac = (plev_prof(k2)-play(l))/(plev_prof(k2)-plev_prof(k1)) |
---|
1117 | t_mod(l)= t_prof(k2) - frac*(t_prof(k2)-t_prof(k1)) |
---|
1118 | q_mod(l)= q_prof(k2) - frac*(q_prof(k2)-q_prof(k1)) |
---|
1119 | u_mod(l)= u_prof(k2) - frac*(u_prof(k2)-u_prof(k1)) |
---|
1120 | v_mod(l)= v_prof(k2) - frac*(v_prof(k2)-v_prof(k1)) |
---|
1121 | w_mod(l)= w_prof(k2) - frac*(w_prof(k2)-w_prof(k1)) |
---|
1122 | ht_mod(l)= ht_prof(k2) - frac*(ht_prof(k2)-ht_prof(k1)) |
---|
1123 | vt_mod(l)= vt_prof(k2) - frac*(vt_prof(k2)-vt_prof(k1)) |
---|
1124 | hq_mod(l)= hq_prof(k2) - frac*(hq_prof(k2)-hq_prof(k1)) |
---|
1125 | vq_mod(l)= vq_prof(k2) - frac*(vq_prof(k2)-vq_prof(k1)) |
---|
1126 | |
---|
1127 | else !play>plev_prof(1) |
---|
1128 | |
---|
1129 | k1=1 |
---|
1130 | k2=2 |
---|
1131 | frac1 = (play(l)-plev_prof(k2))/(plev_prof(k1)-plev_prof(k2)) |
---|
1132 | frac2 = (play(l)-plev_prof(k1))/(plev_prof(k1)-plev_prof(k2)) |
---|
1133 | t_mod(l)= frac1*t_prof(k1) - frac2*t_prof(k2) |
---|
1134 | q_mod(l)= frac1*q_prof(k1) - frac2*q_prof(k2) |
---|
1135 | u_mod(l)= frac1*u_prof(k1) - frac2*u_prof(k2) |
---|
1136 | v_mod(l)= frac1*v_prof(k1) - frac2*v_prof(k2) |
---|
1137 | w_mod(l)= frac1*w_prof(k1) - frac2*w_prof(k2) |
---|
1138 | ht_mod(l)= frac1*ht_prof(k1) - frac2*ht_prof(k2) |
---|
1139 | vt_mod(l)= frac1*vt_prof(k1) - frac2*vt_prof(k2) |
---|
1140 | hq_mod(l)= frac1*hq_prof(k1) - frac2*hq_prof(k2) |
---|
1141 | vq_mod(l)= frac1*vq_prof(k1) - frac2*vq_prof(k2) |
---|
1142 | |
---|
1143 | endif ! play.le.plev_prof(1) |
---|
1144 | |
---|
1145 | else ! above max altitude of forcing file |
---|
1146 | |
---|
1147 | !jyg |
---|
1148 | fact=20.*(plev_prof(nlev_toga)-play(l))/plev_prof(nlev_toga) !jyg |
---|
1149 | fact = max(fact,0.) !jyg |
---|
1150 | fact = exp(-fact) !jyg |
---|
1151 | t_mod(l)= t_prof(nlev_toga) !jyg |
---|
1152 | q_mod(l)= q_prof(nlev_toga)*fact !jyg |
---|
1153 | u_mod(l)= u_prof(nlev_toga)*fact !jyg |
---|
1154 | v_mod(l)= v_prof(nlev_toga)*fact !jyg |
---|
1155 | w_mod(l)= 0.0 !jyg |
---|
1156 | ht_mod(l)= ht_prof(nlev_toga) !jyg |
---|
1157 | vt_mod(l)= vt_prof(nlev_toga) !jyg |
---|
1158 | hq_mod(l)= hq_prof(nlev_toga)*fact !jyg |
---|
1159 | vq_mod(l)= vq_prof(nlev_toga)*fact !jyg |
---|
1160 | |
---|
1161 | endif ! play |
---|
1162 | |
---|
1163 | enddo ! l |
---|
1164 | |
---|
1165 | ! do l = 1,llm |
---|
1166 | ! print *,'t_mod(l),q_mod(l),ht_mod(l),hq_mod(l) ', |
---|
1167 | ! $ l,t_mod(l),q_mod(l),ht_mod(l),hq_mod(l) |
---|
1168 | ! enddo |
---|
1169 | |
---|
1170 | return |
---|
1171 | end |
---|
1172 | |
---|
1173 | !===================================================================== |
---|
1174 | SUBROUTINE interp_case_vertical(play,nlev_cas,plev_prof_cas & |
---|
1175 | & ,t_prof_cas,q_prof_cas,u_prof_cas,v_prof_cas,ug_prof_cas,vg_prof_cas,vitw_prof_cas & |
---|
1176 | & ,du_prof_cas,hu_prof_cas,vu_prof_cas,dv_prof_cas,hv_prof_cas,vv_prof_cas & |
---|
1177 | & ,dt_prof_cas,ht_prof_cas,vt_prof_cas,dtrad_prof_cas,dq_prof_cas,hq_prof_cas,vq_prof_cas & |
---|
1178 | & ,t_mod_cas,q_mod_cas,u_mod_cas,v_mod_cas,ug_mod_cas,vg_mod_cas,w_mod_cas & |
---|
1179 | & ,du_mod_cas,hu_mod_cas,vu_mod_cas,dv_mod_cas,hv_mod_cas,vv_mod_cas & |
---|
1180 | & ,dt_mod_cas,ht_mod_cas,vt_mod_cas,dtrad_mod_cas,dq_mod_cas,hq_mod_cas,vq_mod_cas,mxcalc) |
---|
1181 | |
---|
1182 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
1183 | implicit none |
---|
1184 | |
---|
1185 | |
---|
1186 | |
---|
1187 | !------------------------------------------------------------------------- |
---|
1188 | ! Vertical interpolation of TOGA-COARE forcing data onto mod_casel levels |
---|
1189 | !------------------------------------------------------------------------- |
---|
1190 | |
---|
1191 | integer nlevmax |
---|
1192 | parameter (nlevmax=41) |
---|
1193 | integer nlev_cas,mxcalc |
---|
1194 | ! real play(llm), plev_prof(nlevmax) |
---|
1195 | ! real t_prof(nlevmax),q_prof(nlevmax) |
---|
1196 | ! real u_prof(nlevmax),v_prof(nlevmax), w_prof(nlevmax) |
---|
1197 | ! real ht_prof(nlevmax),vt_prof(nlevmax) |
---|
1198 | ! real hq_prof(nlevmax),vq_prof(nlevmax) |
---|
1199 | |
---|
1200 | real play(llm), plev_prof_cas(nlev_cas) |
---|
1201 | real t_prof_cas(nlev_cas),q_prof_cas(nlev_cas) |
---|
1202 | real u_prof_cas(nlev_cas),v_prof_cas(nlev_cas) |
---|
1203 | real ug_prof_cas(nlev_cas),vg_prof_cas(nlev_cas), vitw_prof_cas(nlev_cas) |
---|
1204 | real du_prof_cas(nlev_cas),hu_prof_cas(nlev_cas),vu_prof_cas(nlev_cas) |
---|
1205 | real dv_prof_cas(nlev_cas),hv_prof_cas(nlev_cas),vv_prof_cas(nlev_cas) |
---|
1206 | real dt_prof_cas(nlev_cas),ht_prof_cas(nlev_cas),vt_prof_cas(nlev_cas),dtrad_prof_cas(nlev_cas) |
---|
1207 | real dq_prof_cas(nlev_cas),hq_prof_cas(nlev_cas),vq_prof_cas(nlev_cas) |
---|
1208 | |
---|
1209 | real t_mod_cas(llm),q_mod_cas(llm) |
---|
1210 | real u_mod_cas(llm),v_mod_cas(llm) |
---|
1211 | real ug_mod_cas(llm),vg_mod_cas(llm), w_mod_cas(llm) |
---|
1212 | real du_mod_cas(llm),hu_mod_cas(llm),vu_mod_cas(llm) |
---|
1213 | real dv_mod_cas(llm),hv_mod_cas(llm),vv_mod_cas(llm) |
---|
1214 | real dt_mod_cas(llm),ht_mod_cas(llm),vt_mod_cas(llm),dtrad_mod_cas(llm) |
---|
1215 | real dq_mod_cas(llm),hq_mod_cas(llm),vq_mod_cas(llm) |
---|
1216 | |
---|
1217 | integer l,k,k1,k2 |
---|
1218 | real frac,frac1,frac2,fact |
---|
1219 | |
---|
1220 | do l = 1, llm |
---|
1221 | |
---|
1222 | if (play(l).ge.plev_prof_cas(nlev_cas)) then |
---|
1223 | |
---|
1224 | mxcalc=l |
---|
1225 | k1=0 |
---|
1226 | k2=0 |
---|
1227 | |
---|
1228 | if (play(l).le.plev_prof_cas(1)) then |
---|
1229 | |
---|
1230 | do k = 1, nlev_cas-1 |
---|
1231 | if (play(l).le.plev_prof_cas(k).and. play(l).gt.plev_prof_cas(k+1)) then |
---|
1232 | k1=k |
---|
1233 | k2=k+1 |
---|
1234 | endif |
---|
1235 | enddo |
---|
1236 | |
---|
1237 | if (k1.eq.0 .or. k2.eq.0) then |
---|
1238 | write(*,*) 'PB! k1, k2 = ',k1,k2 |
---|
1239 | write(*,*) 'l,play(l) = ',l,play(l)/100 |
---|
1240 | do k = 1, nlev_cas-1 |
---|
1241 | write(*,*) 'k,plev_prof_cas(k) = ',k,plev_prof_cas(k)/100 |
---|
1242 | enddo |
---|
1243 | endif |
---|
1244 | |
---|
1245 | frac = (plev_prof_cas(k2)-play(l))/(plev_prof_cas(k2)-plev_prof_cas(k1)) |
---|
1246 | t_mod_cas(l)= t_prof_cas(k2) - frac*(t_prof_cas(k2)-t_prof_cas(k1)) |
---|
1247 | q_mod_cas(l)= q_prof_cas(k2) - frac*(q_prof_cas(k2)-q_prof_cas(k1)) |
---|
1248 | u_mod_cas(l)= u_prof_cas(k2) - frac*(u_prof_cas(k2)-u_prof_cas(k1)) |
---|
1249 | v_mod_cas(l)= v_prof_cas(k2) - frac*(v_prof_cas(k2)-v_prof_cas(k1)) |
---|
1250 | ug_mod_cas(l)= ug_prof_cas(k2) - frac*(ug_prof_cas(k2)-ug_prof_cas(k1)) |
---|
1251 | vg_mod_cas(l)= vg_prof_cas(k2) - frac*(vg_prof_cas(k2)-vg_prof_cas(k1)) |
---|
1252 | w_mod_cas(l)= vitw_prof_cas(k2) - frac*(vitw_prof_cas(k2)-vitw_prof_cas(k1)) |
---|
1253 | du_mod_cas(l)= du_prof_cas(k2) - frac*(du_prof_cas(k2)-du_prof_cas(k1)) |
---|
1254 | hu_mod_cas(l)= hu_prof_cas(k2) - frac*(hu_prof_cas(k2)-hu_prof_cas(k1)) |
---|
1255 | vu_mod_cas(l)= vu_prof_cas(k2) - frac*(vu_prof_cas(k2)-vu_prof_cas(k1)) |
---|
1256 | dv_mod_cas(l)= dv_prof_cas(k2) - frac*(dv_prof_cas(k2)-dv_prof_cas(k1)) |
---|
1257 | hv_mod_cas(l)= hv_prof_cas(k2) - frac*(hv_prof_cas(k2)-hv_prof_cas(k1)) |
---|
1258 | vv_mod_cas(l)= vv_prof_cas(k2) - frac*(vv_prof_cas(k2)-vv_prof_cas(k1)) |
---|
1259 | dt_mod_cas(l)= dt_prof_cas(k2) - frac*(dt_prof_cas(k2)-dt_prof_cas(k1)) |
---|
1260 | ht_mod_cas(l)= ht_prof_cas(k2) - frac*(ht_prof_cas(k2)-ht_prof_cas(k1)) |
---|
1261 | vt_mod_cas(l)= vt_prof_cas(k2) - frac*(vt_prof_cas(k2)-vt_prof_cas(k1)) |
---|
1262 | dq_mod_cas(l)= dq_prof_cas(k2) - frac*(dq_prof_cas(k2)-dq_prof_cas(k1)) |
---|
1263 | hq_mod_cas(l)= hq_prof_cas(k2) - frac*(hq_prof_cas(k2)-hq_prof_cas(k1)) |
---|
1264 | vq_mod_cas(l)= vq_prof_cas(k2) - frac*(vq_prof_cas(k2)-vq_prof_cas(k1)) |
---|
1265 | dtrad_mod_cas(l)= dtrad_prof_cas(k2) - frac*(dtrad_prof_cas(k2)-dtrad_prof_cas(k1)) |
---|
1266 | |
---|
1267 | else !play>plev_prof_cas(1) |
---|
1268 | |
---|
1269 | k1=1 |
---|
1270 | k2=2 |
---|
1271 | frac1 = (play(l)-plev_prof_cas(k2))/(plev_prof_cas(k1)-plev_prof_cas(k2)) |
---|
1272 | frac2 = (play(l)-plev_prof_cas(k1))/(plev_prof_cas(k1)-plev_prof_cas(k2)) |
---|
1273 | t_mod_cas(l)= frac1*t_prof_cas(k1) - frac2*t_prof_cas(k2) |
---|
1274 | q_mod_cas(l)= frac1*q_prof_cas(k1) - frac2*q_prof_cas(k2) |
---|
1275 | u_mod_cas(l)= frac1*u_prof_cas(k1) - frac2*u_prof_cas(k2) |
---|
1276 | v_mod_cas(l)= frac1*v_prof_cas(k1) - frac2*v_prof_cas(k2) |
---|
1277 | ug_mod_cas(l)= frac1*ug_prof_cas(k1) - frac2*ug_prof_cas(k2) |
---|
1278 | vg_mod_cas(l)= frac1*vg_prof_cas(k1) - frac2*vg_prof_cas(k2) |
---|
1279 | w_mod_cas(l)= frac1*vitw_prof_cas(k1) - frac2*vitw_prof_cas(k2) |
---|
1280 | du_mod_cas(l)= frac1*du_prof_cas(k1) - frac2*du_prof_cas(k2) |
---|
1281 | hu_mod_cas(l)= frac1*hu_prof_cas(k1) - frac2*hu_prof_cas(k2) |
---|
1282 | vu_mod_cas(l)= frac1*vu_prof_cas(k1) - frac2*vu_prof_cas(k2) |
---|
1283 | dv_mod_cas(l)= frac1*dv_prof_cas(k1) - frac2*dv_prof_cas(k2) |
---|
1284 | hv_mod_cas(l)= frac1*hv_prof_cas(k1) - frac2*hv_prof_cas(k2) |
---|
1285 | vv_mod_cas(l)= frac1*vv_prof_cas(k1) - frac2*vv_prof_cas(k2) |
---|
1286 | dt_mod_cas(l)= frac1*dt_prof_cas(k1) - frac2*dt_prof_cas(k2) |
---|
1287 | ht_mod_cas(l)= frac1*ht_prof_cas(k1) - frac2*ht_prof_cas(k2) |
---|
1288 | vt_mod_cas(l)= frac1*vt_prof_cas(k1) - frac2*vt_prof_cas(k2) |
---|
1289 | dq_mod_cas(l)= frac1*dq_prof_cas(k1) - frac2*dq_prof_cas(k2) |
---|
1290 | hq_mod_cas(l)= frac1*hq_prof_cas(k1) - frac2*hq_prof_cas(k2) |
---|
1291 | vq_mod_cas(l)= frac1*vq_prof_cas(k1) - frac2*vq_prof_cas(k2) |
---|
1292 | dtrad_mod_cas(l)= frac1*dtrad_prof_cas(k1) - frac2*dtrad_prof_cas(k2) |
---|
1293 | |
---|
1294 | endif ! play.le.plev_prof_cas(1) |
---|
1295 | |
---|
1296 | else ! above max altitude of forcing file |
---|
1297 | |
---|
1298 | !jyg |
---|
1299 | fact=20.*(plev_prof_cas(nlev_cas)-play(l))/plev_prof_cas(nlev_cas) !jyg |
---|
1300 | fact = max(fact,0.) !jyg |
---|
1301 | fact = exp(-fact) !jyg |
---|
1302 | t_mod_cas(l)= t_prof_cas(nlev_cas) !jyg |
---|
1303 | q_mod_cas(l)= q_prof_cas(nlev_cas)*fact !jyg |
---|
1304 | u_mod_cas(l)= u_prof_cas(nlev_cas)*fact !jyg |
---|
1305 | v_mod_cas(l)= v_prof_cas(nlev_cas)*fact !jyg |
---|
1306 | ug_mod_cas(l)= ug_prof_cas(nlev_cas)*fact !jyg |
---|
1307 | vg_mod_cas(l)= vg_prof_cas(nlev_cas)*fact !jyg |
---|
1308 | w_mod_cas(l)= 0.0 !jyg |
---|
1309 | du_mod_cas(l)= du_prof_cas(nlev_cas)*fact |
---|
1310 | hu_mod_cas(l)= hu_prof_cas(nlev_cas)*fact !jyg |
---|
1311 | vu_mod_cas(l)= vu_prof_cas(nlev_cas)*fact !jyg |
---|
1312 | dv_mod_cas(l)= dv_prof_cas(nlev_cas)*fact |
---|
1313 | hv_mod_cas(l)= hv_prof_cas(nlev_cas)*fact !jyg |
---|
1314 | vv_mod_cas(l)= vv_prof_cas(nlev_cas)*fact !jyg |
---|
1315 | dt_mod_cas(l)= dt_prof_cas(nlev_cas) |
---|
1316 | ht_mod_cas(l)= ht_prof_cas(nlev_cas) !jyg |
---|
1317 | vt_mod_cas(l)= vt_prof_cas(nlev_cas) !jyg |
---|
1318 | dq_mod_cas(l)= dq_prof_cas(nlev_cas)*fact |
---|
1319 | hq_mod_cas(l)= hq_prof_cas(nlev_cas)*fact !jyg |
---|
1320 | vq_mod_cas(l)= vq_prof_cas(nlev_cas)*fact !jyg |
---|
1321 | dtrad_mod_cas(l)= dtrad_prof_cas(nlev_cas)*fact !jyg |
---|
1322 | |
---|
1323 | endif ! play |
---|
1324 | |
---|
1325 | enddo ! l |
---|
1326 | |
---|
1327 | ! do l = 1,llm |
---|
1328 | ! print *,'t_mod_cas(l),q_mod_cas(l),ht_mod_cas(l),hq_mod_cas(l) ', |
---|
1329 | ! $ l,t_mod_cas(l),q_mod_cas(l),ht_mod_cas(l),hq_mod_cas(l) |
---|
1330 | ! enddo |
---|
1331 | |
---|
1332 | return |
---|
1333 | end |
---|
1334 | !***************************************************************************** |
---|
1335 | !===================================================================== |
---|
1336 | SUBROUTINE interp_dice_vertical(play,nlev_dice,nt_dice,plev_prof & |
---|
1337 | & ,th_prof,qv_prof,u_prof,v_prof,o3_prof & |
---|
1338 | & ,ht_prof,hq_prof,hu_prof,hv_prof,w_prof,omega_prof & |
---|
1339 | & ,th_mod,qv_mod,u_mod,v_mod,o3_mod & |
---|
1340 | & ,ht_mod,hq_mod,hu_mod,hv_mod,w_mod,omega_mod,mxcalc) |
---|
1341 | |
---|
1342 | USE dimensions_mod, ONLY: iim, jjm, llm, ndm |
---|
1343 | implicit none |
---|
1344 | |
---|
1345 | |
---|
1346 | |
---|
1347 | !------------------------------------------------------------------------- |
---|
1348 | ! Vertical interpolation of Dice forcing data onto model levels |
---|
1349 | !------------------------------------------------------------------------- |
---|
1350 | |
---|
1351 | integer nlevmax |
---|
1352 | parameter (nlevmax=41) |
---|
1353 | integer nlev_dice,mxcalc,nt_dice |
---|
1354 | |
---|
1355 | real play(llm), plev_prof(nlev_dice) |
---|
1356 | real th_prof(nlev_dice),qv_prof(nlev_dice) |
---|
1357 | real u_prof(nlev_dice),v_prof(nlev_dice) |
---|
1358 | real o3_prof(nlev_dice) |
---|
1359 | real ht_prof(nlev_dice),hq_prof(nlev_dice) |
---|
1360 | real hu_prof(nlev_dice),hv_prof(nlev_dice) |
---|
1361 | real w_prof(nlev_dice),omega_prof(nlev_dice) |
---|
1362 | |
---|
1363 | real th_mod(llm),qv_mod(llm) |
---|
1364 | real u_mod(llm),v_mod(llm), o3_mod(llm) |
---|
1365 | real ht_mod(llm),hq_mod(llm) |
---|
1366 | real hu_mod(llm),hv_mod(llm),w_mod(llm),omega_mod(llm) |
---|
1367 | |
---|
1368 | integer l,k,k1,k2,kp |
---|
1369 | real aa,frac,frac1,frac2,fact |
---|
1370 | |
---|
1371 | do l = 1, llm |
---|
1372 | |
---|
1373 | if (play(l).ge.plev_prof(nlev_dice)) then |
---|
1374 | |
---|
1375 | mxcalc=l |
---|
1376 | k1=0 |
---|
1377 | k2=0 |
---|
1378 | |
---|
1379 | if (play(l).le.plev_prof(1)) then |
---|
1380 | |
---|
1381 | do k = 1, nlev_dice-1 |
---|
1382 | if (play(l).le.plev_prof(k) .and. play(l).gt.plev_prof(k+1)) then |
---|
1383 | k1=k |
---|
1384 | k2=k+1 |
---|
1385 | endif |
---|
1386 | enddo |
---|
1387 | |
---|
1388 | if (k1.eq.0 .or. k2.eq.0) then |
---|
1389 | write(*,*) 'PB! k1, k2 = ',k1,k2 |
---|
1390 | write(*,*) 'l,play(l) = ',l,play(l)/100 |
---|
1391 | do k = 1, nlev_dice-1 |
---|
1392 | write(*,*) 'k,plev_prof(k) = ',k,plev_prof(k)/100 |
---|
1393 | enddo |
---|
1394 | endif |
---|
1395 | |
---|
1396 | frac = (plev_prof(k2)-play(l))/(plev_prof(k2)-plev_prof(k1)) |
---|
1397 | th_mod(l)= th_prof(k2) - frac*(th_prof(k2)-th_prof(k1)) |
---|
1398 | qv_mod(l)= qv_prof(k2) - frac*(qv_prof(k2)-qv_prof(k1)) |
---|
1399 | u_mod(l)= u_prof(k2) - frac*(u_prof(k2)-u_prof(k1)) |
---|
1400 | v_mod(l)= v_prof(k2) - frac*(v_prof(k2)-v_prof(k1)) |
---|
1401 | o3_mod(l)= o3_prof(k2) - frac*(o3_prof(k2)-o3_prof(k1)) |
---|
1402 | ht_mod(l)= ht_prof(k2) - frac*(ht_prof(k2)-ht_prof(k1)) |
---|
1403 | hq_mod(l)= hq_prof(k2) - frac*(hq_prof(k2)-hq_prof(k1)) |
---|
1404 | hu_mod(l)= hu_prof(k2) - frac*(hu_prof(k2)-hu_prof(k1)) |
---|
1405 | hv_mod(l)= hv_prof(k2) - frac*(hv_prof(k2)-hv_prof(k1)) |
---|
1406 | w_mod(l)= w_prof(k2) - frac*(w_prof(k2)-w_prof(k1)) |
---|
1407 | omega_mod(l)= omega_prof(k2) - frac*(omega_prof(k2)-omega_prof(k1)) |
---|
1408 | |
---|
1409 | else !play>plev_prof(1) |
---|
1410 | |
---|
1411 | k1=1 |
---|
1412 | k2=2 |
---|
1413 | frac1 = (play(l)-plev_prof(k2))/(plev_prof(k1)-plev_prof(k2)) |
---|
1414 | frac2 = (play(l)-plev_prof(k1))/(plev_prof(k1)-plev_prof(k2)) |
---|
1415 | th_mod(l)= frac1*th_prof(k1) - frac2*th_prof(k2) |
---|
1416 | qv_mod(l)= frac1*qv_prof(k1) - frac2*qv_prof(k2) |
---|
1417 | u_mod(l)= frac1*u_prof(k1) - frac2*u_prof(k2) |
---|
1418 | v_mod(l)= frac1*v_prof(k1) - frac2*v_prof(k2) |
---|
1419 | o3_mod(l)= frac1*o3_prof(k1) - frac2*o3_prof(k2) |
---|
1420 | ht_mod(l)= frac1*ht_prof(k1) - frac2*ht_prof(k2) |
---|
1421 | hq_mod(l)= frac1*hq_prof(k1) - frac2*hq_prof(k2) |
---|
1422 | hu_mod(l)= frac1*hu_prof(k1) - frac2*hu_prof(k2) |
---|
1423 | hv_mod(l)= frac1*hv_prof(k1) - frac2*hv_prof(k2) |
---|
1424 | w_mod(l)= frac1*w_prof(k1) - frac2*w_prof(k2) |
---|
1425 | omega_mod(l)= frac1*omega_prof(k1) - frac2*omega_prof(k2) |
---|
1426 | |
---|
1427 | endif ! play.le.plev_prof(1) |
---|
1428 | |
---|
1429 | else ! above max altitude of forcing file |
---|
1430 | |
---|
1431 | !jyg |
---|
1432 | fact=20.*(plev_prof(nlev_dice)-play(l))/plev_prof(nlev_dice) !jyg |
---|
1433 | fact = max(fact,0.) !jyg |
---|
1434 | fact = exp(-fact) !jyg |
---|
1435 | th_mod(l)= th_prof(nlev_dice) !jyg |
---|
1436 | qv_mod(l)= qv_prof(nlev_dice)*fact !jyg |
---|
1437 | u_mod(l)= u_prof(nlev_dice)*fact !jyg |
---|
1438 | v_mod(l)= v_prof(nlev_dice)*fact !jyg |
---|
1439 | o3_mod(l)= o3_prof(nlev_dice)*fact !jyg |
---|
1440 | ht_mod(l)= ht_prof(nlev_dice) !jyg |
---|
1441 | hq_mod(l)= hq_prof(nlev_dice)*fact !jyg |
---|
1442 | hu_mod(l)= hu_prof(nlev_dice) !jyg |
---|
1443 | hv_mod(l)= hv_prof(nlev_dice) !jyg |
---|
1444 | w_mod(l)= 0. !jyg |
---|
1445 | omega_mod(l)= 0. !jyg |
---|
1446 | |
---|
1447 | endif ! play |
---|
1448 | |
---|
1449 | enddo ! l |
---|
1450 | |
---|
1451 | ! do l = 1,llm |
---|
1452 | ! print *,'t_mod(l),q_mod(l),ht_mod(l),hq_mod(l) ', |
---|
1453 | ! $ l,t_mod(l),q_mod(l),ht_mod(l),hq_mod(l) |
---|
1454 | ! enddo |
---|
1455 | |
---|
1456 | return |
---|
1457 | end |
---|
1458 | |
---|
1459 | !====================================================================== |
---|
1460 | SUBROUTINE interp_astex_time(day,day1,annee_ref & |
---|
1461 | & ,year_ini_astex,day_ini_astex,nt_astex,dt_astex & |
---|
1462 | & ,nlev_astex,div_astex,ts_astex,ug_astex,vg_astex & |
---|
1463 | & ,ufa_astex,vfa_astex,div_prof,ts_prof,ug_prof,vg_prof & |
---|
1464 | & ,ufa_prof,vfa_prof) |
---|
1465 | USE yomcst_mod_h, ONLY: RPI, RCLUM, RHPLA, RKBOL, RNAVO & |
---|
1466 | , RDAY, REA, REPSM, RSIYEA, RSIDAY, ROMEGA & |
---|
1467 | , R_ecc, R_peri, R_incl & |
---|
1468 | , RA, RG, R1SA & |
---|
1469 | , RSIGMA & |
---|
1470 | , R, RMD, RMV, RD, RV, RCPD & |
---|
1471 | , RMO3, RMCO2, RMC, RMCH4, RMN2O, RMCFC11, RMCFC12 & |
---|
1472 | , RCPV, RCVD, RCVV, RKAPPA, RETV, eps_w & |
---|
1473 | , RCW, RCS & |
---|
1474 | , RLVTT, RLSTT, RLMLT, RTT, RATM & |
---|
1475 | , RESTT, RALPW, RBETW, RGAMW, RALPS, RBETS, RGAMS & |
---|
1476 | , RALPD, RBETD, RGAMD |
---|
1477 | implicit none |
---|
1478 | |
---|
1479 | !--------------------------------------------------------------------------------------- |
---|
1480 | ! Time interpolation of a 2D field to the timestep corresponding to day |
---|
1481 | ! |
---|
1482 | ! day: current julian day (e.g. 717538.2) |
---|
1483 | ! day1: first day of the simulation |
---|
1484 | ! nt_astex: total nb of data in the forcing (e.g. 41 for Astex) |
---|
1485 | ! dt_astex: total time interval (in sec) between 2 forcing data (e.g. 1h for Astex) |
---|
1486 | !--------------------------------------------------------------------------------------- |
---|
1487 | |
---|
1488 | ! inputs: |
---|
1489 | integer annee_ref |
---|
1490 | integer nt_astex,nlev_astex |
---|
1491 | integer year_ini_astex |
---|
1492 | real day, day1,day_ini_astex,dt_astex |
---|
1493 | real div_astex(nt_astex),ts_astex(nt_astex),ug_astex(nt_astex) |
---|
1494 | real vg_astex(nt_astex),ufa_astex(nt_astex),vfa_astex(nt_astex) |
---|
1495 | ! outputs: |
---|
1496 | real div_prof,ts_prof,ug_prof,vg_prof,ufa_prof,vfa_prof |
---|
1497 | ! local: |
---|
1498 | integer it_astex1, it_astex2 |
---|
1499 | real timeit,time_astex1,time_astex2,frac |
---|
1500 | |
---|
1501 | ! Check that initial day of the simulation consistent with ASTEX period: |
---|
1502 | if (annee_ref.ne.1992 ) then |
---|
1503 | print*,'Pour Astex, annee_ref doit etre 1992 ' |
---|
1504 | print*,'Changer annee_ref dans run.def' |
---|
1505 | stop |
---|
1506 | endif |
---|
1507 | if (annee_ref.eq.1992 .and. day1.lt.day_ini_astex) then |
---|
1508 | print*,'Astex debute le 13 Juin 1992 (jour julien=165)' |
---|
1509 | print*,'Changer dayref dans run.def' |
---|
1510 | stop |
---|
1511 | endif |
---|
1512 | |
---|
1513 | ! Determine timestep relative to the 1st day of TOGA-COARE: |
---|
1514 | ! timeit=(day-day1)*86400. |
---|
1515 | ! if (annee_ref.eq.1992) then |
---|
1516 | ! timeit=(day-day_ini_astex)*86400. |
---|
1517 | ! else |
---|
1518 | ! timeit=(day+2.-1.)*86400. ! 2 days between Jun13 and Jun15 1992 |
---|
1519 | ! endif |
---|
1520 | timeit=(day-day_ini_astex)*86400 |
---|
1521 | |
---|
1522 | ! Determine the closest observation times: |
---|
1523 | it_astex1=INT(timeit/dt_astex)+1 |
---|
1524 | it_astex2=it_astex1 + 1 |
---|
1525 | time_astex1=(it_astex1-1)*dt_astex |
---|
1526 | time_astex2=(it_astex2-1)*dt_astex |
---|
1527 | print *,'timeit day day_ini_astex',timeit,day,day_ini_astex |
---|
1528 | print *,'it_astex1,it_astex2,time_astex1,time_astex2', & |
---|
1529 | & it_astex1,it_astex2,time_astex1,time_astex2 |
---|
1530 | |
---|
1531 | if (it_astex1 .ge. nt_astex) then |
---|
1532 | write(*,*) 'PB-stop: day, it_astex1, it_astex2, timeit: ' & |
---|
1533 | & ,day,it_astex1,it_astex2,timeit/86400. |
---|
1534 | stop |
---|
1535 | endif |
---|
1536 | |
---|
1537 | ! time interpolation: |
---|
1538 | frac=(time_astex2-timeit)/(time_astex2-time_astex1) |
---|
1539 | frac=max(frac,0.0) |
---|
1540 | |
---|
1541 | div_prof = div_astex(it_astex2) & |
---|
1542 | & -frac*(div_astex(it_astex2)-div_astex(it_astex1)) |
---|
1543 | ts_prof = ts_astex(it_astex2) & |
---|
1544 | & -frac*(ts_astex(it_astex2)-ts_astex(it_astex1)) |
---|
1545 | ug_prof = ug_astex(it_astex2) & |
---|
1546 | & -frac*(ug_astex(it_astex2)-ug_astex(it_astex1)) |
---|
1547 | vg_prof = vg_astex(it_astex2) & |
---|
1548 | & -frac*(vg_astex(it_astex2)-vg_astex(it_astex1)) |
---|
1549 | ufa_prof = ufa_astex(it_astex2) & |
---|
1550 | & -frac*(ufa_astex(it_astex2)-ufa_astex(it_astex1)) |
---|
1551 | vfa_prof = vfa_astex(it_astex2) & |
---|
1552 | & -frac*(vfa_astex(it_astex2)-vfa_astex(it_astex1)) |
---|
1553 | |
---|
1554 | print*, & |
---|
1555 | &'day,annee_ref,day_ini_astex,timeit,it_astex1,it_astex2,SST:', & |
---|
1556 | &day,annee_ref,day_ini_astex,timeit/86400.,it_astex1, & |
---|
1557 | &it_astex2,div_prof,ts_prof,ug_prof,vg_prof,ufa_prof,vfa_prof |
---|
1558 | |
---|
1559 | return |
---|
1560 | END |
---|
1561 | |
---|
1562 | !====================================================================== |
---|
1563 | SUBROUTINE interp_toga_time(day,day1,annee_ref & |
---|
1564 | & ,year_ini_toga,day_ini_toga,nt_toga,dt_toga,nlev_toga & |
---|
1565 | & ,ts_toga,plev_toga,t_toga,q_toga,u_toga,v_toga,w_toga & |
---|
1566 | & ,ht_toga,vt_toga,hq_toga,vq_toga & |
---|
1567 | & ,ts_prof,plev_prof,t_prof,q_prof,u_prof,v_prof,w_prof & |
---|
1568 | & ,ht_prof,vt_prof,hq_prof,vq_prof) |
---|
1569 | implicit none |
---|
1570 | |
---|
1571 | !--------------------------------------------------------------------------------------- |
---|
1572 | ! Time interpolation of a 2D field to the timestep corresponding to day |
---|
1573 | ! |
---|
1574 | ! day: current julian day (e.g. 717538.2) |
---|
1575 | ! day1: first day of the simulation |
---|
1576 | ! nt_toga: total nb of data in the forcing (e.g. 480 for TOGA-COARE) |
---|
1577 | ! dt_toga: total time interval (in sec) between 2 forcing data (e.g. 6h for TOGA-COARE) |
---|
1578 | !--------------------------------------------------------------------------------------- |
---|
1579 | |
---|
1580 | INCLUDE "compar1d.h" |
---|
1581 | |
---|
1582 | ! inputs: |
---|
1583 | integer annee_ref |
---|
1584 | integer nt_toga,nlev_toga |
---|
1585 | integer year_ini_toga |
---|
1586 | real day, day1,day_ini_toga,dt_toga |
---|
1587 | real ts_toga(nt_toga) |
---|
1588 | real plev_toga(nlev_toga,nt_toga),t_toga(nlev_toga,nt_toga) |
---|
1589 | real q_toga(nlev_toga,nt_toga),u_toga(nlev_toga,nt_toga) |
---|
1590 | real v_toga(nlev_toga,nt_toga),w_toga(nlev_toga,nt_toga) |
---|
1591 | real ht_toga(nlev_toga,nt_toga),vt_toga(nlev_toga,nt_toga) |
---|
1592 | real hq_toga(nlev_toga,nt_toga),vq_toga(nlev_toga,nt_toga) |
---|
1593 | ! outputs: |
---|
1594 | real ts_prof |
---|
1595 | real plev_prof(nlev_toga),t_prof(nlev_toga) |
---|
1596 | real q_prof(nlev_toga),u_prof(nlev_toga) |
---|
1597 | real v_prof(nlev_toga),w_prof(nlev_toga) |
---|
1598 | real ht_prof(nlev_toga),vt_prof(nlev_toga) |
---|
1599 | real hq_prof(nlev_toga),vq_prof(nlev_toga) |
---|
1600 | ! local: |
---|
1601 | integer it_toga1, it_toga2,k |
---|
1602 | real timeit,time_toga1,time_toga2,frac |
---|
1603 | |
---|
1604 | |
---|
1605 | if (forcing_type.eq.2) then |
---|
1606 | ! Check that initial day of the simulation consistent with TOGA-COARE period: |
---|
1607 | if (annee_ref.ne.1992 .and. annee_ref.ne.1993) then |
---|
1608 | print*,'Pour TOGA-COARE, annee_ref doit etre 1992 ou 1993' |
---|
1609 | print*,'Changer annee_ref dans run.def' |
---|
1610 | stop |
---|
1611 | endif |
---|
1612 | if (annee_ref.eq.1992 .and. day1.lt.day_ini_toga) then |
---|
1613 | print*,'TOGA-COARE a debute le 1er Nov 1992 (jour julien=306)' |
---|
1614 | print*,'Changer dayref dans run.def' |
---|
1615 | stop |
---|
1616 | endif |
---|
1617 | if (annee_ref.eq.1993 .and. day1.gt.day_ini_toga+119) then |
---|
1618 | print*,'TOGA-COARE a fini le 28 Feb 1993 (jour julien=59)' |
---|
1619 | print*,'Changer dayref ou nday dans run.def' |
---|
1620 | stop |
---|
1621 | endif |
---|
1622 | |
---|
1623 | else if (forcing_type.eq.4) then |
---|
1624 | |
---|
1625 | ! Check that initial day of the simulation consistent with TWP-ICE period: |
---|
1626 | if (annee_ref.ne.2006) then |
---|
1627 | print*,'Pour TWP-ICE, annee_ref doit etre 2006' |
---|
1628 | print*,'Changer annee_ref dans run.def' |
---|
1629 | stop |
---|
1630 | endif |
---|
1631 | if (annee_ref.eq.2006 .and. day1.lt.day_ini_toga) then |
---|
1632 | print*,'TWP-ICE a debute le 17 Jan 2006 (jour julien=17)' |
---|
1633 | print*,'Changer dayref dans run.def' |
---|
1634 | stop |
---|
1635 | endif |
---|
1636 | if (annee_ref.eq.2006 .and. day1.gt.day_ini_toga+26) then |
---|
1637 | print*,'TWP-ICE a fini le 12 Feb 2006 (jour julien=43)' |
---|
1638 | print*,'Changer dayref ou nday dans run.def' |
---|
1639 | stop |
---|
1640 | endif |
---|
1641 | |
---|
1642 | endif |
---|
1643 | |
---|
1644 | ! Determine timestep relative to the 1st day of TOGA-COARE: |
---|
1645 | ! timeit=(day-day1)*86400. |
---|
1646 | ! if (annee_ref.eq.1992) then |
---|
1647 | ! timeit=(day-day_ini_toga)*86400. |
---|
1648 | ! else |
---|
1649 | ! timeit=(day+61.-1.)*86400. ! 61 days between Nov01 and Dec31 1992 |
---|
1650 | ! endif |
---|
1651 | timeit=(day-day_ini_toga)*86400 |
---|
1652 | |
---|
1653 | ! Determine the closest observation times: |
---|
1654 | it_toga1=INT(timeit/dt_toga)+1 |
---|
1655 | it_toga2=it_toga1 + 1 |
---|
1656 | time_toga1=(it_toga1-1)*dt_toga |
---|
1657 | time_toga2=(it_toga2-1)*dt_toga |
---|
1658 | |
---|
1659 | if (it_toga1 .ge. nt_toga) then |
---|
1660 | write(*,*) 'PB-stop: day, it_toga1, it_toga2, timeit: ' & |
---|
1661 | & ,day,it_toga1,it_toga2,timeit/86400. |
---|
1662 | stop |
---|
1663 | endif |
---|
1664 | |
---|
1665 | ! time interpolation: |
---|
1666 | frac=(time_toga2-timeit)/(time_toga2-time_toga1) |
---|
1667 | frac=max(frac,0.0) |
---|
1668 | |
---|
1669 | ts_prof = ts_toga(it_toga2) & |
---|
1670 | & -frac*(ts_toga(it_toga2)-ts_toga(it_toga1)) |
---|
1671 | |
---|
1672 | ! print*, |
---|
1673 | ! :'day,annee_ref,day_ini_toga,timeit,it_toga1,it_toga2,SST:', |
---|
1674 | ! :day,annee_ref,day_ini_toga,timeit/86400.,it_toga1,it_toga2,ts_prof |
---|
1675 | |
---|
1676 | do k=1,nlev_toga |
---|
1677 | plev_prof(k) = 100.*(plev_toga(k,it_toga2) & |
---|
1678 | & -frac*(plev_toga(k,it_toga2)-plev_toga(k,it_toga1))) |
---|
1679 | t_prof(k) = t_toga(k,it_toga2) & |
---|
1680 | & -frac*(t_toga(k,it_toga2)-t_toga(k,it_toga1)) |
---|
1681 | q_prof(k) = q_toga(k,it_toga2) & |
---|
1682 | & -frac*(q_toga(k,it_toga2)-q_toga(k,it_toga1)) |
---|
1683 | u_prof(k) = u_toga(k,it_toga2) & |
---|
1684 | & -frac*(u_toga(k,it_toga2)-u_toga(k,it_toga1)) |
---|
1685 | v_prof(k) = v_toga(k,it_toga2) & |
---|
1686 | & -frac*(v_toga(k,it_toga2)-v_toga(k,it_toga1)) |
---|
1687 | w_prof(k) = w_toga(k,it_toga2) & |
---|
1688 | & -frac*(w_toga(k,it_toga2)-w_toga(k,it_toga1)) |
---|
1689 | ht_prof(k) = ht_toga(k,it_toga2) & |
---|
1690 | & -frac*(ht_toga(k,it_toga2)-ht_toga(k,it_toga1)) |
---|
1691 | vt_prof(k) = vt_toga(k,it_toga2) & |
---|
1692 | & -frac*(vt_toga(k,it_toga2)-vt_toga(k,it_toga1)) |
---|
1693 | hq_prof(k) = hq_toga(k,it_toga2) & |
---|
1694 | & -frac*(hq_toga(k,it_toga2)-hq_toga(k,it_toga1)) |
---|
1695 | vq_prof(k) = vq_toga(k,it_toga2) & |
---|
1696 | & -frac*(vq_toga(k,it_toga2)-vq_toga(k,it_toga1)) |
---|
1697 | enddo |
---|
1698 | |
---|
1699 | return |
---|
1700 | END |
---|
1701 | |
---|
1702 | !====================================================================== |
---|
1703 | SUBROUTINE interp_dice_time(day,day1,annee_ref & |
---|
1704 | & ,year_ini_dice,day_ini_dice,nt_dice,dt_dice & |
---|
1705 | & ,nlev_dice,shf_dice,lhf_dice,lwup_dice,swup_dice & |
---|
1706 | & ,tg_dice,ustar_dice,psurf_dice,ug_dice,vg_dice & |
---|
1707 | & ,ht_dice,hq_dice,hu_dice,hv_dice,w_dice,omega_dice & |
---|
1708 | & ,shf_prof,lhf_prof,lwup_prof,swup_prof,tg_prof & |
---|
1709 | & ,ustar_prof,psurf_prof,ug_prof,vg_prof & |
---|
1710 | & ,ht_prof,hq_prof,hu_prof,hv_prof,w_prof,omega_prof) |
---|
1711 | implicit none |
---|
1712 | |
---|
1713 | !--------------------------------------------------------------------------------------- |
---|
1714 | ! Time interpolation of a 2D field to the timestep corresponding to day |
---|
1715 | ! |
---|
1716 | ! day: current julian day (e.g. 717538.2) |
---|
1717 | ! day1: first day of the simulation |
---|
1718 | ! nt_dice: total nb of data in the forcing (e.g. 145 for Dice) |
---|
1719 | ! dt_dice: total time interval (in sec) between 2 forcing data (e.g. 30min. for Dice) |
---|
1720 | !--------------------------------------------------------------------------------------- |
---|
1721 | |
---|
1722 | INCLUDE "compar1d.h" |
---|
1723 | |
---|
1724 | ! inputs: |
---|
1725 | integer annee_ref |
---|
1726 | integer nt_dice,nlev_dice |
---|
1727 | integer year_ini_dice |
---|
1728 | real day, day1,day_ini_dice,dt_dice |
---|
1729 | real shf_dice(nt_dice),lhf_dice(nt_dice),lwup_dice(nt_dice) |
---|
1730 | real swup_dice(nt_dice),tg_dice(nt_dice),ustar_dice(nt_dice) |
---|
1731 | real psurf_dice(nt_dice),ug_dice(nt_dice),vg_dice(nt_dice) |
---|
1732 | real ht_dice(nlev_dice,nt_dice),hq_dice(nlev_dice,nt_dice) |
---|
1733 | real hu_dice(nlev_dice,nt_dice),hv_dice(nlev_dice,nt_dice) |
---|
1734 | real w_dice(nlev_dice,nt_dice),omega_dice(nlev_dice,nt_dice) |
---|
1735 | ! outputs: |
---|
1736 | real tg_prof,shf_prof,lhf_prof,lwup_prof,swup_prof |
---|
1737 | real ustar_prof,psurf_prof,ug_prof,vg_prof |
---|
1738 | real ht_prof(nlev_dice),hq_prof(nlev_dice) |
---|
1739 | real hu_prof(nlev_dice),hv_prof(nlev_dice) |
---|
1740 | real w_prof(nlev_dice),omega_prof(nlev_dice) |
---|
1741 | ! local: |
---|
1742 | integer it_dice1, it_dice2,k |
---|
1743 | real timeit,time_dice1,time_dice2,frac |
---|
1744 | |
---|
1745 | |
---|
1746 | if (forcing_type.eq.7) then |
---|
1747 | ! Check that initial day of the simulation consistent with Dice period: |
---|
1748 | print *,'annee_ref=',annee_ref |
---|
1749 | print *,'day1=',day1 |
---|
1750 | print *,'day_ini_dice=',day_ini_dice |
---|
1751 | if (annee_ref.ne.1999) then |
---|
1752 | print*,'Pour Dice, annee_ref doit etre 1999' |
---|
1753 | print*,'Changer annee_ref dans run.def' |
---|
1754 | stop |
---|
1755 | endif |
---|
1756 | if (annee_ref.eq.1999 .and. day1.gt.day_ini_dice) then |
---|
1757 | print*,'Dice a debute le 23 Oct 1999 (jour julien=296)' |
---|
1758 | print*,'Changer dayref dans run.def',day1,day_ini_dice |
---|
1759 | stop |
---|
1760 | endif |
---|
1761 | if (annee_ref.eq.1999 .and. day1.gt.day_ini_dice+2) then |
---|
1762 | print*,'Dice a fini le 25 Oct 1999 (jour julien=298)' |
---|
1763 | print*,'Changer dayref ou nday dans run.def',day1,day_ini_dice |
---|
1764 | stop |
---|
1765 | endif |
---|
1766 | |
---|
1767 | endif |
---|
1768 | |
---|
1769 | ! Determine timestep relative to the 1st day of TOGA-COARE: |
---|
1770 | ! timeit=(day-day1)*86400. |
---|
1771 | ! if (annee_ref.eq.1992) then |
---|
1772 | ! timeit=(day-day_ini_dice)*86400. |
---|
1773 | ! else |
---|
1774 | ! timeit=(day+61.-1.)*86400. ! 61 days between Nov01 and Dec31 1992 |
---|
1775 | ! endif |
---|
1776 | timeit=(day-day_ini_dice)*86400 |
---|
1777 | |
---|
1778 | ! Determine the closest observation times: |
---|
1779 | it_dice1=INT(timeit/dt_dice)+1 |
---|
1780 | it_dice2=it_dice1 + 1 |
---|
1781 | time_dice1=(it_dice1-1)*dt_dice |
---|
1782 | time_dice2=(it_dice2-1)*dt_dice |
---|
1783 | |
---|
1784 | if (it_dice1 .ge. nt_dice) then |
---|
1785 | write(*,*) 'PB-stop: day, it_dice1, it_dice2, timeit: ',day,it_dice1,it_dice2,timeit/86400. |
---|
1786 | stop |
---|
1787 | endif |
---|
1788 | |
---|
1789 | ! time interpolation: |
---|
1790 | frac=(time_dice2-timeit)/(time_dice2-time_dice1) |
---|
1791 | frac=max(frac,0.0) |
---|
1792 | |
---|
1793 | shf_prof = shf_dice(it_dice2)-frac*(shf_dice(it_dice2)-shf_dice(it_dice1)) |
---|
1794 | lhf_prof = lhf_dice(it_dice2)-frac*(lhf_dice(it_dice2)-lhf_dice(it_dice1)) |
---|
1795 | lwup_prof = lwup_dice(it_dice2)-frac*(lwup_dice(it_dice2)-lwup_dice(it_dice1)) |
---|
1796 | swup_prof = swup_dice(it_dice2)-frac*(swup_dice(it_dice2)-swup_dice(it_dice1)) |
---|
1797 | tg_prof = tg_dice(it_dice2)-frac*(tg_dice(it_dice2)-tg_dice(it_dice1)) |
---|
1798 | ustar_prof = ustar_dice(it_dice2)-frac*(ustar_dice(it_dice2)-ustar_dice(it_dice1)) |
---|
1799 | psurf_prof = psurf_dice(it_dice2)-frac*(psurf_dice(it_dice2)-psurf_dice(it_dice1)) |
---|
1800 | ug_prof = ug_dice(it_dice2)-frac*(ug_dice(it_dice2)-ug_dice(it_dice1)) |
---|
1801 | vg_prof = vg_dice(it_dice2)-frac*(vg_dice(it_dice2)-vg_dice(it_dice1)) |
---|
1802 | |
---|
1803 | ! print*, |
---|
1804 | ! :'day,annee_ref,day_ini_dice,timeit,it_dice1,it_dice2,SST:', |
---|
1805 | ! :day,annee_ref,day_ini_dice,timeit/86400.,it_dice1,it_dice2,ts_prof |
---|
1806 | |
---|
1807 | do k=1,nlev_dice |
---|
1808 | ht_prof(k) = ht_dice(k,it_dice2)-frac*(ht_dice(k,it_dice2)-ht_dice(k,it_dice1)) |
---|
1809 | hq_prof(k) = hq_dice(k,it_dice2)-frac*(hq_dice(k,it_dice2)-hq_dice(k,it_dice1)) |
---|
1810 | hu_prof(k) = hu_dice(k,it_dice2)-frac*(hu_dice(k,it_dice2)-hu_dice(k,it_dice1)) |
---|
1811 | hv_prof(k) = hv_dice(k,it_dice2)-frac*(hv_dice(k,it_dice2)-hv_dice(k,it_dice1)) |
---|
1812 | w_prof(k) = w_dice(k,it_dice2)-frac*(w_dice(k,it_dice2)-w_dice(k,it_dice1)) |
---|
1813 | omega_prof(k) = omega_dice(k,it_dice2)-frac*(omega_dice(k,it_dice2)-omega_dice(k,it_dice1)) |
---|
1814 | enddo |
---|
1815 | |
---|
1816 | return |
---|
1817 | END |
---|
1818 | |
---|
1819 | !====================================================================== |
---|
1820 | SUBROUTINE interp_gabls4_time(day,day1,annee_ref & |
---|
1821 | & ,year_ini_gabls4,day_ini_gabls4,nt_gabls4,dt_gabls4,nlev_gabls4 & |
---|
1822 | & ,ug_gabls4,vg_gabls4,ht_gabls4,hq_gabls4,tg_gabls4 & |
---|
1823 | & ,ug_prof,vg_prof,ht_prof,hq_prof,tg_prof) |
---|
1824 | implicit none |
---|
1825 | |
---|
1826 | !--------------------------------------------------------------------------------------- |
---|
1827 | ! Time interpolation of a 2D field to the timestep corresponding to day |
---|
1828 | ! |
---|
1829 | ! day: current julian day |
---|
1830 | ! day1: first day of the simulation |
---|
1831 | ! nt_gabls4: total nb of data in the forcing (e.g. 37 for gabls4) |
---|
1832 | ! dt_gabls4: total time interval (in sec) between 2 forcing data (e.g. 60min. for gabls4) |
---|
1833 | !--------------------------------------------------------------------------------------- |
---|
1834 | |
---|
1835 | INCLUDE "compar1d.h" |
---|
1836 | |
---|
1837 | ! inputs: |
---|
1838 | integer annee_ref |
---|
1839 | integer nt_gabls4,nlev_gabls4 |
---|
1840 | integer year_ini_gabls4 |
---|
1841 | real day, day1,day_ini_gabls4,dt_gabls4 |
---|
1842 | real ug_gabls4(nlev_gabls4,nt_gabls4),vg_gabls4(nlev_gabls4,nt_gabls4) |
---|
1843 | real ht_gabls4(nlev_gabls4,nt_gabls4),hq_gabls4(nlev_gabls4,nt_gabls4) |
---|
1844 | real tg_gabls4(nt_gabls4), tg_prof |
---|
1845 | ! outputs: |
---|
1846 | real ug_prof(nlev_gabls4),vg_prof(nlev_gabls4) |
---|
1847 | real ht_prof(nlev_gabls4),hq_prof(nlev_gabls4) |
---|
1848 | ! local: |
---|
1849 | integer it_gabls41, it_gabls42,k |
---|
1850 | real timeit,time_gabls41,time_gabls42,frac |
---|
1851 | |
---|
1852 | |
---|
1853 | |
---|
1854 | ! Check that initial day of the simulation consistent with gabls4 period: |
---|
1855 | if (forcing_type.eq.8 ) then |
---|
1856 | print *,'annee_ref=',annee_ref |
---|
1857 | print *,'day1=',day1 |
---|
1858 | print *,'day_ini_gabls4=',day_ini_gabls4 |
---|
1859 | if (annee_ref.ne.2009) then |
---|
1860 | print*,'Pour gabls4, annee_ref doit etre 2009' |
---|
1861 | print*,'Changer annee_ref dans run.def' |
---|
1862 | stop |
---|
1863 | endif |
---|
1864 | if (annee_ref.eq.2009 .and. day1.gt.day_ini_gabls4) then |
---|
1865 | print*,'gabls4 a debute le 11 dec 2009 (jour julien=345)' |
---|
1866 | print*,'Changer dayref dans run.def',day1,day_ini_gabls4 |
---|
1867 | stop |
---|
1868 | endif |
---|
1869 | if (annee_ref.eq.2009 .and. day1.gt.day_ini_gabls4+2) then |
---|
1870 | print*,'gabls4 a fini le 12 dec 2009 (jour julien=346)' |
---|
1871 | print*,'Changer dayref ou nday dans run.def',day1,day_ini_gabls4 |
---|
1872 | stop |
---|
1873 | endif |
---|
1874 | endif |
---|
1875 | |
---|
1876 | timeit=(day-day_ini_gabls4)*86400 |
---|
1877 | print *,'day,day_ini_gabls4=',day,day_ini_gabls4 |
---|
1878 | print *,'nt_gabls4,dt,timeit=',nt_gabls4,dt_gabls4,timeit |
---|
1879 | |
---|
1880 | ! Determine the closest observation times: |
---|
1881 | it_gabls41=INT(timeit/dt_gabls4)+1 |
---|
1882 | it_gabls42=it_gabls41 + 1 |
---|
1883 | time_gabls41=(it_gabls41-1)*dt_gabls4 |
---|
1884 | time_gabls42=(it_gabls42-1)*dt_gabls4 |
---|
1885 | |
---|
1886 | if (it_gabls41 .ge. nt_gabls4) then |
---|
1887 | write(*,*) 'PB-stop: day, it_gabls41, it_gabls42, timeit: ',day,it_gabls41,it_gabls42,timeit/86400. |
---|
1888 | stop |
---|
1889 | endif |
---|
1890 | |
---|
1891 | ! time interpolation: |
---|
1892 | frac=(time_gabls42-timeit)/(time_gabls42-time_gabls41) |
---|
1893 | frac=max(frac,0.0) |
---|
1894 | |
---|
1895 | |
---|
1896 | do k=1,nlev_gabls4 |
---|
1897 | ug_prof(k) = ug_gabls4(k,it_gabls42)-frac*(ug_gabls4(k,it_gabls42)-ug_gabls4(k,it_gabls41)) |
---|
1898 | vg_prof(k) = vg_gabls4(k,it_gabls42)-frac*(vg_gabls4(k,it_gabls42)-vg_gabls4(k,it_gabls41)) |
---|
1899 | ht_prof(k) = ht_gabls4(k,it_gabls42)-frac*(ht_gabls4(k,it_gabls42)-ht_gabls4(k,it_gabls41)) |
---|
1900 | hq_prof(k) = hq_gabls4(k,it_gabls42)-frac*(hq_gabls4(k,it_gabls42)-hq_gabls4(k,it_gabls41)) |
---|
1901 | enddo |
---|
1902 | tg_prof=tg_gabls4(it_gabls42)-frac*(tg_gabls4(it_gabls42)-tg_gabls4(it_gabls41)) |
---|
1903 | return |
---|
1904 | END |
---|
1905 | |
---|
1906 | !====================================================================== |
---|
1907 | SUBROUTINE interp_armcu_time(day,day1,annee_ref & |
---|
1908 | & ,year_ini_armcu,day_ini_armcu,nt_armcu,dt_armcu & |
---|
1909 | & ,nlev_armcu,fs_armcu,fl_armcu,at_armcu,rt_armcu & |
---|
1910 | & ,aqt_armcu,fs_prof,fl_prof,at_prof,rt_prof,aqt_prof) |
---|
1911 | implicit none |
---|
1912 | |
---|
1913 | !--------------------------------------------------------------------------------------- |
---|
1914 | ! Time interpolation of a 2D field to the timestep corresponding to day |
---|
1915 | ! |
---|
1916 | ! day: current julian day (e.g. 717538.2) |
---|
1917 | ! day1: first day of the simulation |
---|
1918 | ! nt_armcu: total nb of data in the forcing (e.g. 31 for armcu) |
---|
1919 | ! dt_armcu: total time interval (in sec) between 2 forcing data (e.g. 1/2h for armcu) |
---|
1920 | ! fs= sensible flux |
---|
1921 | ! fl= latent flux |
---|
1922 | ! at,rt,aqt= advective and radiative tendencies |
---|
1923 | !--------------------------------------------------------------------------------------- |
---|
1924 | |
---|
1925 | ! inputs: |
---|
1926 | integer annee_ref |
---|
1927 | integer nt_armcu,nlev_armcu |
---|
1928 | integer year_ini_armcu |
---|
1929 | real day, day1,day_ini_armcu,dt_armcu |
---|
1930 | real fs_armcu(nt_armcu),fl_armcu(nt_armcu),at_armcu(nt_armcu) |
---|
1931 | real rt_armcu(nt_armcu),aqt_armcu(nt_armcu) |
---|
1932 | ! outputs: |
---|
1933 | real fs_prof,fl_prof,at_prof,rt_prof,aqt_prof |
---|
1934 | ! local: |
---|
1935 | integer it_armcu1, it_armcu2,k |
---|
1936 | real timeit,time_armcu1,time_armcu2,frac |
---|
1937 | |
---|
1938 | ! Check that initial day of the simulation consistent with ARMCU period: |
---|
1939 | if (annee_ref.ne.1997 ) then |
---|
1940 | print*,'Pour ARMCU, annee_ref doit etre 1997 ' |
---|
1941 | print*,'Changer annee_ref dans run.def' |
---|
1942 | stop |
---|
1943 | endif |
---|
1944 | |
---|
1945 | timeit=(day-day_ini_armcu)*86400 |
---|
1946 | |
---|
1947 | ! Determine the closest observation times: |
---|
1948 | it_armcu1=INT(timeit/dt_armcu)+1 |
---|
1949 | it_armcu2=it_armcu1 + 1 |
---|
1950 | time_armcu1=(it_armcu1-1)*dt_armcu |
---|
1951 | time_armcu2=(it_armcu2-1)*dt_armcu |
---|
1952 | print *,'timeit day day_ini_armcu',timeit,day,day_ini_armcu |
---|
1953 | print *,'it_armcu1,it_armcu2,time_armcu1,time_armcu2', & |
---|
1954 | & it_armcu1,it_armcu2,time_armcu1,time_armcu2 |
---|
1955 | |
---|
1956 | if (it_armcu1 .ge. nt_armcu) then |
---|
1957 | write(*,*) 'PB-stop: day, it_armcu1, it_armcu2, timeit: ' & |
---|
1958 | & ,day,it_armcu1,it_armcu2,timeit/86400. |
---|
1959 | stop |
---|
1960 | endif |
---|
1961 | |
---|
1962 | ! time interpolation: |
---|
1963 | frac=(time_armcu2-timeit)/(time_armcu2-time_armcu1) |
---|
1964 | frac=max(frac,0.0) |
---|
1965 | |
---|
1966 | fs_prof = fs_armcu(it_armcu2) & |
---|
1967 | & -frac*(fs_armcu(it_armcu2)-fs_armcu(it_armcu1)) |
---|
1968 | fl_prof = fl_armcu(it_armcu2) & |
---|
1969 | & -frac*(fl_armcu(it_armcu2)-fl_armcu(it_armcu1)) |
---|
1970 | at_prof = at_armcu(it_armcu2) & |
---|
1971 | & -frac*(at_armcu(it_armcu2)-at_armcu(it_armcu1)) |
---|
1972 | rt_prof = rt_armcu(it_armcu2) & |
---|
1973 | & -frac*(rt_armcu(it_armcu2)-rt_armcu(it_armcu1)) |
---|
1974 | aqt_prof = aqt_armcu(it_armcu2) & |
---|
1975 | & -frac*(aqt_armcu(it_armcu2)-aqt_armcu(it_armcu1)) |
---|
1976 | |
---|
1977 | print*, & |
---|
1978 | &'day,annee_ref,day_ini_armcu,timeit,it_armcu1,it_armcu2,SST:', & |
---|
1979 | &day,annee_ref,day_ini_armcu,timeit/86400.,it_armcu1, & |
---|
1980 | &it_armcu2,fs_prof,fl_prof,at_prof,rt_prof,aqt_prof |
---|
1981 | |
---|
1982 | return |
---|
1983 | END |
---|
1984 | |
---|
1985 | !===================================================================== |
---|
1986 | subroutine readprofiles(nlev_max,kmax,ntrac,height, & |
---|
1987 | & thlprof,qtprof,uprof, & |
---|
1988 | & vprof,e12prof,ugprof,vgprof, & |
---|
1989 | & wfls,dqtdxls,dqtdyls,dqtdtls, & |
---|
1990 | & thlpcar,tracer,nt1,nt2) |
---|
1991 | implicit none |
---|
1992 | |
---|
1993 | integer nlev_max,kmax,kmax2,ntrac |
---|
1994 | logical :: llesread = .true. |
---|
1995 | |
---|
1996 | real height(nlev_max),thlprof(nlev_max),qtprof(nlev_max), & |
---|
1997 | & uprof(nlev_max),vprof(nlev_max),e12prof(nlev_max), & |
---|
1998 | & ugprof(nlev_max),vgprof(nlev_max),wfls(nlev_max), & |
---|
1999 | & dqtdxls(nlev_max),dqtdyls(nlev_max),dqtdtls(nlev_max), & |
---|
2000 | & thlpcar(nlev_max),tracer(nlev_max,ntrac) |
---|
2001 | |
---|
2002 | real height1(nlev_max) |
---|
2003 | |
---|
2004 | integer, parameter :: ilesfile=1 |
---|
2005 | integer :: ierr,k,itrac,nt1,nt2 |
---|
2006 | |
---|
2007 | if(.not.(llesread)) return |
---|
2008 | |
---|
2009 | open (ilesfile,file='prof.inp.001',status='old',iostat=ierr) |
---|
2010 | if (ierr /= 0) stop 'ERROR:Prof.inp does not exist' |
---|
2011 | read (ilesfile,*) kmax |
---|
2012 | do k=1,kmax |
---|
2013 | read (ilesfile,*) height1(k),thlprof(k),qtprof (k), & |
---|
2014 | & uprof (k),vprof (k),e12prof(k) |
---|
2015 | enddo |
---|
2016 | close(ilesfile) |
---|
2017 | |
---|
2018 | open(ilesfile,file='lscale.inp.001',status='old',iostat=ierr) |
---|
2019 | if (ierr /= 0) stop 'ERROR:Lscale.inp does not exist' |
---|
2020 | read (ilesfile,*) kmax2 |
---|
2021 | if (kmax .ne. kmax2) then |
---|
2022 | print *, 'fichiers prof.inp et lscale.inp incompatibles :' |
---|
2023 | print *, 'nbre de niveaux : ',kmax,' et ',kmax2 |
---|
2024 | stop 'lecture profiles' |
---|
2025 | endif |
---|
2026 | do k=1,kmax |
---|
2027 | read (ilesfile,*) height(k),ugprof(k),vgprof(k),wfls(k), & |
---|
2028 | & dqtdxls(k),dqtdyls(k),dqtdtls(k),thlpcar(k) |
---|
2029 | end do |
---|
2030 | do k=1,kmax |
---|
2031 | if (height(k) .ne. height1(k)) then |
---|
2032 | print *, 'fichiers prof.inp et lscale.inp incompatibles :' |
---|
2033 | print *, 'les niveaux different : ',k,height1(k), height(k) |
---|
2034 | stop |
---|
2035 | endif |
---|
2036 | end do |
---|
2037 | close(ilesfile) |
---|
2038 | |
---|
2039 | open(ilesfile,file='trac.inp.001',status='old',iostat=ierr) |
---|
2040 | if (ierr /= 0) then |
---|
2041 | print*,'WARNING : trac.inp does not exist' |
---|
2042 | else |
---|
2043 | read (ilesfile,*) kmax2,nt1,nt2 |
---|
2044 | if (nt2>ntrac) then |
---|
2045 | stop 'Augmenter le nombre de traceurs dans traceur.def' |
---|
2046 | endif |
---|
2047 | if (kmax .ne. kmax2) then |
---|
2048 | print *, 'fichiers prof.inp et lscale.inp incompatibles :' |
---|
2049 | print *, 'nbre de niveaux : ',kmax,' et ',kmax2 |
---|
2050 | stop 'lecture profiles' |
---|
2051 | endif |
---|
2052 | do k=1,kmax |
---|
2053 | read (ilesfile,*) height(k),(tracer(k,itrac),itrac=nt1,nt2) |
---|
2054 | end do |
---|
2055 | close(ilesfile) |
---|
2056 | endif |
---|
2057 | |
---|
2058 | return |
---|
2059 | end |
---|
2060 | !====================================================================== |
---|
2061 | subroutine readprofile_sandu(nlev_max,kmax,height,pprof,tprof, & |
---|
2062 | & thlprof,qprof,uprof,vprof,wprof,omega,o3mmr) |
---|
2063 | !====================================================================== |
---|
2064 | implicit none |
---|
2065 | |
---|
2066 | integer nlev_max,kmax |
---|
2067 | logical :: llesread = .true. |
---|
2068 | |
---|
2069 | real height(nlev_max),pprof(nlev_max),tprof(nlev_max) |
---|
2070 | real thlprof(nlev_max) |
---|
2071 | real qprof(nlev_max),uprof(nlev_max),vprof(nlev_max) |
---|
2072 | real wprof(nlev_max),omega(nlev_max),o3mmr(nlev_max) |
---|
2073 | |
---|
2074 | integer, parameter :: ilesfile=1 |
---|
2075 | integer :: k,ierr |
---|
2076 | |
---|
2077 | if(.not.(llesread)) return |
---|
2078 | |
---|
2079 | open (ilesfile,file='prof.inp.001',status='old',iostat=ierr) |
---|
2080 | if (ierr /= 0) stop 'ERROR:Prof.inp does not exist' |
---|
2081 | read (ilesfile,*) kmax |
---|
2082 | do k=1,kmax |
---|
2083 | read (ilesfile,*) height(k),pprof(k), tprof(k),thlprof(k), & |
---|
2084 | & qprof (k),uprof(k), vprof(k), wprof(k), & |
---|
2085 | & omega (k),o3mmr(k) |
---|
2086 | enddo |
---|
2087 | close(ilesfile) |
---|
2088 | |
---|
2089 | return |
---|
2090 | end |
---|
2091 | |
---|
2092 | !====================================================================== |
---|
2093 | subroutine readprofile_astex(nlev_max,kmax,height,pprof,tprof, & |
---|
2094 | & thlprof,qvprof,qlprof,qtprof,uprof,vprof,wprof,tkeprof,o3mmr) |
---|
2095 | !====================================================================== |
---|
2096 | implicit none |
---|
2097 | |
---|
2098 | integer nlev_max,kmax |
---|
2099 | logical :: llesread = .true. |
---|
2100 | |
---|
2101 | real height(nlev_max),pprof(nlev_max),tprof(nlev_max), & |
---|
2102 | & thlprof(nlev_max),qlprof(nlev_max),qtprof(nlev_max), & |
---|
2103 | & qvprof(nlev_max),uprof(nlev_max),vprof(nlev_max), & |
---|
2104 | & wprof(nlev_max),tkeprof(nlev_max),o3mmr(nlev_max) |
---|
2105 | |
---|
2106 | integer, parameter :: ilesfile=1 |
---|
2107 | integer :: ierr,k |
---|
2108 | |
---|
2109 | if(.not.(llesread)) return |
---|
2110 | |
---|
2111 | open (ilesfile,file='prof.inp.001',status='old',iostat=ierr) |
---|
2112 | if (ierr /= 0) stop 'ERROR:Prof.inp does not exist' |
---|
2113 | read (ilesfile,*) kmax |
---|
2114 | do k=1,kmax |
---|
2115 | read (ilesfile,*) height(k),pprof(k), tprof(k),thlprof(k), & |
---|
2116 | & qvprof (k),qlprof (k),qtprof (k), & |
---|
2117 | & uprof(k), vprof(k), wprof(k),tkeprof(k),o3mmr(k) |
---|
2118 | enddo |
---|
2119 | close(ilesfile) |
---|
2120 | |
---|
2121 | return |
---|
2122 | end |
---|
2123 | |
---|
2124 | |
---|
2125 | |
---|
2126 | !====================================================================== |
---|
2127 | subroutine readprofile_armcu(nlev_max,kmax,height,pprof,uprof, & |
---|
2128 | & vprof,thetaprof,tprof,qvprof,rvprof,aprof,bprof) |
---|
2129 | !====================================================================== |
---|
2130 | implicit none |
---|
2131 | |
---|
2132 | integer nlev_max,kmax |
---|
2133 | logical :: llesread = .true. |
---|
2134 | |
---|
2135 | real height(nlev_max),pprof(nlev_max),tprof(nlev_max) |
---|
2136 | real thetaprof(nlev_max),rvprof(nlev_max) |
---|
2137 | real qvprof(nlev_max),uprof(nlev_max),vprof(nlev_max) |
---|
2138 | real aprof(nlev_max+1),bprof(nlev_max+1) |
---|
2139 | |
---|
2140 | integer, parameter :: ilesfile=1 |
---|
2141 | integer, parameter :: ifile=2 |
---|
2142 | integer :: ierr,jtot,k |
---|
2143 | |
---|
2144 | if(.not.(llesread)) return |
---|
2145 | |
---|
2146 | ! Read profiles at full levels |
---|
2147 | IF(nlev_max.EQ.19) THEN |
---|
2148 | open (ilesfile,file='prof.inp.19',status='old',iostat=ierr) |
---|
2149 | print *,'On ouvre prof.inp.19' |
---|
2150 | ELSE |
---|
2151 | open (ilesfile,file='prof.inp.40',status='old',iostat=ierr) |
---|
2152 | print *,'On ouvre prof.inp.40' |
---|
2153 | ENDIF |
---|
2154 | if (ierr /= 0) stop 'ERROR:Prof.inp does not exist' |
---|
2155 | read (ilesfile,*) kmax |
---|
2156 | do k=1,kmax |
---|
2157 | read (ilesfile,*) height(k) ,pprof(k), uprof(k), vprof(k), & |
---|
2158 | & thetaprof(k) ,tprof(k), qvprof(k),rvprof(k) |
---|
2159 | enddo |
---|
2160 | close(ilesfile) |
---|
2161 | |
---|
2162 | ! Vertical coordinates half levels for eta-coordinates (plev = alpha + beta * psurf) |
---|
2163 | IF(nlev_max.EQ.19) THEN |
---|
2164 | open (ifile,file='proh.inp.19',status='old',iostat=ierr) |
---|
2165 | print *,'On ouvre proh.inp.19' |
---|
2166 | if (ierr /= 0) stop 'ERROR:Proh.inp.19 does not exist' |
---|
2167 | ELSE |
---|
2168 | open (ifile,file='proh.inp.40',status='old',iostat=ierr) |
---|
2169 | print *,'On ouvre proh.inp.40' |
---|
2170 | if (ierr /= 0) stop 'ERROR:Proh.inp.40 does not exist' |
---|
2171 | ENDIF |
---|
2172 | read (ifile,*) kmax |
---|
2173 | do k=1,kmax |
---|
2174 | read (ifile,*) jtot,aprof(k),bprof(k) |
---|
2175 | enddo |
---|
2176 | close(ifile) |
---|
2177 | |
---|
2178 | return |
---|
2179 | end |
---|
2180 | |
---|
2181 | !===================================================================== |
---|
2182 | subroutine read_fire(fich_fire,nlevel,ntime & |
---|
2183 | & ,zz,thl,qt,u,v,tke & |
---|
2184 | & ,ug,vg,wls,dqtdx,dqtdy,dqtdt,thl_rad) |
---|
2185 | |
---|
2186 | !program reading forcings of the FIRE case study |
---|
2187 | |
---|
2188 | USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,& |
---|
2189 | nf90_inq_dimid,nf90_inquire_dimension |
---|
2190 | implicit none |
---|
2191 | |
---|
2192 | integer ntime,nlevel |
---|
2193 | character*80 :: fich_fire |
---|
2194 | real*8 zz(nlevel) |
---|
2195 | |
---|
2196 | real*8 thl(nlevel) |
---|
2197 | real*8 qt(nlevel),u(nlevel) |
---|
2198 | real*8 v(nlevel),tke(nlevel) |
---|
2199 | real*8 ug(nlevel,ntime),vg(nlevel,ntime),wls(nlevel,ntime) |
---|
2200 | real*8 dqtdx(nlevel,ntime),dqtdy(nlevel,ntime) |
---|
2201 | real*8 dqtdt(nlevel,ntime),thl_rad(nlevel,ntime) |
---|
2202 | |
---|
2203 | integer nid, ierr |
---|
2204 | integer nbvar3d |
---|
2205 | parameter(nbvar3d=30) |
---|
2206 | integer var3didin(nbvar3d) |
---|
2207 | |
---|
2208 | ierr = nf90_open(fich_fire,nf90_nowrite,nid) |
---|
2209 | if (ierr.NE.nf90_noerr) then |
---|
2210 | write(*,*) 'ERROR: Pb opening forcings nc file ' |
---|
2211 | write(*,*) nf90_strerror(ierr) |
---|
2212 | stop "" |
---|
2213 | endif |
---|
2214 | |
---|
2215 | |
---|
2216 | ierr=nf90_inq_varid(nid,"zz",var3didin(1)) |
---|
2217 | if(ierr/=nf90_noerr) then |
---|
2218 | write(*,*) nf90_strerror(ierr) |
---|
2219 | stop 'lev' |
---|
2220 | endif |
---|
2221 | |
---|
2222 | |
---|
2223 | ierr=nf90_inq_varid(nid,"thetal",var3didin(2)) |
---|
2224 | if(ierr/=nf90_noerr) then |
---|
2225 | write(*,*) nf90_strerror(ierr) |
---|
2226 | stop 'temp' |
---|
2227 | endif |
---|
2228 | |
---|
2229 | ierr=nf90_inq_varid(nid,"qt",var3didin(3)) |
---|
2230 | if(ierr/=nf90_noerr) then |
---|
2231 | write(*,*) nf90_strerror(ierr) |
---|
2232 | stop 'qv' |
---|
2233 | endif |
---|
2234 | |
---|
2235 | ierr=nf90_inq_varid(nid,"u",var3didin(4)) |
---|
2236 | if(ierr/=nf90_noerr) then |
---|
2237 | write(*,*) nf90_strerror(ierr) |
---|
2238 | stop 'u' |
---|
2239 | endif |
---|
2240 | |
---|
2241 | ierr=nf90_inq_varid(nid,"v",var3didin(5)) |
---|
2242 | if(ierr/=nf90_noerr) then |
---|
2243 | write(*,*) nf90_strerror(ierr) |
---|
2244 | stop 'v' |
---|
2245 | endif |
---|
2246 | |
---|
2247 | ierr=nf90_inq_varid(nid,"tke",var3didin(6)) |
---|
2248 | if(ierr/=nf90_noerr) then |
---|
2249 | write(*,*) nf90_strerror(ierr) |
---|
2250 | stop 'tke' |
---|
2251 | endif |
---|
2252 | |
---|
2253 | ierr=nf90_inq_varid(nid,"ugeo",var3didin(7)) |
---|
2254 | if(ierr/=nf90_noerr) then |
---|
2255 | write(*,*) nf90_strerror(ierr) |
---|
2256 | stop 'ug' |
---|
2257 | endif |
---|
2258 | |
---|
2259 | ierr=nf90_inq_varid(nid,"vgeo",var3didin(8)) |
---|
2260 | if(ierr/=nf90_noerr) then |
---|
2261 | write(*,*) nf90_strerror(ierr) |
---|
2262 | stop 'vg' |
---|
2263 | endif |
---|
2264 | |
---|
2265 | ierr=nf90_inq_varid(nid,"wls",var3didin(9)) |
---|
2266 | if(ierr/=nf90_noerr) then |
---|
2267 | write(*,*) nf90_strerror(ierr) |
---|
2268 | stop 'wls' |
---|
2269 | endif |
---|
2270 | |
---|
2271 | ierr=nf90_inq_varid(nid,"dqtdx",var3didin(10)) |
---|
2272 | if(ierr/=nf90_noerr) then |
---|
2273 | write(*,*) nf90_strerror(ierr) |
---|
2274 | stop 'dqtdx' |
---|
2275 | endif |
---|
2276 | |
---|
2277 | ierr=nf90_inq_varid(nid,"dqtdy",var3didin(11)) |
---|
2278 | if(ierr/=nf90_noerr) then |
---|
2279 | write(*,*) nf90_strerror(ierr) |
---|
2280 | stop 'dqtdy' |
---|
2281 | endif |
---|
2282 | |
---|
2283 | ierr=nf90_inq_varid(nid,"dqtdt",var3didin(12)) |
---|
2284 | if(ierr/=nf90_noerr) then |
---|
2285 | write(*,*) nf90_strerror(ierr) |
---|
2286 | stop 'dqtdt' |
---|
2287 | endif |
---|
2288 | |
---|
2289 | ierr=nf90_inq_varid(nid,"thl_rad",var3didin(13)) |
---|
2290 | if(ierr/=nf90_noerr) then |
---|
2291 | write(*,*) nf90_strerror(ierr) |
---|
2292 | stop 'thl_rad' |
---|
2293 | endif |
---|
2294 | !dimensions lecture |
---|
2295 | ! call catchaxis(nid,ntime,nlevel,time,z,ierr) |
---|
2296 | |
---|
2297 | ierr = NF90_GET_VAR(nid,var3didin(1),zz) |
---|
2298 | if(ierr/=nf90_noerr) then |
---|
2299 | write(*,*) nf90_strerror(ierr) |
---|
2300 | stop "getvarup" |
---|
2301 | endif |
---|
2302 | ! write(*,*)'lecture z ok',zz |
---|
2303 | |
---|
2304 | ierr = NF90_GET_VAR(nid,var3didin(2),thl) |
---|
2305 | if(ierr/=nf90_noerr) then |
---|
2306 | write(*,*) nf90_strerror(ierr) |
---|
2307 | stop "getvarup" |
---|
2308 | endif |
---|
2309 | ! write(*,*)'lecture thl ok',thl |
---|
2310 | |
---|
2311 | ierr = NF90_GET_VAR(nid,var3didin(3),qt) |
---|
2312 | if(ierr/=nf90_noerr) then |
---|
2313 | write(*,*) nf90_strerror(ierr) |
---|
2314 | stop "getvarup" |
---|
2315 | endif |
---|
2316 | ! write(*,*)'lecture qt ok',qt |
---|
2317 | |
---|
2318 | ierr = NF90_GET_VAR(nid,var3didin(4),u) |
---|
2319 | if(ierr/=nf90_noerr) then |
---|
2320 | write(*,*) nf90_strerror(ierr) |
---|
2321 | stop "getvarup" |
---|
2322 | endif |
---|
2323 | ! write(*,*)'lecture u ok',u |
---|
2324 | |
---|
2325 | ierr = NF90_GET_VAR(nid,var3didin(5),v) |
---|
2326 | if(ierr/=nf90_noerr) then |
---|
2327 | write(*,*) nf90_strerror(ierr) |
---|
2328 | stop "getvarup" |
---|
2329 | endif |
---|
2330 | ! write(*,*)'lecture v ok',v |
---|
2331 | |
---|
2332 | ierr = NF90_GET_VAR(nid,var3didin(6),tke) |
---|
2333 | if(ierr/=nf90_noerr) then |
---|
2334 | write(*,*) nf90_strerror(ierr) |
---|
2335 | stop "getvarup" |
---|
2336 | endif |
---|
2337 | ! write(*,*)'lecture tke ok',tke |
---|
2338 | |
---|
2339 | ierr = NF90_GET_VAR(nid,var3didin(7),ug) |
---|
2340 | if(ierr/=nf90_noerr) then |
---|
2341 | write(*,*) nf90_strerror(ierr) |
---|
2342 | stop "getvarup" |
---|
2343 | endif |
---|
2344 | ! write(*,*)'lecture ug ok',ug |
---|
2345 | |
---|
2346 | ierr = NF90_GET_VAR(nid,var3didin(8),vg) |
---|
2347 | if(ierr/=nf90_noerr) then |
---|
2348 | write(*,*) nf90_strerror(ierr) |
---|
2349 | stop "getvarup" |
---|
2350 | endif |
---|
2351 | ! write(*,*)'lecture vg ok',vg |
---|
2352 | |
---|
2353 | ierr = NF90_GET_VAR(nid,var3didin(9),wls) |
---|
2354 | if(ierr/=nf90_noerr) then |
---|
2355 | write(*,*) nf90_strerror(ierr) |
---|
2356 | stop "getvarup" |
---|
2357 | endif |
---|
2358 | ! write(*,*)'lecture wls ok',wls |
---|
2359 | |
---|
2360 | ierr = NF90_GET_VAR(nid,var3didin(10),dqtdx) |
---|
2361 | if(ierr/=nf90_noerr) then |
---|
2362 | write(*,*) nf90_strerror(ierr) |
---|
2363 | stop "getvarup" |
---|
2364 | endif |
---|
2365 | ! write(*,*)'lecture dqtdx ok',dqtdx |
---|
2366 | |
---|
2367 | ierr = NF90_GET_VAR(nid,var3didin(11),dqtdy) |
---|
2368 | if(ierr/=nf90_noerr) then |
---|
2369 | write(*,*) nf90_strerror(ierr) |
---|
2370 | stop "getvarup" |
---|
2371 | endif |
---|
2372 | ! write(*,*)'lecture dqtdy ok',dqtdy |
---|
2373 | |
---|
2374 | ierr = NF90_GET_VAR(nid,var3didin(12),dqtdt) |
---|
2375 | if(ierr/=nf90_noerr) then |
---|
2376 | write(*,*) nf90_strerror(ierr) |
---|
2377 | stop "getvarup" |
---|
2378 | endif |
---|
2379 | ! write(*,*)'lecture dqtdt ok',dqtdt |
---|
2380 | |
---|
2381 | ierr = NF90_GET_VAR(nid,var3didin(13),thl_rad) |
---|
2382 | if(ierr/=nf90_noerr) then |
---|
2383 | write(*,*) nf90_strerror(ierr) |
---|
2384 | stop "getvarup" |
---|
2385 | endif |
---|
2386 | ! write(*,*)'lecture thl_rad ok',thl_rad |
---|
2387 | |
---|
2388 | return |
---|
2389 | end subroutine read_fire |
---|
2390 | !===================================================================== |
---|
2391 | subroutine read_dice(fich_dice,nlevel,ntime & |
---|
2392 | & ,zz,pres,t,qv,u,v,o3 & |
---|
2393 | & ,shf,lhf,lwup,swup,tg,ustar,psurf,ug,vg & |
---|
2394 | & ,hadvt,hadvq,hadvu,hadvv,w,omega) |
---|
2395 | |
---|
2396 | !program reading initial profils and forcings of the Dice case study |
---|
2397 | |
---|
2398 | USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,& |
---|
2399 | nf90_inq_dimid,nf90_inquire_dimension |
---|
2400 | |
---|
2401 | USE yomcst_mod_h, ONLY: RPI, RCLUM, RHPLA, RKBOL, RNAVO & |
---|
2402 | , RDAY, REA, REPSM, RSIYEA, RSIDAY, ROMEGA & |
---|
2403 | , R_ecc, R_peri, R_incl & |
---|
2404 | , RA, RG, R1SA & |
---|
2405 | , RSIGMA & |
---|
2406 | , R, RMD, RMV, RD, RV, RCPD & |
---|
2407 | , RMO3, RMCO2, RMC, RMCH4, RMN2O, RMCFC11, RMCFC12 & |
---|
2408 | , RCPV, RCVD, RCVV, RKAPPA, RETV, eps_w & |
---|
2409 | , RCW, RCS & |
---|
2410 | , RLVTT, RLSTT, RLMLT, RTT, RATM & |
---|
2411 | , RESTT, RALPW, RBETW, RGAMW, RALPS, RBETS, RGAMS & |
---|
2412 | , RALPD, RBETD, RGAMD |
---|
2413 | implicit none |
---|
2414 | |
---|
2415 | |
---|
2416 | integer ntime,nlevel |
---|
2417 | integer l,k |
---|
2418 | character*80 :: fich_dice |
---|
2419 | real*8 time(ntime) |
---|
2420 | real*8 zz(nlevel) |
---|
2421 | |
---|
2422 | real*8 th(nlevel),pres(nlevel),t(nlevel) |
---|
2423 | real*8 qv(nlevel),u(nlevel),v(nlevel),o3(nlevel) |
---|
2424 | real*8 shf(ntime),lhf(ntime),lwup(ntime),swup(ntime),tg(ntime) |
---|
2425 | real*8 ustar(ntime),psurf(ntime),ug(ntime),vg(ntime) |
---|
2426 | real*8 hadvt(nlevel,ntime),hadvq(nlevel,ntime),hadvu(nlevel,ntime) |
---|
2427 | real*8 hadvv(nlevel,ntime),w(nlevel,ntime),omega(nlevel,ntime) |
---|
2428 | real*8 pzero |
---|
2429 | |
---|
2430 | integer nid, ierr |
---|
2431 | integer nbvar3d |
---|
2432 | parameter(nbvar3d=30) |
---|
2433 | integer var3didin(nbvar3d) |
---|
2434 | |
---|
2435 | pzero=100000. |
---|
2436 | ierr = nf90_open(fich_dice,nf90_nowrite,nid) |
---|
2437 | if (ierr.NE.nf90_noerr) then |
---|
2438 | write(*,*) 'ERROR: Pb opening forcings nc file ' |
---|
2439 | write(*,*) nf90_strerror(ierr) |
---|
2440 | stop "" |
---|
2441 | endif |
---|
2442 | |
---|
2443 | |
---|
2444 | ierr=nf90_inq_varid(nid,"height",var3didin(1)) |
---|
2445 | if(ierr/=nf90_noerr) then |
---|
2446 | write(*,*) nf90_strerror(ierr) |
---|
2447 | stop 'height' |
---|
2448 | endif |
---|
2449 | |
---|
2450 | ierr=nf90_inq_varid(nid,"pf",var3didin(11)) |
---|
2451 | if(ierr/=nf90_noerr) then |
---|
2452 | write(*,*) nf90_strerror(ierr) |
---|
2453 | stop 'pf' |
---|
2454 | endif |
---|
2455 | |
---|
2456 | ierr=nf90_inq_varid(nid,"theta",var3didin(12)) |
---|
2457 | if(ierr/=nf90_noerr) then |
---|
2458 | write(*,*) nf90_strerror(ierr) |
---|
2459 | stop 'theta' |
---|
2460 | endif |
---|
2461 | |
---|
2462 | ierr=nf90_inq_varid(nid,"qv",var3didin(13)) |
---|
2463 | if(ierr/=nf90_noerr) then |
---|
2464 | write(*,*) nf90_strerror(ierr) |
---|
2465 | stop 'qv' |
---|
2466 | endif |
---|
2467 | |
---|
2468 | ierr=nf90_inq_varid(nid,"u",var3didin(14)) |
---|
2469 | if(ierr/=nf90_noerr) then |
---|
2470 | write(*,*) nf90_strerror(ierr) |
---|
2471 | stop 'u' |
---|
2472 | endif |
---|
2473 | |
---|
2474 | ierr=nf90_inq_varid(nid,"v",var3didin(15)) |
---|
2475 | if(ierr/=nf90_noerr) then |
---|
2476 | write(*,*) nf90_strerror(ierr) |
---|
2477 | stop 'v' |
---|
2478 | endif |
---|
2479 | |
---|
2480 | ierr=nf90_inq_varid(nid,"o3mmr",var3didin(16)) |
---|
2481 | if(ierr/=nf90_noerr) then |
---|
2482 | write(*,*) nf90_strerror(ierr) |
---|
2483 | stop 'o3' |
---|
2484 | endif |
---|
2485 | |
---|
2486 | ierr=nf90_inq_varid(nid,"shf",var3didin(2)) |
---|
2487 | if(ierr/=nf90_noerr) then |
---|
2488 | write(*,*) nf90_strerror(ierr) |
---|
2489 | stop 'shf' |
---|
2490 | endif |
---|
2491 | |
---|
2492 | ierr=nf90_inq_varid(nid,"lhf",var3didin(3)) |
---|
2493 | if(ierr/=nf90_noerr) then |
---|
2494 | write(*,*) nf90_strerror(ierr) |
---|
2495 | stop 'lhf' |
---|
2496 | endif |
---|
2497 | |
---|
2498 | ierr=nf90_inq_varid(nid,"lwup",var3didin(4)) |
---|
2499 | if(ierr/=nf90_noerr) then |
---|
2500 | write(*,*) nf90_strerror(ierr) |
---|
2501 | stop 'lwup' |
---|
2502 | endif |
---|
2503 | |
---|
2504 | ierr=nf90_inq_varid(nid,"swup",var3didin(5)) |
---|
2505 | if(ierr/=nf90_noerr) then |
---|
2506 | write(*,*) nf90_strerror(ierr) |
---|
2507 | stop 'dqtdx' |
---|
2508 | endif |
---|
2509 | |
---|
2510 | ierr=nf90_inq_varid(nid,"Tg",var3didin(6)) |
---|
2511 | if(ierr/=nf90_noerr) then |
---|
2512 | write(*,*) nf90_strerror(ierr) |
---|
2513 | stop 'Tg' |
---|
2514 | endif |
---|
2515 | |
---|
2516 | ierr=nf90_inq_varid(nid,"ustar",var3didin(7)) |
---|
2517 | if(ierr/=nf90_noerr) then |
---|
2518 | write(*,*) nf90_strerror(ierr) |
---|
2519 | stop 'ustar' |
---|
2520 | endif |
---|
2521 | |
---|
2522 | ierr=nf90_inq_varid(nid,"psurf",var3didin(8)) |
---|
2523 | if(ierr/=nf90_noerr) then |
---|
2524 | write(*,*) nf90_strerror(ierr) |
---|
2525 | stop 'psurf' |
---|
2526 | endif |
---|
2527 | |
---|
2528 | ierr=nf90_inq_varid(nid,"Ug",var3didin(9)) |
---|
2529 | if(ierr/=nf90_noerr) then |
---|
2530 | write(*,*) nf90_strerror(ierr) |
---|
2531 | stop 'Ug' |
---|
2532 | endif |
---|
2533 | |
---|
2534 | ierr=nf90_inq_varid(nid,"Vg",var3didin(10)) |
---|
2535 | if(ierr/=nf90_noerr) then |
---|
2536 | write(*,*) nf90_strerror(ierr) |
---|
2537 | stop 'Vg' |
---|
2538 | endif |
---|
2539 | |
---|
2540 | ierr=nf90_inq_varid(nid,"hadvT",var3didin(17)) |
---|
2541 | if(ierr/=nf90_noerr) then |
---|
2542 | write(*,*) nf90_strerror(ierr) |
---|
2543 | stop 'hadvT' |
---|
2544 | endif |
---|
2545 | |
---|
2546 | ierr=nf90_inq_varid(nid,"hadvq",var3didin(18)) |
---|
2547 | if(ierr/=nf90_noerr) then |
---|
2548 | write(*,*) nf90_strerror(ierr) |
---|
2549 | stop 'hadvq' |
---|
2550 | endif |
---|
2551 | |
---|
2552 | ierr=nf90_inq_varid(nid,"hadvu",var3didin(19)) |
---|
2553 | if(ierr/=nf90_noerr) then |
---|
2554 | write(*,*) nf90_strerror(ierr) |
---|
2555 | stop 'hadvu' |
---|
2556 | endif |
---|
2557 | |
---|
2558 | ierr=nf90_inq_varid(nid,"hadvv",var3didin(20)) |
---|
2559 | if(ierr/=nf90_noerr) then |
---|
2560 | write(*,*) nf90_strerror(ierr) |
---|
2561 | stop 'hadvv' |
---|
2562 | endif |
---|
2563 | |
---|
2564 | ierr=nf90_inq_varid(nid,"w",var3didin(21)) |
---|
2565 | if(ierr/=nf90_noerr) then |
---|
2566 | write(*,*) nf90_strerror(ierr) |
---|
2567 | stop 'w' |
---|
2568 | endif |
---|
2569 | |
---|
2570 | ierr=nf90_inq_varid(nid,"omega",var3didin(22)) |
---|
2571 | if(ierr/=nf90_noerr) then |
---|
2572 | write(*,*) nf90_strerror(ierr) |
---|
2573 | stop 'omega' |
---|
2574 | endif |
---|
2575 | !dimensions lecture |
---|
2576 | ! call catchaxis(nid,ntime,nlevel,time,z,ierr) |
---|
2577 | |
---|
2578 | ierr = NF90_GET_VAR(nid,var3didin(1),zz) |
---|
2579 | if(ierr/=nf90_noerr) then |
---|
2580 | write(*,*) nf90_strerror(ierr) |
---|
2581 | stop "getvarup" |
---|
2582 | endif |
---|
2583 | ! write(*,*)'lecture zz ok',zz |
---|
2584 | |
---|
2585 | ierr = NF90_GET_VAR(nid,var3didin(11),pres) |
---|
2586 | if(ierr/=nf90_noerr) then |
---|
2587 | write(*,*) nf90_strerror(ierr) |
---|
2588 | stop "getvarup" |
---|
2589 | endif |
---|
2590 | ! write(*,*)'lecture pres ok',pres |
---|
2591 | |
---|
2592 | ierr = NF90_GET_VAR(nid,var3didin(12),th) |
---|
2593 | if(ierr/=nf90_noerr) then |
---|
2594 | write(*,*) nf90_strerror(ierr) |
---|
2595 | stop "getvarup" |
---|
2596 | endif |
---|
2597 | ! write(*,*)'lecture th ok',th |
---|
2598 | do k=1,nlevel |
---|
2599 | t(k)=th(k)*(pres(k)/pzero)**rkappa |
---|
2600 | enddo |
---|
2601 | |
---|
2602 | ierr = NF90_GET_VAR(nid,var3didin(13),qv) |
---|
2603 | if(ierr/=nf90_noerr) then |
---|
2604 | write(*,*) nf90_strerror(ierr) |
---|
2605 | stop "getvarup" |
---|
2606 | endif |
---|
2607 | ! write(*,*)'lecture qv ok',qv |
---|
2608 | |
---|
2609 | ierr = NF90_GET_VAR(nid,var3didin(14),u) |
---|
2610 | if(ierr/=nf90_noerr) then |
---|
2611 | write(*,*) nf90_strerror(ierr) |
---|
2612 | stop "getvarup" |
---|
2613 | endif |
---|
2614 | ! write(*,*)'lecture u ok',u |
---|
2615 | |
---|
2616 | ierr = NF90_GET_VAR(nid,var3didin(15),v) |
---|
2617 | if(ierr/=nf90_noerr) then |
---|
2618 | write(*,*) nf90_strerror(ierr) |
---|
2619 | stop "getvarup" |
---|
2620 | endif |
---|
2621 | ! write(*,*)'lecture v ok',v |
---|
2622 | |
---|
2623 | ierr = NF90_GET_VAR(nid,var3didin(16),o3) |
---|
2624 | if(ierr/=nf90_noerr) then |
---|
2625 | write(*,*) nf90_strerror(ierr) |
---|
2626 | stop "getvarup" |
---|
2627 | endif |
---|
2628 | ! write(*,*)'lecture o3 ok',o3 |
---|
2629 | |
---|
2630 | ierr = NF90_GET_VAR(nid,var3didin(2),shf) |
---|
2631 | if(ierr/=nf90_noerr) then |
---|
2632 | write(*,*) nf90_strerror(ierr) |
---|
2633 | stop "getvarup" |
---|
2634 | endif |
---|
2635 | ! write(*,*)'lecture shf ok',shf |
---|
2636 | |
---|
2637 | ierr = NF90_GET_VAR(nid,var3didin(3),lhf) |
---|
2638 | if(ierr/=nf90_noerr) then |
---|
2639 | write(*,*) nf90_strerror(ierr) |
---|
2640 | stop "getvarup" |
---|
2641 | endif |
---|
2642 | ! write(*,*)'lecture lhf ok',lhf |
---|
2643 | |
---|
2644 | ierr = NF90_GET_VAR(nid,var3didin(4),lwup) |
---|
2645 | if(ierr/=nf90_noerr) then |
---|
2646 | write(*,*) nf90_strerror(ierr) |
---|
2647 | stop "getvarup" |
---|
2648 | endif |
---|
2649 | ! write(*,*)'lecture lwup ok',lwup |
---|
2650 | |
---|
2651 | ierr = NF90_GET_VAR(nid,var3didin(5),swup) |
---|
2652 | if(ierr/=nf90_noerr) then |
---|
2653 | write(*,*) nf90_strerror(ierr) |
---|
2654 | stop "getvarup" |
---|
2655 | endif |
---|
2656 | ! write(*,*)'lecture swup ok',swup |
---|
2657 | |
---|
2658 | ierr = NF90_GET_VAR(nid,var3didin(6),tg) |
---|
2659 | if(ierr/=nf90_noerr) then |
---|
2660 | write(*,*) nf90_strerror(ierr) |
---|
2661 | stop "getvarup" |
---|
2662 | endif |
---|
2663 | ! write(*,*)'lecture tg ok',tg |
---|
2664 | |
---|
2665 | ierr = NF90_GET_VAR(nid,var3didin(7),ustar) |
---|
2666 | if(ierr/=nf90_noerr) then |
---|
2667 | write(*,*) nf90_strerror(ierr) |
---|
2668 | stop "getvarup" |
---|
2669 | endif |
---|
2670 | ! write(*,*)'lecture ustar ok',ustar |
---|
2671 | |
---|
2672 | ierr = NF90_GET_VAR(nid,var3didin(8),psurf) |
---|
2673 | if(ierr/=nf90_noerr) then |
---|
2674 | write(*,*) nf90_strerror(ierr) |
---|
2675 | stop "getvarup" |
---|
2676 | endif |
---|
2677 | ! write(*,*)'lecture psurf ok',psurf |
---|
2678 | |
---|
2679 | ierr = NF90_GET_VAR(nid,var3didin(9),ug) |
---|
2680 | if(ierr/=nf90_noerr) then |
---|
2681 | write(*,*) nf90_strerror(ierr) |
---|
2682 | stop "getvarup" |
---|
2683 | endif |
---|
2684 | ! write(*,*)'lecture ug ok',ug |
---|
2685 | |
---|
2686 | ierr = NF90_GET_VAR(nid,var3didin(10),vg) |
---|
2687 | if(ierr/=nf90_noerr) then |
---|
2688 | write(*,*) nf90_strerror(ierr) |
---|
2689 | stop "getvarup" |
---|
2690 | endif |
---|
2691 | ! write(*,*)'lecture vg ok',vg |
---|
2692 | |
---|
2693 | ierr = NF90_GET_VAR(nid,var3didin(17),hadvt) |
---|
2694 | if(ierr/=nf90_noerr) then |
---|
2695 | write(*,*) nf90_strerror(ierr) |
---|
2696 | stop "getvarup" |
---|
2697 | endif |
---|
2698 | ! write(*,*)'lecture hadvt ok',hadvt |
---|
2699 | |
---|
2700 | ierr = NF90_GET_VAR(nid,var3didin(18),hadvq) |
---|
2701 | if(ierr/=nf90_noerr) then |
---|
2702 | write(*,*) nf90_strerror(ierr) |
---|
2703 | stop "getvarup" |
---|
2704 | endif |
---|
2705 | ! write(*,*)'lecture hadvq ok',hadvq |
---|
2706 | |
---|
2707 | ierr = NF90_GET_VAR(nid,var3didin(19),hadvu) |
---|
2708 | if(ierr/=nf90_noerr) then |
---|
2709 | write(*,*) nf90_strerror(ierr) |
---|
2710 | stop "getvarup" |
---|
2711 | endif |
---|
2712 | ! write(*,*)'lecture hadvu ok',hadvu |
---|
2713 | |
---|
2714 | ierr = NF90_GET_VAR(nid,var3didin(20),hadvv) |
---|
2715 | if(ierr/=nf90_noerr) then |
---|
2716 | write(*,*) nf90_strerror(ierr) |
---|
2717 | stop "getvarup" |
---|
2718 | endif |
---|
2719 | ! write(*,*)'lecture hadvv ok',hadvv |
---|
2720 | |
---|
2721 | ierr = NF90_GET_VAR(nid,var3didin(21),w) |
---|
2722 | if(ierr/=nf90_noerr) then |
---|
2723 | write(*,*) nf90_strerror(ierr) |
---|
2724 | stop "getvarup" |
---|
2725 | endif |
---|
2726 | ! write(*,*)'lecture w ok',w |
---|
2727 | |
---|
2728 | ierr = NF90_GET_VAR(nid,var3didin(22),omega) |
---|
2729 | if(ierr/=nf90_noerr) then |
---|
2730 | write(*,*) nf90_strerror(ierr) |
---|
2731 | stop "getvarup" |
---|
2732 | endif |
---|
2733 | ! write(*,*)'lecture omega ok',omega |
---|
2734 | |
---|
2735 | return |
---|
2736 | end subroutine read_dice |
---|
2737 | !===================================================================== |
---|
2738 | subroutine read_gabls4(fich_gabls4,nlevel,ntime,nsol & |
---|
2739 | & ,zz,depth_sn,ug,vg,pf,th,t,qv,u,v,hadvt,hadvq,tg,tsnow,snow_dens) |
---|
2740 | |
---|
2741 | !program reading initial profils and forcings of the Gabls4 case study |
---|
2742 | |
---|
2743 | USE yomcst_mod_h, ONLY: RPI, RCLUM, RHPLA, RKBOL, RNAVO & |
---|
2744 | , RDAY, REA, REPSM, RSIYEA, RSIDAY, ROMEGA & |
---|
2745 | , R_ecc, R_peri, R_incl & |
---|
2746 | , RA, RG, R1SA & |
---|
2747 | , RSIGMA & |
---|
2748 | , R, RMD, RMV, RD, RV, RCPD & |
---|
2749 | , RMO3, RMCO2, RMC, RMCH4, RMN2O, RMCFC11, RMCFC12 & |
---|
2750 | , RCPV, RCVD, RCVV, RKAPPA, RETV, eps_w & |
---|
2751 | , RCW, RCS & |
---|
2752 | , RLVTT, RLSTT, RLMLT, RTT, RATM & |
---|
2753 | , RESTT, RALPW, RBETW, RGAMW, RALPS, RBETS, RGAMS & |
---|
2754 | , RALPD, RBETD, RGAMD |
---|
2755 | USE netcdf, ONLY: nf90_open,nf90_nowrite,nf90_noerr,nf90_strerror,nf90_inq_varid,nf90_get_var,& |
---|
2756 | nf90_inq_dimid,nf90_inquire_dimension |
---|
2757 | |
---|
2758 | implicit none |
---|
2759 | |
---|
2760 | integer ntime,nlevel,nsol |
---|
2761 | integer l,k |
---|
2762 | character*80 :: fich_gabls4 |
---|
2763 | real*8 time(ntime) |
---|
2764 | |
---|
2765 | ! ATTENTION: visiblement quand on lit gabls4_driver.nc on recupere les donnees |
---|
2766 | ! dans un ordre inverse par rapport a la convention LMDZ |
---|
2767 | ! ==> il faut tout inverser (MPL 20141024) |
---|
2768 | ! les variables indexees "_i" sont celles qui sont lues dans gabls4_driver.nc |
---|
2769 | real*8 zz_i(nlevel),th_i(nlevel),pf_i(nlevel),t_i(nlevel) |
---|
2770 | real*8 qv_i(nlevel),u_i(nlevel),v_i(nlevel),ug_i(nlevel,ntime),vg_i(nlevel,ntime) |
---|
2771 | real*8 hadvt_i(nlevel,ntime),hadvq_i(nlevel,ntime) |
---|
2772 | |
---|
2773 | real*8 zz(nlevel),th(nlevel),pf(nlevel),t(nlevel) |
---|
2774 | real*8 qv(nlevel),u(nlevel),v(nlevel),ug(nlevel,ntime),vg(nlevel,ntime) |
---|
2775 | real*8 hadvt(nlevel,ntime),hadvq(nlevel,ntime) |
---|
2776 | |
---|
2777 | real*8 depth_sn(nsol),tsnow(nsol),snow_dens(nsol) |
---|
2778 | real*8 tg(ntime) |
---|
2779 | integer nid, ierr |
---|
2780 | integer nbvar3d |
---|
2781 | parameter(nbvar3d=30) |
---|
2782 | integer var3didin(nbvar3d) |
---|
2783 | |
---|
2784 | ierr = nf90_open(fich_gabls4,nf90_nowrite,nid) |
---|
2785 | if (ierr.NE.nf90_noerr) then |
---|
2786 | write(*,*) 'ERROR: Pb opening forcings nc file ' |
---|
2787 | write(*,*) nf90_strerror(ierr) |
---|
2788 | stop "" |
---|
2789 | endif |
---|
2790 | |
---|
2791 | |
---|
2792 | ierr=nf90_inq_varid(nid,"height",var3didin(1)) |
---|
2793 | if(ierr/=nf90_noerr) then |
---|
2794 | write(*,*) nf90_strerror(ierr) |
---|
2795 | stop 'height' |
---|
2796 | endif |
---|
2797 | |
---|
2798 | ierr=nf90_inq_varid(nid,"depth_sn",var3didin(2)) |
---|
2799 | if(ierr/=nf90_noerr) then |
---|
2800 | write(*,*) nf90_strerror(ierr) |
---|
2801 | stop 'depth_sn' |
---|
2802 | endif |
---|
2803 | |
---|
2804 | ierr=nf90_inq_varid(nid,"Ug",var3didin(3)) |
---|
2805 | if(ierr/=nf90_noerr) then |
---|
2806 | write(*,*) nf90_strerror(ierr) |
---|
2807 | stop 'Ug' |
---|
2808 | endif |
---|
2809 | |
---|
2810 | ierr=nf90_inq_varid(nid,"Vg",var3didin(4)) |
---|
2811 | if(ierr/=nf90_noerr) then |
---|
2812 | write(*,*) nf90_strerror(ierr) |
---|
2813 | stop 'Vg' |
---|
2814 | endif |
---|
2815 | ierr=nf90_inq_varid(nid,"pf",var3didin(5)) |
---|
2816 | if(ierr/=nf90_noerr) then |
---|
2817 | write(*,*) nf90_strerror(ierr) |
---|
2818 | stop 'pf' |
---|
2819 | endif |
---|
2820 | |
---|
2821 | ierr=nf90_inq_varid(nid,"theta",var3didin(6)) |
---|
2822 | if(ierr/=nf90_noerr) then |
---|
2823 | write(*,*) nf90_strerror(ierr) |
---|
2824 | stop 'theta' |
---|
2825 | endif |
---|
2826 | |
---|
2827 | ierr=nf90_inq_varid(nid,"tempe",var3didin(7)) |
---|
2828 | if(ierr/=nf90_noerr) then |
---|
2829 | write(*,*) nf90_strerror(ierr) |
---|
2830 | stop 'tempe' |
---|
2831 | endif |
---|
2832 | |
---|
2833 | ierr=nf90_inq_varid(nid,"qv",var3didin(8)) |
---|
2834 | if(ierr/=nf90_noerr) then |
---|
2835 | write(*,*) nf90_strerror(ierr) |
---|
2836 | stop 'qv' |
---|
2837 | endif |
---|
2838 | |
---|
2839 | ierr=nf90_inq_varid(nid,"u",var3didin(9)) |
---|
2840 | if(ierr/=nf90_noerr) then |
---|
2841 | write(*,*) nf90_strerror(ierr) |
---|
2842 | stop 'u' |
---|
2843 | endif |
---|
2844 | |
---|
2845 | ierr=nf90_inq_varid(nid,"v",var3didin(10)) |
---|
2846 | if(ierr/=nf90_noerr) then |
---|
2847 | write(*,*) nf90_strerror(ierr) |
---|
2848 | stop 'v' |
---|
2849 | endif |
---|
2850 | |
---|
2851 | ierr=nf90_inq_varid(nid,"hadvT",var3didin(11)) |
---|
2852 | if(ierr/=nf90_noerr) then |
---|
2853 | write(*,*) nf90_strerror(ierr) |
---|
2854 | stop 'hadvt' |
---|
2855 | endif |
---|
2856 | |
---|
2857 | ierr=nf90_inq_varid(nid,"hadvQ",var3didin(12)) |
---|
2858 | if(ierr/=nf90_noerr) then |
---|
2859 | write(*,*) nf90_strerror(ierr) |
---|
2860 | stop 'hadvq' |
---|
2861 | endif |
---|
2862 | |
---|
2863 | ierr=nf90_inq_varid(nid,"Tsnow",var3didin(14)) |
---|
2864 | if(ierr/=nf90_noerr) then |
---|
2865 | write(*,*) nf90_strerror(ierr) |
---|
2866 | stop 'tsnow' |
---|
2867 | endif |
---|
2868 | |
---|
2869 | ierr=nf90_inq_varid(nid,"snow_density",var3didin(15)) |
---|
2870 | if(ierr/=nf90_noerr) then |
---|
2871 | write(*,*) nf90_strerror(ierr) |
---|
2872 | stop 'snow_density' |
---|
2873 | endif |
---|
2874 | |
---|
2875 | ierr=nf90_inq_varid(nid,"Tg",var3didin(16)) |
---|
2876 | if(ierr/=nf90_noerr) then |
---|
2877 | write(*,*) nf90_strerror(ierr) |
---|
2878 | stop 'Tg' |
---|
2879 | endif |
---|
2880 | |
---|
2881 | |
---|
2882 | !dimensions lecture |
---|
2883 | ! call catchaxis(nid,ntime,nlevel,time,z,ierr) |
---|
2884 | |
---|
2885 | ierr = NF90_GET_VAR(nid,var3didin(1),zz_i) |
---|
2886 | if(ierr/=nf90_noerr) then |
---|
2887 | write(*,*) nf90_strerror(ierr) |
---|
2888 | stop "getvarup" |
---|
2889 | endif |
---|
2890 | |
---|
2891 | ierr = NF90_GET_VAR(nid,var3didin(2),depth_sn) |
---|
2892 | if(ierr/=nf90_noerr) then |
---|
2893 | write(*,*) nf90_strerror(ierr) |
---|
2894 | stop "getvarup" |
---|
2895 | endif |
---|
2896 | |
---|
2897 | ierr = NF90_GET_VAR(nid,var3didin(3),ug_i) |
---|
2898 | if(ierr/=nf90_noerr) then |
---|
2899 | write(*,*) nf90_strerror(ierr) |
---|
2900 | stop "getvarup" |
---|
2901 | endif |
---|
2902 | |
---|
2903 | ierr = NF90_GET_VAR(nid,var3didin(4),vg_i) |
---|
2904 | if(ierr/=nf90_noerr) then |
---|
2905 | write(*,*) nf90_strerror(ierr) |
---|
2906 | stop "getvarup" |
---|
2907 | endif |
---|
2908 | |
---|
2909 | ierr = NF90_GET_VAR(nid,var3didin(5),pf_i) |
---|
2910 | if(ierr/=nf90_noerr) then |
---|
2911 | write(*,*) nf90_strerror(ierr) |
---|
2912 | stop "getvarup" |
---|
2913 | endif |
---|
2914 | |
---|
2915 | ierr = NF90_GET_VAR(nid,var3didin(6),th_i) |
---|
2916 | if(ierr/=nf90_noerr) then |
---|
2917 | write(*,*) nf90_strerror(ierr) |
---|
2918 | stop "getvarup" |
---|
2919 | endif |
---|
2920 | |
---|
2921 | ierr = NF90_GET_VAR(nid,var3didin(7),t_i) |
---|
2922 | if(ierr/=nf90_noerr) then |
---|
2923 | write(*,*) nf90_strerror(ierr) |
---|
2924 | stop "getvarup" |
---|
2925 | endif |
---|
2926 | |
---|
2927 | ierr = NF90_GET_VAR(nid,var3didin(8),qv_i) |
---|
2928 | if(ierr/=nf90_noerr) then |
---|
2929 | write(*,*) nf90_strerror(ierr) |
---|
2930 | stop "getvarup" |
---|
2931 | endif |
---|
2932 | |
---|
2933 | ierr = NF90_GET_VAR(nid,var3didin(9),u_i) |
---|
2934 | if(ierr/=nf90_noerr) then |
---|
2935 | write(*,*) nf90_strerror(ierr) |
---|
2936 | stop "getvarup" |
---|
2937 | endif |
---|
2938 | |
---|
2939 | ierr = NF90_GET_VAR(nid,var3didin(10),v_i) |
---|
2940 | if(ierr/=nf90_noerr) then |
---|
2941 | write(*,*) nf90_strerror(ierr) |
---|
2942 | stop "getvarup" |
---|
2943 | endif |
---|
2944 | |
---|
2945 | ierr = NF90_GET_VAR(nid,var3didin(11),hadvt_i) |
---|
2946 | if(ierr/=nf90_noerr) then |
---|
2947 | write(*,*) nf90_strerror(ierr) |
---|
2948 | stop "getvarup" |
---|
2949 | endif |
---|
2950 | |
---|
2951 | ierr = NF90_GET_VAR(nid,var3didin(12),hadvq_i) |
---|
2952 | if(ierr/=nf90_noerr) then |
---|
2953 | write(*,*) nf90_strerror(ierr) |
---|
2954 | stop "getvarup" |
---|
2955 | endif |
---|
2956 | |
---|
2957 | ierr = NF90_GET_VAR(nid,var3didin(14),tsnow) |
---|
2958 | if(ierr/=nf90_noerr) then |
---|
2959 | write(*,*) nf90_strerror(ierr) |
---|
2960 | stop "getvarup" |
---|
2961 | endif |
---|
2962 | |
---|
2963 | ierr = NF90_GET_VAR(nid,var3didin(15),snow_dens) |
---|
2964 | if(ierr/=nf90_noerr) then |
---|
2965 | write(*,*) nf90_strerror(ierr) |
---|
2966 | stop "getvarup" |
---|
2967 | endif |
---|
2968 | |
---|
2969 | ierr = NF90_GET_VAR(nid,var3didin(16),tg) |
---|
2970 | if(ierr/=nf90_noerr) then |
---|
2971 | write(*,*) nf90_strerror(ierr) |
---|
2972 | stop "getvarup" |
---|
2973 | endif |
---|
2974 | |
---|
2975 | ! On remet les variables lues dans le bon ordre des niveaux (MPL 20141024) |
---|
2976 | do k=1,nlevel |
---|
2977 | zz(k)=zz_i(nlevel+1-k) |
---|
2978 | ug(k,:)=ug_i(nlevel+1-k,:) |
---|
2979 | vg(k,:)=vg_i(nlevel+1-k,:) |
---|
2980 | pf(k)=pf_i(nlevel+1-k) |
---|
2981 | print *,'pf=',pf(k) |
---|
2982 | th(k)=th_i(nlevel+1-k) |
---|
2983 | t(k)=t_i(nlevel+1-k) |
---|
2984 | qv(k)=qv_i(nlevel+1-k) |
---|
2985 | u(k)=u_i(nlevel+1-k) |
---|
2986 | v(k)=v_i(nlevel+1-k) |
---|
2987 | hadvt(k,:)=hadvt_i(nlevel+1-k,:) |
---|
2988 | hadvq(k,:)=hadvq_i(nlevel+1-k,:) |
---|
2989 | enddo |
---|
2990 | return |
---|
2991 | end subroutine read_gabls4 |
---|
2992 | !===================================================================== |
---|
2993 | |
---|
2994 | ! Reads CIRC input files |
---|
2995 | |
---|
2996 | SUBROUTINE read_circ(nlev_circ,cf,lwp,iwp,reliq,reice,t,z,p,pm,h2o,o3,sza) |
---|
2997 | |
---|
2998 | parameter (ncm_1=49180) |
---|
2999 | |
---|
3000 | real albsfc(ncm_1), albsfc_w(ncm_1) |
---|
3001 | real cf(nlev_circ), icefra(nlev_circ), deice(nlev_circ), & |
---|
3002 | reliq(nlev_circ), reice(nlev_circ), lwp(nlev_circ), iwp(nlev_circ) |
---|
3003 | real t(nlev_circ+1), z(nlev_circ+1), dz(nlev_circ), p(nlev_circ+1) |
---|
3004 | real aer_beta(nlev_circ), waer(nlev_circ), gaer(nlev_circ) |
---|
3005 | real pm(nlev_circ), tm(nlev_circ), h2o(nlev_circ), o3(nlev_circ) |
---|
3006 | real co2(nlev_circ), n2o(nlev_circ), co(nlev_circ), ch4(nlev_circ), & |
---|
3007 | o2(nlev_circ), ccl4(nlev_circ), f11(nlev_circ), f12(nlev_circ) |
---|
3008 | ! za= zenital angle |
---|
3009 | ! sza= cosinus angle zenital |
---|
3010 | real wavn(ncm_1), ssf(ncm_1),za,sza |
---|
3011 | integer nlev |
---|
3012 | |
---|
3013 | |
---|
3014 | ! Open the files |
---|
3015 | |
---|
3016 | open (11, file='Tsfc_sza_nlev_case.txt', status='old') |
---|
3017 | open (12, file='level_input_case.txt', status='old') |
---|
3018 | open (13, file='layer_input_case.txt', status='old') |
---|
3019 | open (14, file='aerosol_input_case.txt', status='old') |
---|
3020 | open (15, file='cloud_input_case.txt', status='old') |
---|
3021 | open (16, file='sfcalbedo_input_case.txt', status='old') |
---|
3022 | |
---|
3023 | ! Read scalar information |
---|
3024 | do iskip=1,5 |
---|
3025 | read (11, *) |
---|
3026 | enddo |
---|
3027 | read (11, '(i8)') nlev |
---|
3028 | read (11, '(f10.2)') tsfc |
---|
3029 | read (11, '(f10.2)') za |
---|
3030 | read (11, '(f10.4)') sw_dn_toa |
---|
3031 | sza=cos(za/180.*RPI) |
---|
3032 | print *,'nlev,tsfc,sza,sw_dn_toa,RPI',nlev,tsfc,sza,sw_dn_toa,RPI |
---|
3033 | close(11) |
---|
3034 | |
---|
3035 | ! Read level information |
---|
3036 | read (12, *) |
---|
3037 | do il=1,nlev |
---|
3038 | read (12, 302) ilev, z(il), p(il), t(il) |
---|
3039 | z(il)=z(il)*1000. ! z donne en km |
---|
3040 | p(il)=p(il)*100. ! p donne en mb |
---|
3041 | enddo |
---|
3042 | 302 format (i8, f8.3, 2f9.2) |
---|
3043 | close(12) |
---|
3044 | |
---|
3045 | ! Read layer information (midpoint values) |
---|
3046 | do iskip=1,3 |
---|
3047 | read (13, *) |
---|
3048 | enddo |
---|
3049 | do il=1,nlev-1 |
---|
3050 | read (13, 303) ilev,pm(il),tm(il),h2o(il),co2(il),o3(il), & |
---|
3051 | n2o(il),co(il),ch4(il),o2(il),ccl4(il), & |
---|
3052 | f11(il),f12(il) |
---|
3053 | pm(il)=pm(il)*100. |
---|
3054 | enddo |
---|
3055 | 303 format (i8, 2f9.2, 10(2x,e13.7)) |
---|
3056 | close(13) |
---|
3057 | |
---|
3058 | ! Read aerosol layer information |
---|
3059 | do iskip=1,3 |
---|
3060 | read (14, *) |
---|
3061 | enddo |
---|
3062 | read (14, '(f10.2)') aer_alpha |
---|
3063 | read (14, *) |
---|
3064 | read (14, *) |
---|
3065 | do il=1,nlev-1 |
---|
3066 | read (14, 304) ilev, aer_beta(il), waer(il), gaer(il) |
---|
3067 | enddo |
---|
3068 | 304 format (i8, f9.5, 2f8.3) |
---|
3069 | close(14) |
---|
3070 | |
---|
3071 | ! Read cloud information |
---|
3072 | do iskip=1,3 |
---|
3073 | read (15, *) |
---|
3074 | enddo |
---|
3075 | do il=1,nlev-1 |
---|
3076 | read (15, 305) ilev, cf(il), lwp(il), iwp(il), reliq(il), reice(il) |
---|
3077 | lwp(il)=lwp(il)/1000. ! lwp donne en g/kg |
---|
3078 | iwp(il)=iwp(il)/1000. ! iwp donne en g/kg |
---|
3079 | reliq(il)=reliq(il)/1000000. ! reliq donne en microns |
---|
3080 | reice(il)=reice(il)/1000000. ! reice donne en microns |
---|
3081 | enddo |
---|
3082 | 305 format (i8, f8.3, 4f9.2) |
---|
3083 | close(15) |
---|
3084 | |
---|
3085 | ! Read surface albedo (weighted & unweighted) and spectral solar irradiance |
---|
3086 | do iskip=1,6 |
---|
3087 | read (16, *) |
---|
3088 | enddo |
---|
3089 | do icm_1=1,ncm_1 |
---|
3090 | read (16, 306) wavn(icm_1), albsfc(icm_1), albsfc_w(icm_1), ssf(icm_1) |
---|
3091 | enddo |
---|
3092 | 306 format(f10.1, 2f12.5, f14.8) |
---|
3093 | close(16) |
---|
3094 | |
---|
3095 | return |
---|
3096 | end subroutine read_circ |
---|
3097 | !===================================================================== |
---|
3098 | ! Reads RTMIP input files |
---|
3099 | |
---|
3100 | SUBROUTINE read_rtmip(nlev_rtmip,play,plev,t,h2o,o3) |
---|
3101 | |
---|
3102 | |
---|
3103 | real t(nlev_rtmip), pt(nlev_rtmip),pb(nlev_rtmip),h2o(nlev_rtmip), o3(nlev_rtmip) |
---|
3104 | real temp(nlev_rtmip), play(nlev_rtmip),ovap(nlev_rtmip), oz(nlev_rtmip),plev(nlev_rtmip+1) |
---|
3105 | integer nlev |
---|
3106 | |
---|
3107 | |
---|
3108 | ! Open the files |
---|
3109 | |
---|
3110 | open (11, file='low_resolution_profile.txt', status='old') |
---|
3111 | |
---|
3112 | ! Read level information |
---|
3113 | read (11, *) |
---|
3114 | do il=1,nlev_rtmip |
---|
3115 | read (11, 302) pt(il), pb(il), t(il),h2o(il),o3(il) |
---|
3116 | enddo |
---|
3117 | do il=1,nlev_rtmip |
---|
3118 | play(il)=pt(nlev_rtmip-il+1)*100. ! p donne en mb |
---|
3119 | temp(il)=t(nlev_rtmip-il+1) |
---|
3120 | ovap(il)=h2o(nlev_rtmip-il+1) |
---|
3121 | oz(il)=o3(nlev_rtmip-il+1) |
---|
3122 | enddo |
---|
3123 | do il=1,39 |
---|
3124 | plev(il)=play(il)+(play(il+1)-play(il))/2. |
---|
3125 | print *,'il p t ovap oz=',il,plev(il),temp(il),ovap(il),oz(il) |
---|
3126 | enddo |
---|
3127 | plev(41)=101300. |
---|
3128 | 302 format (e16.10,3x,e16.10,3x,e16.10,3x,e12.6,3x,e12.6) |
---|
3129 | close(12) |
---|
3130 | |
---|
3131 | return |
---|
3132 | end subroutine read_rtmip |
---|
3133 | !===================================================================== |
---|