LMDZ
thermcell_closure.F90
Go to the documentation of this file.
1 !
2 ! $Id: thermcell_closure.F90 2311 2015-06-25 07:45:24Z emillour $
3 !
4  SUBROUTINE thermcell_closure(ngrid,nlay,r_aspect,ptimestep,rho, &
5  & zlev,lalim,alim_star,f_star,zmax,wmax,f,lev_out)
6 
7 !-------------------------------------------------------------------------
8 !thermcell_closure: fermeture, determination de f
9 !
10 ! Modification 7 septembre 2009
11 ! 1. On enleve alim_star_tot des arguments pour le recalculer et etre ainis
12 ! coherent avec l'integrale au numerateur.
13 ! 2. On ne garde qu'une version des couples wmax,zmax et wmax_sec,zmax_sec
14 ! l'idee etant que le choix se fasse a l'appel de thermcell_closure
15 ! 3. Vectorisation en mettant les boucles en l l'exterieur avec des if
16 !-------------------------------------------------------------------------
17  IMPLICIT NONE
18 
19 #include "thermcell.h"
20 INTEGER ngrid,nlay
21 INTEGER ig,k
22 REAL r_aspect,ptimestep
23 integer lev_out ! niveau pour les print
24 
25 INTEGER lalim(ngrid)
26 REAL alim_star(ngrid,nlay)
27 REAL f_star(ngrid,nlay+1)
28 REAL rho(ngrid,nlay)
29 REAL zlev(ngrid,nlay)
30 REAL zmax(ngrid)
31 REAL wmax(ngrid)
32 REAL zdenom(ngrid)
33 REAL alim_star2(ngrid)
34 REAL f(ngrid)
35 
36 REAL alim_star_tot(ngrid)
37 INTEGER llmax
38 
39 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40 !print*,'THERMCELL CLOSURE 26E'
41 
42 alim_star2(:)=0.
43 alim_star_tot(:)=0.
44 f(:)=0.
45 
46 ! Indice vertical max (max de lalim) atteint par les thermiques sur le domaine
47 llmax=1
48 do ig=1,ngrid
49  if (lalim(ig)>llmax) llmax=lalim(ig)
50 enddo
51 
52 
53 ! Calcul des integrales sur la verticale de alim_star et de
54 ! alim_star^2/(rho dz)
55 do k=1,llmax-1
56  do ig=1,ngrid
57  if (k<lalim(ig)) then
58  alim_star2(ig)=alim_star2(ig)+alim_star(ig,k)**2 &
59 & /(rho(ig,k)*(zlev(ig,k+1)-zlev(ig,k)))
60  alim_star_tot(ig)=alim_star_tot(ig)+alim_star(ig,k)
61  endif
62  enddo
63 enddo
64 
65 
66 do ig=1,ngrid
67  if (alim_star2(ig)>1.e-10) then
68  f(ig)=wmax(ig)*alim_star_tot(ig)/ &
69 & (max(500.,zmax(ig))*r_aspect*alim_star2(ig))
70  endif
71 enddo
72 
73 
74 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
75 ! TESTS POUR UNE NOUVELLE FERMETURE DANS LAQUELLE ALIM_STAR NE SERAIT
76 ! PAS NORMALISE
77 ! f(ig)=f(ig)*f_star(ig,2)/(f_star(ig,lalim(ig)))
78 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
79 
80  return
81  end
subroutine thermcell_closure(ngrid, nlay, r_aspect, ptimestep, rho, zlev, lalim, alim_star, f_star, zmax, wmax, f, lev_out)