Changeset 1947 for trunk/LMDZ.TITAN/libf
- Timestamp:
- Jun 13, 2018, 5:22:44 PM (7 years ago)
- Location:
- trunk/LMDZ.TITAN/libf/phytitan
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.TITAN/libf/phytitan/calchim.F90
r1946 r1947 62 62 USE geometry_mod, ONLY: latitude 63 63 USE logic_mod, ONLY: moyzon_ch 64 USE moyzon_mod, ONLY: tmoy, playmoy , phimoy, zlaymoy, zlevmoy64 USE moyzon_mod, ONLY: tmoy, playmoy 65 65 66 66 IMPLICIT NONE … … 198 198 ! ---------------------------------------------------------------------- 199 199 200 ! JVO18 : altitudes calculated in firstcall are just for diag, as I set kedd in pressure grid200 ! JVO18 : altitudes are no more calculated in firstcall, as I set kedd in pressure grid 201 201 202 202 ! a. For GCM layers we just copy-paste 203 203 204 !$OMP MASTER205 204 PRINT*,'Init chemistry : pressure, density, temperature ... :' 206 PRINT*,'level, rmil (km), press_c (mbar), nb (cm-3), temp_c(K)' 207 !$OMP END MASTER 208 !$OMP BARRIER 205 PRINT*,'level, press_c (mbar), nb (cm-3), temp_c (K)' 209 206 210 207 IF (ngrid.NE.1) THEN 211 208 DO l=1,klev 212 rinter(l) = (zlevmoy(l)+rad)/1000.0 ! km213 rmil(l) = (zlaymoy(l)+rad)/1000.0 ! km214 209 temp_c(l) = tmoy(l) ! K 215 phi_c(l) = phimoy(l) ! m2.s-2216 210 press_c(l) = playmoy(l)/100. ! mbar 217 211 nb(l) = 1.e-4*press_c(l) / (kbol*temp_c(l)) ! cm-3 218 !$OMP MASTER 219 PRINT*, l, rmil(l)-rad/1000.0, press_c(l), nb(l), temp_c(l), phi_c(l) 220 !$OMP END MASTER 221 !$OMP BARRIER 212 PRINT*, l, press_c(l), nb(l), temp_c(l), phi_c(l) 222 213 ENDDO 223 rinter(klev+1)=(zlevmoy(klev+1)+rad)/1000.224 214 ELSE 225 215 DO l=1,klev 226 rinter(l) = (czlev(1,l)+rad)/1000.0 ! km227 rmil(l) = (czlay(1,l)+rad)/1000.0 ! km228 216 temp_c(l) = ctemp(1,l) ! K 229 phi_c(l) = cpphi(1,l) ! m2.s-2230 217 press_c(l) = cplay(1,l)/100. ! mbar 231 218 nb(l) = 1.e-4*press_c(l) / (kbol*temp_c(l)) ! cm-3 232 PRINT*, l, rmil(l)-rad/1000.0, press_c(l), nb(l), temp_c(l), phi_c(l)219 PRINT*, l, press_c(l), nb(l), temp_c(l) 233 220 ENDDO 234 rinter(klev+1)=(czlev(1,klev+1)+rad)/1000. 235 ENDIF ! if ngrid.ne.1 221 ENDIF 236 222 237 223 ! b. Extension in upper atmosphere with Vervack profile … … 250 236 nb(l) = exp( log(ct1d(ipres))*(1-factp) + log(ct1d(ipres+1))* factp ) 251 237 temp_c(l) = t1d(ipres)*(1-factp) + t1d(ipres+1)*factp 252 ENDDO 253 254 ! We build altitude with hydrostatic equilibrium on preskim grid with Vervack profile 255 ! ( keeping in mind that preskim is built based on Vervack profile with dz=10km ) 256 257 DO l=klev+1,nlaykim_tot 258 259 ! Compute geopotential on the upper grid, to have correct altitude 260 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 261 ! NB : Upper chemistry model is based on observational profiles and needs correct altitudes !! 262 ! Altitudes can (and must) be calculated with correct g even if it's not the case in the GCM under 263 264 temp1 = 0.5*(temp_c(l-1)+temp_c(l)) ! interlayer temp 265 phi_c(l) = phi_c(l-1) + r*temp1*log(press_c(l-1)/press_c(l)) ! Geopotential assuming hydrostatic equilibrium 266 267 rmil(l) = ( g*rad*rad / (g*rad - phi_c(l)) ) / 1000.0 ! z(phi) with g varying with altitude 268 269 !$OMP MASTER 270 PRINT*, l , rmil(l)-rad/1000.0, press_c(l), nb(l), temp_c(l), phi_c(l) 271 !$OMP END MASTER 272 !$OMP BARRIER 273 ENDDO 274 275 DO l=klev+2,nlaykim_tot 276 rinter(l) = 0.5*(rmil(l-1) + rmil(l)) 238 PRINT*, l , press_c(l), nb(l), temp_c(l) 277 239 ENDDO 278 240 -
trunk/LMDZ.TITAN/libf/phytitan/callcorrk.F90
r1897 r1947 279 279 !======================================================================= 280 280 281 282 Cmk= 0.01 * 1.0 / (glat(ig) * mugaz * 1.672621e-27) ! q_main=1.0 assumed. 283 glat_ig=glat(ig) 281 Cmk(:) = 0.01 * 1.0 / (gzlat(ig,:) * mugaz * 1.672621e-27) ! q_main=1.0 assumed. 282 gzlat_ig(:) = gzlat(ig,:) 284 283 285 284 !----------------------------------------------------------------------- … … 386 385 DO l=2,L_NLAYRAD 387 386 dtsw(ig,L_NLAYRAD+1-l)=(fmnetv(l)-fmnetv(l-1)) & 388 *g lat(ig)/(cpp*scalep*(plevrad(2*l+1)-plevrad(2*l-1)))387 *gzlat(ig,L_NLAYRAD+1-l)/(cpp*scalep*(plevrad(2*l+1)-plevrad(2*l-1))) 389 388 dtlw(ig,L_NLAYRAD+1-l)=(fmneti(l)-fmneti(l-1)) & 390 *g lat(ig)/(cpp*scalep*(plevrad(2*l+1)-plevrad(2*l-1)))389 *gzlat(ig,L_NLAYRAD+1-l)/(cpp*scalep*(plevrad(2*l+1)-plevrad(2*l-1))) 391 390 END DO 392 391 393 392 ! These are values at top of atmosphere 394 393 dtsw(ig,L_NLAYRAD)=(fmnetv(1)-nfluxtopv) & 395 *g lat(ig)/(cpp*scalep*(plevrad(3)-plevrad(1)))394 *gzlat(ig,L_NLAYRAD)/(cpp*scalep*(plevrad(3)-plevrad(1))) 396 395 dtlw(ig,L_NLAYRAD)=(fmneti(1)-nfluxtopi) & 397 *g lat(ig)/(cpp*scalep*(plevrad(3)-plevrad(1)))396 *gzlat(ig,L_NLAYRAD)/(cpp*scalep*(plevrad(3)-plevrad(1))) 398 397 399 398 -
trunk/LMDZ.TITAN/libf/phytitan/callkeys_mod.F90
r1897 r1947 40 40 logical,save :: oblate 41 41 !$OMP THREADPRIVATE(nosurf,oblate) 42 logical,save :: eff_gz 43 !$OMP THREADPRIVATE(eff_gz) 42 44 43 45 integer,save :: ichim -
trunk/LMDZ.TITAN/libf/phytitan/calmufi.F90
r1926 r1947 1 1 2 2 3 SUBROUTINE calmufi(dt, plev, zlev, play, zlay, temp, pq, zdqfi, zdq)3 SUBROUTINE calmufi(dt, plev, zlev, play, zlay, g3d, temp, pq, zdqfi, zdq) 4 4 !! Interface subroutine to YAMMS model for Titan LMDZ GCM. 5 5 !! … … 18 18 USE MMP_GCM 19 19 USE tracer_h 20 USE comcstfi_mod, only : g21 20 USE callkeys_mod, only : callclouds 22 21 USE muphy_diag … … 29 28 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: play !! Pressure layers (Pa). 30 29 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: zlay !! Altitude at the center of each layer (m). 30 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: g3d !! Latitude-Altitude depending gravitational acceleration (m.s-2). 31 31 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: temp !! Temperature at the center of each layer (K). 32 32 … … 56 56 REAL(kind=8), DIMENSION(:,:), ALLOCATABLE :: dgazs !! Tendencies of each condensible gaz species !(\(mol.mol^{-1}\)). 57 57 58 REAL(kind=8), DIMENSION(: ), ALLOCATABLE :: int2ext58 REAL(kind=8), DIMENSION(:,:), ALLOCATABLE :: int2ext 59 59 TYPE(error) :: err 60 60 … … 68 68 nices = size(ices_indx) 69 69 ! Conversion intensive to extensive 70 ALLOCATE( int2ext(nl ay) )70 ALLOCATE( int2ext(nlon,nlay) ) 71 71 72 72 ! Allocate arrays … … 101 101 ! Convert tracers to extensive ( except for gazs where we work with molar mass ratio ) 102 102 ! We suppose a given order of tracers ! 103 int2ext( :) = ( plev(ilon,1:nlay)-plev(ilon,2:nlay+1) ) / g104 m0as(:) = zq(ilon,:,1) * int2ext( :)105 m3as(:) = zq(ilon,:,2) * int2ext( :)106 m0af(:) = zq(ilon,:,3) * int2ext( :)107 m3af(:) = zq(ilon,:,4) * int2ext( :)103 int2ext(ilon,:) = ( plev(ilon,1:nlay)-plev(ilon,2:nlay+1) ) / g3d(ilon,1:nlay) 104 m0as(:) = zq(ilon,:,1) * int2ext(ilon,:) 105 m3as(:) = zq(ilon,:,2) * int2ext(ilon,:) 106 m0af(:) = zq(ilon,:,3) * int2ext(ilon,:) 107 m3af(:) = zq(ilon,:,4) * int2ext(ilon,:) 108 108 109 109 if (callclouds) then ! if call clouds 110 m0n(:) = zq(ilon,:,5) * int2ext( :)111 m3n(:) = zq(ilon,:,6) * int2ext( :)110 m0n(:) = zq(ilon,:,5) * int2ext(ilon,:) 111 m3n(:) = zq(ilon,:,6) * int2ext(ilon,:) 112 112 do i=1,nices 113 m3i(:,nices) = zq(ilon,:,6+i) * int2ext( :)113 m3i(:,nices) = zq(ilon,:,6+i) * int2ext(ilon,:) 114 114 gazs(:,i) = zq(ilon,:,ices_indx(i)) / rat_mmol(ices_indx(i)) ! For gazs we work on the full tracer array !! 115 115 ! We use the molar mass ratio from GCM in case there is discrepancy with the mm one … … 151 151 ! We suppose a given order of tracers ! 152 152 153 zdq(ilon,:,1) = dm0as(:) / int2ext( :)154 zdq(ilon,:,2) = dm3as(:) / int2ext( :)155 zdq(ilon,:,3) = dm0af(:) / int2ext( :)156 zdq(ilon,:,4) = dm3af(:) / int2ext( :)153 zdq(ilon,:,1) = dm0as(:) / int2ext(ilon,:) 154 zdq(ilon,:,2) = dm3as(:) / int2ext(ilon,:) 155 zdq(ilon,:,3) = dm0af(:) / int2ext(ilon,:) 156 zdq(ilon,:,4) = dm3af(:) / int2ext(ilon,:) 157 157 158 158 if (callclouds) then ! if call clouds 159 zdq(ilon,:,5) = dm0n(:) / int2ext( :)160 zdq(ilon,:,6) = dm3n(:) / int2ext( :)159 zdq(ilon,:,5) = dm0n(:) / int2ext(ilon,:) 160 zdq(ilon,:,6) = dm3n(:) / int2ext(ilon,:) 161 161 do i=1,nices 162 zdq(ilon,:,6+i) = dm3i(:,nices) / int2ext( :)162 zdq(ilon,:,6+i) = dm3i(:,nices) / int2ext(ilon,:) 163 163 zdq(ilon,:,ices_indx(i)) = dgazs(:,i) * rat_mmol(ices_indx(i)) ! For gazs we work on the full tracer array !! 164 164 ! We use the molar mass ratio from GCM in case there is discrepancy with the mm one -
trunk/LMDZ.TITAN/libf/phytitan/inifis_mod.F90
r1897 r1947 181 181 call getin_p("Rmean", Rmean) 182 182 write(*,*) "Rmean = ", Rmean 183 184 write(*,*) "Compute effective altitude-dependent gravity field?" 185 eff_gz = .false. 186 call getin_p("eff_gz", eff_gz) 187 write(*,*) "eff_gz = ", eff_gz 183 188 184 189 ! Test of incompatibility: … … 344 349 stop 345 350 endif 351 352 ! sanity check warning 353 if (callchim.and.(.not.eff_gz)) then 354 print*,"WARNING : You run chemistry without effective altitude-dependent gravity field !!" 355 print*,"You will have wrong vertical photodissociations rates, that's crazy !!" 356 print*,"I let you continue but you should rather set eff_gz =.true. ..." 357 !stop 358 endif 359 346 360 347 361 write(*,*)"Chemistry is computed every ichim", & -
trunk/LMDZ.TITAN/libf/phytitan/inimufi.F90
r1926 r1947 2 2 3 3 use mmp_gcm 4 use callkeys_mod, only : callclouds, p_prod, tx_prod, rc_prod, air_rad 4 use callkeys_mod, only : callclouds, p_prod, tx_prod, rc_prod, air_rad, eff_gz 5 5 use tracer_h 6 6 use comcstfi_mod, only : g, rad, mugaz … … 40 40 41 41 ! PATCH : YAMMS now allows to enable/disable effective g computations: 42 ! In the library it defaults to .true., in the GCM we do not want it ! 43 mm_use_effg = .false. 42 mm_use_effg = eff_gz 44 43 45 44 !---------------------------------------------------- -
trunk/LMDZ.TITAN/libf/phytitan/mass_redistribution.F90
r1647 r1947 5 5 6 6 use surfdat_h 7 use radcommon_h, only: g lat7 use radcommon_h, only: gzlat 8 8 USE tracer_h 9 9 USE planete_mod, only: bp … … 123 123 zdmass_sum(ig,nlayer+1)=0. 124 124 DO l = nlayer, 1, -1 125 zmass(ig,l) = (pplev(ig,l)-pplev(ig,l+1))/g lat(ig)125 zmass(ig,l) = (pplev(ig,l)-pplev(ig,l+1))/gzlat(ig,l) 126 126 zdmass_sum(ig,l)= zdmass_sum(ig,l+1)+pdmassmr(ig,l) 127 127 END DO -
trunk/LMDZ.TITAN/libf/phytitan/optci.F90
r1897 r1947 3 3 4 4 use radinc_h 5 use radcommon_h, only: gasi,tlimit,Cmk, tgasref,pfgasref,wnoi,scalep,indi,glat_ig,gweight5 use radcommon_h, only: gasi,tlimit,Cmk,gzlat_ig,tgasref,pfgasref,wnoi,scalep,indi,gweight 6 6 use gases_h 7 use comcstfi_mod, only: g,r7 use comcstfi_mod, only: r 8 8 use callkeys_mod, only: continuum,graybody,callclouds,callmufi, uncoupl_optic_haze 9 9 use tracer_h, only : nmicro,nice … … 118 118 119 119 do K=2,L_LEVELS 120 121 ilay = k / 2 ! int. arithmetic => gives the gcm layer index 122 120 123 DPR(k) = PLEV(K)-PLEV(K-1) 121 124 122 125 ! if we have continuum opacities, we need dz 123 dz(k) = dpr(k)*R*TMID(K)/(g lat_ig*PMID(K))124 U(k) = Cmk *DPR(k) ! only Cmk line in optci.F126 dz(k) = dpr(k)*R*TMID(K)/(gzlat_ig(ilay)*PMID(K)) 127 U(k) = Cmk(ilay)*DPR(k) ! only Cmk line in optci.F 125 128 126 129 call tpindex(PMID(K),TMID(K),pfgasref,tgasref,LCOEF,MT(K),MP(K)) … … 221 224 enddo 222 225 223 ! Oobleck test224 !rho = PMID(k)*scalep / (TMID(k)*286.99)225 !if(WNOI(nw).gt.300.0 .and. WNOI(nw).lt.500.0)then226 ! DCONT = rho * 0.125 * 4.6e-4227 !elseif(WNOI(nw).gt.500.0 .and. WNOI(nw).lt.700.0)then228 ! DCONT = 1000*dpr(k) * 1.0 * 4.6e-4 / g229 ! DCONT = rho * 1.0 * 4.6e-4230 !elseif(WNOI(nw).gt.700.0 .and. WNOI(nw).lt.900.0)then231 ! DCONT = rho * 0.125 * 4.6e-4232 !endif233 234 226 DCONT = DCONT*dz(k) 235 227 -
trunk/LMDZ.TITAN/libf/phytitan/optcv.F90
r1897 r1947 3 3 4 4 use radinc_h 5 use radcommon_h, only: gasv, tlimit, Cmk, tgasref, pfgasref,wnov,scalep,indv,glat_ig,gweight5 use radcommon_h, only: gasv,tlimit,Cmk,gzlat_ig,tgasref,pfgasref,wnov,scalep,indv,gweight 6 6 use gases_h 7 use comcstfi_mod, only: g,r7 use comcstfi_mod, only: r 8 8 use callkeys_mod, only: continuum,graybody,callgasvis,callclouds,callmufi,uncoupl_optic_haze 9 9 use tracer_h, only: nmicro,nice … … 132 132 133 133 do K=2,L_LEVELS 134 135 ilay = k / 2 ! int. arithmetic => gives the gcm layer index 136 134 137 DPR(k) = PLEV(K)-PLEV(K-1) 135 138 136 139 ! if we have continuum opacities, we need dz 137 140 138 dz(k) = dpr(k)*R*TMID(K)/(g lat_ig*PMID(K))139 U(k) = Cmk *DPR(k) ! only Cmk line in optcv.F141 dz(k) = dpr(k)*R*TMID(K)/(gzlat_ig(ilay)*PMID(K)) 142 U(k) = Cmk(ilay)*DPR(k) ! only Cmk line in optcv.F 140 143 141 144 call tpindex(PMID(K),TMID(K),pfgasref,tgasref,LCOEF,MT(K),MP(K)) -
trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90
r1943 r1947 15 15 16 16 use radinc_h, only : L_NSPECTI,L_NSPECTV 17 use radcommon_h, only: sigma, g lat, grav, BWNV17 use radcommon_h, only: sigma, gzlat, gzlat_ig, Cmk, grav, BWNV 18 18 use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe 19 19 use comchem_h, only: nkim, cnames, nlaykim_up, ykim_up, ykim_tot … … 394 394 integer :: i,j 395 395 real :: pqo(ngrid,nlayer,nq) ! Tracers for the optics (X/m2). 396 real :: i2e(nlayer) ! int 2 ext factor397 396 ! -----******----- END FOR MUPHYS OPTICS -----******----- 398 397 399 real ,dimension(:,:), allocatable :: i2e2d ! factor to convert X.kg-1 in X.m-3 (for microphysics diags)400 398 real :: i2e(ngrid,nlayer) ! int 2 ext factor ( X.kg-1 -> X.m-3 or X.m-2 , depending if optics or diags ) 399 401 400 real,save,dimension(:,:,:), allocatable :: tpq ! Tracers for decoupled microphysical tests ( temporary in 01/18 ) 402 401 !$OMP THREADPRIVATE(tpq) … … 410 409 ! Or one can put calmufi in MMP_GCM module (in muphytitan). 411 410 INTERFACE 412 SUBROUTINE calmufi(dt, plev, zlev, play, zlay, temp, pq, zdqfi, zdq)411 SUBROUTINE calmufi(dt, plev, zlev, play, zlay, g3d, temp, pq, zdqfi, zdq) 413 412 REAL(kind=8), INTENT(IN) :: dt !! Physics timestep (s). 414 413 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: plev !! Pressure levels (Pa). … … 416 415 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: play !! Pressure layers (Pa). 417 416 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: zlay !! Altitude at the center of each layer (m). 417 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: g3d !! Latitude-Altitude depending gravitational acceleration (m.s-2). 418 418 REAL(kind=8), DIMENSION(:,:), INTENT(IN) :: temp !! Temperature at the center of each layer (K). 419 419 REAL(kind=8), DIMENSION(:,:,:), INTENT(IN) :: pq !! Tracers (\(kg.kg^{-1}}\)). … … 476 476 ALLOCATE(fract(ngrid)) 477 477 ! This is defined in radcommon_h 478 ALLOCATE(glat(ngrid)) 479 478 ALLOCATE(gzlat(ngrid,nlayer)) 479 ALLOCATE(gzlat_ig(nlayer)) 480 ALLOCATE(Cmk(nlayer)) 480 481 481 482 ! Variables set to 0 … … 704 705 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 705 706 if (oblate .eqv. .false.) then 706 g lat(:) = g707 gzlat(:,:) = g 707 708 else if (flatten .eq. 0.0 .or. J2 .eq. 0.0 .or. Rmean .eq. 0.0 .or. MassPlanet .eq. 0.0) then 708 print*,'I need values for flatten, J2, Rmean and MassPlanet to compute g lat (else set oblate=.false.)'709 print*,'I need values for flatten, J2, Rmean and MassPlanet to compute gzlat (else set oblate=.false.)' 709 710 call abort 710 711 else 711 712 gmplanet = MassPlanet*grav*1e24 712 713 do ig=1,ngrid 713 g lat(ig)= gmplanet/(Rmean**2) * (1.D0 + 0.75 *J2 - 2.0*flatten/3. + (2.*flatten - 15./4.* J2) * cos(2. * (pi/2. - latitude(ig))))714 gzlat(ig,:)= gmplanet/(Rmean**2) * (1.D0 + 0.75 *J2 - 2.0*flatten/3. + (2.*flatten - 15./4.* J2) * cos(2. * (pi/2. - latitude(ig)))) 714 715 end do 715 716 endif 716 717 ! Compute geopotential between layers. 718 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 719 zzlay(:,:)=pphi(:,:) 720 do l=1,nlayer 721 zzlay(:,l)= zzlay(:,l)/glat(:) 722 enddo 717 718 ! Compute altitudes with the geopotential coming from the dynamics. 719 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 720 721 if (eff_gz .eqv. .false.) then 722 723 do l=1,nlayer 724 zzlay(:,l) = pphi(:,l) / gzlat(:,l) 725 enddo 726 727 else ! In this case we consider variations of g with altitude 728 729 do l=1,nlayer 730 zzlay(:,l) = g*rad*rad / ( g*rad - pphi(:,l) ) - rad 731 gzlat(:,l) = g*rad*rad / ( rad + zzlay(:,l) )**2 732 end do 733 734 endif ! if eff_gz 723 735 724 736 zzlev(:,1)=0. … … 737 749 if (moyzon_ch) then 738 750 739 zzlaybar(1,:)=(zphibar(1,:)+zphisbar(1))/g 740 ! SI ON TIENT COMPTE DE LA VARIATION DE G AVEC L'ALTITUDE: 741 ! zzlaybar(1,:)=RG*RA*RA/(RG*RA-(zphibar(1,:)+zphisbar(1)))-RA 742 zzlevbar(1,1)=zphisbar(1)/g 751 if (eff_gz .eqv. .false.) then 752 zzlaybar(1,:)=(zphibar(1,:)+zphisbar(1))/g 753 else ! if we take into account effective altitude-dependent gravity field 754 zzlaybar(1,:)=g*rad*rad/(g*rad-(zphibar(1,:)+zphisbar(1)))-rad 755 endif 756 zzlevbar(1,1)=zphisbar(1)/g 743 757 DO l=2,nlayer 744 z1=(zplaybar(1,l-1)+zplevbar(1,l))/(zpl evbar(1,l-1)-zplevbar(1,l))758 z1=(zplaybar(1,l-1)+zplevbar(1,l))/(zplaybar(1,l-1)-zplevbar(1,l)) 745 759 z2=(zplevbar(1,l) +zplaybar(1,l))/(zplevbar(1,l) -zplaybar(1,l)) 746 760 zzlevbar(1,l)=(z1*zzlaybar(1,l-1)+z2*zzlaybar(1,l))/(z1+z2) … … 749 763 750 764 DO ig=2,ngrid 751 if (latitude(ig).ne.latitude(ig-1)) then 752 DO l=1,nlayer 753 zzlaybar(ig,l)=(zphibar(ig,l)+zphisbar(ig))/g 754 ! SI ON TIENT COMPTE DE LA VARIATION DE G AVEC L'ALTITUDE: 755 !zzlaybar(ig,l)=RG*RA*RA/(RG*RA-(zphibar(ig,l)+zphisbar(ig)))-RA 765 if (latitude(ig).ne.latitude(ig-1)) then 766 DO l=1,nlayer 767 if (eff_gz .eqv. .false.) then 768 zzlaybar(ig,l)=(zphibar(ig,l)+zphisbar(ig))/g 769 else ! if we take into account effective altitude-dependent gravity field 770 zzlaybar(ig,l)=g*rad*rad/(g*rad-(zphibar(ig,l)+zphisbar(ig)))-rad 771 endif 756 772 ENDDO 757 773 zzlevbar(ig,1)=zphisbar(ig)/g 758 774 DO l=2,nlayer 759 z1=(zplaybar(ig,l-1)+zplevbar(ig,l))/ (zpl evbar(ig,l-1)-zplevbar(ig,l))775 z1=(zplaybar(ig,l-1)+zplevbar(ig,l))/ (zplaybar(ig,l-1)-zplevbar(ig,l)) 760 776 z2=(zplevbar(ig,l) +zplaybar(ig,l))/(zplevbar(ig,l) -zplaybar(ig,l)) 761 777 zzlevbar(ig,l)=(z1*zzlaybar(ig,l-1)+z2*zzlaybar(ig,l))/(z1+z2) 762 778 ENDDO 763 zzlevbar(ig,nlayer+1)=zzlaybar(ig,nlayer)+(zzlaybar(ig,nlayer)-zzlevbar(ig,nlayer)) 779 zzlevbar(ig,nlayer+1)=zzlaybar(ig,nlayer)+(zzlaybar(ig,nlayer)-zzlevbar(ig,nlayer)) 764 780 else 765 781 zzlaybar(ig,:)=zzlaybar(ig-1,:) 766 782 zzlevbar(ig,:)=zzlevbar(ig-1,:) 767 endif 783 endif 768 784 ENDDO 769 785 … … 778 794 zpopsk(ig,l)=(pplay(ig,l)/pplev(ig,1))**rcp 779 795 zh(ig,l)=pt(ig,l)/zpopsk(ig,l) 780 mass(ig,l) = (pplev(ig,l) - pplev(ig,l+1))/g lat(ig)796 mass(ig,l) = (pplev(ig,l) - pplev(ig,l+1))/gzlat(ig,l) 781 797 massarea(ig,l)=mass(ig,l)*cell_area(ig) 782 798 enddo … … 843 859 ! NOTE: it should be moved somewhere else: calmufi performs the same kind of 844 860 ! computations... waste of time... 845 DO i = 1, ngrid 846 i2e(1:nlayer) = ( pplev(i,1:nlayer)-pplev(i,2:nlayer+1) ) / g 847 pqo(i,:,:) = 0.0 848 DO j=1,nmicro-nice 849 pqo(i,:,j) = pq(i,:,j)*i2e(:) 850 ENDDO 861 i2e(:,1:nlayer) = ( pplev(:,1:nlayer)-pplev(:,2:nlayer+1) ) / gzlat(:,1:nlayer) 862 pqo(:,:,:) = 0.0 863 DO j=1,nmicro-nice 864 pqo(:,:,j) = pq(:,:,j)*i2e(:,:) 851 865 ENDDO 852 853 866 854 867 ! standard callcorrk … … 1086 1099 #ifdef USE_QTEST 1087 1100 dtpq(:,:,:) = 0.0 ! we want tpq to go only through mufi 1088 call calmufi(ptimestep,pplev,zzlev,pplay,zzlay, pt,tpq,dtpq,zdqmufi)1101 call calmufi(ptimestep,pplev,zzlev,pplay,zzlay,gzlat,pt,tpq,dtpq,zdqmufi) 1089 1102 tpq(:,:,:) = tpq(:,:,:) + zdqmufi(:,:,:)*ptimestep ! only manipulation of tpq->*ptimestep here 1090 1103 #else 1091 call calmufi(ptimestep,pplev,zzlev,pplay,zzlay, pt,pq,pdq,zdqmufi)1104 call calmufi(ptimestep,pplev,zzlev,pplay,zzlay,gzlat,pt,pq,pdq,zdqmufi) 1092 1105 pdq(:,:,:) = pdq(:,:,:) + zdqmufi(:,:,:) 1093 1106 #endif … … 1097 1110 zdqfibar(:,:,:) = 0.0 ! We work in zonal average -> forget processes other than condensation 1098 1111 call calmufi(ptimestep,zplevbar,zzlevbar,zplaybar,zzlaybar, & 1099 ztfibar,zqfibar,zdqfibar,zdqmufibar)1112 gzlat,ztfibar,zqfibar,zdqfibar,zdqmufibar) 1100 1113 endif 1101 1114 … … 1511 1524 if (callmufi) then 1512 1525 ! Microphysical tracers are expressed in unit/m3. 1513 ! convert X.kg-1 --> X.m-3 1514 ALLOCATE(i2e2d(ngrid,nlayer)) 1515 i2e2d(:,:) = ( pplev(:,1:nlayer)-pplev(:,2:nlayer+1) ) / g /(zzlev(:,2:nlayer+1)-zzlev(:,1:nlayer)) 1526 ! convert X.kg-1 --> X.m-3 (whereas for optics was -> X.m-2) 1527 i2e(:,:) = ( pplev(:,1:nlayer)-pplev(:,2:nlayer+1) ) / gzlat(:,1:nlayer) /(zzlev(:,2:nlayer+1)-zzlev(:,1:nlayer)) 1516 1528 1517 1529 #ifdef USE_QTEST 1518 1530 ! Microphysical tracers passed through dyn+phys(except mufi) 1519 call writediagfi(ngrid,"mu_m0as_dp","Dynphys only spherical mode 0th order moment",'m-3',3,zq(:,:,micro_indx(1))*i2e 2d)1520 call writediagfi(ngrid,"mu_m3as_dp","Dynphys only spherical mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(2))*i2e 2d)1521 call writediagfi(ngrid,"mu_m0af_dp","Dynphys only fractal mode 0th order moment",'m-3',3,zq(:,:,micro_indx(3))*i2e 2d)1522 call writediagfi(ngrid,"mu_m3af_dp","Dynphys only fractal mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(4))*i2e 2d)1531 call writediagfi(ngrid,"mu_m0as_dp","Dynphys only spherical mode 0th order moment",'m-3',3,zq(:,:,micro_indx(1))*i2e) 1532 call writediagfi(ngrid,"mu_m3as_dp","Dynphys only spherical mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(2))*i2e) 1533 call writediagfi(ngrid,"mu_m0af_dp","Dynphys only fractal mode 0th order moment",'m-3',3,zq(:,:,micro_indx(3))*i2e) 1534 call writediagfi(ngrid,"mu_m3af_dp","Dynphys only fractal mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(4))*i2e) 1523 1535 ! Microphysical tracers passed through mufi only 1524 call writediagfi(ngrid,"mu_m0as_mo","Mufi only spherical mode 0th order moment",'m-3',3,tpq(:,:,micro_indx(1))*i2e 2d)1525 call writediagfi(ngrid,"mu_m3as_mo","Mufi only spherical mode 3rd order moment",'m3/m3',3,tpq(:,:,micro_indx(2))*i2e 2d)1526 call writediagfi(ngrid,"mu_m0af_mo","Mufi only fractal mode 0th order moment",'m-3',3,tpq(:,:,micro_indx(3))*i2e 2d)1527 call writediagfi(ngrid,"mu_m3af_mo","Mufi only fractal mode 3rd order moment",'m3/m3',3,tpq(:,:,micro_indx(4))*i2e 2d)1536 call writediagfi(ngrid,"mu_m0as_mo","Mufi only spherical mode 0th order moment",'m-3',3,tpq(:,:,micro_indx(1))*i2e) 1537 call writediagfi(ngrid,"mu_m3as_mo","Mufi only spherical mode 3rd order moment",'m3/m3',3,tpq(:,:,micro_indx(2))*i2e) 1538 call writediagfi(ngrid,"mu_m0af_mo","Mufi only fractal mode 0th order moment",'m-3',3,tpq(:,:,micro_indx(3))*i2e) 1539 call writediagfi(ngrid,"mu_m3af_mo","Mufi only fractal mode 3rd order moment",'m3/m3',3,tpq(:,:,micro_indx(4))*i2e) 1528 1540 #else 1529 call writediagfi(ngrid,"mu_m0as","Spherical mode 0th order moment",'m-3',3,zq(:,:,micro_indx(1))*i2e 2d)1530 call writediagfi(ngrid,"mu_m3as","Spherical mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(2))*i2e 2d)1531 call writediagfi(ngrid,"mu_m0af","Fractal mode 0th order moment",'m-3',3,zq(:,:,micro_indx(3))*i2e 2d)1532 call writediagfi(ngrid,"mu_m3af","Fractal mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(4))*i2e 2d)1541 call writediagfi(ngrid,"mu_m0as","Spherical mode 0th order moment",'m-3',3,zq(:,:,micro_indx(1))*i2e) 1542 call writediagfi(ngrid,"mu_m3as","Spherical mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(2))*i2e) 1543 call writediagfi(ngrid,"mu_m0af","Fractal mode 0th order moment",'m-3',3,zq(:,:,micro_indx(3))*i2e) 1544 call writediagfi(ngrid,"mu_m3af","Fractal mode 3rd order moment",'m3/m3',3,zq(:,:,micro_indx(4))*i2e) 1533 1545 #endif 1534 1546 1535 DEALLOCATE(i2e2d)1536 1537 1547 ! Microphysical diagnostics 1538 1548 call writediagfi(ngrid,"mmd_aer_prec","Total aerosols precipitations",'m',2,mmd_aer_prec) … … 1619 1629 1620 1630 enddo 1621 1631 1632 ! Condensation tendencies ( mol/mol/s ) 1633 CALL send_xios_field("dqcond_CH4",zdqcond(:,:,7+nmicro)/rat_mmol(7+nmicro)) 1634 CALL send_xios_field("dqcond_C2H2",zdqcond(:,:,10+nmicro)/rat_mmol(10+nmicro)) 1635 CALL send_xios_field("dqcond_C2H4",zdqcond(:,:,12+nmicro)/rat_mmol(12+nmicro)) 1636 CALL send_xios_field("dqcond_C2H6",zdqcond(:,:,14+nmicro)/rat_mmol(14+nmicro)) 1637 CALL send_xios_field("dqcond_C3H6",zdqcond(:,:,17+nmicro)/rat_mmol(17+nmicro)) 1638 CALL send_xios_field("dqcond_C4H4",zdqcond(:,:,21+nmicro)/rat_mmol(21+nmicro)) 1639 CALL send_xios_field("dqcond_CH3CCH",zdqcond(:,:,24+nmicro)/rat_mmol(24+nmicro)) 1640 CALL send_xios_field("dqcond_C3H8",zdqcond(:,:,25+nmicro)/rat_mmol(25+nmicro)) 1641 CALL send_xios_field("dqcond_C4H2",zdqcond(:,:,26+nmicro)/rat_mmol(26+nmicro)) 1642 CALL send_xios_field("dqcond_C4H6",zdqcond(:,:,27+nmicro)/rat_mmol(27+nmicro)) 1643 CALL send_xios_field("dqcond_C4H10",zdqcond(:,:,28+nmicro)/rat_mmol(28+nmicro)) 1644 CALL send_xios_field("dqcond_AC6H6",zdqcond(:,:,29+nmicro)/rat_mmol(29+nmicro)) 1645 CALL send_xios_field("dqcond_HCN",zdqcond(:,:,36+nmicro)/rat_mmol(36+nmicro)) 1646 CALL send_xios_field("dqcond_CH3CN",zdqcond(:,:,40+nmicro)/rat_mmol(40+nmicro)) 1647 CALL send_xios_field("dqcond_HC3N",zdqcond(:,:,42+nmicro)/rat_mmol(42+nmicro)) 1648 CALL send_xios_field("dqcond_NCCN",zdqcond(:,:,43+nmicro)/rat_mmol(43+nmicro)) 1649 CALL send_xios_field("dqcond_C4N2",zdqcond(:,:,44+nmicro)/rat_mmol(44+nmicro)) 1650 1622 1651 endif ! of 'if callchim' 1623 1652 1624 1653 ! Microphysical tracers 1625 1654 if (callmufi) then 1626 CALL send_xios_field("mu_m0as",zq(:,:,micro_indx(1))*i2e 2d)1627 CALL send_xios_field("mu_m3as",zq(:,:,micro_indx(2))*i2e 2d)1628 CALL send_xios_field("mu_m0af",zq(:,:,micro_indx(3))*i2e 2d)1629 CALL send_xios_field("mu_m3af",zq(:,:,micro_indx(4))*i2e 2d)1655 CALL send_xios_field("mu_m0as",zq(:,:,micro_indx(1))*i2e) 1656 CALL send_xios_field("mu_m3as",zq(:,:,micro_indx(2))*i2e) 1657 CALL send_xios_field("mu_m0af",zq(:,:,micro_indx(3))*i2e) 1658 CALL send_xios_field("mu_m3af",zq(:,:,micro_indx(4))*i2e) 1630 1659 endif 1631 1660 -
trunk/LMDZ.TITAN/libf/phytitan/radcommon_h.F90
r1788 r1947 88 88 real*8, parameter :: grav = 6.672E-11 89 89 90 real*8,save :: Cmk91 real*8,save :: glat_ig92 !$OMP THREADPRIVATE(Cmk,glat_ig)93 94 90 ! extinction of incoming sunlight (Saturn's rings, eclipses, etc...) 95 91 REAL, DIMENSION(:), ALLOCATABLE ,SAVE :: eclipse 92 !$OMP THREADPRIVATE(eclipse) 96 93 97 !Latitude-dependent gravity 98 REAL, DIMENSION(:), ALLOCATABLE , SAVE :: glat 99 !$OMP THREADPRIVATE(glat,eclipse) 94 ! Altitude-Latitude-dependent gravity 95 REAL, DIMENSION(:,:), ALLOCATABLE , SAVE :: gzlat ! This should be stored elsewhere ... 96 REAL, DIMENSION(:), ALLOCATABLE , SAVE :: gzlat_ig 97 REAL, DIMENSION(:), ALLOCATABLE , SAVE :: Cmk 98 !$OMP THREADPRIVATE(gzlat,gzlat_ig,Cmk) 100 99 101 100 end module radcommon_h -
trunk/LMDZ.TITAN/libf/phytitan/turbdiff.F90
r1647 r1947 7 7 pdqdif,pdqsdif,flux_u,flux_v,lastcall) 8 8 9 use radcommon_h, only : sigma, g lat9 use radcommon_h, only : sigma, gzlat 10 10 use comcstfi_mod, only: rcp, g, r, cpp 11 11 use callkeys_mod, only: tracer,nosurf … … 139 139 DO ilay=1,nlay 140 140 DO ig=1,ngrid 141 zmass(ig,ilay)=(pplev(ig,ilay)-pplev(ig,ilay+1))/g lat(ig)141 zmass(ig,ilay)=(pplev(ig,ilay)-pplev(ig,ilay+1))/gzlat(ig,ilay) 142 142 zExner(ig,ilay)=(pplev(ig,ilay)/pplev(ig,1))**rcp 143 143 zovExner(ig,ilay)=1./ppopsk(ig,ilay)
Note: See TracChangeset
for help on using the changeset viewer.