source: trunk/LMDZ.VENUS/libf/phyvenus/phytrac_chimie.F @ 1395

Last change on this file since 1395 was 1305, checked in by slebonnois, 11 years ago

SL: VENUS PHOTOCHEMISTRY. Needs Lapack (see arch files...)

  • Property svn:executable set to *
File size: 11.8 KB
Line 
1!
2! $Header: /home/cvsroot/LMDZ4/libf/phylmd/phytrac.F,v 1.16 2006/03/24 15:06:23 lmdzadmin Exp $
3!
4c
5c
6      SUBROUTINE  phytrac_chimie (
7     I                    debutphy,
8     I                    gmtime,
9     I                    nqmax,
10     I                    n_lon,
11     I                    lat,
12     I                    lon,
13     I                    n_lev,
14     I                    pdtphys,
15     I                    temp,
16     I                    pplev,
17     O                    trac,
18     O                    NBRTOT_droplet,
19     O                    W_H2SO4,
20     O                    rho)
21
22c======================================================================
23c Auteur(s) FH
24c Objet: Moniteur general des tendances traceurs
25c
26cAA Remarques en vrac:
27cAA--------------------
28cAA 1/ le call phytrac se fait avec nqmax
29c======================================================================
30      USE chemparam_mod
31      IMPLICIT none
32     
33#include "clesphys.h"
34#include "YOMCST.h"
35c======================================================================
36c Arguments:
37c
38c
39c   EN ENTREE:
40c   ==========
41c
42c   divers:
43c   -------
44c
45
46      REAL  sza_local
47      REAL  gmtime
48c      INTEGER, SAVE :: cpt_cloudIO  !un compteur pour fichier sortie cloud_parameter en 1D
49      INTEGER  iq
50      INTEGER  i
51      INTEGER  ilon, ilev
52      integer  n_lon  ! nombre de points horizontaux
53      INTEGER  n_lev  ! nombre de couches verticales
54      INTEGER  nqmax ! nombre de traceurs auxquels on applique la physique
55c      INTEGER  nbapp_cloud, i_app_cloud
56      real  pdtphys  ! pas d'integration pour la physique (seconde)
57      real  lat(n_lon), lat_local(n_lon)
58      real  lon(n_lon), lon_local(n_lon)
59      real  temp(n_lon,n_lev) ! temp
60      real  trac(n_lon,n_lev,nqmax) ! traceur
61      real  pplev(n_lon,n_lev)  ! pression pour le mileu de chaque couche (en Pa)
62      real  lon_sun
63      logical debutphy       ! le flag de l'initialisation de la physique
64c      character*7 modname
65
66C
67C----------------------------------------------------------------------------
68C     Model cloud:
69C     Aerosol and PSC variables:
70      real  NBRTOT_droplet(n_lon,n_lev)
71      real  W_H2SO4(n_lon,n_lev)
72      real  W_H2O(n_lon,n_lev)
73      real  rho(n_lon,n_lev)
74C----------------------------------------------------------------------------
75C----------------------------------------------------------------------------
76C     Time variables:
77      REAL, save :: dT_cloud
78C----------------------------------------------------------------------------   
79C----------------------------------------------------------------------------
80C     Auxilary variables:
81 
82      REAL mrtwv,mrtsa,mrwv,mrsa,
83     +     ppwv, psatwv,
84     +     ps_sa,satps_sa
85C    ps_sa: satur pressure pure SA
86C    satps_sa: satur pres over mixture in dyne/cm2=Pa/10
87C----------------------------------------------------------------------------
88       
89C Variables liees a l'ecriture de la bande histoire : phytrac.nc
90 
91      logical ok_sync
92      parameter (ok_sync = .true.)
93
94c      modname = 'phytrac'
95
96c      PRINT*,'DEBUT subroutine PHYTRAC'
97
98c----------------------------------
99c debutphy: Initiation des traceurs
100c----------------------------------
101
102      if (debutphy) then
103         
104      PRINT*,'PRECISION REAL'
105      PRINT*,precision(NBRTOT_droplet(1,1)), range(NBRTOT_droplet(1,1))
106     
107         if (n_lon .EQ. 1) then           
108         PRINT*,'n_lon 1D: ',n_lon
109         end if
110                 
111c         if ((n_lon .GT. 1) .AND. ok_chem) then
112c !!! DONC 3D !!!       
113c           CALL chemparam_ini()
114c         endif
115         
116c         if ((n_lon .GT. 1) .AND. ok_cloud) then
117c !!! DONC 3D !!!
118c         CALL cloud_ini(n_lon,n_lev)
119c         endif
120           
121         IF (reinit_trac) THEN
122         PRINT*,'REINIT MIXING RATIO TRACEURS'
123
124c       =============================================================
125c                                       Passage de Rm à Rv
126c       =============================================================
127c     Necessaire si on reprend les start.nc qui sont en MMR
128      DO iq=1,nqmax
129      trac(:,:,iq)=trac(:,:,iq)*RMD/M_tr(iq)
130      END DO
131c       =============================================================
132         
133     
134c=============================================================
135c               Initialisation des profils traceurs en Rv
136c=============================================================
137         trac(:,:,:)=1.0d-30
138     
139         trac(:,:,i_co2)=0.965d0 * RMD / M_tr(i_co2)
140
141         trac(:,:,i_co)=25.0d-6
142
143 
144      trac(:,:,i_h2so4)=1.0d-21
145      trac(:,:,i_h2o)=1.0d-21
146
147c     !!! SANS NUAGE !!!       
148c        trac(:,1:29,i_ocs)=1.0d-6
149c        trac(:,29:40,i_ocs)=1.0e-9
150c       trac(:,:,i_so2)=1.d-6
151c       trac(:,:,i_h2o)=1.0d-6
152
153c     !!! AVEC NUAGE !!!
154         trac(:,1:20,i_ocs)=3.d-6
155
156            DO i=21,26
157            trac(:,i,i_ocs)=trac(:,i-1,i_ocs)-0.3d-6
158            END DO
159       
160c       DO i=21,30
161c       trac(:,i,i_ocs)=trac(:,i-1,i_ocs)-0.3d-6
162c       END DO
163       
164         trac(:,1:26,i_hcl)=0.2d-6
165
166c      trac(:,:,i_hcl)=0.2d-6
167
168c       Initialisation SO2 Bertaux et De Bergh 2007 JGR
169c         trac(:,1:26,i_so2)=20.d-6
170c            DO i=2,20
171c            trac(:,i,i_so2)=trac(:,i-1,i_so2)+(100./19.)*0.25d-6
172c            END DO
173c            DO i=21,22
174c            trac(:,i,i_so2)=trac(:,i-1,i_so2)-(100./9.)*0.25d-6
175c            END DO
176
177c       DO i=21,29
178c       trac(:,i,i_so2)=trac(:,i-1,i_so2)-(100./9.)*1d-6
179c       END DO
180
181c      trac(:,1:30,i_so2)= 100.0d-6
182c       trac(:,30,i_so2)=20.0d-6
183c      trac(:,31,i_so2)=10.0d-6
184c      trac(:,32,i_so2)=1.0d-6
185c      trac(:,33,i_so2)=0.1d-6
186c      trac(:,34:42,i_so2)=0.02d-6
187c      trac(:,43:46,i_so2)=0.07d-6
188c      trac(:,47:50,i_so2)=0.05d-6
189
190c      trac(:,1:28,i_h2o)=30.0d-6
191c      trac(:,29:50,i_h2o)=5.0d-6
192      trac(:,15:50,i_h2o)=10.0d-6
193c      trac(:,15:35,i_h2so4)=17.0d-6
194c       DO i=23,35
195c       trac(:,i,i_h2o)=(3.d-6-30.0d-6)/12.0*(-23.0+i)+trac(:,22,i_h2o)
196c       END DO
197c       trac(:,36:50,i_h2o)=3.0d-6
198       
199      trac(:,15:50,i_h2so4)=20.0d-6
200c      trac(:,29:50,i_h2so4)=1.0d-9
201c      trac(:,1:10,i_h2)=1.0d-10
202c      trac(:,11:20,i_h2)=1.0d-9
203c      trac(:,21:35,i_h2)=1.0d-8
204c      trac(:,36:50,i_h2)=1.0d-7     
205   
206c=============================================================
207     
208c       =============================================================
209c                                       Passage de Rv à Rm
210c       =============================================================
211         DO iq=1,nqmax
212         trac(:,:,iq)=trac(:,:,iq)*M_tr(iq)/RMD
213         END DO
214c       =============================================================
215
216c       Ecriture fichier initialisation
217c       PRINT*,'Ecriture Initial_State.csv'
218c       OPEN(88,file='Initial_State.csv',
219c     & form='formatted')
220     
221c      DO ilon=1,n_lon
222c        DO ilev=1,n_lev
223c        WRITE(88,"(36(e15.8,','))") R_MEDIAN(ilon,ilev),
224c     &  STDDEV(ilon,ilev),trac(ilon,ilev,1:nqmax)
225c        ENDDO
226c      ENDDO
227c      PRINT*,'FIN Ecriture Initial_State.csv'
228     
229         ENDIF  !FIN REINIT TRAC
230       
231c-------------
232c fin debutphy
233c-------------
234      ENDIF  ! fin debutphy
235
236c       =============================================================
237c                                       Passage de Rm à Rv
238c       =============================================================
239      DO iq=1,nqmax
240      trac(:,:,iq)=trac(:,:,iq)*RMD/M_tr(iq)
241      END DO
242c       =============================================================
243
244
245c=============================================================
246c                       Boucle sur les lon, lat (n_lon)
247c=============================================================
248c      PRINT*, 'gmtime', gmtime*RDAY
249c      PRINT*, 'RDAY', RDAY
250     
251      lon_sun = (0.5 - gmtime) * 2.0 * RPI
252      lon_local = lon * RPI/180.0d0
253      lat_local = lat * RPI/180.0d0
254       
255      DO ilon=1, n_lon
256
257c     calcul sza_local pour obtenir des sza_local > 90, utile pour la chimie
258      sza_local = acos(cos(lat_local(ilon))*cos(lon_local(ilon))*
259     & cos(lon_sun) + cos(lat_local(ilon))*sin(lon_local(ilon))
260     & *sin(lon_sun))* 180.0d0/RPI
261     
262c      PRINT*,'sza_local :', sza_local
263
264         IF (ok_cloud) THEN
265c      PRINT*,'DEBUT CLOUD'
266               
267      dT_cloud=pdtphys
268     
269     
270c      nbapp_cloud=NINT(pdtphys/dT_cloud)
271c      PRINT*,'pdtphys',pdtphys
272c      PRINT*,'nbapp_cloud',nbapp_cloud
273c       =============================================================
274c                        Appel Microphysique (sans nucleation)
275c                  Volume Mixing Ratio
276c       =============================================================
277
278c      FIXE un profil de temperature def dans fichier temp
279      if (n_lon .EQ. 1) then
280      OPEN(13,file='temp',status='old',form='formatted')
281      DO ilev=1,n_lev
282        READ (13,*) temp(n_lon,ilev)
283      ENDDO
284      CLOSE(13)
285      endif
286                 
287      DO ilev=1, n_lev
288c      PRINT*,'DEBUT INIT CALL CLOUD'
289c     ppwv et pplev en Pa
290       
291c      PRINT*,'@@@@ IN CLOUD @@@@'     
292     
293c     On remet tout le RM liq dans la partie gaz
294c     !!! On reforme un nuage à chaque fois !!!
295         
296      mrtwv=trac(ilon,ilev,i_h2o) + trac(ilon,ilev,i_h2oliq)
297      mrtsa=trac(ilon,ilev,i_h2so4) + trac(ilon,ilev,i_h2so4liq)
298      mrwv=mrtwv
299      mrsa=mrtsa
300     
301
302c     !!! Remise a zero !!!
303        W_H2SO4(ilon,ilev)=0.0d0
304        W_H2O(ilon,ilev)=0.d0
305        rho(ilon,ilev)=0.0d0
306        NBRTOT_droplet(ilon,ilev)=0.d0
307        satps_sa=0.d0
308        ps_sa=0.d0
309       
310c       pression partielle H2O       
311      ppwv=pplev(ilon,ilev) * mrwv
312
313c     Pression saturante de vapeur d'eau, tirée du code d'Anni
314      psatwv=EXP(77.344913 - 7235.4247/temp(ilon,ilev)
315     & - 8.2*DLOG(temp(ilon,ilev)) + 0.0057113*temp(ilon,ilev))
316     
317c      PRINT*,'DEBUT CALL CLOUD'
318
319c       Ne pas passer par la routine des nuages si on a des valeurs proches de 0 ?
320c       Empeche de foirer en parallèle ?
321
322           
323      CALL new_cloud_venus(dT_cloud,
324     e NBRTOT_droplet(ilon,ilev),
325     e R_MEDIAN(ilon,ilev),STDDEV(ilon,ilev),
326     e temp(ilon,ilev),pplev(ilon,ilev),
327     e ppwv,
328     e mrwv,mrsa,
329     e ilev,
330     e mrtwv,mrtsa,
331     e W_H2SO4(ilon,ilev),
332     e ps_sa,satps_sa,
333     e rho(ilon,ilev))
334           
335c      END DO
336   
337c       =========================================               
338c       Actualisation des mixing ratio liq et gaz
339c       =========================================
340c       Si la routine new_cloud_venus n'a pas actualisé mrwv et mrsa
341c       on a alors bien mr=mrt pour sa et wv, donc les parties liq sont=0 hors du nuage
342c       ou si on ne condense pas
343
344c      PRINT*,'DEBUT ACTUALISATION OUTPUT CLOUD'
345c    si tout se passe bien, mrtwv et mrtsa ne changent pas
346     
347      trac(ilon,ilev,i_h2o) = mrwv
348      trac(ilon,ilev,i_h2oliq) = mrtwv - trac(ilon,ilev,i_h2o)
349     
350      trac(ilon,ilev,i_h2so4) = mrsa
351      trac(ilon,ilev,i_h2so4liq) = mrtsa - trac(ilon,ilev,i_h2so4)
352       
353c      ENDIF
354     
355     
356      IF (n_lon .EQ. 1) THEN   
357      WRITE(66,"(i4,','11(e15.8,','))") ilev,temp(ilon,ilev),
358     & pplev(ilon,ilev),ps_sa,satps_sa,NBRTOT_droplet(ilon,ilev),
359     & W_H2SO4(ilon,ilev),trac(ilon,ilev,i_h2oliq),
360     & trac(ilon,ilev,i_h2so4liq),mrwv,mrsa,trac(ilon,ilev,i_so2)
361      ENDIF
362
363      END DO
364
365c       =============================================================
366c      PRINT*,'FIN CLOUD'
367      ENDIF
368     
369      IF (ok_chem) THEN
370c      PRINT*,"vmr SO2 ht atmo: ",trac(1,50,i_so2)
371c      PRINT*,'DEBUT CHEMISTRY'
372c       =============================================================
373c                                       Appel Photochimie
374c       =============================================================
375c     Pression en hPa => pplev/100.
376       
377      CALL new_photochemistry_venus(n_lev, n_lon, pdtphys,
378     e                         pplev(ilon,:)/100.,
379     e                         temp(ilon,:),
380     e                         trac(ilon,:,:),
381     e                         sza_local, nqmax)
382c       =============================================================
383c      PRINT*,'FIN CHEMISTRY'
384c      PRINT*,"vmr SO2 ht atmo: ",trac(1,50,i_so2)
385     
386        END IF
387
388      END DO
389c       =============================================================
390c                                       Passage de Rv à Rm
391c       =============================================================
392        DO iq=1,nqmax
393                trac(:,:,iq)=trac(:,:,iq)*M_tr(iq)/RMD
394        END DO
395c       =============================================================   
396
397c      PRINT*,'FIN PHYTRAC'
398      RETURN
399      END
Note: See TracBrowser for help on using the repository browser.