source: trunk/LMDZ.VENUS/libf/phyvenus/concentrations2.F @ 2203

Last change on this file since 2203 was 1621, checked in by emillour, 8 years ago

Further work on full dynamics/physics separation.

LMDZ.COMMON:

  • added phy_common/vertical_layers_mod.F90 to store information on vertical grid. This is where routines in the physics should get the information.
  • The contents of vertical_layers_mod intialized via dynphy_lonlat/inigeomphy_mod.F90.

LMDZ.MARS:

  • physics now completely decoupled from dynamics; the physics package may now be compiled as a library (-libphy option of makelmdz_fcm).
  • created an "ini_tracer_mod" routine in module "tracer_mod" for a cleaner initialization of the later.
  • removed some purely dynamics-related outputs (etot0, zoom parameters, etc.) from diagfi.nc and stats.nc outputs as these informations are not available in the physics.

LMDZ.GENERIC:

  • physics now completely decoupled from dynamics; the physics package may now be compiled as a library (-libphy option of makelmdz_fcm).
  • added nqtot to tracer_h.F90.
  • removed some purely dynamics-related outputs (etot0, zoom parameters, etc.) from diagfi.nc and stats.nc outputs as these informations are not available in the physics.

LMDZ.VENUS:

  • physics now completely decoupled from dynamics; the physics package may now be compiled as a library (-libphy option of makelmdz_fcm).
  • added infotrac_phy.F90 to store information on tracers in the physics. Initialized via iniphysiq.
  • added cpdet_phy_mod.F90 to store t2tpot etc. functions to be used in the physics. Initialized via iniphysiq. IMPORTANT: there are some hard-coded constants! These should match what is in cpdet_mod.F90 in the dynamics.
  • got rid of references to moyzon_mod module within the physics. The required variables (tmoy, plevmoy) are passed to the physics as arguments to physiq.

LMDZ.TITAN:

  • added infotrac_phy.F90 to store information on tracers in the physics. Initialized via iniphysiq.
  • added cpdet_phy_mod.F90 to store t2tpot etc. functions to be used in the physics.
  • Extra work required to completely decouple physics and dynamics: moyzon_mod should be cleaned up and information passed from dynamics to physics as as arguments. Likewise moyzon_ch and moyzon_mu should not be queried from logic_mod (which is in the dynamics).

EM

