source: trunk/LMDZ.TITAN.old/libf/phytitan/optci.F @ 3094

Last change on this file since 3094 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: 10.4 KB
Line 
1      SUBROUTINE OPTCI(ykim,qaer,nmicro,IPRINT)
2      use dimphy
3      use infotrac_phy, only: nqtot
4      use common_mod, only:rmcbar,xfbar,ncount,TauHID,TauCID,TauGID
5      USE TGMDAT_MOD, ONLY: RHCH4,FH2,FHAZE,FHVIS,FHIR,TAUFAC,
6     &                      RCLOUD,FARGON
7#include "dimensions.h"
8#include "microtab.h"
9#include "numchimrad.h"
10#include "clesphys.h"
11
12c   Arguments:
13c   ---------
14      REAL    ykim(klon,klev,nqtot)
15      real    qaer(klon,klev,nqtot)
16      integer nmicro,IPRINT
17c   ---------
18
19c  ASTUCE POUR EVITER klon... EN ATTENDANT MIEUX
20      INTEGER   ngrid
21      PARAMETER (ngrid=(jjm-1)*iim+2)  ! = klon
22c
23      PARAMETER(NLAYER=llm,NLEVEL=NLAYER+1)
24      PARAMETER (NSPECI=46,NSPC1I=47,NSPECV=24,NSPC1V=25)
25
26      COMMON /ATM/ Z(NLEVEL),PRESS(NLEVEL),DEN(NLEVEL),TEMP(NLEVEL)
27
28      COMMON /GASS/ CH4(NLEVEL),XN2(NLEVEL),H2(NLEVEL),AR(NLEVEL)
29     & ,XMU(NLEVEL),GAS1(NLAYER),COLDEN(NLAYER)
30
31      COMMON /STRATO/ C2H2(NLAYER),C2H6(NLAYER)
32      COMMON /STRAT2/ HCN(NLAYER)
33
34      COMMON /AERSOL/ RADIUS(NLAYER), XNUMB(NLAYER)
35     & , REALI(NSPECI), XIMGI(NSPECI), REALV(NSPECV), XIMGV(NSPECV)
36
37      COMMON /CLOUD/
38     &               RCLDI(NSPECI), XICLDI(NSPECI)
39     &             , RCLDV(NSPECV), XICLDV(NSPECV)
40     &             , RCLDI2(NSPECI), XICLDI2(NSPECI)
41     &             , RCLDV2(NSPECV), XICLDV2(NSPECV)
42
43      COMMON /TAUS/   TAUHI(ngrid,NSPECI),TAUCI(ngrid,NSPECI),
44     &                TAUGI(ngrid,NSPECI),TAURV(ngrid,NSPECV),
45     &                TAUHV(ngrid,NSPECV),TAUCV(ngrid,NSPECV),
46     &                TAUGV(ngrid,NSPECV)
47
48      COMMON /OPTICI/ DTAUI(ngrid,NLAYER,NSPECI)
49     &               ,TAUI (ngrid,NLEVEL,NSPECI)
50     &               ,WBARI(ngrid,NLAYER,NSPECI)
51     &               ,COSBI(ngrid,NLAYER,NSPECI)
52     &               ,DTAUIP(ngrid,NLAYER,NSPECI)
53     &               ,TAUIP(ngrid,NLEVEL,NSPECI)
54     &               ,WBARIP(ngrid,NLAYER,NSPECI)
55     &               ,COSBIP(ngrid,NLAYER,NSPECI)
56
57      COMMON /SPECTI/ BWNI(NSPC1I), WNOI(NSPECI),
58     &                DWNI(NSPECI), WLNI(NSPECI)
59
60      REAL DTAUP(ngrid,NLAYER,NSPECI),DTAUPP(ngrid,NLAYER,NSPECI)
61      COMMON /IRTAUS/ DTAUP,DTAUPP
62
63      COMMON /part/v,rayon,vrat,dr,dv
64
65      DIMENSION PROD(NLEVEL)
66* nrad dans microtab.h
67      real v(nrad),rayon(nrad),vrat,dr(nrad),dv(nrad)
68      real xv1(klev,nspeci),xv2(klev,nspeci)
69      real xv3(klev,nspeci)
70      REAL QF1(nrad,NSPECI),QF2(nrad,NSPECI)
71      REAL QF3(nrad,NSPECI),QF4(nrad,NSPECI)
72      REAL QM1(nrad,NSPECI),QM2(nrad,NSPECI)
73      REAL QM3(nrad,NSPECI),QM4(nrad,NSPECI)
74      real emu
75      REAL TAEROSM1(NSPECI),TAEROSCATM1(NSPECI),DELTAZM1(NSPECI)
76     
77      save qf1,qf2,qf3,qf4,qm1,qm2,qm3,qm4
78
79      integer iopti,iwarning     ! iopti: premier appel, une seule boucle sur les l.d'o.
80      integer ig,seulmtunpt,iout
81      save iopti,iwarning,seulmtunpt
82      data iopti,iwarning,seulmtunpt/0,0,0/
83
84      real   zqaer_1pt(NLAYER,2*nrad)
85#include "optci_1pt.h"
86
87      character*100 dummy
88      real   dummy2,dummy3
89
90C THE PRESSURE INDUCED TRANSITIONS ARE FROM REGIS
91C THE LAST SEVENTEEN INTERVALS ARE THE BANDS FROM GNF.
92C
93C THIS SUBROUTINE SETS THE OPTICAL CONSTANTS IN THE INFRARED
94C IT CALCUALTES FOR EACH LAYER, FOR EACH SPECRAL INTERVAL IN THE IR
95C LAYER: WBAR, DTAU, COSBAR
96C LEVEL: TAU
97C
98       print*,'START OPTCI'
99
100c Diagnostic eventuellement:
101c      if (nmicro.gt.0) then
102c      sum=0.
103c      do nng=2,klon
104c        do i=1,klev
105c         do j=1,nmicro
106c          print*,'j,rj',j,rayon(j)
107c          print*,'paer',qaer(nng,i,j)
108c           sum=sum+qaer(nng,i,j)*rayon(j)**3.*1.3333*3.1415*1000.
109c         enddo
110c        enddo
111c        enddo
112c      print*,sum/(klon-1),'SOMME COLONNE/OPTCI'
113c      endif
114
115
116c      do inq=1,nrad
117c          print*,inq,rayon(inq),vrat,qaer(12,25,inq)
118c      enddo
119             
120C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
121c INITIALISATIONS UNE SEULE FOIS
122C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
123
124      if (iopti.eq.0) then
125
126c verif pour taille zqaer_1pt, sachant que si microfi=0 et nqtot=1,
127c il faut quand meme qu on lise la look-up table de dim nrad=10
128c et si microfi=1, on doit avoir nmicro=nrad (dans microtab.h)
129c
130c Nouvelle verif pour nuages :
131c La condition ci-dessus n'est plus realisable !
132c nmicro comprend maintenant aussi des glaces
133c Donc on teste juste que nmicro soit > 2*nrad (ou nrad si on ne fait pas de nuages)
134       if (microfi.ge.1) then
135         if ((clouds.eq.1).and.(nmicro.lt.2*nrad)) then
136           print*,"OPTCI :"
137           print*,"clouds = 1 MAIS nmicro < 2*nrad"
138           print*,"Probleme pour zqaer_1pt dans optci."
139           stop
140         endif
141         if ((clouds.eq.0).and.(nmicro.lt.nrad)) then
142           print*,"OPTCI :"
143           print*,"nmicro < nrad"
144           print*,"Probleme pour zqaer_1pt dans optci."
145           stop
146         endif
147       endif
148
149      DO 420 K=1,NSPECI
150C LETS USE THE THOLIN OPTICAL CONSTANTS FOR THE HAZE.
151c         CALL THOLIN(WLNI(K),TNR,TNI)
152          CALL THOLIN_CVD(WLNI(K),TNR,TNI)
153          REALI(K)=TNR
154          XIMGI(K)=TNI*FHIR
155C SET UP THE OPTICAL CONSTANTS FOR THE CLOUD
156          CALL LIQCH4(WLNI(K),TNR,TNI)
157          RCLDI(K)=TNR
158          XICLDI(K)=TNI
159          CALL LIQC2H6(WLNI(K),TNR,TNI)
160          RCLDI2(K)=TNR
161          XICLDI2(K)=TNI
162 420  CONTINUE
163
164c DEBUG
165c       print*,"wnoi=",WNOI
166
167C
168C ZERO ALL OPTICAL DEPTHS.
169C ??FLAG? FOR SOME APPLCIATIONS THE TOP OPACITY MAY NOT VANISH
170
171c      open  (unit=1,file='xsetupi')
172c      do i=1,klev
173c       read(1,*) a
174c        do j=1,nspeci
175c            read(1,*) xv1(i,j),xv2(i,j),xv3(i,j)
176c        enddo
177c       enddo
178c       close(1)
179
180      endif    ! fin initialisations premier appel
181
182c************************************************************************
183c************************************************************************
184      DO 79 ig=1,klon      ! BOUCLE SUR GRILLE HORIZONTALE   
185c      print*,'ig NEW optci',ig
186c************************************************************************
187c************************************************************************
188
189        if (.not.ylellouch) then
190       
191            XN2(1) = ykim(ig,1,iradn2)
192            CH4(1) = ykim(ig,1,iradch4)
193             H2(1) = ykim(ig,1,iradh2)
194            do j=2,nlayer
195               XN2(j) = (ykim(ig,j,iradn2)+ykim(ig,j-1,iradn2))/2.
196               CH4(j) = (ykim(ig,j,iradch4)+ykim(ig,j-1,iradch4))/2.
197                H2(j) = (ykim(ig,j,iradh2)+ykim(ig,j-1,iradh2))/2.
198            enddo
199            XN2(nlevel) = ykim(ig,nlayer,iradn2)
200            CH4(nlevel) = ykim(ig,nlayer,iradch4)
201             H2(nlevel) = ykim(ig,nlayer,iradh2)     
202
203            do j=1,nlayer
204               emu = ( xmu(j) + xmu(j+1) )/2.
205               C2H2(j) = ykim(ig,j,iradc2h2) * 26./emu
206               C2H6(j) = ykim(ig,j,iradc2h6) * 30./emu
207                HCN(j) = ykim(ig,j,iradhcn ) * 27./emu
208            enddo
209                 
210        endif
211
212c     if ((.not.ylellouch).and.(ig.eq.klon/2)) then
213c        print*,' LAYER      C2H2         C2H6       HCN masmix ratios'
214c        do j=1,nlayer
215c            print*,j,C2H2(j),C2H6(j),HCN(j)
216c        enddo
217c     endif   
218
219        if (microfi.ge.1) then
220          do iq=1,2*nrad
221c           si on ne fait pas de nuages on ne copie que les nrad premieres valeurs.
222            if (clouds.eq.0.and.iq.gt.nrad) then
223              zqaer_1pt(:,iq)=0.
224            else
225              do j=1,NLAYER
226                zqaer_1pt(j,iq)=qaer(ig,j,iq)
227              enddo
228            endif
229          enddo
230        else
231         if (ig.eq.1)  then
232           zqaer_1pt = 0.
233c initialisation zqaer_1pt a partir d une look-up table (uniforme en ig)
234c boucle sur nrad=10 (dans microtab.h)
235           open(10,file="qaer_eq_1d.dat")
236           do iq=1,15
237             read(10,'(A100)') dummy
238           enddo
239           do j=NLAYER,1,-1
240             read(10,*) dummy2,dummy3,(zqaer_1pt(j,iq),iq=1,nrad)
241           enddo
242           close(10)
243c ici, les tableaux definissant la structure des aerosols sont
244c remplis: rf,df(nq),rayon(nq,)v(nq)......
245           call rdf()
246         endif
247        endif
248
249c        if ((ig.eq.klon/2).or.(microfi.eq.0))  then
250c       print*,"Q01=",zqaer_1pt(:,1)
251c       print*,"Q05=",zqaer_1pt(:,5)
252c       print*,"Q10=",zqaer_1pt(:,10)
253c       stop
254c        endif
255       
256        iout=0
257c       if ((microfi.eq.0).or.(ig.eq.(klon/2+16))) iout=1
258        if (seulmtunpt.eq.0) then
259          call optci_1pt3(zqaer_1pt,rmcbar(ig,:),xfbar(ig,:,:),
260     &                   iopti,iout)
261           iopti = 1
262        endif
263
264c Pas de microphysique, ni de composition variable: un seul passage
265c dans optci_1pt.
266        if ((microfi.eq.0).and.(ylellouch)) then
267           seulmtunpt = 1
268        endif
269       
270        COSBI(ig,:,:)  = MAX(MIN(COSBI_1pt(:,:),0.999999),1e-6)
271        WBARI(ig,:,:)  = MAX(MIN(WBARI_1pt(:,:),0.999999),1e-6)
272        DTAUI(ig,:,:)  = DTAUI_1pt(:,:)
273        TAUI(ig,:,:)   = TAUI_1pt(:,:)
274
275        COSBIP(ig,:,:)  = MAX(MIN(COSBIP_1pt(:,:),0.999999),1e-6)
276        WBARIP(ig,:,:)  = MAX(MIN(WBARIP_1pt(:,:),0.999999),1e-6)
277        DTAUIP(ig,:,:)  = DTAUIP_1pt(:,:)
278        TAUIP(ig,:,:)   = TAUIP_1pt(:,:)
279
280        TAUHI(ig,:)    = TAUHI_1pt(:)
281        TAUCI(ig,:)    = TAUCI_1pt(:)
282        TAUGI(ig,:)    = TAUGI_1pt(:)
283
284        TauHID(ig,:,:) = TAUHID_1pt(:,:)
285        TauCID(ig,:,:) = TAUCID_1pt(:,:)
286        TauGID(ig,:,:) = TAUGID_1pt(:,:)
287
288c DEBUG
289c     if(ig.eq.(ngrid/2+16)) then
290c         print*,ig,'/',KLON,':'
291c         print*,'TauHID_1',TAUHID(ig,1,:)
292c         print*,'TauGID_1',TAUGID(ig,1,:)
293c         print*,'TauHID_50',TAUHID(ig,50,:)
294c         print*,'TauGID_50',TAUGID(ig,50,:)
295c         print*,"DTAUI_1=",DTAUI(ig,1,:)
296c         print*,"DTAUI_50=",DTAUI(ig,50,:)
297c         print*,'cosBI_1',COSBI(ig,1,:)
298c         print*,'cosBI_50',COSBI(ig,50,:)
299c         print*,'WBARI_1',WBARI(ig,1,:)
300c         print*,'WBARI_50',WBARI(ig,50,:)
301c         stop
302c     endif
303
304c************************************************************************
305c************************************************************************
306  79  CONTINUE   ! FIN BOUCLE GRILLE HORIZONTALE
307c************************************************************************
308c************************************************************************
309C THIS ROUTINE HAS ALREADY SET THE DTAUI(J,K) VALUES BUT MUST BE PASSED
310        DO 225 IG=1,klon
311         DO 220 J=1,NLAYER
312          DO 230 K=1,NSPECI
313              DTAUP(IG,J,K)=DTAUI(IG,J,K)
314              DTAUPP(IG,J,K)=DTAUIP(IG,J,K)
315230       CONTINUE
316220      CONTINUE
317225     CONTINUE
318
319      print*, 'FIN OPTCI'
320
321      RETURN
322      END
323
Note: See TracBrowser for help on using the repository browser.