My Project
 All Classes Files Functions Variables Macros
thermcell_closure.F90
Go to the documentation of this file.
1 !
2 ! $Header$
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 "iniprint.h"
20 #include "thermcell.h"
21 INTEGER ngrid,nlay
22 INTEGER ig,k
23 REAL r_aspect,ptimestep
24 integer lev_out ! niveau pour les print
25 
26 INTEGER lalim(ngrid)
27 REAL alim_star(ngrid,nlay)
28 REAL f_star(ngrid,nlay+1)
29 REAL rho(ngrid,nlay)
30 REAL zlev(ngrid,nlay)
31 REAL zmax(ngrid)
32 REAL wmax(ngrid)
33 REAL zdenom(ngrid)
34 REAL alim_star2(ngrid)
35 REAL f(ngrid)
36 
37 REAL alim_star_tot(ngrid)
38 INTEGER llmax
39 
40 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41 !print*,'THERMCELL CLOSURE 26E'
42 
43 alim_star2(:)=0.
44 alim_star_tot(:)=0.
45 f(:)=0.
46 
47 ! Indice vertical max (max de lalim) atteint par les thermiques sur le domaine
48 llmax=1
49 do ig=1,ngrid
50  if (lalim(ig)>llmax) llmax=lalim(ig)
51 enddo
52 
53 
54 ! Calcul des integrales sur la verticale de alim_star et de
55 ! alim_star^2/(rho dz)
56 do k=1,llmax-1
57  do ig=1,ngrid
58  if (k<lalim(ig)) then
59  alim_star2(ig)=alim_star2(ig)+alim_star(ig,k)**2 &
60 & /(rho(ig,k)*(zlev(ig,k+1)-zlev(ig,k)))
61  alim_star_tot(ig)=alim_star_tot(ig)+alim_star(ig,k)
62  endif
63  enddo
64 enddo
65 
66 
67 do ig=1,ngrid
68  if (alim_star2(ig)>1.e-10) then
69  f(ig)=wmax(ig)*alim_star_tot(ig)/ &
70 & (max(500.,zmax(ig))*r_aspect*alim_star2(ig))
71  endif
72 enddo
73 
74 
75 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
76 ! TESTS POUR UNE NOUVELLE FERMETURE DANS LAQUELLE ALIM_STAR NE SERAIT
77 ! PAS NORMALISE
78 ! f(ig)=f(ig)*f_star(ig,2)/(f_star(ig,lalim(ig)))
79 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
80 
81  return
82  end