File size: 6.7 KB
Line 
1      SUBROUTINE concentrations2(pplay,t_seri,pdt,tr_seri, nqmx)
2
3      use dimphy
4      use conc,  only: mmean, rho, Akknew, rnew, cpnew
5      use cpdet_phy_mod, only: cpdet                       
6      USE chemparam_mod
7
8      implicit none
9
10!=======================================================================
11! CALCULATION OF MEAN MOLECULAR MASS, Cp, Akk and R
12!
13! mmean(klon,klev)      amu
14! cpnew(klon,klev)      J/kg/K
15! rnew(klon,klev)       J/kg/K
16! akknew(klon,klev)     coefficient of thermal conduction
17!
18! version: April 2012 - Franck Lefevre
19!=======================================================================
20
21!     declarations
22 
23#include "YOMCST.h"
24#include "clesphys.h"
25c#include "comdiurn.h"
26c#include "chimiedata.h"
27c#include "tracer.h"
28c#include "mmol.h"
29
30!     input/output
31
32      real pplay(klon,klev)
33c      real pt(klon,klev)
34      integer,intent(in) :: nqmx    ! number of tracers
35      real t_seri(klon, klev)
36      real pdt(klon,klev)
37      real n2vmr_gcm(klon,klev),nvmr_gcm(klon,klev)
38      real tr_seri(klon,klev,nqmx)
39c      real pdq(klon,klev,nqmx)
40      real ptimestep
41
42!     local variables
43
44      integer       :: i, l, ig, iq
45      integer, save :: nbq
46      integer,allocatable,save :: niq(:)
47      real          :: ni(nqmx), ntot
48      real          :: zt(klon, klev)
49      real          :: zq(klon, klev, nqmx)
50      real,allocatable,save    :: aki(:)
51      real,allocatable,save    :: cpi(:)
52      real, save    :: akin,akin2
53
54      logical, save :: firstcall = .true.
55
56      if (firstcall) then
57
58!        initialize thermal conductivity and specific heat coefficients
59!        values are taken from the literature [J/kg K]
60
61         ! allocate local saved arrays:
62         allocate(aki(nqmx))
63         allocate(cpi(nqmx))
64         allocate(niq(nqmx))
65
66!        find index of chemical tracers to use
67!        initialize thermal conductivity and specific heat coefficients
68!        !? values are estimated
69
70         nbq = 0 ! to count number of tracers used in this subroutine
71
72         if (i_co2 /= 0) then
73            nbq = nbq + 1
74            niq(nbq) = i_co2
75            aki(nbq) = 3.072e-4
76            cpi(nbq) = 0.834e3
77         end if
78         if (i_co /= 0) then
79            nbq = nbq + 1
80            niq(nbq) = i_co
81            aki(nbq) = 4.87e-4
82            cpi(nbq) = 1.034e3
83         end if
84         if (i_o /= 0) then
85            nbq = nbq + 1
86            niq(nbq) = i_o
87            aki(nbq) = 7.59e-4
88            cpi(nbq) = 1.3e3
89         end if
90         if (i_o1d /= 0) then
91            nbq = nbq + 1
92            niq(nbq) = i_o1d
93            aki(nbq) = 7.59e-4  !?
94            cpi(nbq) = 1.3e3    !?
95         end if
96         if (i_o2 /= 0) then
97            nbq = nbq + 1
98            niq(nbq) = i_o2
99            aki(nbq) = 5.68e-4
100            cpi(nbq) = 0.9194e3
101         end if
102         if (i_o3 /= 0) then
103            nbq = nbq + 1
104            niq(nbq) = i_o3
105            aki(nbq) = 3.00e-4  !?
106            cpi(nbq) = 0.800e3  !?
107         end if
108         if (i_h /= 0) then
109            nbq = nbq + 1
110            niq(nbq) = i_h
111            aki(nbq) = 0.0
112            cpi(nbq) = 20.780e3
113         end if
114         if (i_h2 /= 0) then
115            nbq = nbq + 1
116            niq(nbq) = i_h2
117            aki(nbq) = 36.314e-4
118            cpi(nbq) = 14.266e3
119         end if
120         if (i_oh /= 0) then
121            nbq = nbq + 1
122            niq(nbq) = i_oh
123            aki(nbq)  = 7.00e-4 !?
124            cpi(nbq)  = 1.045e3
125         end if
126         if (i_ho2 /= 0) then
127            nbq = nbq + 1
128            niq(nbq) = i_ho2
129            aki(nbq) = 0.0
130            cpi(nbq) = 1.065e3  !?
131         end if
132         if (i_n2 /= 0) then
133            nbq = nbq + 1
134            niq(nbq) = i_n2
135            aki(nbq) = 5.6e-4
136            cpi(nbq) = 1.034e3
137         end if
138c         if (i_ar /= 0) then
139c            nbq = nbq + 1
140c            niq(nbq) = i_ar
141c            aki(nbq) = 0.0      !?
142c            cpi(nbq) = 1.000e3  !?
143c         end if
144         if (i_h2o /= 0) then
145            nbq = nbq + 1
146            niq(nbq) = i_h2o
147            aki(nbq) = 0.0
148            cpi(nbq) = 1.870e3
149         end if
150c         if (i_n /= 0) then
151c            nbq = nbq + 1
152c            niq(nbq) = i_n
153c            aki(nbq) = 0.0
154c            cpi(nbq) = 0.0
155c         endif
156c         if(i_no /= 0) then
157c            nbq = nbq + 1
158c            niq(nbq) = i_no
159c            aki(nbq) = 0.0
160c            cpi(nbq) = 0.0
161c         endif
162c         if(i_no2 /= 0) then
163c            nbq = nbq + 1
164c            niq(nbq) = i_no2
165c            aki(nbq) = 0.0
166c            cpi(nbq) = 0.0
167c         endif
168c         if(i_n2d /= 0) then
169c            nbq = nbq + 1
170c            niq(nbq) = i_n2d
171c            aki(nbq) = 0.0
172c            cpi(nbq) = 0.0
173c         endif
174
175         ! tell the world about it:
176         write(*,*) "concentrations: firstcall, nbq=",nbq
177!         write(*,*) "  niq(1:nbq)=",niq(1:nbq)
178!         write(*,*) "  aki(1:nbq)=",aki(1:nbq)
179!         write(*,*) "  cpi(1:nbq)=",cpi(1:nbq)
180
181
182         firstcall = .false.
183      end if ! if (firstcall)
184
185!     update temperature
186
187      do l = 1,klev
188         do ig = 1,klon
189            zt(ig,l) = t_seri(ig,l)
190         end do
191      end do
192
193
194!     update mass mixing ratio tracers
195
196      do l = 1,klev
197         do ig = 1,klon
198            do i = 1,nqmx
199!               iq = niq(i)
200               zq(ig,l,i) = max(1.e-30, tr_seri(ig,l,i))
201            end do
202         end do
203      end do
204
205!     mmean : mean molecular mass
206!     rho   : mass density [kg/m3]
207!     rnew  : specific gas constant
208   
209      mmean(:,:)  = 0.
210      rho(:,:) = 0.     
211
212      do l = 1,klev
213         do ig = 1,klon
214            do i = 1,nqmx
215c               iq = niq(i)
216               mmean(ig,l) = mmean(ig,l) + zq(ig,l,i)/M_tr(i)
217            end do
218            mmean(ig,l) = 1./mmean(ig,l)
219            rnew(ig,l) = 8.314/mmean(ig,l)*1.e3     ! J/kg K
220c            write(*,*),'Mmean in concentration2: ',ig, l, mmean(ig,l)
221         end do
222      end do
223
224!     cpnew  : specific heat
225!     akknew : thermal conductivity cofficient
226     
227      cpnew(:,:)  = 0.
228      akknew(:,:) = 0.
229
230      do l = 1,klev
231          do ig = 1,klon
232
233            ntot = pplay(ig,l)/(RKBOL*zt(ig,l))*1.e-6  ! in #/cm3
234            rho(ig,l) = (ntot * mmean(ig,l))/RNAVO*1.e3     ! in kg/m3
235
236c            write(*,*),'Air density: ',ig, l, rho(0,l)           
237
238!!  WARNING -> Cp here below doesn't depend on T (cpdet)
239
240            do i = 1,nbq
241c               iq = niq(i)
242               ni(i) = ntot*zq(ig,l,i)*mmean(ig,l)/M_tr(i)
243               cpnew(ig,l) = cpnew(ig,l) + ni(i)*cpi(i)
244               akknew(ig,l) = akknew(ig,l) + ni(i)*aki(i)
245            end do
246 
247
248            cpnew(ig,l) = cpnew(ig,l)/ntot
249            akknew(ig,l)= akknew(ig,l)/ntot
250
251
252          end do
253       end do
254
255      return
256      end
Note: See TracBrowser for help on using the repository browser.