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

Last change on this file since 3567 was 3466, checked in by emillour, 2 months ago

Mars PCM:
More tidying in aeronomars:

  • remove unused "inv.F" and remove "dtridgl.F" which is not used here and is a duplicate of the "dtridgl" routine in phymars/swr_toon.F
  • turn aeronomars routines to modules, for those which aren't in modules yet.

EM

File size: 5.1 KB
Line 
1      MODULE molvis_mod
2     
3      IMPLICIT NONE
4     
5      CONTAINS
6
7      SUBROUTINE molvis(ngrid,nlayer,ptimestep,
8     &            pplay,pplev,pt,pdteuv,pdtconduc
9     $           ,pvel,tsurf,zzlev,zzlay,zdvelmolvis)
10     
11      use conc_mod, only: cpnew, Akknew, rnew
12      IMPLICIT NONE
13
14c=======================================================================
15c
16c   Molecular Viscosity Diffusion
17
18c   Based on conduction.F  by N. Descamp, F. Forget 05/1999
19c
20c   modified by M. Angelats i Coll
21c
22c=======================================================================
23
24c-----------------------------------------------------------------------
25c   declarations:
26c-----------------------------------------------------------------------
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
79!$OMP THREADPRIVATE(firstcall)
80
81c-----------------------------------------------------------------------
82c   calcul des coefficients alpha et lambda
83c-----------------------------------------------------------------------
84
85      IF (firstcall) THEN
86!        write(*,*)'molvis: coeff of molecular viscosity Akk,skk,factor'
87!        write(*,*) Akk,skk,fac
88! NB: Akk and fac are undefined at firstcall
89        write(*,*)'molvis: coeff of molecular viscosity skk ', skk
90       
91        firstcall = .false.
92      END IF
93
94! Initialize phitop
95      phitop=0.0
96
97      nz=nlayer
98
99      do ig=1,ngrid
100
101        zt(1)=pt(ig,1)+(pdteuv(ig,1)+pdtconduc(ig,1))*ptimestep
102        zvel(1)=pvel(ig,1)
103        zlay(1)=zzlay(ig,1)
104        zlev(1)=zzlev(ig,1)
105
106        do l=2,nz
107          zt(l)=pt(ig,l)+(pdteuv(ig,l)+pdtconduc(ig,l))*ptimestep
108          zvel(l)=pvel(ig,l)
109          zlay(l)=zzlay(ig,l)
110          zlev(l)=zzlev(ig,l)
111        enddo
112
113          zlev(nz+1)= zlev(nz)+10000.
114
115        fac=0.25*(9.*cpnew(ig,1)-5.*(cpnew(ig,1)-rnew(ig,1)))
116        Akk=Akknew(ig,1)
117        lambda(1)=Akk*tsurf(ig)**skk/zlay(1)/fac   
118c        write(*,*) 'rnew(ig,nz)  ',ig , rnew(ig,nz)
119
120        DO l=2,nz
121          fac=(9.*cpnew(ig,l)-5.*(cpnew(ig,l)-rnew(ig,l)))/4.
122          Akk=Akknew(ig,l)
123          lambda(l)=Akk/fac*zt(l)**skk/(zlay(l)-zlay(l-1))
124        ENDDO
125   
126        DO l=1,nz-1
127          muvol(l)=pplay(ig,l)/(rnew(ig,l)*zt(l))
128          alpha(l)=(muvol(l)/ptimestep)*(zlev(l+1)-zlev(l))
129        ENDDO
130        muvol(nz)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz))
131        alpha(nz)=(muvol(nz)/ptimestep)*(zlev(nz+1)-zlev(nz))
132
133c--------------------------------------------------------------------
134c
135c     calcul des coefficients C et D
136c
137c-------------------------------------------------------------------
138
139      den(1)=alpha(1)+lambda(2)+lambda(1)
140      C(1)=lambda(1)*(velsurf-zvel(1))+lambda(2)*(zvel(2)-zvel(1))
141      C(1)=C(1)/den(1)       
142      D(1)=lambda(2)/den(1)           
143   
144      DO l = 2,nz-1
145         den(l)=alpha(l)+lambda(l+1)
146         den(l)=den(l)+lambda(l)*(1-D(l-1))
147         
148         C(l) =lambda(l+1)*(zvel(l+1)-zvel(l))
149     $        +lambda(l)*(zvel(l-1)-zvel(l)+C(l-1))   
150         C(l) =C(l)/den(l)           
151
152         D(l) =lambda(l+1) / den(l)
153      ENDDO
154
155      den(nz)=alpha(nz) + lambda(nz) * (1-D(nz-1))
156      C(nz)=C(nz-1)+zvel(nz-1)-zvel(nz)
157      C(nz)=(C(nz)*lambda(nz)+phitop) / den(nz)
158               
159c----------------------------------------------------------------------
160c
161c      calcul de la nouvelle pdvelm
162c
163c----------------------------------------------------------------------
164
165      DO l=1,nz
166         pdvelm(l)=0.
167      ENDDO
168         pdvelm(nz)=C(nz)
169      DO l=nz-1,1,-1
170         pdvelm(l)=C(l)+D(l)*pdvelm(l+1)
171      ENDDO
172c-----------------------------------------------------------------------
173c
174c     calcul de la tendance zdvelmolvis
175c
176c-----------------------------------------------------------------------
177   
178      DO l=1,nz
179        zdvelmolvis(ig,l)=pdvelm(l)/ptimestep
180      ENDDO
181
182      ENDDO             ! boucle sur ngrid
183
184      END SUBROUTINE molvis
185
186      END MODULE molvis_mod
Note: See TracBrowser for help on using the repository browser.