source: trunk/LMDZ.PLUTO/libf/phypluto/aeropacity.F90 @ 3572

Last change on this file since 3572 was 3572, checked in by debatzbr, 3 weeks ago

Remove generic_aerosols and generic_condensation, along with their related variables (useless). RENAME THE VARIABLE AEROHAZE TO OPTICHAZE.

File size: 6.0 KB
RevLine 
[3184]1module aeropacity_mod
2
3implicit none
4
5contains
6
7      Subroutine aeropacity(ngrid,nlayer,nq,pplay,pplev,pt, pq, &
[3572]8         aerosol,reffrad,nueffrad, QREFvis3d,QREFir3d,tau_col)
[3184]9
10       use radinc_h, only : L_TAUMAX,naerkind
[3572]11       use aerosol_mod, only: iaero_haze, i_haze
[3184]12       USE tracer_h, only: noms,rho_n2,rho_ice,rho_q,mmol
13       use comcstfi_mod, only: g, pi, mugaz, avocado
14       use geometry_mod, only: latitude
[3572]15       use callkeys_mod, only: kastprof
[3184]16       implicit none
17
18!==================================================================
[3195]19!
[3184]20!     Purpose
21!     -------
22!     Compute aerosol optical depth in each gridbox.
[3195]23!
[3184]24!     Authors
[3195]25!     -------
[3184]26!     F. Forget
[3195]27!     F. Montmessin (water ice scheme)
[3184]28!     update J.-B. Madeleine (2008)
29!     dust removal, simplification by Robin Wordsworth (2009)
30!     Generic n-layer aerosol - J. Vatant d'Ollone (2020)
31!     Radiative Generic Condensable Species - Lucas Teinturier (2022)
32!
33!     Input
[3195]34!     -----
[3184]35!     ngrid             Number of horizontal gridpoints
36!     nlayer            Number of layers
37!     nq                Number of tracers
38!     pplev             Pressure (Pa) at each layer boundary
39!     pq                Aerosol mixing ratio
40!     reffrad(ngrid,nlayer,naerkind)         Aerosol effective radius
41!     QREFvis3d(ngrid,nlayer,naerkind) \ 3d extinction coefficients
42!     QREFir3d(ngrid,nlayer,naerkind)  / at reference wavelengths
43!
44!     Output
45!     ------
46!     aerosol            Aerosol optical depth in layer l, grid point ig
47!     tau_col            Total column optical depth at grid point ig
48!
49!=======================================================================
50
51      INTEGER,INTENT(IN) :: ngrid  ! number of atmospheric columns
52      INTEGER,INTENT(IN) :: nlayer ! number of atmospheric layers
53      INTEGER,INTENT(IN) :: nq     ! number of tracers
54      REAL,INTENT(IN) :: pplay(ngrid,nlayer) ! mid-layer pressure (Pa)
55      REAL,INTENT(IN) :: pplev(ngrid,nlayer+1) ! inter-layer pressure (Pa)
56      REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! tracers (.../kg_of_air)
57      REAL,INTENT(IN) :: pt(ngrid,nlayer) ! mid-layer temperature (K)
58      REAL,INTENT(OUT) :: aerosol(ngrid,nlayer,naerkind) ! aerosol optical depth
59      REAL,INTENT(IN) :: reffrad(ngrid,nlayer,naerkind) ! aerosol effective radius
60      REAL,INTENT(IN) :: nueffrad(ngrid,nlayer,naerkind) ! aerosol effective variance
61      REAL,INTENT(IN) :: QREFvis3d(ngrid,nlayer,naerkind) ! extinction coefficient in the visible
62      REAL,INTENT(IN) :: QREFir3d(ngrid,nlayer,naerkind)
63      REAL,INTENT(OUT):: tau_col(ngrid) !column integrated visible optical depth
64
65      real aerosol0, obs_tau_col_aurora, pm
66      real pcloud_deck, cloud_slope
67
68      real dp_strato(ngrid)
69      real dp_tropo(ngrid)
70      real dp_layer(ngrid)
71
72      INTEGER l,ig,iq,iaer,ia
73
74      LOGICAL,SAVE :: firstcall=.true.
75!$OMP THREADPRIVATE(firstcall)
76      REAL CBRT
77      EXTERNAL CBRT
78
79      INTEGER,SAVE :: i_n2ice=0      ! n2 ice
80!$OMP THREADPRIVATE(i_n2ice)
81      CHARACTER(LEN=20) :: tracername ! to temporarily store text
82
83      real CLFtot
[3275]84      integer igen_ice,igen_gas ! to store the index of generic tracer
[3184]85      logical dummy_bool ! dummy boolean just in case we need one
86      !  for venus clouds
87      real      :: p_bot,p_top,h_bot,h_top,mode_dens,h_lay
88
89      ! identify tracers
90      IF (firstcall) THEN
91        ia =0
92        write(*,*) "Tracers found in aeropacity:"
93        do iq=1,nq
94          tracername=noms(iq)
95          if (tracername.eq."n2_ice") then
96            i_n2ice=iq
97          write(*,*) "i_n2ice=",i_n2ice
98
99          endif
100        enddo
101
102        firstcall=.false.
103      ENDIF ! of IF (firstcall)
104
105
106!     ---------------------------------------------------------
107!==================================================================
[3195]108!    Haze aerosols
[3184]109!==================================================================
110
[3195]111      if (iaero_haze.ne.0) then
112        iaer=iaero_haze
[3184]113!       1. Initialization
[3195]114         aerosol(1:ngrid,1:nlayer,iaer)=0.0
[3184]115!       2. Opacity calculation
[3195]116         DO ig=1, ngrid
117               DO l=1,nlayer-1 ! to stop the rad tran bug
118                  ! if fractal, radius doit etre equivalent sphere radius
119                  aerosol0 =                         &
120                       (  0.75 * QREFvis3d(ig,l,iaer) /        &
121                       ( rho_q(i_haze) * reffrad(ig,l,iaer) )  ) *   &
122                       ( pq(ig,l,i_haze) + 1.E-10 ) *         &
123                       ( pplev(ig,l) - pplev(ig,l+1) ) / g
124                  aerosol0           = max(aerosol0,1.e-10)
125                  aerosol0           = min(aerosol0,L_TAUMAX)
126                  aerosol(ig,l,iaer) = aerosol0
[3184]127               ENDDO
128         ENDDO
[3195]129         !QREF est le meme dans toute la colonne par def si size uniforme
130         !print*, 'TB17: QREFvis3d=',QREFvis3d(1,:,1)
131         !print*, 'TB17: rho_q=',rho_q(i_haze)
132         !print*, 'TB17: reffrad=',reffrad(1,:,1)
133         !print*, 'TB17: pq=',pq(1,:,i_haze)
134         !print*, 'TB17: deltap=',pplev(1,1) - pplev(1,nlayer)
135   end if ! if haze aerosols
[3184]136
137! --------------------------------------------------------------------------
138! Column integrated visible optical depth in each point (used for diagnostic)
139
[3195]140   tau_col(:)=0.0
141   do iaer = 1, naerkind
142      do l=1,nlayer
143         do ig=1,ngrid
144            tau_col(ig) = tau_col(ig) + aerosol(ig,l,iaer)
[3184]145         end do
146      end do
[3195]147   end do
[3184]148
[3195]149   do ig=1,ngrid
150      do l=1,nlayer
151         do iaer = 1, naerkind
152            if(aerosol(ig,l,iaer).gt.1.e3)then
153               print*,'WARNING: aerosol=',aerosol(ig,l,iaer)
154               print*,'at ig=',ig,',  l=',l,', iaer=',iaer
155               print*,'QREFvis3d=',QREFvis3d(ig,l,iaer)
156               print*,'reffrad=',reffrad(ig,l,iaer)
157            endif
158         end do
159      end do
160   end do
[3184]161
[3195]162   do ig=1,ngrid
163      if(tau_col(ig).gt.1.e3)then
164         print*,'WARNING: tau_col=',tau_col(ig)
165         print*,'at ig=',ig
166         print*,'aerosol=',aerosol(ig,:,:)
167         print*,'QREFvis3d=',QREFvis3d(ig,:,:)
168         print*,'reffrad=',reffrad(ig,:,:)
169      endif
170   end do
171  end subroutine aeropacity
[3184]172
173end module aeropacity_mod
Note: See TracBrowser for help on using the repository browser.