source: LMDZ6/trunk/libf/phylmd/thermcell_down.F90 @ 4365

Last change on this file since 4365 was 4365, checked in by fhourdin, 19 months ago

Poursuite codage des subsidences des thermiques

sous clé cpp

File size: 4.2 KB
Line 
1   SUBROUTINE thermcell_updown_dq(ngrid,nlay,lmax,eup,dup,edn,ddn,masse,theta,dtheta,thetau,thetad)
2
3!--------------------------------------------------------------
4! thermcell_updown_dq: calcul du transport d'un traceur en présence
5! d'up/down drafts
6!--------------------------------------------------------------
7
8   ! Suite du travail :
9   ! Calculer les tendances d'un traceur (ici theta) en tenant compte
10   ! des up et down drafts et de la subsidence compensatoire.
11
12
13   IMPLICIT NONE
14
15! arguments
16
17   integer,intent(in) :: ngrid,nlay
18   real,intent(in), dimension(ngrid,nlay) :: eup,dup,edn,ddn,masse
19   real,intent(in), dimension(ngrid,nlay) :: theta
20   real,intent(out), dimension(ngrid,nlay) :: thetau,thetad,dtheta
21   integer, intent(out), dimension(ngrid) :: lmax
22
23   
24! Local
25
26   real, dimension(ngrid,nlay+1) :: fup,fdn
27
28   integer ig,ilay
29
30   fdn(:,:)=0.
31   thetad(:,:)=0.
32
33   ! lmax : indice tel que fu(kmax+1)=0
34   
35   ! Dans ce cas, pas besoin d'initialiser thetad(lmax) ( =theta(lmax) )
36
37   do ilay=nlay,1,-1
38      do ig=1,ngrid
39         if (ilay.le.lmax(ig)) then
40            fdn(ig,ilay)=fdn(ig,ilay+1)+edn(ig,ilay)-ddn(ig,ilay)
41            thetad(ig,ilay)=( fdn(ig,ilay+1)*thetad(ig,ilay+1) + edn(ig,ilay)*theta(ig,ilay) ) / (fdn(ig,ilay)+ddn(ig,ilay))
42         endif
43      enddo
44   enddo
45
46
47
48!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49! Initialisations :
50!------------------
51
52
53!
54 RETURN
55   END
56
57!=========================================================================
58
59   SUBROUTINE thermcell_down(ngrid,nlay,po,pt,pu,pv,pplay,pplev,  &
60     &           lmax,fup,eup,dup,theta)
61
62!--------------------------------------------------------------
63!thermcell_down: calcul des propriétés du panache descendant.
64!--------------------------------------------------------------
65
66
67   USE thermcell_ini_mod, ONLY : prt_level,RLvCp,RKAPPA,RETV
68   IMPLICIT NONE
69
70! arguments
71
72   integer,intent(in) :: ngrid,nlay
73   real,intent(in), dimension(ngrid,nlay) :: po,pt,pu,pv,pplay,eup,dup
74   real,intent(in), dimension(ngrid,nlay) :: theta
75   real,intent(in), dimension(ngrid,nlay+1) :: pplev,fup
76   integer, intent(in), dimension(ngrid) :: lmax
77
78
79   
80! Local
81
82   real, dimension(ngrid,nlay) :: edn,ddn,thetad
83   real, dimension(ngrid,nlay+1) :: fdn
84
85   integer ig,ilay
86   real dqsat_dT
87   logical mask(ngrid,nlay)
88
89   edn(:,:)=0.
90   ddn(:,:)=0.
91   fdn(:,:)=0.
92   thetad(:,:)=0.
93
94   ! lmax : indice tel que fu(kmax+1)=0
95   
96   ! Dans ce cas, pas besoin d'initialiser thetad(lmax) ( =theta(lmax) )
97
98! FH MODIFS APRES REUNIONS POUR COMMISSIONS
99! quelques erreurs de declaration
100! probleme si lmax=1 ce qui a l'air d'être le cas en début de simu. Devrait être 0 ?
101! Remarques :
102! on pourrait écrire la formule de thetad
103!    www=fdn(ig,ilay+1)/ (fdn(ig,ilay)+ddn(ig,ilay))
104!    thetad(ig,ilay)= www * thetad(ig,ilay+1) + (1.-www) * theta(ig,ilay)
105! Elle a l'avantage de bien montré la conservation, l'idée fondamentale dans le
106!   transport qu'on ne fait que sommer des "sources" au travers d'un "propagateur"
107!   (Green)
108! Elle montre aussi beaucoup plus clairement pourquoi on n'a pas à se souccier (trop)
109!   de la possible nulité du dénominateur
110
111
112   do ilay=nlay,1,-1
113      do ig=1,ngrid
114         if (ilay.le.lmax(ig).and.lmax(ig)>1) then
115            edn(ig,ilay)=0.5*dup(ig,ilay)
116            ddn(ig,ilay)=0.5*eup(ig,ilay)
117            fdn(ig,ilay)=fdn(ig,ilay+1)+edn(ig,ilay)-ddn(ig,ilay)
118            thetad(ig,ilay)=( fdn(ig,ilay+1)*thetad(ig,ilay+1) + edn(ig,ilay)*theta(ig,ilay) ) / (fdn(ig,ilay)+ddn(ig,ilay))
119         endif
120      enddo
121   enddo
122
123   ! Suite du travail :
124   ! Ecrire la conservervation de theta_l dans le panache descendant
125   ! Eventuellement faire la transformation theta_l -> theta_v
126   ! Si l'air est sec (et qu'on oublie le côté theta_v) on peut
127   ! se contenter de conserver theta.
128   !
129   ! Connaissant thetadn, on peut calculer la flotabilité.
130   ! Connaissant la flotabilité, on peut calculer w de proche en proche
131   ! On peut calculer le detrainement de facon à garder alpha*rho = cste
132   ! On en déduit l'entrainement latéral
133   ! C'est le modèle des mini-projets.
134
135!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136! Initialisations :
137!------------------
138
139
140!
141 RETURN
142   END
Note: See TracBrowser for help on using the repository browser.