Changeset 1958 for trunk/LMDZ.TITAN/libf


Ignore:
Timestamp:
Jul 3, 2018, 12:50:23 PM (6 years ago)
Author:
jvatant
Message:

Pseudo-evap was done in 2D in the photochem -> now 3D
--JVO

Location:
trunk/LMDZ.TITAN/libf
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/chimtitan/gptitan.c

    r1956 r1958  
    1212              char CORPS[][10], double Y[][NLEV],
    1313              double *FIN, double *LAT, double *MASS, double MD[][NLEV],
    14               double *KEDD, double *botCH4, double *fluxCH4, double KRATE[][NLEV],
     14              double *KEDD, double KRATE[][NLEV],
    1515              int reactif[][5], int *nom_prod, int *nom_perte,
    1616              int prod[][200], int perte[][200][2], int *aerprod, int *utilaer,
     
    2222  int    i,j,k,l;
    2323  int    ireac,ncom1,ncom2;
    24   int    in2, ich4, ih, ih2, in4s;
     24  int    in2, ih, ih2, in4s;
    2525  double  ***a,***b,**c;
    2626  double  *fl,*fp,*mu,**jac,**ym1,**f;
    27   double  dyCH4surf;
    2827  double  conv,delta,deltamax;
    2928  double  cm,cp,dim,dip,dm,dp,dym,dyp,km,kp,r,dra,dram,drap;
     
    10099  for( i = 0; i <= ST-1; i++ )
    101100    {
    102       if( strcmp(corps[i], "CH4") == 0 ) ich4 = i;
    103101      if( strcmp(corps[i], "H"  ) == 0 ) ih   = i;
    104102      if( strcmp(corps[i], "H2" ) == 0 ) ih2  = i;
     
    107105    }
    108106
    109   /* initialisation mu, CH4 au sol */
     107  /* initialisation mu */
    110108     
    111109  for( j = 0; j <= NLEV-1; j++ )
     
    114112      for( i = 0; i <= ST-1; i++ )
    115113        {
    116           if( ( i == ich4 ) && ( Y[i][j] <= *botCH4 ) && ( j == 0 ) )
    117             {
    118               dyCH4surf = (*botCH4 - Y[i][j]);
    119               Y[i][j] = *botCH4;
    120             }
    121114          mu[j] += ( MASS[i] * Y[i][j] );
    122115        }
     
    789782            /* end inversion by blocs: */
    790783
    791             /* CH4 au sol */
    792             /* ---------- */
    793             if( Y[ich4][0] < *botCH4 )
    794                 {
    795                   dyCH4surf += (*botCH4 - Y[ich4][0]*10.0e0);
    796                   Y[ich4][0] = *botCH4;
    797                 }
    798 
    799784            /* ------------------ */
    800785            /* Tests et evolution */
     
    888873  /* ------------ */
    889874
    890   *fluxCH4=dyCH4surf;
    891      
    892875  for( j = 0; j <= NLEV-1; j++ )
    893876    {
  • trunk/LMDZ.TITAN/libf/phytitan/calchim.F90

    r1956 r1958  
    11SUBROUTINE calchim(ngrid,qy_c,declin,dtchim,            &
    2      ctemp,cpphi,cplay,cplev,czlay,czlev,dqyc,zdyevapCH4)
     2     ctemp,cpphi,cplay,cplev,czlay,czlev,dqyc)
    33
    44  !---------------------------------------------------------------------------------------------------------
     
    8686
    8787  REAL*8, DIMENSION(ngrid,klev,nkim), INTENT(OUT)  :: dqyc        ! Chemical species tendencies on GCM layers (mol/mol/s).
    88   REAL*8, DIMENSION(ngrid),           INTENT(OUT)  :: zdyevapCH4  ! Diagnostic surface methane pseudo-evaporation flux (mol/mol/s).
    8988
    9089  ! Local variables :
     
    117116  REAL*8, DIMENSION(nlaykim_tot) :: rinter ! Inter-layer distance (km) to planetographic center (RA grid in chem. module).
    118117  ! NB : rinter is on nlaykim_tot too, we don't care of the uppermost layer upper boundary altitude.
    119 
    120   REAL(c_double) :: fluxCH4 ! Surface "evaporation" flux (mol/mol)
    121118
    122119  ! Saved variables initialized at firstcall
     
    469466             nomqy_c,cqy,                               &
    470467             dtchim,latitude(ig)*180./pi,mass,md,       &
    471              kedd,botCH4,fluxCH4,krate,reactif,         &
     468             kedd,krate,reactif,                        &
    472469             nom_prod,nom_perte,prod,perte,             &
    473470             aerprod,utilaer,cmaer,cprodaer,ccsn,ccsh,  &
    474471             htoh2,surfhaze)
    475 
    476         zdyevapCH4(ig) = fluxCH4 / dtchim ! Diagnostic pseudo-evaporation ( due to readjustement to botCH4 value ) (mol/mol/s)
    477472
    478473        ! 5. Calculates tendencies on composition for advected tracers
     
    495490
    496491     ELSE ! In 2D chemistry, if following grid point at same latitude, same zonal mean so don't do calculations again !
    497         zdyevapCH4(ig)  = zdyevapCH4(igm1)
    498492        dqyc(ig,:,:)    = dqyc(igm1,:,:) ! will be put back in 3D with longitudinal variations assuming same relative tendencies within a lat band
    499493        ykim_up(:,ig,:) = ykim_up(:,igm1,:) ! no horizontal mixing in upper layers -> no longitudinal variations
  • trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90

    r1957 r1958  
    1717      use radcommon_h, only: sigma, gzlat, gzlat_ig, Cmk, grav, BWNV
    1818      use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe
    19       use comchem_h, only: nkim, cnames, nlaykim_up, ykim_up, ykim_tot
     19      use comchem_h, only: nkim, cnames, nlaykim_up, ykim_up, ykim_tot, botCH4
    2020      use comdiurn_h, only: coslat, sinlat, coslon, sinlon
    2121      use comsaison_h, only: mu0, fract, dist_star, declin, right_ascen
     
    287287     
    288288      real zdqchi(ngrid,nlayer,nq)    ! Chemical tendency ( chemistry routine ).
    289       real zdqcond(ngrid,nlayer,nq)   ! Condensation tendency ( chemistry routine ).
    290289     
    291290      real zdqmufi(ngrid,nlayer,nq)   ! Microphysical tendency.
     
    376375      real, dimension(ngrid,nlayer,nkim)          :: ychimbar ! For 2D chemistry
    377376
    378       ! Molar fraction tendencies ( chemistry and condensation ) for tracers (mol/mol/s)
    379       real, dimension(ngrid,nlayer,nq)            :: dyccond ! All tracers, we want to use indx on it.
    380       real, dimension(ngrid,nlayer,nq)            :: dyccondbar ! For 2D chemistry
    381       real, dimension(:,:,:), allocatable, save   :: dycchi  ! Only for chem tracers. Saved since chemistry is not called every step.
     377      ! Molar fraction tendencies ( chemistry, condensation and evaporation ) for tracers (mol/mol/s)
     378      real, dimension(:,:,:), allocatable, save   :: dycchi         ! NB : Only for chem tracers. Saved since chemistry is not called every step.
    382379!$OMP THREADPRIVATE(dycchi)
     380      real, dimension(ngrid,nlayer,nq)            :: dyccond        ! Condensation flux. NB : for all tracers, as we want to use indx on it.
     381      real, dimension(ngrid,nlayer,nq)            :: dyccondbar     ! For 2D chemistry
     382      real, dimension(ngrid)                      :: dycevapCH4     ! Surface "pseudo-evaporation" flux (forcing constant surface humidity).
    383383
    384384      ! Saturation profiles
     
    389389      ! Surface methane
    390390      real, dimension(:), allocatable, save :: tankCH4    ! Depth of surface methane tank (m)
    391       real, dimension(:), allocatable, save :: zdyevapCH4 ! Surface pseudo-evaporation flux (chemistry keeping constant surface humidity) (mol/mol/s).
    392 !$OMP THREADPRIVATE(tankCH4,zdyevapCH4)
     391!$OMP THREADPRIVATE(tankCH4)
     392
    393393
    394394      ! -----******----- FOR MUPHYS OPTICS -----******-----
     
    523523            allocate(dycchi(ngrid,nlayer,nkim)) ! only for chemical tracers
    524524            allocate(qysat(nlayer,nkim))
    525             allocate(zdyevapCH4(ngrid))
    526525           
    527526            ! Chemistry timestep
     
    540539         
    541540            zdqchi(:,:,:)  = 0.0
    542             zdqcond(:,:,:) = 0.0
    543541
    544542         endif
     
    11461144            endif
    11471145
    1148             ! i. Condensation after the transport
    1149             ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1146            ! i. Condensation of the 3D tracers after the transport
     1147            ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    11501148            do iq=1,nkim
    11511149               do l=1,nlayer
     
    11641162            do iq=1,nkim
    11651163              ychim(:,:,iq) = ychim(:,:,iq) + dyccond(:,:,iq+nmicro) ! update molar ychim for following calchim
    1166               zdqcond(:,:,iq+nmicro) = dyccond(:,:,iq+nmicro)*rat_mmol(iq+nmicro) ! convert tendencies to mass mixing ratio
     1164
     1165              pdq(:,:,iq+nmicro) = pdq(:,:,iq+nmicro) + dyccond(:,:,iq+nmicro)*rat_mmol(iq+nmicro) ! convert tendencies to mass mixing ratio
    11671166            enddo
    11681167           
    1169             pdq(:,:,:) = pdq(:,:,:) + zdqcond(:,:,:)
    1170 
    1171             ! 2D zonally averaged fields needed to condense before photochem
     1168
     1169            ! ii. 2D zonally averaged fields need to condense and evap before photochem
     1170            ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    11721171            if ( moyzon_ch .and. mod(icount-1,ichim).eq. 0 ) then
     1172
    11731173              do iq = 1,nkim
    11741174                do l=1,nlayer
     
    11891189              enddo
    11901190
     1191              ! Pseudo-evap ( forcing constant surface humidity )
     1192              do ig=1,ngrid
     1193                 if ( ychimbar(ig,1,7+nmicro) .lt. botCH4 ) ychimbar(ig,1,7+nmicro) = botCH4
     1194              enddo
     1195
    11911196            endif ! if ( moyzon_ch .and. mod(icount-1,ichim).eq. 0 )
    11921197
    1193             ! ii. Photochemistry ( must be call after condensation)
    1194             ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1198            ! iii. Photochemistry ( must be call after condensation (and evap of 2D) )
     1199            ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    11951200            if( mod(icount-1,ichim).eq.0. ) then
    11961201               
     
    12011206                 ! Here we send zonal average fields ( corrected with cond ) from dynamics to chem. module
    12021207                 call calchim(ngrid,ychimbar,declin,ctimestep,ztfibar,zphibar,  &
    1203                               zplaybar,zplevbar,zzlaybar,zzlevbar,dycchi,zdyevapCH4)
     1208                              zplaybar,zplevbar,zzlaybar,zzlevbar,dycchi)
    12041209               else ! 3D chemistry (or 1D run)
    12051210                 call calchim(ngrid,ychim,declin,ctimestep,pt,pphi,  &
    1206                               pplay,pplev,zzlay,zzlev,dycchi,zdyevapCH4)
     1211                              pplay,pplev,zzlay,zzlev,dycchi)
    12071212               endif ! if moyzon
    12081213
    12091214            endif
    12101215           
    1211             ! Add diagnostic-only surface pseudo-evapoaration in condensation tendency for bottom layer
    1212             zdqcond(:,1,chimi_indx(7)) = zdyevapCH4(:)*rat_mmol(chimi_indx(7))
    1213            
     1216            ! iv. Surface pseudo-evaporation
     1217            ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     1218            do ig=1,ngrid
     1219               if ( (ychim(ig,1,7+nmicro)+dycchi(ig,1,7+nmicro)*ptimestep) .lt. botCH4 ) then ! +dycchi because ychim not yet updated
     1220                  dycevapCH4(ig) = ( -ychim(ig,1,7+nmicro)+botCH4 ) / ptimestep - dycchi(ig,1,7+nmicro)
     1221               else
     1222                  dycevapCH4(ig) = 0.0
     1223               endif
     1224            enddo
     1225
     1226            pdq(:,1,7+nmicro) = pdq(:,1,7+nmicro) + dycevapCH4(:)*rat_mmol(7+nmicro)
     1227           
     1228            ! v. Updates and positivity check
     1229            ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    12141230            do iq=1,nkim
    12151231              zdqchi(:,:,iq+nmicro) = dycchi(:,:,iq)*rat_mmol(iq+nmicro) ! convert tendencies to mass mixing ratio
     
    15641580             call writediagfi(ngrid,cnames(iq),cnames(iq),'mol/mol',3,zq(:,:,iq+nmicro)/rat_mmol(iq+nmicro))
    15651581           enddo
    1566            call writediagfi(ngrid,"fluxCH4","Surface CH4 pseudo-evaporation",'mol/mol/s',2,zdyevapCH4)
     1582           call writediagfi(ngrid,"fluxCH4","Surface CH4 pseudo-evaporation",'mol/mol/s',2,dycevapCH4)
    15671583         endif
    15681584
     
    16441660       
    16451661        ! Condensation tendencies ( mol/mol/s )
    1646         CALL send_xios_field("dqcond_CH4",zdqcond(:,:,7+nmicro)/rat_mmol(7+nmicro))
    1647         CALL send_xios_field("dqcond_C2H2",zdqcond(:,:,10+nmicro)/rat_mmol(10+nmicro))
    1648         CALL send_xios_field("dqcond_C2H4",zdqcond(:,:,12+nmicro)/rat_mmol(12+nmicro))
    1649         CALL send_xios_field("dqcond_C2H6",zdqcond(:,:,14+nmicro)/rat_mmol(14+nmicro))
    1650         CALL send_xios_field("dqcond_C3H6",zdqcond(:,:,17+nmicro)/rat_mmol(17+nmicro))
    1651         CALL send_xios_field("dqcond_C4H4",zdqcond(:,:,21+nmicro)/rat_mmol(21+nmicro))
    1652         CALL send_xios_field("dqcond_CH3CCH",zdqcond(:,:,24+nmicro)/rat_mmol(24+nmicro))
    1653         CALL send_xios_field("dqcond_C3H8",zdqcond(:,:,25+nmicro)/rat_mmol(25+nmicro))
    1654         CALL send_xios_field("dqcond_C4H2",zdqcond(:,:,26+nmicro)/rat_mmol(26+nmicro))
    1655         CALL send_xios_field("dqcond_C4H6",zdqcond(:,:,27+nmicro)/rat_mmol(27+nmicro))
    1656         CALL send_xios_field("dqcond_C4H10",zdqcond(:,:,28+nmicro)/rat_mmol(28+nmicro))
    1657         CALL send_xios_field("dqcond_AC6H6",zdqcond(:,:,29+nmicro)/rat_mmol(29+nmicro))
    1658         CALL send_xios_field("dqcond_HCN",zdqcond(:,:,36+nmicro)/rat_mmol(36+nmicro))
    1659         CALL send_xios_field("dqcond_CH3CN",zdqcond(:,:,40+nmicro)/rat_mmol(40+nmicro))
    1660         CALL send_xios_field("dqcond_HC3N",zdqcond(:,:,42+nmicro)/rat_mmol(42+nmicro))
    1661         CALL send_xios_field("dqcond_NCCN",zdqcond(:,:,43+nmicro)/rat_mmol(43+nmicro))
    1662         CALL send_xios_field("dqcond_C4N2",zdqcond(:,:,44+nmicro)/rat_mmol(44+nmicro))
     1662        CALL send_xios_field("dqcond_CH4",dyccond(:,:,7+nmicro))
     1663        CALL send_xios_field("dqcond_C2H2",dyccond(:,:,10+nmicro))
     1664        CALL send_xios_field("dqcond_C2H4",dyccond(:,:,12+nmicro))
     1665        CALL send_xios_field("dqcond_C2H6",dyccond(:,:,14+nmicro))
     1666        CALL send_xios_field("dqcond_C3H6",dyccond(:,:,17+nmicro))
     1667        CALL send_xios_field("dqcond_C4H4",dyccond(:,:,21+nmicro))
     1668        CALL send_xios_field("dqcond_CH3CCH",dyccond(:,:,24+nmicro))
     1669        CALL send_xios_field("dqcond_C3H8",dyccond(:,:,25+nmicro))
     1670        CALL send_xios_field("dqcond_C4H2",dyccond(:,:,26+nmicro))
     1671        CALL send_xios_field("dqcond_C4H6",dyccond(:,:,27+nmicro))
     1672        CALL send_xios_field("dqcond_C4H10",dyccond(:,:,28+nmicro))
     1673        CALL send_xios_field("dqcond_AC6H6",dyccond(:,:,29+nmicro))
     1674        CALL send_xios_field("dqcond_HCN",dyccond(:,:,36+nmicro))
     1675        CALL send_xios_field("dqcond_CH3CN",dyccond(:,:,40+nmicro))
     1676        CALL send_xios_field("dqcond_HC3N",dyccond(:,:,42+nmicro))
     1677        CALL send_xios_field("dqcond_NCCN",dyccond(:,:,43+nmicro))
     1678        CALL send_xios_field("dqcond_C4N2",dyccond(:,:,44+nmicro))
     1679
     1680        ! Pseudo-evaporation flux (mol/mol/s)
     1681        CALL send_xios_field("dqevapCH4",dycevapCH4(:))
    16631682
    16641683      endif ! of 'if callchim'
Note: See TracChangeset for help on using the changeset viewer.