Changeset 2050 for trunk/LMDZ.TITAN/libf/phytitan
- Timestamp:
- Nov 30, 2018, 12:55:49 AM (6 years ago)
- Location:
- trunk/LMDZ.TITAN/libf/phytitan
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.TITAN/libf/phytitan/callcorrk.F90
r2046 r2050 15 15 use callkeys_mod, only: global1d, szangle 16 16 use comcstfi_mod, only: pi, mugaz, cpp 17 use callkeys_mod, only: diurnal,tracer,seashaze, 17 use callkeys_mod, only: diurnal,tracer,seashaze,corrk_recombin, & 18 18 strictboundcorrk,specOLR 19 19 use geometry_mod, only: latitude … … 33 33 ! Emmanuel 01/2001, Forget 09/2001 34 34 ! Robin Wordsworth (2009) 35 ! Jan Vatant d'Ollone (2018) -> corrk recombining case 35 36 ! 36 37 !================================================================== … … 46 47 INTEGER,INTENT(IN) :: ngrid ! Number of atmospheric columns. 47 48 INTEGER,INTENT(IN) :: nlayer ! Number of atmospheric layers. 48 REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! Tracers (X/ m2).49 REAL,INTENT(IN) :: pq(ngrid,nlayer,nq) ! Tracers (X/kg). 49 50 INTEGER,INTENT(IN) :: nq ! Number of tracers. 50 51 REAL,INTENT(IN) :: qsurf(ngrid,nq) ! Tracers on surface (kg.m-2). … … 105 106 REAL*8 albv(L_NSPECTV) ! Spectral Visible Albedo. 106 107 107 INTEGER ig,l,k,nw 108 INTEGER ig,l,k,nw,iq,ip,ilay,it 109 110 LOGICAL found 108 111 109 112 real*8 taugsurf(L_NSPECTV,L_NGAUSS-1) … … 120 123 REAL*8 seashazefact(L_LEVELS) 121 124 125 ! For muphys optics 126 REAL*8 pqmo(ngrid,nlayer,nmicro) ! Tracers for microphysics optics (X/m2). 127 REAL*8 i2e(ngrid,nlayer) ! int 2 ext factor ( X.kg-1 -> X.m-2 for optics ) 128 129 ! For corr-k recombining 130 REAL*8 pqr(ngrid,L_PINT,L_REFVAR) ! Tracers for corr-k recombining (mol/mol). 131 REAL*8 fact, tmin, tmax 132 133 LOGICAL usept(L_PINT,L_NTREF) ! mask if pfref grid point will be used 134 INTEGER inflay(L_PINT) ! nearest inferior GCM layer for pfgasref grid points 135 122 136 !======================================================================= 123 137 ! I. Initialization on every call … … 130 144 end do 131 145 146 ! Convert (microphysical) tracers for optics: X.kg-1 --> X.m-2 147 ! NOTE: it should be moved somewhere else: calmufi performs the same kind of 148 ! computations... waste of time... 149 i2e(:,1:nlayer) = ( pplev(:,1:nlayer)-pplev(:,2:nlayer+1) ) / gzlat(:,1:nlayer) 150 pqmo(:,:,:) = 0.0 151 DO iq=1,nmicro 152 pqmo(:,:,iq) = pq(:,:,iq)*i2e(:,:) 153 ENDDO 154 155 ! Default value for fixed species for whom vmr has been taken 156 ! into account while computing high-resolution spectra 157 if (corrk_recombin) pqr(:,:,:) = 1.0 132 158 133 159 !----------------------------------------------------------------------- 134 160 do ig=1,ngrid ! Starting Big Loop over every GCM column 135 161 !----------------------------------------------------------------------- 136 162 163 ! Recombine reference corr-k if needed 164 if (corrk_recombin) then 165 166 ! NB : To have decent CPU time recombining is not done on all gridpoints and wavelenghts but we 167 ! calculate a gasi/v_recomb variable on the reference corrk-k T,P grid (only for T,P values 168 ! who match the atmospheric conditions ) which is then processed as a standard pre-mix in 169 ! optci/v routines, but updated every time tracers on the ref P grid have varied > 1%. 170 171 ! Extract tracers for variable radiative species 172 ! Also find the nearest GCM layer under each ref pressure 173 do ip=1,L_PINT 174 175 ilay=0 176 found = .false. 177 do l=1,nlayer 178 if ( pplay(ig,l) .gt. 10.0**(pfgasref(ip)+2.0) ) then ! pfgasref=log(p[mbar]) 179 found=.true. 180 ilay=l 181 endif 182 enddo 183 184 if (.not. found ) then ! set to min 185 do iq=1,L_REFVAR 186 if ( radvar_mask(iq) ) then 187 pqr(ig,ip,iq) = pq(ig,1,radvar_indx(iq)) / rat_mmol(radvar_indx(iq)-nmicro) ! mol/mol 188 endif 189 enddo 190 else 191 if (ilay==nlayer) then ! set to max 192 do iq=1,L_REFVAR 193 if ( radvar_mask(iq) ) then 194 pqr(ig,ip,iq) = pq(ig,nlayer,radvar_indx(iq)) / rat_mmol(radvar_indx(iq)-nmicro) ! mol/mol 195 endif 196 enddo 197 else ! standard 198 fact = ( 10.0**(pfgasref(ip)+2.0) - pplay(1,ilay+1) ) / ( pplay(1,ilay) - pplay(1,ilay+1) ) ! pfgasref=log(p[mbar]) 199 do iq=1,L_REFVAR 200 if ( radvar_mask(iq) ) then 201 pqr(ig,ip,iq) = pq(ig,ilay,radvar_indx(iq))**fact * pq(ig,ilay+1,radvar_indx(iq))**(1.0-fact) 202 pqr(ig,ip,iq) = pqr(ig,ip,iq) / rat_mmol(radvar_indx(iq)-nmicro) ! mol/mol 203 endif 204 enddo 205 endif ! if ilay==nlayer 206 endif ! if not found 207 208 inflay(ip) = ilay 209 210 enddo ! ip=1,L_PINT 211 212 ! NB : The following usept is a trick to call recombine only for the reference T-P 213 ! grid points that are useful given the temperature range at this altitude 214 ! It saves a looot of time - JVO 18 215 usept(:,:) = .true. 216 do ip=1,L_PINT-1 217 if ( inflay(ip+1)==nlayer ) then 218 usept(ip,:) = .false. 219 endif 220 if ( inflay(ip) == 0 ) then 221 usept(ip+1:,:) = .false. 222 endif 223 if ( usept(ip,1) ) then ! if not all false 224 tmin = minval(pt(ig,min(inflay(ip+1)+1,nlayer):max(inflay(ip),1))) 225 tmax = maxval(pt(ig,min(inflay(ip+1)+1,nlayer):max(inflay(ip),1))) 226 do it=1,L_NTREF-1 227 if ( tgasref(it+1) .lt. tmin ) then 228 usept(ip,it) = .false. 229 endif 230 enddo 231 do it=2,L_NTREF 232 if ( tgasref(it-1) .gt. tmax ) then 233 usept(ip,it) = .false. 234 endif 235 enddo 236 ! in case of out-of-bounds 237 if ( tgasref(1) .lt. tmin ) usept(ip,1) = .true. 238 if ( tgasref(L_NTREF) .gt. tmax ) usept(ip,L_NTREF) = .true. 239 endif 240 enddo ! ip=1,L_PINT-1 241 ! deal with last bound 242 if ( inflay(L_PINT-1).ne.0 ) usept(L_PINT,:) = usept(L_PINT-1,:) 243 244 245 do ip=1,L_PINT 246 247 ! Recombine k at (useful only!) reference T-P values if tracers or T have enough varied 248 do it=1,L_NTREF 249 250 if ( usept(ip,it) .eqv. .false. ) cycle 251 252 do l=1,L_REFVAR 253 if ( abs( (pqr(ig,ip,l) - pqrold(ip,l)) / max(1.0e-30,pqrold(ip,l))) .GT. 0.01 & ! +- 1% 254 .or. ( useptold(ip,it) .eqv. .false. ) ) then ! in case T change but not the tracers 255 call recombin_corrk( pqr(ig,ip,:),ip,it ) 256 exit ! one is enough to trigger the update 257 endif 258 enddo 259 260 enddo 261 262 enddo ! ip=1,L_PINT 263 264 useptold(:,:)=usept(:,:) 265 266 endif ! if corrk_recombin 137 267 138 268 !======================================================================= … … 304 434 endif 305 435 306 call optcv(pq (ig,:,1:nmicro),nlayer,plevrad,tmid,pmid,&436 call optcv(pqmo(ig,:,:),nlayer,plevrad,tmid,pmid, & 307 437 dtauv,tauv,taucumv,wbarv,cosbv,tauray,taugsurf,seashazefact) 308 438 … … 346 476 !----------------------------------------------------------------------- 347 477 348 call optci(pq (ig,:,1:nmicro),nlayer,plevrad,tlevrad,tmid,pmid,&478 call optci(pqmo(ig,:,:),nlayer,plevrad,tlevrad,tmid,pmid, & 349 479 dtaui,taucumi,cosbi,wbari,taugsurfi,seashazefact) 350 480 … … 459 589 endif 460 590 461 ! See physiq.F for explanations about CLFvarying. This is temporary.462 591 if (lastcall) then 463 592 IF( ALLOCATED( gasi ) ) DEALLOCATE( gasi ) 464 593 IF( ALLOCATED( gasv ) ) DEALLOCATE( gasv ) 594 IF( ALLOCATED( gasi_recomb ) ) DEALLOCATE( gasi_recomb ) 595 IF( ALLOCATED( gasv_recomb ) ) DEALLOCATE( gasv_recomb ) 596 IF( ALLOCATED( pqrold ) ) DEALLOCATE( pqrold ) 597 IF( ALLOCATED( useptold ) ) DEALLOCATE( useptold ) 465 598 !$OMP BARRIER 466 599 !$OMP MASTER -
trunk/LMDZ.TITAN/libf/phytitan/callkeys_mod.F90
r2046 r2050 14 14 logical,save :: strictboundcorrk 15 15 !$OMP THREADPRIVATE(strictboundcorrk) 16 logical,save :: corrk_recombin 17 !$OMP_THREADPRIVATE(corrk_recombin) 16 18 logical,save :: seashaze,uncoupl_optic_haze 17 19 !$OMP THREADPRIVATE(seashaze,uncoupl_optic_haze) -
trunk/LMDZ.TITAN/libf/phytitan/inifis_mod.F90
r2046 r2050 234 234 call getin_p("corrkdir",corrkdir) 235 235 write(*,*) " corrkdir = ",corrkdir 236 237 write(*,*) "use correlated-k recombination instead of pre-mixed values ?" 238 corrk_recombin=.true. ! default value 239 call getin_p("corrk_recombin",corrk_recombin) 240 write(*,*) " corrk_recombin = ",corrk_recombin 236 241 endif 237 242 -
trunk/LMDZ.TITAN/libf/phytitan/optci.F90
r2046 r2050 1 subroutine optci(PQ O,NLAY,PLEV,TLEV,TMID,PMID, &1 subroutine optci(PQMO,NLAY,PLEV,TLEV,TMID,PMID, & 2 2 DTAUI,TAUCUMI,COSBI,WBARI,TAUGSURF,SEASHAZEFACT) 3 3 4 4 use radinc_h 5 use radcommon_h, only: gasi,tlimit,Cmk,gzlat_ig,tgasref,pfgasref,wnoi,scalep,indi,gweight 5 use radcommon_h, only: gasi,gasi_recomb,tlimit,Cmk,gzlat_ig, & 6 tgasref,pfgasref,wnoi,scalep,indi,gweight 6 7 use gases_h 7 8 use comcstfi_mod, only: r 8 use callkeys_mod, only: continuum,graybody,callclouds,callmufi,seashaze,uncoupl_optic_haze 9 use callkeys_mod, only: continuum,graybody,corrk_recombin, & 10 callclouds,callmufi,seashaze,uncoupl_optic_haze 9 11 use tracer_h, only : nmicro,nice 10 12 use MMP_OPTICS … … 37 39 ! Input/Output 38 40 !========================================================== 39 REAL*8, INTENT(IN) :: PQ O(nlay,nmicro) ! Tracers (X/m2).40 INTEGER, INTENT(IN) :: NLAY ! Number of pressure layers (for pqo)41 REAL*8, INTENT(IN) :: PQMO(nlay,nmicro) ! Tracers for microphysics optics (X/m2). 42 INTEGER, INTENT(IN) :: NLAY ! Number of pressure layers (for pqmo) 41 43 REAL*8, INTENT(IN) :: PLEV(L_LEVELS), TLEV(L_LEVELS) 42 44 REAL*8, INTENT(IN) :: TMID(L_LEVELS), PMID(L_LEVELS) … … 144 146 ! as long as the microphysics only isn't fully debugged -- JVO 01/18 145 147 IF (callmufi .AND. (.NOT. uncoupl_optic_haze)) THEN 146 m0as = pq o(ilay,1)147 m3as = pq o(ilay,2)148 m0af = pq o(ilay,3)149 m3af = pq o(ilay,4)148 m0as = pqmo(ilay,1) 149 m3as = pqmo(ilay,2) 150 m0af = pqmo(ilay,3) 151 m3af = pqmo(ilay,4) 150 152 151 153 IF (.NOT.mmp_sph_optics_ir(m0as,m3as,nw,ext_s,sca_s,ssa_s,asf_s)) & … … 238 240 ! transfer on the tested simulations ! 239 241 240 tmpk = GASI(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG) 242 if (corrk_recombin) then 243 tmpk = GASI_RECOMB(MT(K):MT(K)+1,MP(K):MP(K)+1,NW,NG) 244 else 245 tmpk = GASI(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG) 246 endif 241 247 242 248 KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASI(MT(K),MP(K),1,NW,NG) -
trunk/LMDZ.TITAN/libf/phytitan/optcv.F90
r2046 r2050 1 SUBROUTINE OPTCV(PQ O,NLAY,PLEV,TMID,PMID, &1 SUBROUTINE OPTCV(PQMO,NLAY,PLEV,TMID,PMID, & 2 2 DTAUV,TAUV,TAUCUMV,WBARV,COSBV,TAURAY,TAUGSURF,SEASHAZEFACT) 3 3 4 4 use radinc_h 5 use radcommon_h, only: gasv,tlimit,Cmk,gzlat_ig,tgasref,pfgasref,wnov,scalep,indv,gweight 5 use radcommon_h, only: gasv,gasv_recomb,tlimit,Cmk,gzlat_ig, & 6 tgasref,pfgasref,wnov,scalep,indv,gweight 6 7 use gases_h 7 8 use comcstfi_mod, only: r 8 use callkeys_mod, only: continuum,graybody,callgasvis,callclouds,callmufi,seashaze,uncoupl_optic_haze 9 use callkeys_mod, only: continuum,graybody,callgasvis,corrk_recombin, & 10 callclouds,callmufi,seashaze,uncoupl_optic_haze 9 11 use tracer_h, only: nmicro,nice 10 12 use MMP_OPTICS … … 43 45 ! Input/Output 44 46 !========================================================== 45 REAL*8, INTENT(IN) :: PQ O(nlay,nmicro) ! Tracers (X/m2).46 INTEGER, INTENT(IN) :: NLAY ! Number of pressure layers (for pqo)47 REAL*8, INTENT(IN) :: PQMO(nlay,nmicro) ! Tracers for microphysics optics (X/m2). 48 INTEGER, INTENT(IN) :: NLAY ! Number of pressure layers (for pqmo) 47 49 REAL*8, INTENT(IN) :: PLEV(L_LEVELS) 48 50 REAL*8, INTENT(IN) :: TMID(L_LEVELS), PMID(L_LEVELS) … … 167 169 ! as long as the microphysics only isn't fully debugged -- JVO 01/18 168 170 IF (callmufi .AND. (.NOT. uncoupl_optic_haze)) THEN 169 m0as = pq o(ilay,1)170 m3as = pq o(ilay,2)171 m0af = pq o(ilay,3)172 m3af = pq o(ilay,4)171 m0as = pqmo(ilay,1) 172 m3as = pqmo(ilay,2) 173 m0af = pqmo(ilay,3) 174 m3af = pqmo(ilay,4) 173 175 174 176 IF (.NOT.mmp_sph_optics_vis(m0as,m3as,nw,ext_s,sca_s,ssa_s,asf_s)) & … … 267 269 ! transfer on the tested simulations ! 268 270 269 tmpk = GASV(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG) 271 if (corrk_recombin) then 272 tmpk = GASV_RECOMB(MT(K):MT(K)+1,MP(K):MP(K)+1,NW,NG) 273 else 274 tmpk = GASV(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG) 275 endif 270 276 271 277 KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASV(MT(K),MP(K),1,NW,NG) … … 302 308 ! Now the full treatment for the layers, where besides the opacity 303 309 ! we need to calculate the scattering albedo and asymmetry factors 310 ! ====================================================================== 304 311 305 312 ! Haze scattering -
trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90
r2046 r2050 391 391 !$OMP THREADPRIVATE(tankCH4) 392 392 393 394 ! -----******----- FOR MUPHYS OPTICS -----******----- 395 integer :: i,j 396 real :: pqo(ngrid,nlayer,nq) ! Tracers for the optics (X/m2). 397 ! -----******----- END FOR MUPHYS OPTICS -----******----- 398 399 real :: i2e(ngrid,nlayer) ! int 2 ext factor ( X.kg-1 -> X.m-3 or X.m-2 , depending if optics or diags ) 393 real :: i2e(ngrid,nlayer) ! int 2 ext factor ( X.kg-1 -> X.m-3 for diags ) 400 394 401 395 real,save,dimension(:,:,:), allocatable :: tpq ! Tracers for decoupled microphysical tests ( temporary in 01/18 ) … … 844 838 call call_profilgases(nlayer) 845 839 846 ! Convert (microphysical) tracers for optics: X.kg-1 --> X.m-2_847 ! NOTE: it should be moved somewhere else: calmufi performs the same kind of848 ! computations... waste of time...849 i2e(:,1:nlayer) = ( pplev(:,1:nlayer)-pplev(:,2:nlayer+1) ) / gzlat(:,1:nlayer)850 pqo(:,:,:) = 0.0851 DO j=1,nmicro-nice852 pqo(:,:,j) = pq(:,:,j)*i2e(:,:)853 ENDDO854 855 840 ! standard callcorrk 856 call callcorrk(ngrid,nlayer,pq o,nq,qsurf,zday, &841 call callcorrk(ngrid,nlayer,pq,nq,qsurf,zday, & 857 842 albedo,albedo_equivalent,emis,mu0,pplev,pplay,pt, & 858 843 tsurf,fract,dist_star, & -
trunk/LMDZ.TITAN/libf/phytitan/radcommon_h.F90
r2026 r2050 56 56 REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE :: gasi, gasv 57 57 REAL*8, DIMENSION(:), ALLOCATABLE :: PGASREF, TGASREF, PFGASREF, GWEIGHT 58 59 ! For corrk recombining - JVO 18 60 REAL*8, DIMENSION(:,:,:,:), ALLOCATABLE :: gasi_recomb, gasv_recomb 61 REAL*8, DIMENSION(:,:), ALLOCATABLE :: pqrold 62 REAL*8, DIMENSION(:), ALLOCATABLE :: w_cum 63 LOGICAL, DIMENSION(:,:), ALLOCATABLE :: useptold 64 INTEGER, DIMENSION(:), ALLOCATABLE :: permut_idx 65 !$OMP THREADPRIVATE(gasi_recomb,gasv_recomb,pqrold,w_cum,useptold,permut_idx) 66 67 LOGICAL, DIMENSION(:), ALLOCATABLE :: RADVAR_MASK ! for corrk recombin -> read by master in sugas_corrk 68 INTEGER, DIMENSION(:), ALLOCATABLE :: RADVAR_INDX ! for corrk recombin -> read by master in sugas_corrk 69 58 70 real*8 FZEROI(L_NSPECTI) 59 71 real*8 FZEROV(L_NSPECTV) 60 72 real*8 pgasmin, pgasmax 61 73 real*8 tgasmin, tgasmax 62 !$OMP THREADPRIVATE(gasi,gasv,& !pgasref,tgasref,pfgasref read by master in sugas_corrk74 !$OMP THREADPRIVATE(gasi,gasv,& !pgasref,tgasref,pfgasref, gweight read by master in sugas_corrk 63 75 !$OMP FZEROI,FZEROV) !pgasmin,pgasmax,tgasmin,tgasmax read by master in sugas_corrk 64 76 … … 73 85 real*8,parameter :: UBARI = 0.5D0 74 86 75 !$OMP THREADPRIVATE(QREFvis,QREFir,omegaREFvis,omegaREFir,& ! gweight read by master in sugas_corrk87 !$OMP THREADPRIVATE(QREFvis,QREFir,omegaREFvis,omegaREFir,& 76 88 !$OMP tstellar,planckir,PTOP) 77 89 -
trunk/LMDZ.TITAN/libf/phytitan/radinc_h.F90
r2026 r2050 40 40 ! L_PINT is the number of Lagrange interpolated reference 41 41 ! pressures for the gas k-coefficients - now for a 42 ! smaller p-grid than before42 ! finer p-grid than before 43 43 ! L_NTREF is the number of reference temperatures for the 44 44 ! k-coefficients … … 46 46 ! to this value 47 47 ! 48 ! L_REFVAR The number of different mixing ratio values for 49 ! the k-coefficients. Variable component of the mixture 50 ! can in princple be anything: currently it's H2O. 48 ! L_REFVAR 49 ! EITHER (corrk_recombin = false) 50 ! _ The number of different mixing ratio values for 51 ! / \ the k-coefficients. Variable component of the mixture 52 ! / \ can in princple be anything: currently it's H2O. 53 ! / ! \ 54 ! /_______\ OR (corrk_recombin = true) 55 ! The TOTAL number of species to recombine when we 56 ! recombine corr-k instead of pre-mixed values. 51 57 !---------------------------------------------------------------------- 52 58 -
trunk/LMDZ.TITAN/libf/phytitan/sugas_corrk.F90
r2026 r2050 23 23 use radcommon_h, only : pgasref,pfgasref,pgasmin,pgasmax 24 24 use radcommon_h, only : tgasref,tgasmin,tgasmax 25 use radcommon_h, only : gasv,gasi,FZEROI,FZEROV,gweight 25 use radcommon_h, only : gasv,gasi,FZEROI,FZEROV,gweight, w_cum 26 26 use radcommon_h, only : WNOI,WNOV 27 use radcommon_h, only : gasi_recomb, gasv_recomb, pqrold, useptold 28 use radcommon_h, only : radvar_mask, radvar_indx, permut_idx 27 29 use datafile_mod, only: datadir, corrkdir, banddir 28 30 use comcstfi_mod, only: mugaz 29 31 use gases_h 30 32 use ioipsl_getin_p_mod, only: getin_p 31 use callkeys_mod, only: graybody,callgasvis, continuum 33 use callkeys_mod, only: graybody,callgasvis, continuum, tracer, corrk_recombin 34 use tracer_h, only: noms, nqtot_p 32 35 implicit none 33 36 … … 43 46 ! ALLOCATABLE ARRAYS -- AS 12/2011 44 47 REAL*8, DIMENSION(:,:,:,:,:), ALLOCATABLE,SAVE :: gasi8, gasv8 !read by master 48 character*20,allocatable,DIMENSION(:),SAVE :: gastype ! for name check, read by master 45 49 46 50 real*8 x, xi(4), yi(4), ans, p … … 54 58 55 59 integer :: dummy 60 61 integer ngasvar 62 logical found 56 63 57 64 !======================================================================= … … 77 84 read(111,*) ngas 78 85 79 if(ngas. gt.5 .or. ngas.lt.1)then86 if(ngas.lt.1)then 80 87 print*,ngas,' species in database [', & 81 88 corrkdir(1:LEN_TRIM(corrkdir)), & … … 84 91 endif 85 92 86 L_REFVAR = 1 ! JVO 2017 : set to 1 to keep the code running until the new variable species treatment 93 if ( corrk_recombin ) then 94 L_REFVAR = ngas 95 96 ! dynamical allocations and read from Q.dat 97 IF ( .NOT. ALLOCATED( gastype ) ) ALLOCATE( gastype( L_REFVAR ) ) 98 IF ( .NOT. ALLOCATED( radvar_mask ) ) ALLOCATE( radvar_mask( L_REFVAR ) ) 99 IF ( .NOT. ALLOCATED( radvar_indx ) ) ALLOCATE( radvar_indx( L_REFVAR ) ) 100 101 ngasvar = 0 102 103 write(*,*) ' ' 104 do igas=1,L_REFVAR 105 read(111,*) gastype(igas) 106 read(111,*) radvar_mask(igas) ! boolean 107 print *, 'Found radiatively active specie : ',trim(gastype(igas)), ' : Variable =', radvar_mask(igas) 108 if ( radvar_mask(igas) ) ngasvar = ngasvar+1 109 enddo 110 111 print *, ' ' 112 print *, 'TOTAL number of species found for radiative transfer = ', L_REFVAR 113 print *, ' including : ', ngasvar, 'variable species.' 114 print *, ' ' 115 116 if (.not. tracer .and. ngasvar .gt. 0) then 117 write(*,*) 'sugas_corrk:error: You try to run variable species for corrk recombining' 118 write(*,*) 'in the radiative transfer but without tracers : I will stop here ! ' 119 call abort 120 endif 121 122 ! NB (JVO 18) We should enable here to force composition even if no associated tracers 123 124 ! Check that we have matching tracers for the variable radiative active species 125 if ( ngasvar .GT. 0 ) then 126 127 do igas=1,L_REFVAR 128 if ( radvar_mask(igas) ) then 129 130 found = .false. 131 do jgas=1,nqtot_p 132 if ( trim(noms(jgas)) == trim(gastype(igas)) .OR. & 133 trim(noms(jgas)) == trim(gastype(igas))//'_') then 134 radvar_indx(igas) = jgas 135 found=.true. 136 exit 137 endif 138 enddo 139 140 if (.not. found) then 141 write(*,*) "sugas_corrk:error: "//trim(gastype(igas))//" is missing from tracers." 142 call abort 143 endif 144 145 endif 146 enddo ! igas=1,L_REFVAR 147 148 endif ! if ngasvar .gt. 0 149 150 else 151 L_REFVAR = 1 ! JVO 2017 : those will not be used, just set to 1 to keep the code running 152 endif ! if corrk_recombin 87 153 88 154 !======================================================================= … … 118 184 print*,'' 119 185 186 IF (.NOT. ALLOCATED(permut_idx)) ALLOCATE(permut_idx(L_NGAUSS*L_NGAUSS)) ! for corr-k recombining 187 permut_idx = (/(i, i=1,L_NGAUSS*L_NGAUSS)/) ! for the recombin_corrk firstcall 188 189 IF (.NOT. ALLOCATED(w_cum)) ALLOCATE(w_cum(L_NGAUSS)) ! for corr-k recombining 190 w_cum(1)= gweight(1) 191 DO n=2,L_NGAUSS 192 w_cum(n) = w_cum(n-1)+gweight(n) 193 ENDDO 194 120 195 !======================================================================= 121 196 ! Set the reference pressure and temperature arrays. These are … … 213 288 IF( .NOT. ALLOCATED( gasv ) ) ALLOCATE( gasv(L_NTREF,L_PINT,L_REFVAR,L_NSPECTV,L_NGAUSS) ) 214 289 290 if (corrk_recombin) then 291 IF( .NOT. ALLOCATED( gasi_recomb ) ) ALLOCATE( gasi_recomb(L_NTREF,L_PINT,L_NSPECTI,L_NGAUSS) ) 292 IF( .NOT. ALLOCATED( gasv_recomb ) ) ALLOCATE( gasv_recomb(L_NTREF,L_PINT,L_NSPECTV,L_NGAUSS) ) 293 IF( .NOT. ALLOCATED( pqrold ) ) ALLOCATE( pqrold(L_PINT,L_REFVAR) ) 294 IF( .NOT. ALLOCATED( useptold ) ) ALLOCATE( useptold(L_PINT,L_NTREF) ) 295 pqrold(:,:) = 0.0 296 useptold(:,:) = .false. 297 endif 298 215 299 ! display the values 216 300 print*,'' … … 272 356 print*,'Visible corrk gaseous absorption is set to zero if graybody=F' 273 357 else 274 file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_VI.dat' 275 file_path=TRIM(datadir)//TRIM(file_id) 358 359 if (corrk_recombin .eqv. .false. ) then 360 file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_VI.dat' 361 file_path=TRIM(datadir)//TRIM(file_id) 362 363 ! check that the file exists 364 inquire(FILE=file_path,EXIST=file_ok) 365 if(.not.file_ok) then 366 write(*,*)'The file ',TRIM(file_path) 367 write(*,*)'was not found by sugas_corrk.F90.' 368 write(*,*)'Are you sure you have absorption data for these bands?' 369 call abort 370 endif 371 372 open(111,file=TRIM(file_path),form='formatted') 373 read(111,*) gasv8 374 close(111) 375 376 else 377 378 do igas=1,L_REFVAR 379 ! JVO 18 : To comply with Q.dat watch out for 2-letters gas trailing underscore : 380 ! e.g. if ever you have N2_ (symmetric so shouldn't happen) file should be ..._N2_.dat 381 file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_VI_'//trim(adjustl(gastype(igas)))//'.dat' 382 file_path=TRIM(datadir)//TRIM(file_id) 383 384 ! check that the file exists 385 inquire(FILE=file_path,EXIST=file_ok) 386 if(.not.file_ok) then 387 write(*,*)'The file ',TRIM(file_path) 388 write(*,*)'was not found by sugas_corrk.F90.' 389 write(*,*)'Are you sure you have absorption data for these bands and this specie?' 390 call abort 391 endif 392 393 open(111,file=TRIM(file_path),form='formatted') 394 read(111,*) gasv8(:,:,igas,:,:) 395 close(111) 396 enddo 397 398 endif ! if corrk_recombin 276 399 277 ! check that the file exists278 inquire(FILE=file_path,EXIST=file_ok)279 if(.not.file_ok) then280 write(*,*)'The file ',TRIM(file_path)281 write(*,*)'was not found by sugas_corrk.F90.'282 write(*,*)'Are you sure you have absorption data for these bands?'283 call abort284 endif285 286 open(111,file=TRIM(file_path),form='formatted')287 read(111,*) gasv8288 close(111)289 400 end if 290 401 … … 316 427 !$OMP BARRIER 317 428 else 318 file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_IR.dat'319 file_path=TRIM(datadir)//TRIM(file_id)320 429 321 ! check that the file exists 322 inquire(FILE=file_path,EXIST=file_ok) 323 if(.not.file_ok) then 324 write(*,*)'The file ',TRIM(file_path) 325 write(*,*)'was not found by sugas_corrk.F90.' 326 write(*,*)'Are you sure you have absorption data for these bands?' 327 call abort 328 endif 329 430 if ( corrk_recombin .eqv. .false. ) then 431 file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_IR.dat' 432 file_path=TRIM(datadir)//TRIM(file_id) 433 434 ! check that the file exists 435 inquire(FILE=file_path,EXIST=file_ok) 436 if(.not.file_ok) then 437 write(*,*)'The file ',TRIM(file_path) 438 write(*,*)'was not found by sugas_corrk.F90.' 439 write(*,*)'Are you sure you have absorption data for these bands?' 440 call abort 441 endif 442 330 443 !$OMP MASTER 331 open(111,file=TRIM(file_path),form='formatted')332 read(111,*) gasi8333 close(111)444 open(111,file=TRIM(file_path),form='formatted') 445 read(111,*) gasi8 446 close(111) 334 447 !$OMP END MASTER 335 448 !$OMP BARRIER 449 450 else 451 452 do igas=1,L_REFVAR 453 ! JVO 18 : To comply with Q.dat watch out for 2-letters gas trailing underscore : 454 ! e.g. if ever tou have N2_ (symmetric so shouldn't happen) file should be ..._N2_.dat 455 file_id='/corrk_data/'//trim(adjustl(banddir))//'/corrk_gcm_IR_'//trim(adjustl(gastype(igas)))//'.dat' 456 file_path=TRIM(datadir)//TRIM(file_id) 457 458 ! check that the file exists 459 inquire(FILE=file_path,EXIST=file_ok) 460 if(.not.file_ok) then 461 write(*,*)'The file ',TRIM(file_path) 462 write(*,*)'was not found by sugas_corrk.F90.' 463 write(*,*)'Are you sure you have absorption data for these bands and this specie?' 464 call abort 465 endif 466 467 !$OMP MASTER 468 open(111,file=TRIM(file_path),form='formatted') 469 read(111,*) gasi8(:,:,igas,:,:) 470 close(111) 471 !$OMP END MASTER 472 !$OMP BARRIER 473 enddo ! do igas=1,L_REFVAR 474 475 endif! if corrk_recombin 476 336 477 337 478 ! 'fzero' is a currently unused feature that allows optimisation … … 559 700 end do 560 701 702 gasi_recomb(:,:,:,:) = kappa_IR ! non-zero init 703 gasv_recomb(:,:,:,:) = kappa_VI ! non-zero init 561 704 562 705 !======================================================================= … … 613 756 IF( ALLOCATED( gasv8 ) ) DEALLOCATE( gasv8 ) 614 757 IF( ALLOCATED( pgasref ) ) DEALLOCATE( pgasref ) 758 IF( ALLOCATED( gastype ) ) DEALLOCATE( gastype ) 615 759 !$OMP END MASTER 616 760 !$OMP BARRIER
Note: See TracChangeset
for help on using the changeset viewer.