source: LMDZ6/trunk/libf/phylmd/dyn1d/mod_1D_cases_read_std.F90 @ 3683

Last change on this file since 3683 was 3683, checked in by fhourdin, 4 years ago

Correction format standard
Frédéric

File size: 55.3 KB
Line 
1!
2! $Id: mod_1D_cases_read.F90 2373 2015-10-13 17:28:01Z jyg $
3!
4MODULE mod_1D_cases_read_std
5
6!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7!Declarations specifiques au cas standard
8        character*80 :: fich_cas
9! Discr?tisation
10        integer nlev_cas, nt_cas
11        real zzs_cas,pp_cas
12
13
14!profils environnementaux
15        real, allocatable::  ppforc_cas(:,:),plev_cas(:,:)
16
17!profils initiaux
18        real, allocatable::  zzforc_cas(:,:)
19        real, allocatable::  qt0_cas(:),qv0_cas(:),ql0_cas(:),qi0_cas(:),tke_cas(:)
20        real, allocatable::  rt0_cas(:),rv0_cas(:),rl0_cas(:),ri0_cas(:),rh0_cas(:)
21        real, allocatable::  temp0_cas(:),theta0_cas(:), thetal0_cas(:)
22        real, allocatable::  u0_cas(:),v0_cas(:),w_cas(:,:),omega_cas(:,:),ug_cas(:,:), vg_cas(:,:)
23        real, allocatable::  t_cas(:),theta_cas(:), thl_cas(:),u_cas(:),v_cas(:)
24!advections et nudging     
25        real, allocatable::  uadv_cas(:,:),vadv_cas(:,:)
26        real, allocatable::  tadv_cas(:,:),thadv_cas(:,:),thladv_cas(:,:)
27        real, allocatable::  qtadv_cas(:,:),qvadv_cas(:,:)
28        real, allocatable::  rtadv_cas(:,:),rvadv_cas(:,:)
29        real, allocatable::  trad_cas(:,:),thrad_cas(:,:),thlrad_cas(:,:)
30        real, allocatable::  temp_nudg_cas(:,:),th_nudg_cas(:,:),thl_nudg_cas(:,:)
31        real, allocatable::  qv_nudg_cas(:,:),qt_nudg_cas(:,:)
32        real, allocatable::  rv_nudg_cas(:,:),rt_nudg_cas(:,:)
33        real, allocatable::  u_nudg_cas(:,:),v_nudg_cas(:,:)
34! flux     
35        real, allocatable::  lat_cas(:),sens_cas(:),ustar_cas(:)
36        real, allocatable::  ts_cas(:),ps_cas(:),ps_forc_cas(:)
37        real, allocatable::  wpthetap_cas(:),wpqvp_cas(:),wpqtp_cas(:),wprvp_cas(:),wprtp_cas(:)
38
39!champs interpoles
40        real, allocatable::  plev_prof_cas(:)
41        real, allocatable::  plev_forc_prof_cas(:)
42        real, allocatable::  pforc_prof_cas(:)
43        real, allocatable::  t_prof_cas(:),th_prof_cas(:),thl_prof_cas(:)
44        real, allocatable::  qt_prof_cas(:),qv_prof_cas(:),ql_prof_cas(:),qi_prof_cas(:)
45        real, allocatable::  rh_prof_cas(:)
46        real, allocatable::  rt_prof_cas(:),rv_prof_cas(:),rl_prof_cas(:),ri_prof_cas(:)
47        real, allocatable::  u_prof_cas(:),v_prof_cas(:),w_prof_cas(:),omega_prof_cas(:)
48        real, allocatable::  ug_prof_cas(:),vg_prof_cas(:)
49        real, allocatable::  uadv_prof_cas(:),vadv_prof_cas(:),tadv_prof_cas(:),thadv_prof_cas(:),thladv_prof_cas(:)
50        real, allocatable::  qtadv_prof_cas(:),qvadv_prof_cas(:),rtadv_prof_cas(:),rvadv_prof_cas(:)
51        real, allocatable::  temp_nudg_prof_cas(:), th_nudg_prof_cas(:), thl_nudg_prof_cas(:)
52        real, allocatable::  qv_nudg_prof_cas(:), qt_nudg_prof_cas(:), rv_nudg_prof_cas(:), rt_nudg_prof_cas(:)
53        real, allocatable::  u_nudg_prof_cas(:),v_nudg_prof_cas(:)
54        real, allocatable::  trad_prof_cas(:),thrad_prof_cas(:),thlrad_prof_cas(:)
55
56        real lat_prof_cas,sens_prof_cas,ts_prof_cas,ps_prof_cas,ps_forc_prof_cas,ustar_prof_cas,tke_prof_cas
57        real wpqtp_prof_cas,wpqvp_prof_cas,wprtp_prof_cas,wprvp_prof_cas,wpthetap_prof_cas
58!       real o3_cas,orog_cas,albedo_cas,emiss_cas,t_skin_cas,q_skin_cas,mom_rough,heat_rough,rugos_cas,sand_cas,clay_cas
59     
60
61
62CONTAINS
63
64
65!**********************************************************************************************
66SUBROUTINE read_SCM_cas
67      implicit none
68
69#include "netcdf.inc"
70#include "date_cas.h"
71
72      INTEGER nid,rid,ierr
73      INTEGER ii,jj,timeid
74      REAL, ALLOCATABLE :: time_val(:)
75
76      print*,'ON EST VRAIMENT LA'
77      fich_cas='cas.nc'
78      print*,'fich_cas ',fich_cas
79      ierr = NF_OPEN(fich_cas,NF_NOWRITE,nid)
80      print*,'fich_cas,NF_NOWRITE,nid ',fich_cas,NF_NOWRITE,nid
81      if (ierr.NE.NF_NOERR) then
82         write(*,*) 'ERROR: GROS Pb opening forcings nc file '
83         write(*,*) NF_STRERROR(ierr)
84         stop ""
85      endif
86!.......................................................................
87      ierr=NF_INQ_DIMID(nid,'lat',rid)
88      IF (ierr.NE.NF_NOERR) THEN
89         print*, 'Oh probleme lecture dimension lat'
90      ENDIF
91      ierr=NF_INQ_DIMLEN(nid,rid,ii)
92      print*,'OK1 read2: nid,rid,lat',nid,rid,ii
93!.......................................................................
94      ierr=NF_INQ_DIMID(nid,'lon',rid)
95      IF (ierr.NE.NF_NOERR) THEN
96         print*, 'Oh probleme lecture dimension lon'
97      ENDIF
98      ierr=NF_INQ_DIMLEN(nid,rid,jj)
99      print*,'OK2 read2: nid,rid,lat',nid,rid,jj
100!.......................................................................
101      ierr=NF_INQ_DIMID(nid,'lev',rid)
102      IF (ierr.NE.NF_NOERR) THEN
103         print*, 'Oh probleme lecture dimension nlev'
104      ENDIF
105      ierr=NF_INQ_DIMLEN(nid,rid,nlev_cas)
106      print*,'OK3 read2: nid,rid,nlev_cas',nid,rid,nlev_cas
107      IF ( .NOT. ( nlev_cas > 10 .AND. nlev_cas < 200000 )) THEN
108              print*,'Valeur de nlev_cas peu probable'
109              STOP
110      ENDIF
111!.......................................................................
112      ierr=NF_INQ_DIMID(nid,'time',rid)
113      nt_cas=0
114      IF (ierr.NE.NF_NOERR) THEN
115        stop 'Oh probleme lecture dimension time'
116      ENDIF
117      ierr=NF_INQ_DIMLEN(nid,rid,nt_cas)
118      print*,'OK4 read2: nid,rid,nt_cas',nid,rid,nt_cas
119! Lecture de l'axe des temps
120      print*,'LECTURE DU TEMPS'
121      ierr=NF_INQ_VARID(nid,'time',timeid)
122         if(ierr/=NF_NOERR) then
123           print *,'Variable time manquante dans cas.nc:'
124           ierr=NF_NOERR
125         else
126                 allocate(time_val(nt_cas))
127#ifdef NC_DOUBLE
128         ierr = NF_GET_VAR_DOUBLE(nid,timeid,time_val)
129#else
130           ierr = NF_GET_VAR_REAL(nid,timeid,time_val)
131#endif
132           if(ierr/=NF_NOERR) then
133              print *,'Pb a la lecture de time cas.nc: '
134           endif
135   endif
136   IF (nt_cas>1) THEN
137           pdt_cas=time_val(2)-time_val(1)
138   ELSE
139           pdt_cas=0.
140   ENDIF
141
142!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
143        allocate(zzforc_cas(nlev_cas,nt_cas))
144        allocate(ppforc_cas(nlev_cas,nt_cas))
145!profils initiaux
146        allocate(temp0_cas(nlev_cas),theta0_cas(nlev_cas),thetal0_cas(nlev_cas),tke_cas(nlev_cas))
147        allocate(qt0_cas(nlev_cas),qv0_cas(nlev_cas),ql0_cas(nlev_cas),qi0_cas(nlev_cas),u0_cas(nlev_cas),v0_cas(nlev_cas))
148        allocate(rt0_cas(nlev_cas),rv0_cas(nlev_cas),rl0_cas(nlev_cas),ri0_cas(nlev_cas),rh0_cas(nlev_cas))
149        allocate(t_cas(nlev_cas),theta_cas(nlev_cas),thl_cas(nlev_cas),u_cas(nlev_cas),v_cas(nlev_cas))
150        allocate(w_cas(nlev_cas,nt_cas),omega_cas(nlev_cas,nt_cas))
151        allocate(ug_cas(nlev_cas,nt_cas),vg_cas(nlev_cas,nt_cas))
152!advections et nudging     
153        allocate(uadv_cas(nlev_cas,nt_cas),vadv_cas(nlev_cas,nt_cas))
154        allocate(tadv_cas(nlev_cas,nt_cas),thadv_cas(nlev_cas,nt_cas),thladv_cas(nlev_cas,nt_cas))
155        allocate(qtadv_cas(nlev_cas,nt_cas),qvadv_cas(nlev_cas,nt_cas))
156        allocate(rtadv_cas(nlev_cas,nt_cas),rvadv_cas(nlev_cas,nt_cas))
157        allocate(trad_cas(nlev_cas,nt_cas),thrad_cas(nlev_cas,nt_cas),thlrad_cas(nlev_cas,nt_cas))
158        allocate(temp_nudg_cas(nlev_cas,nt_cas),th_nudg_cas(nlev_cas,nt_cas),thl_nudg_cas(nlev_cas,nt_cas))
159        allocate(qv_nudg_cas(nlev_cas,nt_cas),qt_nudg_cas(nlev_cas,nt_cas))
160        allocate(rv_nudg_cas(nlev_cas,nt_cas),rt_nudg_cas(nlev_cas,nt_cas))
161        allocate(u_nudg_cas(nlev_cas,nt_cas),v_nudg_cas(nlev_cas,nt_cas))
162! flux     
163        allocate(lat_cas(nt_cas),sens_cas(nt_cas),ustar_cas(nt_cas))
164        allocate(ts_cas(nt_cas),ps_cas(nt_cas),ps_forc_cas(nt_cas))
165        allocate(wpthetap_cas(nt_cas),wpqvp_cas(nt_cas),wpqtp_cas(nt_cas),wprvp_cas(nt_cas),wprtp_cas(nt_cas))
166
167!champs interpoles
168        allocate(plev_prof_cas(nlev_cas))
169        allocate(t_prof_cas(nlev_cas))
170        allocate(th_prof_cas(nlev_cas))
171        allocate(thl_prof_cas(nlev_cas))
172        allocate(qt_prof_cas(nlev_cas))
173        allocate(qv_prof_cas(nlev_cas))
174        allocate(ql_prof_cas(nlev_cas))
175        allocate(qi_prof_cas(nlev_cas))
176        allocate(rh_prof_cas(nlev_cas))
177        allocate(rt_prof_cas(nlev_cas))
178        allocate(rv_prof_cas(nlev_cas))
179        allocate(rl_prof_cas(nlev_cas))
180        allocate(ri_prof_cas(nlev_cas))
181        allocate(u_prof_cas(nlev_cas))
182        allocate(v_prof_cas(nlev_cas))
183        allocate(w_prof_cas(nlev_cas))
184        allocate(omega_prof_cas(nlev_cas))
185        allocate(ug_prof_cas(nlev_cas))
186        allocate(vg_prof_cas(nlev_cas))
187        allocate(temp_nudg_prof_cas(nlev_cas),th_nudg_prof_cas(nlev_cas),thl_nudg_prof_cas(nlev_cas))
188        allocate(qt_nudg_prof_cas(nlev_cas),qv_nudg_prof_cas(nlev_cas),rt_nudg_prof_cas(nlev_cas),rv_nudg_prof_cas(nlev_cas))
189        allocate(u_nudg_prof_cas(nlev_cas),v_nudg_prof_cas(nlev_cas))
190
191        print*,'Allocations OK'
192
193           CALL read_SCM(nid,nlev_cas,nt_cas,                                                                             &
194     &     zzs_cas,pp_cas,zzforc_cas,ppforc_cas,temp0_cas,theta0_cas,thetal0_cas,qt0_cas,qv0_cas,ql0_cas,qi0_cas,         &
195     &     rh0_cas,rt0_cas,rv0_cas,rl0_cas,ri0_cas,                                                                       &
196     &     u0_cas,v0_cas,w_cas,omega_cas,ug_cas,vg_cas,uadv_cas,vadv_cas,tadv_cas,thadv_cas,thladv_cas,                   &
197     &     qvadv_cas,qtadv_cas,rvadv_cas,rtadv_cas,                                                                       &
198     &     temp_nudg_cas,th_nudg_cas,thl_nudg_cas,qv_nudg_cas,qt_nudg_cas,rv_nudg_cas,rt_nudg_cas,u_nudg_cas,v_nudg_cas,  &
199     &     trad_cas,thrad_cas,thlrad_cas,tke_cas,sens_cas,lat_cas,ts_cas,ps_cas,ps_forc_cas,ustar_cas,                    &
200     &     wpthetap_cas,wpqvp_cas,wpqtp_cas,wprvp_cas,wprtp_cas)
201
202        print*,'read_SCM cas OK'
203        do ii=1,nlev_cas
204        print*,'apres read2_SCM, plev_cas=',ii,ppforc_cas(ii,1)
205        !print*,'apres read_SCM, plev_cas=',ii,omega_cas(ii,nt_cas/2+1)
206        enddo
207
208
209END SUBROUTINE read_SCM_cas
210
211
212!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
213SUBROUTINE deallocate2_1D_cases
214
215      deallocate(zzforc_cas)
216      deallocate(ppforc_cas)
217!profils initiaux
218      deallocate(temp0_cas,theta0_cas,thetal0_cas)
219      deallocate(qt0_cas,qv0_cas,ql0_cas,qi0_cas,u0_cas,v0_cas)
220      deallocate(rt0_cas,rv0_cas,rl0_cas,ri0_cas,rh0_cas,tke_cas)
221      deallocate(t_cas,theta_cas,thl_cas,u_cas,v_cas)
222      deallocate(w_cas,omega_cas)
223      deallocate(ug_cas,vg_cas)
224!advections et nudging     
225      deallocate(uadv_cas,vadv_cas)
226      deallocate(tadv_cas,thadv_cas,thladv_cas)
227      deallocate(qtadv_cas,qvadv_cas)
228      deallocate(rtadv_cas,rvadv_cas)
229      deallocate(trad_cas,thrad_cas,thlrad_cas)
230      deallocate(temp_nudg_cas,th_nudg_cas,thl_nudg_cas)
231      deallocate(qv_nudg_cas,qt_nudg_cas)
232      deallocate(rv_nudg_cas,rt_nudg_cas)
233      deallocate(u_nudg_cas,v_nudg_cas)
234! flux     
235      deallocate(lat_cas,sens_cas,ustar_cas)
236      deallocate(ts_cas,ps_cas,ps_forc_cas)
237      deallocate(wpthetap_cas,wpqvp_cas,wpqtp_cas,wprvp_cas,wprtp_cas)
238
239!champs interpoles
240        deallocate (plev_prof_cas)
241        deallocate (t_prof_cas)
242        deallocate (th_prof_cas)
243        deallocate (thl_prof_cas)
244        deallocate (qt_prof_cas)
245        deallocate (qv_prof_cas)
246        deallocate (ql_prof_cas)
247        deallocate (qi_prof_cas)
248        deallocate (rh_prof_cas)
249        deallocate (rt_prof_cas)
250        deallocate (rv_prof_cas)
251        deallocate (rl_prof_cas)
252        deallocate (ri_prof_cas)
253        deallocate (u_prof_cas)
254        deallocate (v_prof_cas)
255        deallocate (w_prof_cas)
256        deallocate (omega_prof_cas)
257        deallocate (ug_prof_cas)
258        deallocate (vg_prof_cas)
259        deallocate (temp_nudg_prof_cas,th_nudg_prof_cas,thl_nudg_prof_cas)
260        deallocate (qt_nudg_prof_cas,qv_nudg_prof_cas,rt_nudg_prof_cas,rv_nudg_prof_cas)
261        deallocate (u_nudg_prof_cas,v_nudg_prof_cas)
262
263END SUBROUTINE deallocate2_1D_cases
264
265
266!=====================================================================
267      SUBROUTINE read_SCM(nid,nlevel,ntime,                                                 &
268     &     zzs,pp,zzforc,ppforc,temp0,theta0,thetal0,qt0,qv0,ql0,qi0,rh0,rt0,rv0,rl0,ri0,    &
269     &     u0,v0,w,omega,ug,vg,uadv,vadv,tadv,thadv,thladv,qvadv,qtadv,rvadv,rtadv,         &
270     &     temp_nudg,th_nudg,thl_nudg,qv_nudg,qt_nudg,rv_nudg,rt_nudg,u_nudg,v_nudg,        &
271     &     trad,thrad,thlrad,tke,sens,flat,ts,ps,ps_forc,ustar,                              &
272     &     wpthetap,wpqvp,wpqtp,wprvp,wprtp)
273
274!program reading forcing of the case study   
275      implicit none
276#include "netcdf.inc"
277#include "compar1d_std.h"
278
279      integer ntime,nlevel,k,t
280
281      real zzs,zzforc(nlevel,ntime)
282      real pp,ppforc(nlevel,ntime)
283!profils initiaux
284      real temp0(nlevel),theta0(nlevel),thetal0(nlevel),tke(nlevel)
285      real temp(nlevel,ntime),qv(nlevel,ntime),ql(nlevel,ntime),qi(nlevel,ntime),u(nlevel,ntime),v(nlevel,ntime)
286      real qt0(nlevel),qv0(nlevel),ql0(nlevel),qi0(nlevel),u0(nlevel),v0(nlevel)
287      real rt0(nlevel),rv0(nlevel),rl0(nlevel),ri0(nlevel),rh0(nlevel)
288      real w(nlevel,ntime),omega(nlevel,ntime)
289      real ug(nlevel,ntime),vg(nlevel,ntime)
290!advections et nudging     
291      real uadv(nlevel,ntime),vadv(nlevel,ntime)
292      real tadv(nlevel,ntime),thadv(nlevel,ntime),thladv(nlevel,ntime)
293      real qtadv(nlevel,ntime),qvadv(nlevel,ntime)
294      real rtadv(nlevel,ntime),rvadv(nlevel,ntime)
295      real trad(nlevel,ntime),thrad(nlevel,ntime),thlrad(nlevel,ntime)
296      real temp_nudg(nlevel,ntime),th_nudg(nlevel,ntime),thl_nudg(nlevel,ntime)
297      real qv_nudg(nlevel,ntime),qt_nudg(nlevel,ntime)
298      real rv_nudg(nlevel,ntime),rt_nudg(nlevel,ntime)
299      real u_nudg(nlevel,ntime),v_nudg(nlevel,ntime)
300! flux     
301      real flat(ntime),sens(ntime),ustar(ntime)
302      real ts(ntime),ps(ntime),ps_forc(ntime)
303      real wpthetap(ntime),wpqvp(ntime),wpqtp(ntime),wprtp(ntime),wprvp(ntime)
304      real resul(nlevel,ntime),resul1(nlevel),resul2(ntime),resul3
305
306
307      integer nid, ierr,ierr1,ierr2,rid,i
308      integer nbvar3d
309      parameter(nbvar3d=55)
310      integer var3didin(nbvar3d),missing_var(nbvar3d)
311      character*14 name_var(1:nbvar3d)
312
313
314      data name_var/ &
315     ! coordonnees pression (n niveaux) profils intiaux #1-#17
316     & 'qt','qv','ql','qi','rt','rv','rl','ri',                                                   &
317     & 'rh','temp','theta','thetal','u','v','tke',                                                &
318     & 'height','pressure',                                                                       &
319     ! coordonnees pression (n niveaux) + temps #18-#44
320     & 'height_forc','pressure_forc','w','omega','ug','vg','u_adv','v_adv',                       &
321     & 'temp_adv','theta_adv','thetal_adv','qt_adv','qv_adv','rt_adv','rv_adv',                   &
322     & 'temp_rad','theta_rad','thetal_rad','temp_nudging','theta_nudging','thetal_nudging',       &
323     & 'qv_nudging','qt_nudging','rv_nudging','rt_nudging','u_nudging','v_nudging',               &
324     ! coordonnees temps #45-#55
325     & 'sfc_sens_flx','sfc_lat_flx','ts','ps','ps_forc','ustar',                                  &
326     & 'wpthetap','wpqvp','wpqtp','wprtp','wprvp'/
327     ! scalaires #56-57
328     ! Aucune
329
330!-----------------------------------------------------------------------
331! Checking availability of variable #i in the cas.nc file
332!     missing_var=1 if the variable is missing
333!-----------------------------------------------------------------------
334
335       do i=1,nbvar3d
336         missing_var(i)=0.
337         ierr=NF_INQ_VARID(nid,name_var(i),var3didin(i))
338         if(ierr/=NF_NOERR) then
339           print *,'Variable manquante dans cas.nc:',i,name_var(i)
340           ierr=NF_NOERR
341           missing_var(i)=1
342         else
343
344!-----------------------------------------------------------------------
345! Activating keys depending on the presence of specific variables in cas.nc
346!-----------------------------------------------------------------------
347if ( 1 == 1 ) THEN
348            if ( name_var(i) == 'temp_nudging' .and. nint(nudging_temp)==0) stop 'Nudging inconsistency temp'
349            if ( name_var(i) == 'theta_nudging' .and. nint(nudging_theta)==0) stop 'Nudging inconsistency theta'
350            if ( name_var(i) == 'thetal_nudging' .and. nint(nudging_thetal)==0) stop 'Nudging inconsistency thetal'
351            if ( name_var(i) == 'qv_nudging' .and. nint(nudging_qv)==0) stop 'Nudging inconsistency qv'
352            if ( name_var(i) == 'qt_nudging' .and. nint(nudging_qt)==0) stop 'Nudging inconsistency qt'
353            if ( name_var(i) == 'rv_nudging' .and. nint(nudging_rv)==0) stop 'Nudging inconsistency rv'
354            if ( name_var(i) == 'rt_nudging' .and. nint(nudging_rt)==0) stop 'Nudging inconsistency rt'
355            if ( name_var(i) == 'u_nudging' .and. nint(nudging_u)==0) stop 'Nudging inconsistency u'
356            if ( name_var(i) == 'v_nudging' .and. nint(nudging_u)==0) stop 'Nudging inconsistency v'
357    ELSE
358             print*,'GUIDAGE : CONSISTENCY CHECK DEACTIVATED FOR TESTS of SANDU/REF'
359    ENDIF
360
361!-----------------------------------------------------------------------
362!  Reading 1D (N) vertical varialbes    (nlevel,lat,lon)   
363!-----------------------------------------------------------------------
364           if(i.LE.17) then
365#ifdef NC_DOUBLE
366           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul1)
367#else
368           ierr = NF_GET_VAR_REAL(nid,var3didin(i),resul1)
369#endif
370           print *,'read2_cas(resul1), on a lu ',i,name_var(i)
371           if(ierr/=NF_NOERR) then
372              print *,'Pb a la lecture de cas.nc: ',name_var(i)
373              stop "getvarup"
374           endif
375         print*,'Lecture de la variable (nlevel,lat,lon) #i ',i,name_var(i),minval(resul1),maxval(resul1)
376
377!-----------------------------------------------------------------------
378!  Reading 2D tim-vertical variables  (time,nlevel,lat,lon)
379!  TBD : seems to be the same as above.
380!-----------------------------------------------------------------------
381           else if(i.ge.18.and.i.LE.44) then
382#ifdef NC_DOUBLE
383           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul)
384#else
385           ierr = NF_GET_VAR_REAL(nid,var3didin(i),resul)
386#endif
387           print *,'read2_cas(resul), on a lu ',i,name_var(i)
388           if(ierr/=NF_NOERR) then
389              print *,'Pb a la lecture de cas.nc: ',name_var(i)
390              stop "getvarup"
391           endif
392         print*,'Lecture de la variable (time,nlevel,lat,lon) #i ',i,name_var(i),minval(resul),maxval(resul)
393
394!-----------------------------------------------------------------------
395!  Reading 1D time variables (time,lat,lon)
396!-----------------------------------------------------------------------
397           else if (i.gt.45.and.i.LE.55) then
398#ifdef NC_DOUBLE
399           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul2)
400#else
401           ierr = NF_GET_VAR_REAL(nid,var3didin(i),resul2)
402#endif
403           print *,'read2_cas(resul2), on a lu ',i,name_var(i)
404           if(ierr/=NF_NOERR) then
405              print *,'Pb a la lecture de cas.nc: ',name_var(i)
406              stop "getvarup"
407           endif
408         print*,'Lecture de la variable (time,lat,lon) #i  ',i,name_var(i),minval(resul2),maxval(resul2)
409!-----------------------------------------------------------------------
410! Reading scalar variables (t0,lat,lon)
411!-----------------------------------------------------------------------
412           else
413#ifdef NC_DOUBLE
414           ierr = NF_GET_VAR_DOUBLE(nid,var3didin(i),resul3)
415#else
416           ierr = NF_GET_VAR_REAL(nid,var3didin(i),resul3)
417#endif
418           print *,'read2_cas(resul3), on a lu ',i,name_var(i)
419           if(ierr/=NF_NOERR) then
420              print *,'Pb a la lecture de cas.nc: ',name_var(i)
421              stop "getvarup"
422           endif
423         print*,'Lecture de la variable  (t0,lat,lon) #i ',i,name_var(i),resul3
424           endif
425         endif
426
427!-----------------------------------------------------------------------
428! Attributing variables
429!-----------------------------------------------------------------------
430         select case(i)
431           case(1) ; qt0         =resul1
432           case(2) ; qv0         =resul1   
433           case(3) ; ql0         =resul1
434           case(4) ; qi0         =resul1
435           case(5) ; rt0         =resul1
436           case(6) ; rv0         =resul1
437           case(7) ; rl0         =resul1
438           case(8) ; ri0         =resul1
439           case(9) ; rh0         =resul1
440           case(10) ; temp0      =resul1
441           case(11) ; theta0     =resul1
442           case(12) ; thetal0    =resul1
443           case(13) ; u0         =resul1
444           case(14) ; v0         =resul1
445           case(15) ; tke        =resul1       
446           case(16) ; zzforc     =resul        ! donnees indexees en nlevel,time
447           case(17) ; ppforc     =resul
448           case(18) ; w          =resul
449           case(19) ; omega      =resul
450           case(20) ; ug         =resul
451           case(21) ; vg         =resul
452           case(22) ; uadv       =resul
453           case(23) ; vadv       =resul
454           case(24) ; tadv       =resul
455           case(25) ; thadv      =resul
456           case(26) ; thladv     =resul
457           case(27) ; qtadv      =resul
458           case(28) ; qvadv      =resul
459           case(29) ; rtadv      =resul
460           case(30) ; rvadv      =resul
461           case(31) ; trad       =resul
462           case(32) ; thrad      =resul
463           case(33) ; thlrad     =resul
464           case(34) ; temp_nudg  =resul
465           case(35) ; th_nudg    =resul
466           case(36) ; thl_nudg   =resul
467           case(37) ; qv_nudg    =resul
468           case(38) ; qt_nudg    =resul
469           case(39) ; rv_nudg    =resul
470           case(40) ; rt_nudg    =resul
471           case(41) ; u_nudg     =resul
472           case(42) ; v_nudg     =resul
473           case(43) ; sens       =resul2        ! donnees indexees en time seulement
474           case(44) ; flat       =resul2     
475           case(45) ; ts         =resul2
476           case(46) ; ps         =resul2
477           case(47) ; ps_forc    =resul2
478           case(48) ; ustar      =resul2
479           case(49) ; wpthetap   =resul2
480           case(50) ; wpqvp      =resul2
481           case(51) ; wpqtp      =resul2
482           case(52) ; wprvp      =resul2
483           case(53) ; wprtp      =resul2
484           case(54) ; zzs        =resul3       ! scalaires
485           case(55) ; pp         =resul3
486         end select
487         resul=0.
488         resul1=0.
489         resul2=0.
490         resul3=0.
491       enddo
492!        print*,'Lecture de la variable APRES ,sens ',minval(sens),maxval(sens)
493!        print*,'Lecture de la variable APRES ,flat ',minval(flat),maxval(flat)
494
495!CR:ATTENTION EN ATTENTE DE REGLER LA QUESTION DU PAS DE TEMPS INITIAL
496!      do t=1,ntime
497!         do k=1,nlevel
498!            temp(k,t)=temp0(k)
499!            qv(k,t)=qv0(k)
500!            ql(k,t)=ql0(k)
501!            qi(k,t)=qi0(k)
502!            u(k,t)=u0(k)
503!            v(k,t)=v0(k)
504!            !tke(k,t)=tke0(k)
505!         enddo
506!      enddo
507       !!!! TRAVAIL : EN FONCTION DES DECISIONS SUR LA SPECIFICATION DE W
508       !!!omega=-vitw*pres*rg/(rd*temp)
509!-----------------------------------------------------------------------
510
511         return
512         END SUBROUTINE read_SCM
513!======================================================================
514
515!======================================================================
516
517!**********************************************************************************************
518        SUBROUTINE interp_case_time_std(day,day1,annee_ref                           &
519     &         ,nt_cas,nlev_cas                                                      &
520     &         ,ts_cas,ps_cas,ps_forc_cas,plev_cas,ppforc_cas,t_cas,th_cas,thl_cas   &
521     &         ,qt_cas,qv_cas,ql_cas,qi_cas                                          &
522     &         ,rt_cas,rv_cas,rl_cas,ri_cas,rh_cas                                   &
523     &         ,u_cas,v_cas,w_cas,omega_cas,ug_cas,vg_cas                            &
524     &         ,temp_nudg_cas,th_nudg_cas,thl_nudg_cas,qt_nudg_cas,qv_nudg_cas       &
525     &         ,rt_nudg_cas,rv_nudg_cas,u_nudg_cas,v_nudg_cas                        &
526     &         ,uadv_cas,vadv_cas,tadv_cas,thadv_cas,thladv_cas                      &
527     &         ,qtadv_cas,qvadv_cas,rtadv_cas,rvadv_cas                              &
528     &         ,trad_cas,thrad_cas,thlrad_cas                                        &
529     &         ,tke_cas,lat_cas,sens_cas,ustar_cas                                   &
530     &         ,wpthetap_cas,wpqtp_cas,wpqvp_cas,wprtp_cas,wprvp_cas                 &
531!
532     &         ,ts_prof_cas,ps_prof_cas,ps_forc_prof_cas,plev_prof_cas,pforc_prof_cas&
533     &         ,t_prof_cas,th_prof_cas,thl_prof_cas                                  &
534     &         ,qt_prof_cas,qv_prof_cas,ql_prof_cas,qi_prof_cas                      &
535     &         ,rt_prof_cas,rv_prof_cas,rl_prof_cas,ri_prof_cas,rh_prof_cas          &
536     &         ,u_prof_cas,v_prof_cas,w_prof_cas,omega_prof_cas                      &
537     &         ,ug_prof_cas,vg_prof_cas                                              &
538     &         ,temp_nudg_prof_cas,th_nudg_prof_cas,thl_nudg_prof_cas                &
539     &         ,qt_nudg_prof_cas,qv_nudg_prof_cas                                    &
540     &         ,rt_nudg_prof_cas,rv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas    &
541     &         ,uadv_prof_cas,vadv_prof_cas,tadv_prof_cas,thadv_prof_cas,thladv_prof_cas&
542     &         ,qtadv_prof_cas,qvadv_prof_cas,rtadv_prof_cas,rvadv_prof_cas          &
543     &         ,trad_prof_cas,thrad_prof_cas,thlrad_prof_cas                         &
544     &         ,tke_prof_cas,lat_prof_cas,sens_prof_cas,ustar_prof_cas               &
545     &         ,wpthetap_prof_cas,wpqtp_prof_cas,wpqvp_prof_cas,wprtp_prof_cas,wprvp_prof_cas)
546         
547
548        implicit none
549
550!---------------------------------------------------------------------------------------
551! Time interpolation of a 2D field to the timestep corresponding to day
552!
553! day: current julian day (e.g. 717538.2)
554! day1: first day of the simulation
555! nt_cas: total nb of data in the forcing
556! pdt_cas: total time interval (in sec) between 2 forcing data
557!---------------------------------------------------------------------------------------
558
559#include "compar1d_std.h"
560#include "date_cas.h"
561
562! inputs:
563        integer annee_ref
564        integer nt_cas,nlev_cas
565        real day, day1,day_cas
566        real ts_cas(nt_cas),ps_cas(nt_cas),ps_forc_cas(nt_cas)
567        real plev_cas(nlev_cas,nt_cas),ppforc_cas(nt_cas)
568        real t_cas(nlev_cas,nt_cas),th_cas(nlev_cas,nt_cas),thl_cas(nlev_cas,nt_cas)
569        real qt_cas(nlev_cas,nt_cas),qv_cas(nlev_cas,nt_cas),ql_cas(nlev_cas,nt_cas),qi_cas(nlev_cas,nt_cas)
570        real rt_cas(nlev_cas,nt_cas),rv_cas(nlev_cas,nt_cas),rl_cas(nlev_cas,nt_cas),ri_cas(nlev_cas,nt_cas)
571        real rh_cas(nlev_cas,nt_cas),u_cas(nlev_cas,nt_cas),v_cas(nlev_cas,nt_cas)
572        real w_cas(nlev_cas,nt_cas),omega_cas(nlev_cas,nt_cas)
573        real ug_cas(nlev_cas,nt_cas),vg_cas(nlev_cas,nt_cas)
574        real temp_nudg_cas(nlev_cas,nt_cas),th_nudg_cas(nlev_cas,nt_cas),thl_nudg_cas(nlev_cas,nt_cas)
575        real qt_nudg_cas(nlev_cas,nt_cas),qv_nudg_cas(nlev_cas,nt_cas)
576        real rt_nudg_cas(nlev_cas,nt_cas),rv_nudg_cas(nlev_cas,nt_cas)
577        real u_nudg_cas(nlev_cas,nt_cas),v_nudg_cas(nlev_cas,nt_cas)
578        real uadv_cas(nlev_cas,nt_cas),vadv_cas(nlev_cas,nt_cas)
579        real tadv_cas(nlev_cas,nt_cas),thadv_cas(nlev_cas,nt_cas),thladv_cas(nlev_cas,nt_cas)
580        real qtadv_cas(nlev_cas,nt_cas),qvadv_cas(nlev_cas,nt_cas)
581        real rtadv_cas(nlev_cas,nt_cas),rvadv_cas(nlev_cas,nt_cas)
582        real trad_cas(nlev_cas,nt_cas),thrad_cas(nlev_cas,nt_cas),thlrad_cas(nlev_cas,nt_cas)
583        real lat_cas(nt_cas),sens_cas(nt_cas),tke_cas(nt_cas)
584        real wpthetap_cas(nt_cas),wpqtp_cas(nt_cas),wpqvp_cas(nt_cas)
585        real ustar_cas(nt_cas),wprtp_cas(nt_cas),wprvp_cas(nt_cas)
586
587! output:
588        real plev_prof_cas(nlev_cas),pforc_prof_cas(nt_cas)
589        real t_prof_cas(nlev_cas),th_prof_cas(nlev_cas),thl_prof_cas(nlev_cas)
590        real qt_prof_cas(nlev_cas),qv_prof_cas(nlev_cas),ql_prof_cas(nlev_cas),qi_prof_cas(nlev_cas)
591        real rt_prof_cas(nlev_cas),rv_prof_cas(nlev_cas),rl_prof_cas(nlev_cas),ri_prof_cas(nlev_cas)
592        real rh_prof_cas(nlev_cas),u_prof_cas(nlev_cas),v_prof_cas(nlev_cas)
593        real w_prof_cas(nlev_cas),omega_prof_cas(nlev_cas)
594        real ug_prof_cas(nlev_cas),vg_prof_cas(nlev_cas)
595        real temp_nudg_prof_cas(nlev_cas),th_nudg_prof_cas(nlev_cas),thl_nudg_prof_cas(nlev_cas)
596        real qt_nudg_prof_cas(nlev_cas),qv_nudg_prof_cas(nlev_cas)
597        real rt_nudg_prof_cas(nlev_cas),rv_nudg_prof_cas(nlev_cas)
598        real u_nudg_prof_cas(nlev_cas),v_nudg_prof_cas(nlev_cas)
599        real uadv_prof_cas(nlev_cas),vadv_prof_cas(nlev_cas)
600        real tadv_prof_cas(nlev_cas),thadv_prof_cas(nlev_cas),thladv_prof_cas(nlev_cas)
601        real qtadv_prof_cas(nlev_cas),qvadv_prof_cas(nlev_cas)
602        real rtadv_prof_cas(nlev_cas),rvadv_prof_cas(nlev_cas)
603        real trad_prof_cas(nlev_cas),thrad_prof_cas(nlev_cas),thlrad_prof_cas(nlev_cas)
604        real lat_prof_cas,sens_prof_cas,tke_prof_cas
605        real ts_prof_cas,ps_prof_cas,ps_forc_prof_cas
606        real wpthetap_prof_cas,wpqtp_prof_cas,wpqvp_prof_cas
607        real ustar_prof_cas,wprtp_prof_cas,wprvp_prof_cas
608
609! local:
610        integer it_cas1, it_cas2,k
611        real timeit,time_cas1,time_cas2,frac
612
613        print*,'Check time',day1,day_ju_ini_cas,day_deb+1,pdt_cas
614!       do k=1,nlev_cas
615!       print*,'debut de interp_case_time, plev_cas=',k,plev_cas(k,1)
616!       enddo
617
618! On teste si la date du cas AMMA est correcte.
619! C est pour memoire car en fait les fichiers .def
620! sont censes etre corrects.
621! A supprimer a terme (MPL 20150623)
622!     if ((forcing_type.eq.10).and.(1.eq.0)) then
623! Check that initial day of the simulation consistent with AMMA case:
624!      if (annee_ref.ne.2006) then
625!       print*,'Pour AMMA, annee_ref doit etre 2006'
626!       print*,'Changer annee_ref dans run.def'
627!       stop
628!      endif
629!      if (annee_ref.eq.2006 .and. day1.lt.day_cas) then
630!       print*,'AMMA a debute le 10 juillet 2006',day1,day_cas
631!       print*,'Changer dayref dans run.def'
632!       stop
633!      endif
634!      if (annee_ref.eq.2006 .and. day1.gt.day_cas+1) then
635!       print*,'AMMA a fini le 11 juillet'
636!       print*,'Changer dayref ou nday dans run.def'
637!       stop
638!      endif
639!      endif
640
641! Determine timestep relative to the 1st day:
642!       timeit=(day-day1)*86400.
643!       if (annee_ref.eq.1992) then
644!        timeit=(day-day_cas)*86400.
645!       else
646!        timeit=(day+61.-1.)*86400. ! 61 days between Nov01 and Dec31 1992
647!       endif
648      timeit=(day-day_ju_ini_cas)*86400
649      print *,'day=',day
650      print *,'day_ju_ini_cas=',day_ju_ini_cas
651      print *,'pdt_cas=',pdt_cas
652      print *,'timeit=',timeit
653      print *,'nt_cas=',nt_cas
654
655! Determine the closest observation times:
656!       it_cas1=INT(timeit/pdt_cas)+1
657!       it_cas2=it_cas1 + 1
658!       time_cas1=(it_cas1-1)*pdt_cas
659!       time_cas2=(it_cas2-1)*pdt_cas
660
661       it_cas1=INT(timeit/pdt_cas)+1
662       IF (it_cas1 .EQ. nt_cas) THEN
663       it_cas2=it_cas1
664       ELSE
665       it_cas2=it_cas1 + 1
666       ENDIF
667       time_cas1=(it_cas1-1)*pdt_cas
668       time_cas2=(it_cas2-1)*pdt_cas
669!     print *,'timeit,pdt_cas,nt_cas=',timeit,pdt_cas,nt_cas
670!     print *,'it_cas1,it_cas2,time_cas1,time_cas2=',it_cas1,it_cas2,time_cas1,time_cas2
671
672       if (it_cas1 .gt. nt_cas) then
673        write(*,*) 'PB-stop: day, day_ju_ini_cas,it_cas1, it_cas2, timeit: '            &
674     &        ,day,day_ju_ini_cas,it_cas1,it_cas2,timeit
675        stop
676       endif
677
678! time interpolation:
679       IF (it_cas1 .EQ. it_cas2) THEN
680          frac=0.
681       ELSE
682          frac=(time_cas2-timeit)/(time_cas2-time_cas1)
683          frac=max(frac,0.0)
684       ENDIF
685
686       lat_prof_cas = lat_cas(it_cas2)                                   &
687     &          -frac*(lat_cas(it_cas2)-lat_cas(it_cas1))
688       sens_prof_cas = sens_cas(it_cas2)                                 &
689     &          -frac*(sens_cas(it_cas2)-sens_cas(it_cas1))
690       tke_prof_cas = tke_cas(it_cas2)                                   &
691     &          -frac*(tke_cas(it_cas2)-tke_cas(it_cas1))
692       ts_prof_cas = ts_cas(it_cas2)                                     &
693     &          -frac*(ts_cas(it_cas2)-ts_cas(it_cas1))
694       ps_prof_cas = ps_cas(it_cas2)                                     &
695     &          -frac*(ps_cas(it_cas2)-ps_cas(it_cas1))
696       ps_forc_prof_cas = ps_forc_cas(it_cas2)                           &
697     &          -frac*(ps_forc_cas(it_cas2)-ps_forc_cas(it_cas1))
698       ustar_prof_cas = ustar_cas(it_cas2)                               &
699     &          -frac*(ustar_cas(it_cas2)-ustar_cas(it_cas1))
700       wpthetap_prof_cas = wpthetap_cas(it_cas2)                               &
701     &          -frac*(wpthetap_cas(it_cas2)-wpthetap_cas(it_cas1))
702       wpqtp_prof_cas = wpqtp_cas(it_cas2)                               &
703     &          -frac*(wpqtp_cas(it_cas2)-wpqtp_cas(it_cas1))
704       wpqvp_prof_cas = wpqvp_cas(it_cas2)                               &
705     &          -frac*(wpqvp_cas(it_cas2)-wpqvp_cas(it_cas1))
706       wprtp_prof_cas = wprtp_cas(it_cas2)                               &
707     &          -frac*(wprtp_cas(it_cas2)-wprtp_cas(it_cas1))
708       wprvp_prof_cas = wprvp_cas(it_cas2)                               &
709     &          -frac*(wprvp_cas(it_cas2)-wprvp_cas(it_cas1))
710
711       do k=1,nlev_cas
712        plev_prof_cas(k) = plev_cas(k,it_cas2)                           &     
713     &          -frac*(plev_cas(k,it_cas2)-plev_cas(k,it_cas1))
714        t_prof_cas(k) = t_cas(k,it_cas2)                                 &       
715     &          -frac*(t_cas(k,it_cas2)-t_cas(k,it_cas1))
716        !print *,'k,frac,plev_cas1,plev_cas2=',k,frac,plev_cas(k,it_cas1),plev_cas(k,it_cas2)
717        th_prof_cas(k) = th_cas(k,it_cas2)                         &                     
718     &          -frac*(th_cas(k,it_cas2)-th_cas(k,it_cas1))
719        thl_prof_cas(k) = thl_cas(k,it_cas2)                             &             
720     &          -frac*(thl_cas(k,it_cas2)-thl_cas(k,it_cas1))
721        qt_prof_cas(k) = qt_cas(k,it_cas2)                               &
722     &          -frac*(qt_cas(k,it_cas2)-qt_cas(k,it_cas1))
723        qv_prof_cas(k) = qv_cas(k,it_cas2)                               &
724     &          -frac*(qv_cas(k,it_cas2)-qv_cas(k,it_cas1))
725        ql_prof_cas(k) = ql_cas(k,it_cas2)                               &
726     &          -frac*(ql_cas(k,it_cas2)-ql_cas(k,it_cas1))
727        qi_prof_cas(k) = qi_cas(k,it_cas2)                               &
728     &          -frac*(qi_cas(k,it_cas2)-qi_cas(k,it_cas1))
729        rt_prof_cas(k) = rt_cas(k,it_cas2)                               &
730     &          -frac*(rt_cas(k,it_cas2)-rt_cas(k,it_cas1))
731        rv_prof_cas(k) = rv_cas(k,it_cas2)                               &
732     &          -frac*(rv_cas(k,it_cas2)-rv_cas(k,it_cas1))
733        rl_prof_cas(k) = rl_cas(k,it_cas2)                               &
734     &          -frac*(rl_cas(k,it_cas2)-rl_cas(k,it_cas1))
735        ri_prof_cas(k) = ri_cas(k,it_cas2)                               &
736     &          -frac*(ri_cas(k,it_cas2)-ri_cas(k,it_cas1))
737        rh_prof_cas(k) = rh_cas(k,it_cas2)                               &
738     &          -frac*(rh_cas(k,it_cas2)-rh_cas(k,it_cas1))
739        u_prof_cas(k) = u_cas(k,it_cas2)                                 &
740     &          -frac*(u_cas(k,it_cas2)-u_cas(k,it_cas1))
741        v_prof_cas(k) = v_cas(k,it_cas2)                                 &
742     &          -frac*(v_cas(k,it_cas2)-v_cas(k,it_cas1))
743        w_prof_cas(k) = w_cas(k,it_cas2)                           &
744     &          -frac*(w_cas(k,it_cas2)-w_cas(k,it_cas1))
745        omega_prof_cas(k) = omega_cas(k,it_cas2)                         &
746     &          -frac*(omega_cas(k,it_cas2)-omega_cas(k,it_cas1))
747        ug_prof_cas(k) = ug_cas(k,it_cas2)                               &
748     &          -frac*(ug_cas(k,it_cas2)-ug_cas(k,it_cas1))
749        vg_prof_cas(k) = vg_cas(k,it_cas2)                               &
750     &          -frac*(vg_cas(k,it_cas2)-vg_cas(k,it_cas1))
751        temp_nudg_prof_cas(k) = temp_nudg_cas(k,it_cas2)                    &
752     &          -frac*(temp_nudg_cas(k,it_cas2)-temp_nudg_cas(k,it_cas1))
753        th_nudg_prof_cas(k) = th_nudg_cas(k,it_cas2)                    &
754     &          -frac*(th_nudg_cas(k,it_cas2)-th_nudg_cas(k,it_cas1))
755        thl_nudg_prof_cas(k) = thl_nudg_cas(k,it_cas2)                    &
756     &          -frac*(thl_nudg_cas(k,it_cas2)-thl_nudg_cas(k,it_cas1))
757        qt_nudg_prof_cas(k) = qt_nudg_cas(k,it_cas2)                        &
758     &          -frac*(qt_nudg_cas(k,it_cas2)-qt_nudg_cas(k,it_cas1))
759        qv_nudg_prof_cas(k) = qv_nudg_cas(k,it_cas2)                        &
760     &          -frac*(qv_nudg_cas(k,it_cas2)-qv_nudg_cas(k,it_cas1))
761        rt_nudg_prof_cas(k) = rt_nudg_cas(k,it_cas2)                        &
762     &          -frac*(rt_nudg_cas(k,it_cas2)-rt_nudg_cas(k,it_cas1))
763        rv_nudg_prof_cas(k) = rv_nudg_cas(k,it_cas2)                        &
764     &          -frac*(rv_nudg_cas(k,it_cas2)-rv_nudg_cas(k,it_cas1))
765        u_nudg_prof_cas(k) = u_nudg_cas(k,it_cas2)                          &
766     &          -frac*(u_nudg_cas(k,it_cas2)-u_nudg_cas(k,it_cas1))
767        v_nudg_prof_cas(k) = v_nudg_cas(k,it_cas2)                          &
768     &          -frac*(v_nudg_cas(k,it_cas2)-v_nudg_cas(k,it_cas1))
769        uadv_prof_cas(k) = uadv_cas(k,it_cas2)                          &
770     &          -frac*(uadv_cas(k,it_cas2)-uadv_cas(k,it_cas1))
771        vadv_prof_cas(k) = vadv_cas(k,it_cas2)                          &
772     &          -frac*(vadv_cas(k,it_cas2)-vadv_cas(k,it_cas1))
773        tadv_prof_cas(k) = tadv_cas(k,it_cas2)                          &
774     &          -frac*(tadv_cas(k,it_cas2)-tadv_cas(k,it_cas1))
775        thadv_prof_cas(k) = thadv_cas(k,it_cas2)                          &
776     &          -frac*(thadv_cas(k,it_cas2)-thadv_cas(k,it_cas1))
777        thladv_prof_cas(k) = thladv_cas(k,it_cas2)                          &
778     &          -frac*(thladv_cas(k,it_cas2)-thladv_cas(k,it_cas1))
779        qtadv_prof_cas(k) = qtadv_cas(k,it_cas2)                          &
780     &          -frac*(qtadv_cas(k,it_cas2)-qtadv_cas(k,it_cas1))
781        qvadv_prof_cas(k) = qvadv_cas(k,it_cas2)                          &
782     &          -frac*(qvadv_cas(k,it_cas2)-qvadv_cas(k,it_cas1))
783        rtadv_prof_cas(k) = rtadv_cas(k,it_cas2)                          &
784     &          -frac*(rtadv_cas(k,it_cas2)-rtadv_cas(k,it_cas1))
785        rvadv_prof_cas(k) = rvadv_cas(k,it_cas2)                          &
786     &          -frac*(rvadv_cas(k,it_cas2)-rvadv_cas(k,it_cas1))
787        trad_prof_cas(k) = trad_cas(k,it_cas2)                         &
788     &          -frac*(trad_cas(k,it_cas2)-trad_cas(k,it_cas1))
789        thrad_prof_cas(k) = thrad_cas(k,it_cas2)                         &
790     &          -frac*(thrad_cas(k,it_cas2)-thrad_cas(k,it_cas1))
791        thlrad_prof_cas(k) = thlrad_cas(k,it_cas2)                         &
792     &          -frac*(thlrad_cas(k,it_cas2)-thlrad_cas(k,it_cas1))
793        enddo
794
795        return
796        END SUBROUTINE interp_case_time_std
797
798!**********************************************************************************************
799!=====================================================================
800       SUBROUTINE interp_case_vertical_std(nlev_cas                                                    &
801     &         ,plev_prof_cas,t_prof_cas,th_prof_cas,thl_prof_cas                                   &
802     &         ,qt_prof_cas,qv_prof_cas,ql_prof_cas,qi_prof_cas                                        &
803     &         ,rt_prof_cas,rv_prof_cas,rl_prof_cas,ri_prof_cas,rh_prof_cas                            &
804     &         ,u_prof_cas,v_prof_cas,w_prof_cas,omega_prof_cas                                        &
805     &         ,ug_prof_cas,vg_prof_cas                                                                &
806     &         ,temp_nudg_prof_cas,th_nudg_prof_cas,thl_nudg_prof_cas                                  &
807     &         ,qt_nudg_prof_cas,qv_nudg_prof_cas                                                      &
808     &         ,rt_nudg_prof_cas,rv_nudg_prof_cas,u_nudg_prof_cas,v_nudg_prof_cas                      &
809     &         ,uadv_prof_cas,vadv_prof_cas,tadv_prof_cas,thadv_prof_cas,thladv_prof_cas               &
810     &         ,qtadv_prof_cas,qvadv_prof_cas,rtadv_prof_cas,rvadv_prof_cas                            &
811     &         ,trad_prof_cas,thrad_prof_cas,thlrad_prof_cas                                           &
812!
813     &         ,plev_mod_cas,t_mod_cas,th_mod_cas,thl_mod_cas                                       &
814     &         ,qt_mod_cas,qv_mod_cas,ql_mod_cas,qi_mod_cas                                            &
815     &         ,rt_mod_cas,rv_mod_cas,rl_mod_cas,ri_mod_cas,rh_mod_cas                                 &
816     &         ,u_mod_cas,v_mod_cas,w_mod_cas,omega_mod_cas                                            &
817     &         ,ug_mod_cas,vg_mod_cas                                                                  &
818     &         ,temp_nudg_mod_cas,th_nudg_mod_cas,thl_nudg_mod_cas                                     &
819     &         ,qt_nudg_mod_cas,qv_nudg_mod_cas                                                        &
820     &         ,rt_nudg_mod_cas,rv_nudg_mod_cas,u_nudg_mod_cas,v_nudg_mod_cas                          &
821     &         ,uadv_mod_cas,vadv_mod_cas,tadv_mod_cas,thadv_mod_cas,thladv_mod_cas                    &
822     &         ,qtadv_mod_cas,qvadv_mod_cas,rtadv_mod_cas,rvadv_mod_cas                                &
823     &         ,trad_mod_cas,thrad_mod_cas,thlrad_mod_cas)
824 
825       implicit none
826 
827#include "YOMCST.h"
828#include "dimensions.h"
829
830!-------------------------------------------------------------------------
831! Vertical interpolation of generic case forcing data onto mod_casel levels
832!-------------------------------------------------------------------------
833 
834       integer nlevmax
835       parameter (nlevmax=41)
836       integer nlev_cas,mxcalc
837!       real play(llm), plev_prof(nlevmax)
838!       real t_prof(nlevmax),q_prof(nlevmax)
839!       real u_prof(nlevmax),v_prof(nlevmax), w_prof(nlevmax)
840!       real ht_prof(nlevmax),vt_prof(nlevmax)
841!       real hq_prof(nlevmax),vq_prof(nlevmax)
842       real plev_prof_cas(nlev_cas)
843       real t_prof_cas(nlev_cas),th_prof_cas(nlev_cas),thl_prof_cas(nlev_cas)                       
844       real qt_prof_cas(nlev_cas),qv_prof_cas(nlev_cas),ql_prof_cas(nlev_cas),qi_prof_cas(nlev_cas)     
845       real rt_prof_cas(nlev_cas),rv_prof_cas(nlev_cas),rl_prof_cas(nlev_cas),ri_prof_cas(nlev_cas)
846       real rh_prof_cas(nlev_cas)                           
847       real u_prof_cas(nlev_cas),v_prof_cas(nlev_cas),w_prof_cas(nlev_cas),omega_prof_cas(nlev_cas)     
848       real ug_prof_cas(nlev_cas),vg_prof_cas(nlev_cas)                                             
849       real temp_nudg_prof_cas(nlev_cas),th_nudg_prof_cas(nlev_cas),thl_nudg_prof_cas(nlev_cas)         
850       real qt_nudg_prof_cas(nlev_cas),qv_nudg_prof_cas(nlev_cas)
851       real rt_nudg_prof_cas(nlev_cas),rv_nudg_prof_cas(nlev_cas)
852       real u_nudg_prof_cas(nlev_cas),v_nudg_prof_cas(nlev_cas)                     
853       real uadv_prof_cas(nlev_cas),vadv_prof_cas(nlev_cas)
854       real tadv_prof_cas(nlev_cas),thadv_prof_cas(nlev_cas),thladv_prof_cas(nlev_cas)
855       real qtadv_prof_cas(nlev_cas),qvadv_prof_cas(nlev_cas)
856       real rtadv_prof_cas(nlev_cas),rvadv_prof_cas(nlev_cas)                           
857       real trad_prof_cas(nlev_cas),thrad_prof_cas(nlev_cas),thlrad_prof_cas(nlev_cas)                                           
858 
859       real play(llm),plev_mod_cas(llm),t_mod_cas(llm),th_mod_cas(llm),thl_mod_cas(llm)             
860       real qt_mod_cas(llm),qv_mod_cas(llm),ql_mod_cas(llm),qi_mod_cas(llm)                       
861       real rt_mod_cas(llm),rv_mod_cas(llm),rl_mod_cas(llm),ri_mod_cas(llm)
862       real rh_mod_cas(llm)
863       real u_mod_cas(llm),v_mod_cas(llm),w_mod_cas(llm),omega_mod_cas(llm)                             
864       real ug_mod_cas(llm),vg_mod_cas(llm)
865       real temp_nudg_mod_cas(llm),th_nudg_mod_cas(llm),thl_nudg_mod_cas(llm)                       
866       real qt_nudg_mod_cas(llm),qv_nudg_mod_cas(llm)
867       real rt_nudg_mod_cas(llm),rv_nudg_mod_cas(llm),u_nudg_mod_cas(llm),v_nudg_mod_cas(llm)
868       real uadv_mod_cas(llm),vadv_mod_cas(llm)
869       real tadv_mod_cas(llm),thadv_mod_cas(llm),thladv_mod_cas(llm)               
870       real qtadv_mod_cas(llm),qvadv_mod_cas(llm)
871       real rtadv_mod_cas(llm),rvadv_mod_cas(llm)                           
872       real trad_mod_cas(llm),thrad_mod_cas(llm),thlrad_mod_cas(llm)                                           
873 
874       integer l,k,k1,k2
875       real frac,frac1,frac2,fact
876 
877!       do l = 1, llm
878!       print *,'debut interp, play=',l,play(l)
879!       enddo
880!      do l = 1, nlev_cas
881!      print *,'debut interp, plev_prof_cas=',l,play(l),plev_prof_cas(l)
882!      enddo
883
884       do l = 1, llm
885
886        if (play(l).ge.plev_prof_cas(nlev_cas)) then
887 
888        mxcalc=l
889!        print *,'debut interp, mxcalc=',mxcalc
890         k1=0
891         k2=0
892
893         if (play(l).le.plev_prof_cas(1)) then
894
895         do k = 1, nlev_cas-1
896          if (play(l).le.plev_prof_cas(k).and. play(l).gt.plev_prof_cas(k+1)) then
897            k1=k
898            k2=k+1
899          endif
900         enddo
901
902         if (k1.eq.0 .or. k2.eq.0) then
903          write(*,*) 'PB! k1, k2 = ',k1,k2
904          write(*,*) 'l,play(l) = ',l,play(l)/100
905         do k = 1, nlev_cas-1
906          write(*,*) 'k,plev_prof_cas(k) = ',k,plev_prof_cas(k)/100
907         enddo
908         endif
909
910         frac = (plev_prof_cas(k2)-play(l))/(plev_prof_cas(k2)-plev_prof_cas(k1))
911         t_mod_cas(l)= t_prof_cas(k2) - frac*(t_prof_cas(k2)-t_prof_cas(k1))
912         th_mod_cas(l)= th_prof_cas(k2) - frac*(th_prof_cas(k2)-th_prof_cas(k1))
913         if(th_mod_cas(l).NE.0) t_mod_cas(l)= th_mod_cas(l)*(play(l)/100000.)**(RD/RCPD)
914         thl_mod_cas(l)= thl_prof_cas(k2) - frac*(thl_prof_cas(k2)-thl_prof_cas(k1))
915         qt_mod_cas(l)= qt_prof_cas(k2) - frac*(qt_prof_cas(k2)-qt_prof_cas(k1))
916         qv_mod_cas(l)= qv_prof_cas(k2) - frac*(qv_prof_cas(k2)-qv_prof_cas(k1))
917         ql_mod_cas(l)= ql_prof_cas(k2) - frac*(ql_prof_cas(k2)-ql_prof_cas(k1))
918         qi_mod_cas(l)= qi_prof_cas(k2) - frac*(qi_prof_cas(k2)-qi_prof_cas(k1))
919         rt_mod_cas(l)= rt_prof_cas(k2) - frac*(rt_prof_cas(k2)-rt_prof_cas(k1))
920         rv_mod_cas(l)= rv_prof_cas(k2) - frac*(rv_prof_cas(k2)-rv_prof_cas(k1))
921         rl_mod_cas(l)= rl_prof_cas(k2) - frac*(rl_prof_cas(k2)-rl_prof_cas(k1))
922         ri_mod_cas(l)= ri_prof_cas(k2) - frac*(ri_prof_cas(k2)-ri_prof_cas(k1))
923         rh_mod_cas(l)= rh_prof_cas(k2) - frac*(rh_prof_cas(k2)-rh_prof_cas(k1))
924         u_mod_cas(l)= u_prof_cas(k2) - frac*(u_prof_cas(k2)-u_prof_cas(k1))
925         v_mod_cas(l)= v_prof_cas(k2) - frac*(v_prof_cas(k2)-v_prof_cas(k1))
926         w_mod_cas(l)= w_prof_cas(k2) - frac*(w_prof_cas(k2)-w_prof_cas(k1))
927         omega_mod_cas(l)= omega_prof_cas(k2) - frac*(omega_prof_cas(k2)-omega_prof_cas(k1))
928         ug_mod_cas(l)= ug_prof_cas(k2) - frac*(ug_prof_cas(k2)-ug_prof_cas(k1))
929         vg_mod_cas(l)= vg_prof_cas(k2) - frac*(vg_prof_cas(k2)-vg_prof_cas(k1))
930         temp_nudg_mod_cas(l)= temp_nudg_prof_cas(k2) - frac*(temp_nudg_prof_cas(k2)-temp_nudg_prof_cas(k1))
931         th_nudg_mod_cas(l)= th_nudg_prof_cas(k2) - frac*(th_nudg_prof_cas(k2)-th_nudg_prof_cas(k1))
932         thl_nudg_mod_cas(l)= thl_nudg_prof_cas(k2) - frac*(thl_nudg_prof_cas(k2)-thl_nudg_prof_cas(k1))
933         qt_nudg_mod_cas(l)= qt_nudg_prof_cas(k2) - frac*(qt_nudg_prof_cas(k2)-qt_nudg_prof_cas(k1))
934         qv_nudg_mod_cas(l)= qv_nudg_prof_cas(k2) - frac*(qv_nudg_prof_cas(k2)-qv_nudg_prof_cas(k1))
935         rt_nudg_mod_cas(l)= rt_nudg_prof_cas(k2) - frac*(rt_nudg_prof_cas(k2)-rt_nudg_prof_cas(k1))
936         rv_nudg_mod_cas(l)= rv_nudg_prof_cas(k2) - frac*(rv_nudg_prof_cas(k2)-rv_nudg_prof_cas(k1))
937         u_nudg_mod_cas(l)= u_nudg_prof_cas(k2) - frac*(u_nudg_prof_cas(k2)-u_nudg_prof_cas(k1))
938         v_nudg_mod_cas(l)= v_nudg_prof_cas(k2) - frac*(v_nudg_prof_cas(k2)-v_nudg_prof_cas(k1))
939         uadv_mod_cas(l)= uadv_prof_cas(k2) - frac*(uadv_prof_cas(k2)-uadv_prof_cas(k1))
940         vadv_mod_cas(l)= vadv_prof_cas(k2) - frac*(vadv_prof_cas(k2)-vadv_prof_cas(k1))
941         tadv_mod_cas(l)= tadv_prof_cas(k2) - frac*(tadv_prof_cas(k2)-tadv_prof_cas(k1))
942         thadv_mod_cas(l)= thadv_prof_cas(k2) - frac*(thadv_prof_cas(k2)-thadv_prof_cas(k1))
943         thladv_mod_cas(l)= thladv_prof_cas(k2) - frac*(thladv_prof_cas(k2)-thladv_prof_cas(k1))
944         qtadv_mod_cas(l)= qtadv_prof_cas(k2) - frac*(qtadv_prof_cas(k2)-qtadv_prof_cas(k1))
945         qvadv_mod_cas(l)= qvadv_prof_cas(k2) - frac*(qvadv_prof_cas(k2)-qvadv_prof_cas(k1))
946         rtadv_mod_cas(l)= rtadv_prof_cas(k2) - frac*(rtadv_prof_cas(k2)-rtadv_prof_cas(k1))
947         rvadv_mod_cas(l)= rvadv_prof_cas(k2) - frac*(rvadv_prof_cas(k2)-rvadv_prof_cas(k1))
948         trad_mod_cas(l)= trad_prof_cas(k2) - frac*(trad_prof_cas(k2)-trad_prof_cas(k1))
949         thrad_mod_cas(l)= thrad_prof_cas(k2) - frac*(thrad_prof_cas(k2)-thrad_prof_cas(k1))
950         thlrad_mod_cas(l)= thlrad_prof_cas(k2) - frac*(thlrad_prof_cas(k2)-thlrad_prof_cas(k1))
951     
952         else !play>plev_prof_cas(1)
953
954         k1=1
955         k2=2
956         print *,'interp_vert, k1,k2=',plev_prof_cas(k1),plev_prof_cas(k2)
957         frac1 = (play(l)-plev_prof_cas(k2))/(plev_prof_cas(k1)-plev_prof_cas(k2))
958         frac2 = (play(l)-plev_prof_cas(k1))/(plev_prof_cas(k1)-plev_prof_cas(k2))
959         t_mod_cas(l)= frac1*t_prof_cas(k1) - frac2*t_prof_cas(k2)
960         th_mod_cas(l)= frac1*th_prof_cas(k1) - frac2*th_prof_cas(k2)
961         if(th_mod_cas(l).NE.0) t_mod_cas(l)= th_mod_cas(l)*(play(l)/100000.)**(RD/RCPD)
962         thl_mod_cas(l)= frac1*thl_prof_cas(k1) - frac2*thl_prof_cas(k2)
963         qt_mod_cas(l)= frac1*qt_prof_cas(k1) - frac2*qt_prof_cas(k2)
964         qv_mod_cas(l)= frac1*qv_prof_cas(k1) - frac2*qv_prof_cas(k2)
965         ql_mod_cas(l)= frac1*ql_prof_cas(k1) - frac2*ql_prof_cas(k2)
966         qi_mod_cas(l)= frac1*qi_prof_cas(k1) - frac2*qi_prof_cas(k2)
967         rt_mod_cas(l)= frac1*rt_prof_cas(k1) - frac2*rt_prof_cas(k2)
968         rv_mod_cas(l)= frac1*rv_prof_cas(k1) - frac2*rv_prof_cas(k2)
969         rl_mod_cas(l)= frac1*rl_prof_cas(k1) - frac2*rl_prof_cas(k2)
970         ri_mod_cas(l)= frac1*ri_prof_cas(k1) - frac2*ri_prof_cas(k2)
971         rh_mod_cas(l)= frac1*rh_prof_cas(k1) - frac2*rh_prof_cas(k2)
972         u_mod_cas(l)= frac1*u_prof_cas(k1) - frac2*u_prof_cas(k2)
973         v_mod_cas(l)= frac1*v_prof_cas(k1) - frac2*v_prof_cas(k2)
974         w_mod_cas(l)= frac1*w_prof_cas(k1) - frac2*w_prof_cas(k2)
975         omega_mod_cas(l)= frac1*omega_prof_cas(k1) - frac2*omega_prof_cas(k2)
976         ug_mod_cas(l)= frac1*ug_prof_cas(k1) - frac2*ug_prof_cas(k2)
977         vg_mod_cas(l)= frac1*vg_prof_cas(k1) - frac2*vg_prof_cas(k2)
978         temp_nudg_mod_cas(l)= frac1*temp_nudg_prof_cas(k1) - frac2*temp_nudg_prof_cas(k2)
979         th_nudg_mod_cas(l)= frac1*th_nudg_prof_cas(k1) - frac2*th_nudg_prof_cas(k2)
980         thl_nudg_mod_cas(l)= frac1*thl_nudg_prof_cas(k1) - frac2*thl_nudg_prof_cas(k2)
981         qt_nudg_mod_cas(l)= frac1*qt_nudg_prof_cas(k1) - frac2*qt_nudg_prof_cas(k2)
982         qv_nudg_mod_cas(l)= frac1*qv_nudg_prof_cas(k1) - frac2*qv_nudg_prof_cas(k2)
983         rt_nudg_mod_cas(l)= frac1*rt_nudg_prof_cas(k1) - frac2*rt_nudg_prof_cas(k2)
984         rv_nudg_mod_cas(l)= frac1*rv_nudg_prof_cas(k1) - frac2*rv_nudg_prof_cas(k2)
985         u_nudg_mod_cas(l)= frac1*u_nudg_prof_cas(k1) - frac2*u_nudg_prof_cas(k2)
986         v_nudg_mod_cas(l)= frac1*v_nudg_prof_cas(k1) - frac2*v_nudg_prof_cas(k2)
987         uadv_mod_cas(l)= frac1*uadv_prof_cas(k1) - frac2*uadv_prof_cas(k2)
988         vadv_mod_cas(l)= frac1*vadv_prof_cas(k1) - frac2*vadv_prof_cas(k2)
989         tadv_mod_cas(l)= frac1*tadv_prof_cas(k1) - frac2*tadv_prof_cas(k2)
990         thadv_mod_cas(l)= frac1*thadv_prof_cas(k1) - frac2*thadv_prof_cas(k2)
991         thladv_mod_cas(l)= frac1*thladv_prof_cas(k1) - frac2*thladv_prof_cas(k2)
992         qtadv_mod_cas(l)= frac1*qtadv_prof_cas(k1) - frac2*qtadv_prof_cas(k2)
993         qvadv_mod_cas(l)= frac1*qvadv_prof_cas(k1) - frac2*qvadv_prof_cas(k2)
994         rtadv_mod_cas(l)= frac1*rtadv_prof_cas(k1) - frac2*rtadv_prof_cas(k2)
995         rvadv_mod_cas(l)= frac1*rvadv_prof_cas(k1) - frac2*rvadv_prof_cas(k2)
996         trad_mod_cas(l)= frac1*trad_prof_cas(k1) - frac2*trad_prof_cas(k2)
997         thrad_mod_cas(l)= frac1*thrad_prof_cas(k1) - frac2*thrad_prof_cas(k2)
998         thlrad_mod_cas(l)= frac1*thlrad_prof_cas(k1) - frac2*thlrad_prof_cas(k2)
999
1000         endif ! play.le.plev_prof_cas(1)
1001
1002        else ! above max altitude of forcing file
1003 
1004!jyg
1005         fact=20.*(plev_prof_cas(nlev_cas)-play(l))/plev_prof_cas(nlev_cas) !jyg
1006         fact = max(fact,0.)                                           !jyg
1007         fact = exp(-fact)                                             !jyg
1008         t_mod_cas(l)= t_prof_cas(nlev_cas)                            !jyg
1009         th_mod_cas(l)= th_prof_cas(nlev_cas)                       !jyg
1010         thl_mod_cas(l)= thl_prof_cas(nlev_cas)                        !jyg
1011         qt_mod_cas(l)= qt_prof_cas(nlev_cas)*fact                     !jyg
1012         qv_mod_cas(l)= qv_prof_cas(nlev_cas)*fact                     !jyg
1013         ql_mod_cas(l)= ql_prof_cas(nlev_cas)*fact                     !jyg
1014         qi_mod_cas(l)= qi_prof_cas(nlev_cas)*fact                     !jyg
1015         rt_mod_cas(l)= rt_prof_cas(nlev_cas)*fact                     !jyg
1016         rv_mod_cas(l)= rv_prof_cas(nlev_cas)*fact                     !jyg
1017         rl_mod_cas(l)= rl_prof_cas(nlev_cas)*fact                     !jyg
1018         ri_mod_cas(l)= ri_prof_cas(nlev_cas)*fact                     !jyg
1019         rh_mod_cas(l)= rh_prof_cas(nlev_cas)*fact                     !jyg
1020         u_mod_cas(l)= u_prof_cas(nlev_cas)*fact                       !jyg
1021         v_mod_cas(l)= v_prof_cas(nlev_cas)*fact                       !jyg
1022         w_mod_cas(l)= 0.0                                             !jyg
1023         omega_mod_cas(l)= 0.0                                         !jyg
1024         ug_mod_cas(l)= ug_prof_cas(nlev_cas)                          !jyg
1025         vg_mod_cas(l)= vg_prof_cas(nlev_cas)                          !jyg
1026         temp_nudg_mod_cas(l)= temp_nudg_prof_cas(nlev_cas)            !jyg
1027         th_nudg_mod_cas(l)= th_nudg_prof_cas(nlev_cas)            !jyg
1028         thl_nudg_mod_cas(l)= thl_nudg_prof_cas(nlev_cas)            !jyg
1029         qt_nudg_mod_cas(l)= qt_nudg_prof_cas(nlev_cas)                !jyg
1030         qv_nudg_mod_cas(l)= qv_nudg_prof_cas(nlev_cas)                !jyg
1031         rt_nudg_mod_cas(l)= rt_nudg_prof_cas(nlev_cas)                !jyg
1032         rv_nudg_mod_cas(l)= rv_nudg_prof_cas(nlev_cas)                !jyg
1033         u_nudg_mod_cas(l)= u_nudg_prof_cas(nlev_cas)                  !jyg
1034         v_nudg_mod_cas(l)= v_nudg_prof_cas(nlev_cas)                  !jyg
1035         uadv_mod_cas(l)= uadv_prof_cas(nlev_cas)                  !jyg
1036         vadv_mod_cas(l)= vadv_prof_cas(nlev_cas)                  !jyg
1037         tadv_mod_cas(l)= tadv_prof_cas(nlev_cas)                  !jyg
1038         thadv_mod_cas(l)= thadv_prof_cas(nlev_cas)                  !jyg
1039         thladv_mod_cas(l)= thladv_prof_cas(nlev_cas)                  !jyg
1040         qtadv_mod_cas(l)= qtadv_prof_cas(nlev_cas)                  !jyg
1041         qvadv_mod_cas(l)= qvadv_prof_cas(nlev_cas)                  !jyg
1042         rtadv_mod_cas(l)= rtadv_prof_cas(nlev_cas)                  !jyg
1043         rvadv_mod_cas(l)= rvadv_prof_cas(nlev_cas)                  !jyg
1044         trad_mod_cas(l)= trad_prof_cas(nlev_cas)*fact               !jyg
1045         thrad_mod_cas(l)= thrad_prof_cas(nlev_cas)*fact               !jyg
1046         thlrad_mod_cas(l)= thlrad_prof_cas(nlev_cas)*fact               !jyg
1047 
1048        endif ! play
1049 
1050       enddo ! l
1051
1052          return
1053          end SUBROUTINE interp_case_vertical_std
1054!*****************************************************************************
1055
1056
1057
1058
1059
1060END MODULE mod_1D_cases_read_std
Note: See TracBrowser for help on using the repository browser.