source: trunk/LMDZ.MARS/libf/aeronomars/molvis.F @ 1242

Last change on this file since 1242 was 1226, checked in by aslmd, 11 years ago

LMDZ.MARS : Replaced comcstfi and planete includes by modules.

File size: 5.6 KB
Line 
1       SUBROUTINE molvis(ngrid,nlayer,ptimestep,
2     &            pplay,pplev,pt,pdteuv,pdtconduc
3     $           ,pvel,tsurf,zzlev,zzlay,zdvelmolvis)
4     
5      use conc_mod, only: cpnew, Akknew, rnew
6      IMPLICIT NONE
7
8c=======================================================================
9c
10c   Molecular Viscosity Diffusion
11
12c   Based on conduction.F  by N. Descamp, F. Forget 05/1999
13c
14c   modified by M. Angelats i Coll
15c
16c=======================================================================
17
18c-----------------------------------------------------------------------
19c   declarations:
20c-----------------------------------------------------------------------
21
22!#include "dimensions.h"
23!#include "dimphys.h"
24!#include "surfdat.h"
25!#include "chimiedata.h"
26!#include "conc.h"
27
28c   arguments:
29c   ----------
30
31      integer,intent(in) :: ngrid ! number of atmospheric columns
32      integer,intent(in) :: nlayer ! number of atmospheric layers
33      REAL ptimestep
34      REAL pplay(ngrid,nlayer)
35      REAL pplev(ngrid,nlayer+1)
36      REAL zzlay(ngrid,nlayer)
37      REAL zzlev(ngrid,nlayer+1)
38      real pt(ngrid,nlayer)
39      real tsurf(ngrid)
40      REAL pvel(ngrid,nlayer)
41      REAL pdvel(ngrid,nlayer)
42      real pdteuv(ngrid,nlayer)
43      real pdtconduc(ngrid,nlayer)
44
45      real zdvelmolvis(ngrid,nlayer)
46
47c   local:
48c   ------
49
50      INTEGER l,ig, nz
51      real Akk,phitop,fac, m, tmean
52      REAL zvel(nlayer)
53      real zt(nlayer)
54      REAL alpha(nlayer)
55      REAL lambda(nlayer)
56      real muvol(nlayer)
57      REAL C(nlayer)
58      real D(nlayer)
59      real den(nlayer)
60      REAL pdvelm(nlayer)
61      REAL zlay(nlayer)
62      real zlev(nlayer+1)
63
64c   constants used locally
65c    ---------------------
66c     The atmospheric conductivity is a function of temperature T :
67c      conductivity = Akk* T**skk
68c     Molecular viscosity is related to thermal conductivity by:
69c       conduc = 0.25*(9*gamma - 5)* Cv * molvis
70c     where gamma = Cp/Cv.  For dry air.
71
72
73      REAL,PARAMETER :: skk=0.69
74
75      REAL,PARAMETER :: velsurf =0.0
76     
77      logical,save :: firstcall=.true.
78
79c-----------------------------------------------------------------------
80c   calcul des coefficients alpha et lambda
81c-----------------------------------------------------------------------
82
83      IF (firstcall) THEN
84!        write(*,*)'molvis: coeff of molecular viscosity Akk,skk,factor'
85!        write(*,*) Akk,skk,fac
86! NB: Akk and fac are undefined at firstcall
87        write(*,*)'molvis: coeff of molecular viscosity skk ', skk
88       
89        firstcall = .false.
90      END IF
91
92! Initialize phitop
93      phitop=0.0
94
95      nz=nlayer
96
97      do ig=1,ngrid
98
99        zt(1)=pt(ig,1)+(pdteuv(ig,1)+pdtconduc(ig,1))*ptimestep
100        zvel(1)=pvel(ig,1)
101c        zlay(1)=-log(pplay(ig,1)/pplev(ig,1))*Rnew(ig,1)*zt(1)/g
102c        zlev(1)=0.0
103
104        zlay(1)=zzlay(ig,1)
105        zlev(1)=zzlev(ig,1)
106
107        do l=2,nz
108          zt(l)=pt(ig,l)+(pdteuv(ig,l)+pdtconduc(ig,l))*ptimestep
109          zvel(l)=pvel(ig,l)
110c          tmean=zt(l)
111c          if(zt(l).ne.zt(l-1)) tmean=(zt(l)-zt(l-1))/log(zt(l)/zt(l-1))
112c          zlay(l)= zlay(l-1)
113c     &          -log(pplay(ig,l)/pplay(ig,l-1))*Rnew(ig,l-1)*tmean/g
114c          zlev(l)= zlev(l-1)
115c     &         -log(pplev(ig,l)/pplev(ig,l-1))*Rnew(ig,l-1)*tmean/g
116        zlay(l)=zzlay(ig,l)
117        zlev(l)=zzlev(ig,l)
118        enddo
119
120c          zlev(nz+1)= zlev(nz)
121c     &         -log(max(pplev(ig,nz+1),1.e-30)/pplev(ig,nz))
122c     &          *Rnew(ig,nz)*tmean/g
123c          if(pplev(ig,nz+1).eq.0.)
124c     &       zlev(nz+1)=zlev(nz)+(zlay(nz)-zlay(nz-1))
125
126          zlev(nz+1)= zlev(nz)+10000.
127
128        fac=0.25*(9.*cpnew(ig,1)-5.*(cpnew(ig,1)-rnew(ig,1)))
129        Akk=Akknew(ig,1)
130        lambda(1)=Akk*tsurf(ig)**skk/zlay(1)/fac   
131c        write(*,*) 'rnew(ig,nz)  ',ig , rnew(ig,nz)
132
133        DO l=2,nz
134          fac=(9.*cpnew(ig,l)-5.*(cpnew(ig,l)-rnew(ig,l)))/4.
135          Akk=Akknew(ig,l)
136          lambda(l)=Akk/fac*zt(l)**skk/(zlay(l)-zlay(l-1))
137        ENDDO
138   
139        DO l=1,nz-1
140          muvol(l)=pplay(ig,l)/(rnew(ig,l)*zt(l))
141          alpha(l)=(muvol(l)/ptimestep)*(zlev(l+1)-zlev(l))
142        ENDDO
143        muvol(nz)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz))
144        alpha(nz)=(muvol(nz)/ptimestep)*(zlev(nz+1)-zlev(nz))
145
146c--------------------------------------------------------------------
147c
148c     calcul des coefficients C et D
149c
150c-------------------------------------------------------------------
151
152      den(1)=alpha(1)+lambda(2)+lambda(1)
153      C(1)=lambda(1)*(velsurf-zvel(1))+lambda(2)*(zvel(2)-zvel(1))
154      C(1)=C(1)/den(1)       
155      D(1)=lambda(2)/den(1)           
156   
157      DO l = 2,nz-1
158         den(l)=alpha(l)+lambda(l+1)
159         den(l)=den(l)+lambda(l)*(1-D(l-1))
160         
161         C(l) =lambda(l+1)*(zvel(l+1)-zvel(l))
162     $        +lambda(l)*(zvel(l-1)-zvel(l)+C(l-1))   
163         C(l) =C(l)/den(l)           
164
165         D(l) =lambda(l+1) / den(l)
166      ENDDO
167
168      den(nz)=alpha(nz) + lambda(nz) * (1-D(nz-1))
169      C(nz)=C(nz-1)+zvel(nz-1)-zvel(nz)
170      C(nz)=(C(nz)*lambda(nz)+phitop) / den(nz)
171               
172c----------------------------------------------------------------------
173c
174c      calcul de la nouvelle pdvelm
175c
176c----------------------------------------------------------------------
177
178      DO l=1,nz
179         pdvelm(l)=0.
180      ENDDO
181         pdvelm(nz)=C(nz)
182      DO l=nz-1,1,-1
183         pdvelm(l)=C(l)+D(l)*pdvelm(l+1)
184      ENDDO
185c-----------------------------------------------------------------------
186c
187c     calcul de la tendance zdvelmolvis
188c
189c-----------------------------------------------------------------------
190   
191      DO l=1,nz
192        zdvelmolvis(ig,l)=pdvelm(l)/ptimestep
193      ENDDO
194
195      ENDDO             ! boucle sur ngrid
196
197      RETURN
198      END
Note: See TracBrowser for help on using the repository browser.