source: trunk/LMDZ.VENUS/libf/phyvenus/clmain_ideal.F @ 3900

Last change on this file since 3900 was 3900, checked in by emillour, 3 months ago

Venus PCM:
Turn clmain into a module; get rid of compbl.h in the
process; prettyfy and translate some comments to English.
EM

File size: 9.6 KB
Line 
1      MODULE clmain_ideal_mod
2     
3      IMPLICIT NONE
4     
5      CONTAINS
6c
7c
8      SUBROUTINE clmain_ideal(dtime,itap,
9     .                  t,u,v,
10     .                  rmu0,
11     .                  ts,
12     .                  ftsoil,
13     .                  paprs,pplay,ppk,radsol,albe,
14     .                  solsw, sollw, sollwdown, fder,
15     .                  rlon, rlat, cufi, cvfi,
16     .                  debut, lafin,
17     .                  d_t,d_u,d_v,d_ts,
18     .                  flux_t,flux_u,flux_v,cdragh,cdragm,
19     .                  dflux_t,
20     .                  zcoefh,zu1,zv1)
21
22c---------------------------------------------------------------
23c VENUS
24c Routine for a very simple idealized Planetary Boundary layer scheme:
25c  - Rayleigh friction in the lowest atmospheric layer, tau=3Ed=2.6e5s
26c  - Kedd=0.15 m^2/s
27
28c S Lebonnois, 10/11/08
29c---------------------------------------------------------------
30
31      use dimphy, only: klon, klev
32      use soil_mod, only: nsoilmx
33      use clmain_mod, only: clvent
34
35      IMPLICIT none
36c======================================================================
37c
38      REAL,INTENT(IN) :: dtime ! physics time step (s)
39      integer,intent(in) :: itap ! physics time step counter
40      REAL,INTENT(IN) :: t(klon,klev) ! atmospheric temperature (K)
41      REAL,INTENT(IN) :: u(klon,klev) ! zonal wind (m/s)
42      REAL,INTENT(IN) :: v(klon,klev) ! meridional wind (m/s)
43      REAL,INTENT(IN) :: paprs(klon,klev+1) ! pressure at layer boundaries (Pa)
44      REAL,INTENT(IN) :: pplay(klon,klev) ! pressure at mid-layer (Pa)
45      REAL,INTENT(IN) :: radsol(klon) ! Net radiative flux (positive downwards) in W/m2
46! ADAPTATION GCM FOR CP(T)
47      real,intent(in) :: ppk(klon,klev)
48      real,intent(in) :: rlon(klon) ! longitudes (deg)
49      real,intent(in) :: rlat(klon) ! latitudes (deg)
50      real,intent(in) :: cufi(klon) ! mesh resolution (m)
51      real,intent(in) :: cvfi(klon) ! mesh resolution (m)
52      REAL,INTENT(OUT) :: d_t(klon, klev) ! temperature increment (K)
53      REAL,INTENT(OUT) :: d_u(klon, klev) ! zonal wind increment (m/s)
54      REAL,INTENT(OUT) :: d_v(klon, klev) ! meridional wind increment (m/s)
55      REAL,INTENT(OUT) :: flux_t(klon,klev) ! latent heat flux (CpT) J/m**2/s (W/m**2)
56                                            ! (positive when downwards)
57      REAL,INTENT(OUT) :: dflux_t(klon) ! derivative of sensible heat flux
58
59      REAL,INTENT(OUT) :: flux_u(klon,klev) ! zonal wind stress (kg m/s)/(m**2 s) or Pa
60      REAL,INTENT(OUT) :: flux_v(klon,klev) ! meridional wind stress (kg m/s)/(m**2 s) or Pa
61      REAL,INTENT(OUT) :: cdragh(klon)
62      REAL,INTENt(OUT) :: cdragm(klon)
63      real,intent(in) :: rmu0(klon)         ! cosine of solar zenithal angle
64      LOGICAL,INTENT(IN) :: debut ! .true. if first call to physics
65      LOGICAL,INTENT(IN) :: lafin ! .true. if last call to physics
66c
67      REAL,INTENT(IN) :: ts(klon) ! surface temperature (K)
68      REAL,INTENT(OUT) :: d_ts(klon) ! surface temperature increment (K)
69      REAL,INTENT(INOUT) :: albe(klon) ! albedo of the surface
70C
71      REAL,INTENT(IN) :: fder(klon)
72      REAL,INTENT(IN) :: sollw(klon), solsw(klon), sollwdown(klon)
73cAA
74      REAL,INTENT(OUT) :: zcoefh(klon,klev)
75      REAL,INTENT(OUT) :: zu1(klon) ! zonal wind in 1st layer (m/s)
76      REAL,INTENT(OUT) :: zv1(klon) ! meridional wind in 1st layer (m/s)
77cAA
78c$$$ PB ajout pour soil
79      REAL,INTENT(INOUT) :: ftsoil(klon,nsoilmx) ! subsurface temperatures (K)
80
81      REAL ytsoil(klon,nsoilmx)
82c======================================================================
83      REAL yts(klon)
84      REAL yalb(klon)
85      REAL yu1(klon), yv1(klon)
86      real ysollw(klon), ysolsw(klon), ysollwdown(klon)
87      real yfder(klon), ytaux(klon), ytauy(klon)
88      REAL yrads(klon)
89C
90      REAL y_d_ts(klon)
91      REAL y_d_t(klon, klev)
92      REAL y_d_u(klon, klev), y_d_v(klon, klev)
93      REAL y_flux_t(klon,klev)
94      REAL y_flux_u(klon,klev), y_flux_v(klon,klev)
95      REAL y_dflux_t(klon)
96      REAL ycoefh(klon,klev), ycoefm(klon,klev)
97      REAL yu(klon,klev), yv(klon,klev)
98      REAL yt(klon,klev)
99      REAL ypaprs(klon,klev+1), ypplay(klon,klev), ydelp(klon,klev)
100c
101      REAL ycoefm0(klon,klev), ycoefh0(klon,klev)
102
103      real yzlay(klon,klev),yzlev(klon,klev+1)
104      real yteta(klon,klev)
105      real ykmm(klon,klev+1),ykmn(klon,klev+1)
106      real ykmq(klon,klev+1)
107      real yustar(klon),y_cd_m(klon),y_cd_h(klon)
108c
109      REAL u1lay(klon), v1lay(klon)
110      REAL delp(klon,klev)
111      INTEGER i, k
112      INTEGER ni(klon), knon, j
113     
114c======================================================================
115      REAL zx_alf1, zx_alf2 ! ambient values used for extrapolation
116c======================================================================
117c
118      REAL zt, zdelta, zcor
119C
120      real taurelax
121
122c=========================================================
123c DEBUT
124c=========================================================
125         
126      DO k = 1, klev   ! thickness of atmospheric layers
127      DO i = 1, klon
128         delp(i,k) = paprs(i,k)-paprs(i,k+1)
129      ENDDO
130      ENDDO
131      DO i = 1, klon  ! wind in the first layer
132ccc         zx_alf1 = (paprs(i,1)-pplay(i,2))/(pplay(i,1)-pplay(i,2))
133         zx_alf1 = 1.0
134         zx_alf2 = 1.0 - zx_alf1
135         u1lay(i) = u(i,1)*zx_alf1 + u(i,2)*zx_alf2
136         v1lay(i) = v(i,1)*zx_alf1 + v(i,2)*zx_alf2
137      ENDDO
138c
139c initialisation:
140c
141      DO i = 1, klon
142         cdragh(i) = 0.0
143         cdragm(i) = 0.0
144         dflux_t(i) = 0.0
145         zu1(i) = 0.0
146         zv1(i) = 0.0
147      ENDDO
148      yts = 0.0
149      yalb = 0.0
150      yfder = 0.0
151      ytaux = 0.0
152      ytauy = 0.0
153      ysolsw = 0.0
154      ysollw = 0.0
155      ysollwdown = 0.0
156      yu1 = 0.0
157      yv1 = 0.0
158      yrads = 0.0
159      ypaprs = 0.0
160      ypplay = 0.0
161      ydelp = 0.0
162      yu = 0.0
163      yv = 0.0
164      yt = 0.0
165      y_flux_u = 0.0
166      y_flux_v = 0.0
167      y_d_ts = 0.0
168      y_d_t = 0.0
169      y_d_u = 0.0
170      y_d_v = 0.0
171      y_flux_t = 0.0
172C$$ PB
173      y_dflux_t = 0.0
174      ytsoil = 999999.
175      DO i = 1, klon
176         d_ts(i) = 0.0
177      ENDDO
178      flux_t = 0.
179      flux_u = 0.
180      flux_v = 0.
181      DO k = 1, klev
182      DO i = 1, klon
183         d_t(i,k) = 0.0
184         d_u(i,k) = 0.0
185         d_v(i,k) = 0.0
186         zcoefh(i,k) = 0.0
187      ENDDO
188      ENDDO
189c
190c identify indexes:
191      DO j = 1, klon
192         ni(j) = j
193      ENDDO
194      knon = klon
195
196      DO j = 1, knon
197      i = ni(j)
198        yts(j) = ts(i)
199        yalb(j) = albe(i)
200        yfder(j) = fder(i)
201        ytaux(j) = flux_u(i,1)
202        ytauy(j) = flux_v(i,1)
203        ysolsw(j) = solsw(i)
204        ysollw(j) = sollw(i)
205        ysollwdown(j) = sollwdown(i)
206        yu1(j) = u1lay(i)
207        yv1(j) = v1lay(i)
208        yrads(j) =  ysolsw(j)+ ysollw(j)
209        ypaprs(j,klev+1) = paprs(i,klev+1)
210      END DO
211C
212c$$$ PB ajour pour soil
213      DO k = 1, nsoilmx
214        DO j = 1, knon
215          i = ni(j)
216          ytsoil(j,k) = ftsoil(i,k)
217        END DO 
218      END DO
219      DO k = 1, klev
220      DO j = 1, knon
221      i = ni(j)
222        ypaprs(j,k) = paprs(i,k)
223        ypplay(j,k) = pplay(i,k)
224        ydelp(j,k) = delp(i,k)
225        yu(j,k) = u(i,k)
226        yv(j,k) = v(i,k)
227        yt(j,k) = t(i,k)
228      ENDDO
229      ENDDO
230c
231c
232cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
233c RAYLEIGH FRICTION (implicit scheme) in the first layer
234c Ref: PhD of C. Lee Oxford 2006
235cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
236
237      taurelax = 2.6e5
238      yu1 = yu1 / (1+dtime/taurelax)
239      yv1 = yv1 / (1+dtime/taurelax)
240      yu(:,1) = yu(:,1) / (1+dtime/taurelax)
241      yv(:,1) = yv(:,1) / (1+dtime/taurelax)
242
243cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
244c Coefficient for vertical diffusion
245cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
246
247      ycoefm = 0.15
248
249cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
250c compute diffusion for winds "u" and "v"
251cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
252
253      CALL clvent(knon,dtime,yu1,yv1,ycoefm,yt,yu,ypaprs,ypplay,ydelp,
254     s            y_d_u,y_flux_u)
255      CALL clvent(knon,dtime,yu1,yv1,ycoefm,yt,yv,ypaprs,ypplay,ydelp,
256     s            y_d_v,y_flux_v)
257
258c for the coupling
259      ytaux = y_flux_u(:,1)
260      ytauy = y_flux_v(:,1)
261
262cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
263c no diffusion for "q" and "h"
264cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
265
266      ycoefh = 0.
267
268c=========================
269c END: compute tendencies
270c=========================
271
272      DO j = 1, knon
273         i = ni(j)
274         d_ts(i) = y_d_ts(j)
275         albe(i) = yalb(j)
276         cdragh(i) = cdragh(i) + ycoefh(j,1)
277         cdragm(i) = cdragm(i) + ycoefm(j,1)
278         dflux_t(i) = dflux_t(i) + y_dflux_t(j)
279         zu1(i) = zu1(i) + yu1(j)
280         zv1(i) = zv1(i) + yv1(j)
281      END DO
282
283c$$$ PB ajout pour soil
284      DO k = 1, nsoilmx
285        DO j = 1, knon
286         i = ni(j)
287         ftsoil(i, k) = ytsoil(j,k)
288        ENDDO
289      END DO
290     
291      DO k = 1, klev
292        DO j = 1, knon
293         i = ni(j)
294         flux_t(i,k) = y_flux_t(j,k)
295         flux_u(i,k) = y_flux_u(j,k)
296         flux_v(i,k) = y_flux_v(j,k)
297         d_t(i,k) = d_t(i,k) + y_d_t(j,k)
298         d_u(i,k) = d_u(i,k) + y_d_u(j,k)
299         d_v(i,k) = d_v(i,k) + y_d_v(j,k)
300         zcoefh(i,k) = zcoefh(i,k) + ycoefh(j,k)
301        ENDDO
302      ENDDO
303
304c --------------------
305c TEST!!!!! PAS DE MELANGE PAR TURBULENCE !!!
306c       d_u = 0.
307c       d_v = 0.
308c       flux_u = 0.
309c       flux_v = 0.
310c --------------------
311
312c     print*,"y_d_t apres clqh=",y_d_t(klon/2,:)
313
314      END SUBROUTINE clmain_ideal
315
316      END MODULE clmain_ideal_mod
Note: See TracBrowser for help on using the repository browser.