source: trunk/LMDZ.VENUS/libf/phyvenus/nirco2abs.F @ 2487

Last change on this file since 2487 was 2464, checked in by slebonnois, 4 years ago

SL: major update related to extension to 250 km. New EUV heating as used in Martian GCM, debug of a few routines, adding He, clean up, updating mmean regularly, modification of the order of processes, add the possibility to use Hedin composition in rad transfer

File size: 9.8 KB
Line 
1      SUBROUTINE nirco2abs(nlon,nlev,nplay,dist_sol,nq,pq,
2     $     mu0,fract,pdtnirco2)
3
4       use dimphy
5       use geometry_mod, only: longitude_deg, latitude_deg
6       use chemparam_mod, only: i_co2, i_o
7c       use compo_hedin83_mod2
8
9
10       IMPLICIT NONE
11c=======================================================================
12c   subject:
13c   --------
14c   Computing heating rate due to
15c   absorption by CO2 in the near-infrared
16c   This version includes NLTE effects
17c
18c   (Scheme to be described in Forget et al., JGR, 2003)
19c   (old Scheme described in Forget et al., JGR, 1999)
20c
21c   This version updated with a new functional fit,
22c   see NLTE correction-factor of Lopez-Valverde et al (1998)
23c   Stephen Lewis 2000
24c
25c   apr 2019 d.quirino   Improving NLTE params, SOIR/SPICAV Temp comparison
26c   oct 2014 g.gilli     Coupling with photochemical model
27C   jan 2014 g.gilli     Revision (following martian non-lte param)   
28C   jun 2013 l.salmi     First adaptation to Venus and NIR NLTE param
29c   jul 2011 malv+fgg    New corrections for NLTE implemented
30c   08/2002 : correction for bug when running with diurnal=F
31c
32c   author:  Frederic Hourdin 1996
33c   ------
34c            Francois Forget 1999
35c
36c   input:
37c   -----
38c   nlon                 number of gridpoint of horizontal grid
39c   nlev                Number of layer
40c   dist_sol              sun-Venus distance (AU)
41c   mu0(nlon)         
42c   fract(nlon)        day fraction of the time interval
43c   declin                latitude of subslar point
44c
45c   output:
46c   -------
47c
48c   pdtnirco2(nlon,nlev)      Heating rate (K/sec)
49c
50c
51c=======================================================================
52c
53c    0.  Declarations :
54c    ------------------
55c
56
57#include "YOMCST.h"
58#include "clesphys.h"
59c#include "comdiurn.h"
60#include "nirdata.h"
61c#include "tracer.h"
62#include "mmol.h"
63c-----------------------------------------------------------------------
64c    Input/Output
65c    ------------
66      integer,intent(in) :: nlon ! number of (horizontal) grid points
67      integer,intent(in) :: nlev ! number of atmospheric layers
68
69      real,intent(in) :: nplay(nlon,nlev) ! Pressure
70      real,intent(in) :: dist_sol ! Sun-Venus distance (in AU)
71      integer,intent(in) :: nq ! number of tracers
72      real,intent(in) :: pq(nlon,nlev,nq) ! mass mixing ratio tracers
73      real,intent(in) :: mu0(nlon) ! solar angle
74      real,intent(in) :: fract(nlon) ! day fraction of the time interval
75c      real,intent(in) :: declin ! latitude of sub-solar point
76      real :: co2vmr_gcm(nlon,nlev), o3pvmr_gcm(nlon,nlev)
77 
78      real,intent(out) :: pdtnirco2(nlon,nlev) ! heating rate (K/sec)
79
80c
81c    Local variables :
82c    -----------------
83      INTEGER l,ig, n, nstep,i
84      REAL co2heat0, zmu(nlon)
85
86c     special diurnal=F
87      real mu0_int(nlon),fract_int(nlon),zday_int
88      real ztim1,ztim2,ztim3,step
89
90c
91c   local saved variables
92c   ---------------------
93      logical,save :: firstcall=.true.
94      integer,save :: ico2=0 ! index of "co2" tracer
95      integer,save :: io=0 ! index of "o" tracer
96
97cccc     parameters for CO2 heating fit
98c
99c     n_a  =  heating rate for Venusian day at p0, r0, mu =0 [K day-1]
100c     Here p0 = p_cloud top [Pa]
101c     n_p0 = is a pressure below which non LTE effects are significant [Pa]
102c     n_a Solar heating [K/Eday] at the cloud top, taken from Crisps table     
103 
104      real n_a, n_p0, n_b, p_ctop
105
106   
107cc "Nominal" values used in Gilli+2'17
108c       parameter (n_a = 18.13/86400.0)     !c     K/Eday  ---> K/sec   
109c       parameter (p_ctop=13.2e2)
110c       parameter (n_p0=0.008)
111
112cc "New" values used to improve SPICAV/SOIR Temperature comparision (D.Quirino)
113       parameter (n_a = 15.92/86400.0)     !c     K/Eday  ---> K/sec   
114       parameter (p_ctop=19.85e2)
115       parameter (n_p0=0.1) 
116       parameter (n_b=1.362)
117
118c    -- NLTE Param v2  --
119C       parameter (n_p0=0.01) 
120c       parameter (n_b = 1.3)
121   
122
123c     Variables added to implement NLTE correction factor (feb 2011)
124      real    pyy(nlev)
125      real    cor1(nlev),oldoco2(nlev),alfa2(nlev)
126      real    p2011,cociente1,merge
127      real    cor0,oco2gcm
128!!!!
129c      real :: pic27(nlon,nlev), pic27b(nlon,nlev)
130c      real :: pic43(nlon,nlev), picnir(nlon,nlev)
131
132c     co2heat is the heating by CO2 at p_ctop=13.2e2 for a zero zenithal angle.
133
134      co2heat0=n_a*(0.72/dist_sol)**2     
135
136CCCCCC   TEST: reduce by X% nir Heating
137c      co2heat0  = co2heat0 * 0.8
138
139c----------------------------------------------------------------------
140     
141c     Initialisation
142c     --------------
143      if (firstcall) then
144        if (nircorr.eq.1) then
145c          ! we will need co2 and o tracers
146          ico2= i_co2
147          if (ico2==0) then
148            write(*,*) "nirco2abs error: I need a CO2 tracer"
149            write(*,*) "     when running with nircorr==1"
150           stop
151          endif
152          io=i_o
153          if (io==0) then
154            write(*,*) "nirco2abs error: I need an O tracer"
155            write(*,*) "     when running with nircorr==1"
156            stop
157          endif
158        endif
159        firstcall=.false.
160      endif
161
162     
163c     
164c     Simple calcul for a given sun incident angle (if cycle_diurne=T)
165c     --------------------------------------------
166
167      IF (cycle_diurne) THEN 
168
169         do ig=1,nlon   
170            zmu(ig)=sqrt(1224.*mu0(ig)*mu0(ig)+1.)/35.
171
172           
173            if(nircorr.eq.1) then
174               do l=1,nlev
175                  pyy(l)=nplay(ig,l)
176               enddo
177
178               call interpnir(cor1,pyy,nlev,corgcm,pres1d,npres)
179               call interpnir(oldoco2,pyy,nlev,oco21d,pres1d,npres)
180               call interpnir(alfa2,pyy,nlev,alfa,pres1d,npres)
181               
182            endif
183
184            do l=1,nlev
185     
186c           Calculations for the O/CO2 correction
187               if(nircorr.eq.1) then
188                  cor0=1./(1.+n_p0/nplay(ig,l))**n_b
189                  if(pq(ig,l,ico2) .gt. 1.e-6) then
190                     oco2gcm=pq(ig,l,io)/pq(ig,l,ico2)
191                     ! handle the rare cases when pq(ig,l,io)<0
192                     if (pq(ig,l,io).lt.0) then
193                       write(*,*) "nirco2abs: warning ig=",ig," l=",l,
194     &                            " pq(ig,l,io)=",pq(ig,l,io)
195                       oco2gcm=1.e6
196                     endif
197                  else
198                     oco2gcm=1.e6
199                  endif
200                  cociente1=oco2gcm/oldoco2(l)
201                 
202c                  WRITE(*,*) "nirco2abs line 211", l, cociente1
203
204                  merge=alog10(cociente1)*alfa2(l)+alog10(cor0)*
205     $                 (1.-alfa2(l))
206                  merge=10**merge
207                  p2011=sqrt(merge)*cor0
208
209               else if (nircorr.eq.0) then
210                  p2011=1.
211                  cor1(l)=1.
212               endif
213
214              if(fract(ig).gt.0.) pdtnirco2(ig,l)=
215     &             co2heat0*sqrt((p_ctop*zmu(ig))/nplay(ig,l))
216     &             /(1.+n_p0/nplay(ig,l))**n_b
217c           Corrections from tabulation
218     $              * cor1(l) * p2011
219             
220          enddo
221         enddo
222         
223c     Averaging over diurnal cycle (if diurnal=F)
224c     -------------------------------------------
225c     NIR CO2 abs is slightly non linear. To remove the diurnal
226c     cycle, it is better to average the heating rate over 1 day rather
227c     than using the mean mu0 computed by mucorr in physiq.F (FF, 1998)
228
229      ELSE      ! if (.not.diurnal) then
230         nstep = 20    ! number of integration step /sol
231         do n=1,nstep
232
233            zday_int = (n-1)/float(nstep)
234
235            CALL zenang(0.,zday_int,RDAY/nstep,
236     &                  latitude_deg,longitude_deg,
237     &                  mu0_int,fract_int)
238
239            do ig=1,nlon
240               zmu(ig)=sqrt(1224.*mu0_int(ig)*mu0_int(ig)+1.)/35.
241
242               if(nircorr.eq.1) then
243                  do l=1,nlev
244                     pyy(l)=nplay(ig,l)
245                  enddo
246                 call interpnir(cor1,pyy,nlev,corgcm,pres1d,npres)
247                 call interpnir(oldoco2,pyy,nlev,oco21d,pres1d,npres)
248                 call interpnir(alfa2,pyy,nlev,alfa,pres1d,npres)
249               endif
250c
251
252               do l=1,nlev
253c           Calculations for the O/CO2 correction
254               if(nircorr.eq.1) then
255                  cor0=1./(1.+n_p0/nplay(ig,l))**n_b
256                  oco2gcm=pq(ig,l,io)/pq(ig,l,ico2)
257                  cociente1=oco2gcm/oldoco2(l)
258                  merge=alog10(cociente1)*alfa2(l)+alog10(cor0)*
259     $                 (1.-alfa2(l))
260                  merge=10**merge
261                  p2011=sqrt(merge)*cor0
262
263               else if (nircorr.eq.0) then
264                  p2011=1.
265                  cor1(l)=1.
266               endif
267
268               if(fract_int(ig).gt.0.) pdtnirco2(ig,l)=
269     &              pdtnirco2(ig,l) + (1/float(nstep))*
270     &              co2heat0*sqrt((p_ctop*zmu(ig))/nplay(ig,l))
271     &              /(1.+n_p0/nplay(ig,l))**n_b
272!     Corrections from tabulation
273     $              * cor1(l) * p2011
274
275               enddo
276            enddo
277         end do
278     
279
280      END IF 
281
282      return
283      end
284
285     
286      subroutine interpnir(escout,p,nlev,escin,pin,nl)
287C
288C subroutine to perform linear interpolation in pressure from 1D profile
289C escin(nl) sampled on pressure grid pin(nl) to profile
290C escout(nlev) on pressure grid p(nlev).
291C
292      real escout(nlev),p(nlev)
293      real escin(nl),pin(nl),wm,wp
294      integer nl,nlev,n1,n,nm,np
295      do n1=1,nlev
296         if(p(n1) .gt. 1500. .or. p(n1) .lt. 1.0e-13) then
297c            escout(n1) = 0.0
298            escout(n1) = 1.e-15
299         else
300            do n = 1,nl-1
301               if (p(n1).le.pin(n).and.p(n1).ge.pin(n+1)) then
302                  nm=n
303                  np=n+1
304                  wm=abs(pin(np)-p(n1))/(pin(nm)-pin(np))
305                  wp=1.0 - wm
306               endif
307            enddo
308            escout(n1) = escin(nm)*wm + escin(np)*wp
309         endif
310      enddo
311      return
312      end
Note: See TracBrowser for help on using the repository browser.