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

Last change on this file since 3289 was 3158, checked in by csegonne, 13 months ago

MARS PCM
Cleaning of conduction.F, euvheat.F90, moldiff.F and molvis.F, some commented lines referring to a local calculation of layers/levels altitudes have been removed.

File size: 5.0 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
22c   arguments:
23c   ----------
24
25      integer,intent(in) :: ngrid ! number of atmospheric columns
26      integer,intent(in) :: nlayer ! number of atmospheric layers
27      REAL ptimestep
28      REAL pplay(ngrid,nlayer)
29      REAL pplev(ngrid,nlayer+1)
30      REAL zzlay(ngrid,nlayer)
31      REAL zzlev(ngrid,nlayer+1)
32      real pt(ngrid,nlayer)
33      real tsurf(ngrid)
34      REAL pvel(ngrid,nlayer)
35      REAL pdvel(ngrid,nlayer)
36      real pdteuv(ngrid,nlayer)
37      real pdtconduc(ngrid,nlayer)
38
39      real zdvelmolvis(ngrid,nlayer)
40
41c   local:
42c   ------
43
44      INTEGER l,ig, nz
45      real Akk,phitop,fac, m, tmean
46      REAL zvel(nlayer)
47      real zt(nlayer)
48      REAL alpha(nlayer)
49      REAL lambda(nlayer)
50      real muvol(nlayer)
51      REAL C(nlayer)
52      real D(nlayer)
53      real den(nlayer)
54      REAL pdvelm(nlayer)
55      REAL zlay(nlayer)
56      real zlev(nlayer+1)
57
58c   constants used locally
59c    ---------------------
60c     The atmospheric conductivity is a function of temperature T :
61c      conductivity = Akk* T**skk
62c     Molecular viscosity is related to thermal conductivity by:
63c       conduc = 0.25*(9*gamma - 5)* Cv * molvis
64c     where gamma = Cp/Cv.  For dry air.
65
66
67      REAL,PARAMETER :: skk=0.69
68
69      REAL,PARAMETER :: velsurf =0.0
70     
71      logical,save :: firstcall=.true.
72
73!$OMP THREADPRIVATE(firstcall)
74
75c-----------------------------------------------------------------------
76c   calcul des coefficients alpha et lambda
77c-----------------------------------------------------------------------
78
79      IF (firstcall) THEN
80!        write(*,*)'molvis: coeff of molecular viscosity Akk,skk,factor'
81!        write(*,*) Akk,skk,fac
82! NB: Akk and fac are undefined at firstcall
83        write(*,*)'molvis: coeff of molecular viscosity skk ', skk
84       
85        firstcall = .false.
86      END IF
87
88! Initialize phitop
89      phitop=0.0
90
91      nz=nlayer
92
93      do ig=1,ngrid
94
95        zt(1)=pt(ig,1)+(pdteuv(ig,1)+pdtconduc(ig,1))*ptimestep
96        zvel(1)=pvel(ig,1)
97        zlay(1)=zzlay(ig,1)
98        zlev(1)=zzlev(ig,1)
99
100        do l=2,nz
101          zt(l)=pt(ig,l)+(pdteuv(ig,l)+pdtconduc(ig,l))*ptimestep
102          zvel(l)=pvel(ig,l)
103          zlay(l)=zzlay(ig,l)
104          zlev(l)=zzlev(ig,l)
105        enddo
106
107          zlev(nz+1)= zlev(nz)+10000.
108
109        fac=0.25*(9.*cpnew(ig,1)-5.*(cpnew(ig,1)-rnew(ig,1)))
110        Akk=Akknew(ig,1)
111        lambda(1)=Akk*tsurf(ig)**skk/zlay(1)/fac   
112c        write(*,*) 'rnew(ig,nz)  ',ig , rnew(ig,nz)
113
114        DO l=2,nz
115          fac=(9.*cpnew(ig,l)-5.*(cpnew(ig,l)-rnew(ig,l)))/4.
116          Akk=Akknew(ig,l)
117          lambda(l)=Akk/fac*zt(l)**skk/(zlay(l)-zlay(l-1))
118        ENDDO
119   
120        DO l=1,nz-1
121          muvol(l)=pplay(ig,l)/(rnew(ig,l)*zt(l))
122          alpha(l)=(muvol(l)/ptimestep)*(zlev(l+1)-zlev(l))
123        ENDDO
124        muvol(nz)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz))
125        alpha(nz)=(muvol(nz)/ptimestep)*(zlev(nz+1)-zlev(nz))
126
127c--------------------------------------------------------------------
128c
129c     calcul des coefficients C et D
130c
131c-------------------------------------------------------------------
132
133      den(1)=alpha(1)+lambda(2)+lambda(1)
134      C(1)=lambda(1)*(velsurf-zvel(1))+lambda(2)*(zvel(2)-zvel(1))
135      C(1)=C(1)/den(1)       
136      D(1)=lambda(2)/den(1)           
137   
138      DO l = 2,nz-1
139         den(l)=alpha(l)+lambda(l+1)
140         den(l)=den(l)+lambda(l)*(1-D(l-1))
141         
142         C(l) =lambda(l+1)*(zvel(l+1)-zvel(l))
143     $        +lambda(l)*(zvel(l-1)-zvel(l)+C(l-1))   
144         C(l) =C(l)/den(l)           
145
146         D(l) =lambda(l+1) / den(l)
147      ENDDO
148
149      den(nz)=alpha(nz) + lambda(nz) * (1-D(nz-1))
150      C(nz)=C(nz-1)+zvel(nz-1)-zvel(nz)
151      C(nz)=(C(nz)*lambda(nz)+phitop) / den(nz)
152               
153c----------------------------------------------------------------------
154c
155c      calcul de la nouvelle pdvelm
156c
157c----------------------------------------------------------------------
158
159      DO l=1,nz
160         pdvelm(l)=0.
161      ENDDO
162         pdvelm(nz)=C(nz)
163      DO l=nz-1,1,-1
164         pdvelm(l)=C(l)+D(l)*pdvelm(l+1)
165      ENDDO
166c-----------------------------------------------------------------------
167c
168c     calcul de la tendance zdvelmolvis
169c
170c-----------------------------------------------------------------------
171   
172      DO l=1,nz
173        zdvelmolvis(ig,l)=pdvelm(l)/ptimestep
174      ENDDO
175
176      ENDDO             ! boucle sur ngrid
177
178      RETURN
179      END
Note: See TracBrowser for help on using the repository browser.