source: trunk/LMDZ.TITAN.old/libf/phytitan/optcv.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: 7.3 KB
Line 
1      SUBROUTINE OPTCV(qaer,nmicro,IPRINT)
2
3      use dimphy
4      use infotrac_phy, only: nqtot
5      use common_mod, only:rmcbar,xfbar,ncount,TauHVD,TauCVD,TauGVD
6      USE TGMDAT_MOD, ONLY: RHCH4,FH2,FHAZE,FHVIS,FHIR,TAUFAC,
7     &                      RCLOUD,FARGON
8#include "dimensions.h"
9#include "microtab.h"
10#include "clesphys.h"
11
12c   Argument:
13c   ---------
14      REAL    qaer(klon,klev,nqtot)
15      integer nmicro
16c   ---------
17
18c  ASTUCE POUR EVITER klon... EN ATTENDANT MIEUX
19      INTEGER   ngrid
20      PARAMETER (ngrid=(jjm-1)*iim+2)  ! = klon
21c
22      PARAMETER(NLAYER=llm,NLEVEL=NLAYER+1)
23      PARAMETER (NSPECI=46,NSPC1I=47,NSPECV=24,NSPC1V=25)
24
25      COMMON /ATM/ Z(NLEVEL),PRESS(NLEVEL),DEN(NLEVEL),TEMP(NLEVEL)
26
27      COMMON /GASS/ CH4(NLEVEL),XN2(NLEVEL),H2(NLEVEL),AR(NLEVEL)
28     & ,XMU(NLEVEL),GAS1(NLAYER),COLDEN(NLAYER)
29
30      COMMON /VISGAS/SOLARF(NSPECV),NTERM(NSPECV),PEXPON(NSPECV),
31     &         ATERM(4,NSPECV),BTERM(4,NSPECV)
32
33      COMMON /AERSOL/ RADIUS(NLAYER), XNUMB(NLAYER)
34     & , REALI(NSPECI), XIMGI(NSPECI), REALV(NSPECV), XIMGV(NSPECV)
35
36      COMMON /CLOUD/
37     &               RCLDI(NSPECI), XICLDI(NSPECI)
38     &             , RCLDV(NSPECV), XICLDV(NSPECV)
39     &             , RCLDI2(NSPECI), XICLDI2(NSPECI)
40     &             , RCLDV2(NSPECV), XICLDV2(NSPECV)
41
42      COMMON /TAUS/   TAUHI(ngrid,NSPECI), TAUCI(ngrid,NSPECI)
43     &               ,TAUGI(ngrid,NSPECI), TAURV(ngrid,NSPECV)
44     &               ,TAUHV(ngrid,NSPECV) ,TAUCV(ngrid,NSPECV)
45     &               ,TAUGV(ngrid,NSPECV)
46
47      COMMON /OPTICV/ DTAUV(ngrid,NLAYER,NSPECV,4)
48     &               ,TAUV(ngrid,NLEVEL,NSPECV,4)
49     &               ,WBARV(ngrid,NLAYER,NSPECV,4)
50     &               ,COSBV(ngrid,NLAYER,NSPECV,4)
51     &               ,DTAUVP(ngrid,NLAYER,NSPECV,4)
52     &               ,TAUVP(ngrid,NLEVEL,NSPECV,4)
53     &               ,WBARVP(ngrid,NLAYER,NSPECV,4)
54     &               ,COSBVP(ngrid,NLAYER,NSPECV,4)
55
56      COMMON /SPECTV/ BWNV(NSPC1V),WNOV(NSPECV)
57     &               ,DWNV(NSPECV),WLNV(NSPECV)
58
59      COMMON /part/ v(nrad),rayon(nrad),vrat,dr(nrad),dv(nrad)
60
61      REAL xv1(klev,NSPECV)
62      REAL xv2(klev,NSPECV)
63      REAL xv3(klev,NSPECV)
64
65      REAL QF1(nrad,NSPECV),QF2(nrad,NSPECV)
66      REAL QF3(nrad,NSPECV),QF4(nrad,NSPECV)
67      REAL QM1(nrad,NSPECV),QM2(nrad,NSPECV)
68      REAL QM3(nrad,NSPECV),QM4(nrad,NSPECV)
69
70      save qf1,qf2,qf3,qf4,qm1,qm2,qm3,qm4
71 
72      integer ioptv,iwarning     ! ioptv: premier appel, une seule boucle sur les l.d'o.
73      integer ig_,seulmtunpt
74      save ioptv,iwarning,seulmtunpt
75      data ioptv,iwarning,seulmtunpt/0,0,0/
76
77      real   zqaer_1pt(NLAYER,2*nrad)
78#include "optcv_1pt.h"
79
80      character*100 dummy
81      real   dummy2,dummy3
82
83C*
84C THIS SUBROUTINE SETS THE OPTICAL CONSTANTS IN THE VISIBLE
85C IT CALCULATES FOR EACH LAYER, FOR EACH SPECRAL INTERVAL IN THE VIS
86C LAYER: WBAR, DTAU, COSBAR
87C LEVEL: TAU
88C
89       sum=0.
90       PRINT*,'OPTCV'
91       print*,'ATTENTION, TAU UNIFORME DANS OPTCV'
92
93C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
94c INITIALISATIONS UNE SEULE FOIS
95C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
96
97      if (ioptv.eq.0) then
98
99c verif pour taille zqaer_1pt, sachant que si microfi=0 et nqtot=1,
100c il faut quand meme qu'on lise la look-up table de dim nrad=10
101c et si microfi=1, on doit avoir nmicro=nrad (dans microtab.h)
102c
103c Nouvelle verif pour nuages :
104c La condition ci-dessus n'est plus realisable !
105c nmicro comprend maintenant aussi des glaces
106c Donc on teste juste que nmicro soit > 2*nrad (ou nrad si on ne fait pas de nuages)
107       if (microfi.ge.1) then
108         if ((clouds.eq.1).and.(nmicro.lt.2*nrad)) then
109           print*,"OPTCV :"
110           print*,"clouds = 1 MAIS nmicro < 2*nrad"
111           print*,"Probleme pour zqaer_1pt dans optcv."
112           stop
113         endif
114         if ((clouds.eq.0).and.(nmicro.lt.nrad)) then
115           print*,"OPTCV :"
116           print*,"nmicro < nrad"
117           print*,"Probleme pour zqaer_1pt dans optcv."
118           stop
119         endif
120       endif
121     
122      DO 130 K=1,NSPECV
123C LETS USE THE OPTICAL CONSTANTS FOR THOLIN
124c     CALL THOLIN(WLNV(K),TNR,TNI)
125      CALL THOLIN_CVD(WLNV(K),TNR,TNI)
126      REALV(K)=TNR
127      XIMGV(K)=TNI*FHVIS
128C BUT WE NOW USE THE GEOMETRIC ALBEDO FITTED RESULTS
129C      XIMGV(K)=FITEDT(WLNV(K))
130C      XIMGV(K)=FITEDN(WLNV(K))
131C THE CLOUD IS CLEAR IN THE VISIBLE
132      CALL LIQCH4(WLNV(K),TNR,TNI)
133      RCLDV(K)=TNR
134      XICLDV(K)=TNI
135      CALL LIQC2H6(WLNV(K),TNR,TNI)
136      RCLDV2(K)=TNR
137      XICLDV2(K)=TNI
138 130  CONTINUE
139C
140c      open (unit=1,file='xsetupv')
141c       do j=1,nspecv
142c        read(1,*) a
143c        do i=1,klev
144c            read(1,*) xv1(i,j),xv2(i,j),xv3(i,j)
145c        enddo
146c       enddo
147c       close(1)
148
149c DEBUG
150c       print*,"wnov=",WNOV
151
152      endif    ! fin initialisations premier appel
153
154c******* DEBUT DES BOUCLE GRILLE ************************
155c     PRINT*, 'AEROSOLS EN VISIBLE'
156
157      DO 101 ig=1,klon       !c! BOUCLE SUR GRILLE HORIZONTALE
158
159        if (microfi.ge.1) then
160           do iq=1,2*nrad
161             if (clouds.eq.0.and.iq.gt.nrad) then
162                zqaer_1pt(:,iq)=0.
163             else
164               do j=1,NLAYER
165                  zqaer_1pt(j,iq)=qaer(ig,j,iq)
166               enddo
167             endif
168           enddo
169        else
170         if (ig.eq.1)  then
171c initialisation zqaer_1pt a partir d une look-up table (uniforme en ig)
172c boucle sur nrad=10
173           open(10,file="qaer_eq_1d.dat")
174           do iq=1,15
175             read(10,'(A100)') dummy
176           enddo
177           do j=NLAYER,1,-1
178             read(10,*) dummy2,dummy3,(zqaer_1pt(j,iq),iq=1,nrad)
179           enddo
180           close(10)
181         endif
182        endif
183       
184c        if ((ig.eq.klon/2).or.(microfi.eq.0))  then
185c       print*,"Q01=",zqaer_1pt(:,1)
186c       print*,"Q05=",zqaer_1pt(:,5)
187c       print*,"Q10=",zqaer_1pt(:,10)
188c       stop
189c        endif
190       
191        iout=0
192c       if ((microfi.eq.0).or.(ig.eq.klon/2)) iout=1
193        if (seulmtunpt.eq.0) then
194          call optcv_1pt3(zqaer_1pt,rmcbar(ig,:),xfbar(ig,:,:),
195     &                   ioptv,IPRINT)
196           ioptv = 1
197        endif
198
199c Pas de microphysique, ni de composition variable: un seul passage
200c dans optcv_1pt.
201        if ((microfi.eq.0).and.(ylellouch)) then
202           seulmtunpt = 1
203        endif
204       
205        COSBV(ig,:,:,:)= MAX(MIN(COSBV_1pt(:,:,:),0.999999),1e-6)
206        WBARV(ig,:,:,:)= MAX(MIN(WBARV_1pt(:,:,:),0.999999),1e-6)
207        DTAUV(ig,:,:,:)= DTAUV_1pt(:,:,:)
208        TAUV(ig,:,:,:) = TAUV_1pt(:,:,:)
209
210        COSBVP(ig,:,:,:)= MAX(MIN(COSBVP_1pt(:,:,:),0.999999),1e-6)
211        WBARVP(ig,:,:,:)= MAX(MIN(WBARVP_1pt(:,:,:),0.999999),1e-6)
212        DTAUVP(ig,:,:,:)= DTAUVP_1pt(:,:,:)
213        TAUVP(ig,:,:,:) = TAUVP_1pt(:,:,:)
214
215        TAUHV(ig,:)    = TAUHV_1pt(:)
216        TAUCV(ig,:)    = TAUCV_1pt(:)
217        TAURV(ig,:)    = TAURV_1pt(:)
218        TAUGV(ig,:)    = TAUGV_1pt(:)
219
220        TauHVD(ig,:,:) = TAUHVD_1pt(:,:)
221        TauCVD(ig,:,:) = TAUCVD_1pt(:,:)
222        TauGVD(ig,:,:) = TAUGVD_1pt(:,:)
223
224c DEBUG
225c     if(ig.eq.(ngrid/2+16)) then
226c         print*,ig,'/',KLON,':'
227c         print*,'TauHVD_1',TAUHVD(ig,1,:)
228c         print*,'TauGVD_1',TAUGVD(ig,1,:)
229c         print*,'TauHVD_50',TAUHVD(ig,50,:)
230c         print*,'TauGVD_50',TAUGVD(ig,50,:)
231c     stop
232c     endif
233
234 101  CONTINUE
235
236c FIN BOUCLE GRILLE     *******
237c******************************
238         
239       PRINT*, 'FIN OPTCV'
240      RETURN
241      END
Note: See TracBrowser for help on using the repository browser.