[1047] | 1 | SUBROUTINE molvis(ngrid,nlayer,ptimestep, |
---|
| 2 | & pplay,pplev,pt,pdteuv,pdtconduc |
---|
[690] | 3 | $ ,pvel,tsurf,zzlev,zzlay,zdvelmolvis) |
---|
[1047] | 4 | |
---|
| 5 | use conc_mod, only: cpnew, Akknew, rnew |
---|
[38] | 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 | |
---|
[1047] | 25 | integer,intent(in) :: ngrid ! number of atmospheric columns |
---|
| 26 | integer,intent(in) :: nlayer ! number of atmospheric layers |
---|
[38] | 27 | REAL ptimestep |
---|
[1047] | 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] | 38 | |
---|
[1047] | 39 | real zdvelmolvis(ngrid,nlayer) |
---|
[38] | 40 | |
---|
| 41 | c local: |
---|
| 42 | c ------ |
---|
| 43 | |
---|
[1047] | 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) |
---|
[38] | 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 | |
---|
[1047] | 67 | REAL,PARAMETER :: skk=0.69 |
---|
[38] | 68 | |
---|
[1047] | 69 | REAL,PARAMETER :: velsurf =0.0 |
---|
[38] | 70 | |
---|
[1047] | 71 | logical,save :: firstcall=.true. |
---|
| 72 | |
---|
[38] | 73 | c----------------------------------------------------------------------- |
---|
| 74 | c calcul des coefficients alpha et lambda |
---|
| 75 | c----------------------------------------------------------------------- |
---|
| 76 | |
---|
| 77 | IF (firstcall) THEN |
---|
| 78 | ! write(*,*)'molvis: coeff of molecular viscosity Akk,skk,factor' |
---|
| 79 | ! write(*,*) Akk,skk,fac |
---|
| 80 | ! NB: Akk and fac are undefined at firstcall |
---|
| 81 | write(*,*)'molvis: coeff of molecular viscosity skk ', skk |
---|
| 82 | |
---|
| 83 | firstcall = .false. |
---|
| 84 | END IF |
---|
| 85 | |
---|
| 86 | ! Initialize phitop |
---|
| 87 | phitop=0.0 |
---|
| 88 | |
---|
[1047] | 89 | nz=nlayer |
---|
[38] | 90 | |
---|
| 91 | do ig=1,ngrid |
---|
| 92 | |
---|
| 93 | zt(1)=pt(ig,1)+(pdteuv(ig,1)+pdtconduc(ig,1))*ptimestep |
---|
| 94 | zvel(1)=pvel(ig,1) |
---|
| 95 | c zlay(1)=-log(pplay(ig,1)/pplev(ig,1))*Rnew(ig,1)*zt(1)/g |
---|
| 96 | c zlev(1)=0.0 |
---|
| 97 | |
---|
| 98 | zlay(1)=zzlay(ig,1) |
---|
| 99 | zlev(1)=zzlev(ig,1) |
---|
| 100 | |
---|
| 101 | do l=2,nz |
---|
| 102 | zt(l)=pt(ig,l)+(pdteuv(ig,l)+pdtconduc(ig,l))*ptimestep |
---|
| 103 | zvel(l)=pvel(ig,l) |
---|
| 104 | c tmean=zt(l) |
---|
| 105 | c if(zt(l).ne.zt(l-1)) tmean=(zt(l)-zt(l-1))/log(zt(l)/zt(l-1)) |
---|
| 106 | c zlay(l)= zlay(l-1) |
---|
| 107 | c & -log(pplay(ig,l)/pplay(ig,l-1))*Rnew(ig,l-1)*tmean/g |
---|
| 108 | c zlev(l)= zlev(l-1) |
---|
| 109 | c & -log(pplev(ig,l)/pplev(ig,l-1))*Rnew(ig,l-1)*tmean/g |
---|
| 110 | zlay(l)=zzlay(ig,l) |
---|
| 111 | zlev(l)=zzlev(ig,l) |
---|
| 112 | enddo |
---|
| 113 | |
---|
| 114 | c zlev(nz+1)= zlev(nz) |
---|
| 115 | c & -log(max(pplev(ig,nz+1),1.e-30)/pplev(ig,nz)) |
---|
| 116 | c & *Rnew(ig,nz)*tmean/g |
---|
| 117 | c if(pplev(ig,nz+1).eq.0.) |
---|
| 118 | c & zlev(nz+1)=zlev(nz)+(zlay(nz)-zlay(nz-1)) |
---|
| 119 | |
---|
| 120 | zlev(nz+1)= zlev(nz)+10000. |
---|
| 121 | |
---|
| 122 | fac=0.25*(9.*cpnew(ig,1)-5.*(cpnew(ig,1)-rnew(ig,1))) |
---|
| 123 | Akk=Akknew(ig,1) |
---|
| 124 | lambda(1)=Akk*tsurf(ig)**skk/zlay(1)/fac |
---|
| 125 | c write(*,*) 'rnew(ig,nz) ',ig , rnew(ig,nz) |
---|
| 126 | |
---|
| 127 | DO l=2,nz |
---|
| 128 | fac=(9.*cpnew(ig,l)-5.*(cpnew(ig,l)-rnew(ig,l)))/4. |
---|
| 129 | Akk=Akknew(ig,l) |
---|
| 130 | lambda(l)=Akk/fac*zt(l)**skk/(zlay(l)-zlay(l-1)) |
---|
| 131 | ENDDO |
---|
| 132 | |
---|
| 133 | DO l=1,nz-1 |
---|
| 134 | muvol(l)=pplay(ig,l)/(rnew(ig,l)*zt(l)) |
---|
| 135 | alpha(l)=(muvol(l)/ptimestep)*(zlev(l+1)-zlev(l)) |
---|
| 136 | ENDDO |
---|
| 137 | muvol(nz)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz)) |
---|
| 138 | alpha(nz)=(muvol(nz)/ptimestep)*(zlev(nz+1)-zlev(nz)) |
---|
| 139 | |
---|
| 140 | c-------------------------------------------------------------------- |
---|
| 141 | c |
---|
| 142 | c calcul des coefficients C et D |
---|
| 143 | c |
---|
| 144 | c------------------------------------------------------------------- |
---|
| 145 | |
---|
| 146 | den(1)=alpha(1)+lambda(2)+lambda(1) |
---|
| 147 | C(1)=lambda(1)*(velsurf-zvel(1))+lambda(2)*(zvel(2)-zvel(1)) |
---|
| 148 | C(1)=C(1)/den(1) |
---|
| 149 | D(1)=lambda(2)/den(1) |
---|
| 150 | |
---|
| 151 | DO l = 2,nz-1 |
---|
| 152 | den(l)=alpha(l)+lambda(l+1) |
---|
| 153 | den(l)=den(l)+lambda(l)*(1-D(l-1)) |
---|
| 154 | |
---|
| 155 | C(l) =lambda(l+1)*(zvel(l+1)-zvel(l)) |
---|
| 156 | $ +lambda(l)*(zvel(l-1)-zvel(l)+C(l-1)) |
---|
| 157 | C(l) =C(l)/den(l) |
---|
| 158 | |
---|
| 159 | D(l) =lambda(l+1) / den(l) |
---|
| 160 | ENDDO |
---|
| 161 | |
---|
| 162 | den(nz)=alpha(nz) + lambda(nz) * (1-D(nz-1)) |
---|
| 163 | C(nz)=C(nz-1)+zvel(nz-1)-zvel(nz) |
---|
| 164 | C(nz)=(C(nz)*lambda(nz)+phitop) / den(nz) |
---|
| 165 | |
---|
| 166 | c---------------------------------------------------------------------- |
---|
| 167 | c |
---|
| 168 | c calcul de la nouvelle pdvelm |
---|
| 169 | c |
---|
| 170 | c---------------------------------------------------------------------- |
---|
| 171 | |
---|
| 172 | DO l=1,nz |
---|
| 173 | pdvelm(l)=0. |
---|
| 174 | ENDDO |
---|
| 175 | pdvelm(nz)=C(nz) |
---|
| 176 | DO l=nz-1,1,-1 |
---|
| 177 | pdvelm(l)=C(l)+D(l)*pdvelm(l+1) |
---|
| 178 | ENDDO |
---|
| 179 | c----------------------------------------------------------------------- |
---|
| 180 | c |
---|
| 181 | c calcul de la tendance zdvelmolvis |
---|
| 182 | c |
---|
| 183 | c----------------------------------------------------------------------- |
---|
| 184 | |
---|
| 185 | DO l=1,nz |
---|
| 186 | zdvelmolvis(ig,l)=pdvelm(l)/ptimestep |
---|
| 187 | ENDDO |
---|
| 188 | |
---|
| 189 | ENDDO ! boucle sur ngrid |
---|
| 190 | |
---|
| 191 | RETURN |
---|
| 192 | END |
---|