source: trunk/LMDZ.GENERIC/libf/phystd/molvis.F90 @ 4033

Last change on this file since 4033 was 4033, checked in by mmaurice, 4 weeks ago

Generic PCM

Introduce molecular viscosity module. Add callconduc and callmolvis
flags to call conduction and molecular viscosity, respectively. Change
phitop in conduction to phitop_conduc (there is also phitop_molvis now).
Move thermal conductivity lambda to conc_mod.F90.

MM

File size: 4.6 KB
Line 
1
2MODULE molvis_mod
3     
4IMPLICIT NONE
5     
6CONTAINS
7
8      SUBROUTINE molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt,pdt, &
9                        pvel,zzlev,zzlay,zdvelmolvis)
10     
11      use comcstfi_mod, only: r, cpp, mugaz
12      use callkeys_mod, only: phitop_molvis,zztop
13      use conc_mod,     only: lambda
14      use gases_h
15
16!=======================================================================
17!
18!   Molecular Viscosity Diffusion
19
20!   Based on the molvis.F module from the Mars PCM
21!   Adapted by Maxime Maurice (2025) 
22!   The kiunematic viscosity mu (kg/m/s) is calculated from
23!   the thermal conductivity lambda (m/s^2) using the formula:
24!   lambda / mu = (9*Cp + 5*Cv) / 4
25!               = (9*Cp + 5*(Cp - R)) / 4
26!
27!=======================================================================
28
29!-----------------------------------------------------------------------
30!   declarations:
31!-----------------------------------------------------------------------
32
33!   arguments:
34!   ----------
35
36      integer,intent(in) :: ngrid ! number of atmospheric columns
37      integer,intent(in) :: nlayer ! number of atmospheric layers
38      REAL,intent(in)    :: ptimestep
39      REAL,intent(in)    :: pplay(ngrid,nlayer)
40      REAL,intent(in)    :: pplev(ngrid,nlayer+1)
41      REAL,intent(in)    :: zzlay(ngrid,nlayer)
42      REAL,intent(in)    :: zzlev(ngrid,nlayer+1)
43      real,intent(in)    :: pt(ngrid,nlayer)
44      REAL,intent(in)    :: pvel(ngrid,nlayer)
45      real,intent(in)    :: pdt(ngrid,nlayer)
46
47      real,intent(out)   :: zdvelmolvis(ngrid,nlayer)
48
49!   local:
50!   ------
51
52      INTEGER l,ig, nz     ! layer index, grid index, and number of layers
53      real fac             ! conversion factor between thermal conductivity and molecular viscosity
54      REAL zvel(nlayer)    ! wind
55      real zt(nlayer)      ! temperature (K)
56      REAL alpha(nlayer)   ! physical coefficient
57      REAL mu(nlayer)      ! dynamical viscosity (kg/m/s)
58      real muvol(nlayer)   ! molecular density (m^-3)
59      REAL C(nlayer)       ! Finite-difference coefficient 1
60      real D(nlayer)       ! Finite-difference coefficient 2
61      real den(nlayer)     ! density
62      REAL pdvelm(nlayer)  ! wind tendency
63      REAL zlay(nlayer)
64      real zlev(nlayer+1)
65      REAL,PARAMETER :: velsurf =0.0
66
67!-----------------------------------------------------------------------
68!   calcul des coefficients alpha et mu
69!-----------------------------------------------------------------------
70
71      nz = nlayer
72
73      fac = (9 * cpp - 5 * (cpp - r)) / 4
74
75      do ig=1,ngrid
76
77        zt(1)   = pt(ig,1) + pdt(ig,1) * ptimestep
78        zvel(1) = pvel(ig,1)
79        zlay(1) = zzlay(ig,1)
80        zlev(1) = zzlev(ig,1)
81
82        do l=2,nz
83          zt(l)   = pt(ig,l) + (pdt(ig,l) + pdt(ig,l)) * ptimestep
84          zvel(l) = pvel(ig,l)
85          zlay(l) = zzlay(ig,l)
86          zlev(l) = zzlev(ig,l)
87        enddo
88
89        zlev(nz+1) = zlev(nz) + zztop
90       
91        mu(1) = lambda(ig,1) / fac
92
93        DO l=2,nz
94          mu(l)=lambda(ig,l)/fac
95        ENDDO
96   
97        DO l=1,nz-1
98          muvol(l) = pplay(ig,l) / (r*zt(l))
99          alpha(l) = (muvol(l) / ptimestep) * (zlev(l+1) - zlev(l))
100        ENDDO
101
102        muvol(nz) = pplay(ig,nz) / (r*zt(nz))
103        alpha(nz) = (muvol(nz) / ptimestep) * (zlev(nz+1) - zlev(nz))
104
105!--------------------------------------------------------------------
106!
107!     C and D coefficients
108!
109!-------------------------------------------------------------------
110
111        den(1) = alpha(1) + mu(2) + mu(1)
112        C(1)   = mu(1) * (velsurf - zvel(1)) + mu(2) * (zvel(2) - zvel(1))
113        C(1)   = C(1) / den(1)       
114        D(1)   = mu(2) / den(1)           
115   
116        DO l = 2, nz-1
117           den(l) = alpha(l) + mu(l+1)
118           den(l) = den(l) + mu(l) * (1 - D(l-1))
119         
120           C(l) = mu(l+1) * (zvel(l+1) - zvel(l)) + mu(l) * (zvel(l-1) - zvel(l) + C(l-1))   
121           C(l) = C(l) / den(l)           
122
123           D(l) = mu(l+1) / den(l)
124        ENDDO
125
126        den(nz) = alpha(nz) + mu(nz) * (1 - D(nz-1))
127        C(nz)   = C(nz-1) + zvel(nz-1) - zvel(nz)
128        C(nz)   = (C(nz) * mu(nz) + phitop_molvis) / den(nz)
129               
130!----------------------------------------------------------------------
131!
132!      Wind tendency calculation
133!
134!-----------------------------------------------------------------------
135   
136        DO l=1,nz
137          pdvelm(l) = 0.
138        ENDDO
139          pdvelm(nz) = C(nz)
140        DO l=nz-1,1,-1
141          pdvelm(l) = C(l) + D(l) * pdvelm(l+1)
142        ENDDO
143
144        DO l=1,nz
145          zdvelmolvis(ig,l) = pdvelm(l) / ptimestep
146        ENDDO
147
148      ENDDO             ! boucle sur ngrid
149
150      END SUBROUTINE molvis
151
152      END MODULE molvis_mod
Note: See TracBrowser for help on using the repository browser.