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 | |
---|
8 | c======================================================================= |
---|
9 | c |
---|
10 | c Molecular Viscosity Diffusion |
---|
11 | c |
---|
12 | c Based on conduction.F by N. Descamp, F. Forget 05/1999 |
---|
13 | c |
---|
14 | c modified by M. Angelats i Coll |
---|
15 | c |
---|
16 | c======================================================================= |
---|
17 | |
---|
18 | c----------------------------------------------------------------------- |
---|
19 | c declarations: |
---|
20 | c----------------------------------------------------------------------- |
---|
21 | |
---|
22 | c arguments: |
---|
23 | c ---------- |
---|
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 | |
---|
41 | c local: |
---|
42 | c ------ |
---|
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 | |
---|
58 | c constants used locally |
---|
59 | c --------------------- |
---|
60 | c The atmospheric conductivity is a function of temperature T : |
---|
61 | c conductivity = Akk* T**skk |
---|
62 | c Molecular viscosity is related to thermal conductivity by: |
---|
63 | c conduc = 0.25*(9*gamma - 5)* Cv * molvis |
---|
64 | c 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 | |
---|
75 | c----------------------------------------------------------------------- |
---|
76 | c calcul des coefficients alpha et lambda |
---|
77 | c----------------------------------------------------------------------- |
---|
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 | c zlay(1)=-log(pplay(ig,1)/pplev(ig,1))*Rnew(ig,1)*zt(1)/g |
---|
98 | c zlev(1)=0.0 |
---|
99 | |
---|
100 | zlay(1)=zzlay(ig,1) |
---|
101 | zlev(1)=zzlev(ig,1) |
---|
102 | |
---|
103 | do l=2,nz |
---|
104 | zt(l)=pt(ig,l)+(pdteuv(ig,l)+pdtconduc(ig,l))*ptimestep |
---|
105 | zvel(l)=pvel(ig,l) |
---|
106 | c tmean=zt(l) |
---|
107 | c if(zt(l).ne.zt(l-1)) tmean=(zt(l)-zt(l-1))/log(zt(l)/zt(l-1)) |
---|
108 | c zlay(l)= zlay(l-1) |
---|
109 | c & -log(pplay(ig,l)/pplay(ig,l-1))*Rnew(ig,l-1)*tmean/g |
---|
110 | c zlev(l)= zlev(l-1) |
---|
111 | c & -log(pplev(ig,l)/pplev(ig,l-1))*Rnew(ig,l-1)*tmean/g |
---|
112 | zlay(l)=zzlay(ig,l) |
---|
113 | zlev(l)=zzlev(ig,l) |
---|
114 | enddo |
---|
115 | |
---|
116 | c zlev(nz+1)= zlev(nz) |
---|
117 | c & -log(max(pplev(ig,nz+1),1.e-30)/pplev(ig,nz)) |
---|
118 | c & *Rnew(ig,nz)*tmean/g |
---|
119 | c if(pplev(ig,nz+1).eq.0.) |
---|
120 | c & zlev(nz+1)=zlev(nz)+(zlay(nz)-zlay(nz-1)) |
---|
121 | |
---|
122 | zlev(nz+1)= zlev(nz)+10000. |
---|
123 | |
---|
124 | fac=0.25*(9.*cpnew(ig,1)-5.*(cpnew(ig,1)-rnew(ig,1))) |
---|
125 | Akk=Akknew(ig,1) |
---|
126 | lambda(1)=Akk*tsurf(ig)**skk/zlay(1)/fac |
---|
127 | c write(*,*) 'rnew(ig,nz) ',ig , rnew(ig,nz) |
---|
128 | |
---|
129 | DO l=2,nz |
---|
130 | fac=(9.*cpnew(ig,l)-5.*(cpnew(ig,l)-rnew(ig,l)))/4. |
---|
131 | Akk=Akknew(ig,l) |
---|
132 | lambda(l)=Akk/fac*zt(l)**skk/(zlay(l)-zlay(l-1)) |
---|
133 | ENDDO |
---|
134 | |
---|
135 | DO l=1,nz-1 |
---|
136 | muvol(l)=pplay(ig,l)/(rnew(ig,l)*zt(l)) |
---|
137 | alpha(l)=(muvol(l)/ptimestep)*(zlev(l+1)-zlev(l)) |
---|
138 | ENDDO |
---|
139 | muvol(nz)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz)) |
---|
140 | alpha(nz)=(muvol(nz)/ptimestep)*(zlev(nz+1)-zlev(nz)) |
---|
141 | |
---|
142 | c-------------------------------------------------------------------- |
---|
143 | c |
---|
144 | c calcul des coefficients C et D |
---|
145 | c |
---|
146 | c------------------------------------------------------------------- |
---|
147 | |
---|
148 | den(1)=alpha(1)+lambda(2)+lambda(1) |
---|
149 | C(1)=lambda(1)*(velsurf-zvel(1))+lambda(2)*(zvel(2)-zvel(1)) |
---|
150 | C(1)=C(1)/den(1) |
---|
151 | D(1)=lambda(2)/den(1) |
---|
152 | |
---|
153 | DO l = 2,nz-1 |
---|
154 | den(l)=alpha(l)+lambda(l+1) |
---|
155 | den(l)=den(l)+lambda(l)*(1-D(l-1)) |
---|
156 | |
---|
157 | C(l) =lambda(l+1)*(zvel(l+1)-zvel(l)) |
---|
158 | $ +lambda(l)*(zvel(l-1)-zvel(l)+C(l-1)) |
---|
159 | C(l) =C(l)/den(l) |
---|
160 | |
---|
161 | D(l) =lambda(l+1) / den(l) |
---|
162 | ENDDO |
---|
163 | |
---|
164 | den(nz)=alpha(nz) + lambda(nz) * (1-D(nz-1)) |
---|
165 | C(nz)=C(nz-1)+zvel(nz-1)-zvel(nz) |
---|
166 | C(nz)=(C(nz)*lambda(nz)+phitop) / den(nz) |
---|
167 | |
---|
168 | c---------------------------------------------------------------------- |
---|
169 | c |
---|
170 | c calcul de la nouvelle pdvelm |
---|
171 | c |
---|
172 | c---------------------------------------------------------------------- |
---|
173 | |
---|
174 | DO l=1,nz |
---|
175 | pdvelm(l)=0. |
---|
176 | ENDDO |
---|
177 | pdvelm(nz)=C(nz) |
---|
178 | DO l=nz-1,1,-1 |
---|
179 | pdvelm(l)=C(l)+D(l)*pdvelm(l+1) |
---|
180 | ENDDO |
---|
181 | c----------------------------------------------------------------------- |
---|
182 | c |
---|
183 | c calcul de la tendance zdvelmolvis |
---|
184 | c |
---|
185 | c----------------------------------------------------------------------- |
---|
186 | |
---|
187 | DO l=1,nz |
---|
188 | zdvelmolvis(ig,l)=pdvelm(l)/ptimestep |
---|
189 | ENDDO |
---|
190 | |
---|
191 | ENDDO ! boucle sur ngrid |
---|
192 | |
---|
193 | RETURN |
---|
194 | END |
---|