Changeset 2456


Ignore:
Timestamp:
Feb 16, 2021, 12:51:00 AM (4 years ago)
Author:
aslmd
Message:

MESOSCALE Mars: fixing a couple of problems with double types related to introduction of CO2 model in r2362

Location:
trunk/LMDZ.MARS/libf/phymars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/co2cloud.F90

    r2447 r2456  
    162162     pcondicea(ngrid,nlay),     & ! Rate of condensation/sublimation of co2 ice in layers
    163163     pdtcloudco2(ngrid,nlay),   & ! Tendency on temperature due to latent heat
    164      riceco2(ngrid,nlay),       & ! Ice mass mean radius (m) r_c in Montmessin et al. (2004)
    165164     rsedcloudco2(ngrid,nlay)     ! Cloud sedimentation radius
    166165
     
    168167     rdust(ngrid,nlay) ! Dust geometric mean radius (m)
    169168
     169  double precision, intent(out) :: &
     170     riceco2(ngrid,nlay)          ! Ice mass mean radius (m) r_c in Montmessin et al. (2004)
    170171!----------------------------------------------------------------------------------------------------------------------!
    171172! Local:
     
    265266! ---Extinction coefficients at 1 micron of CO2 particles
    266267     vrat_cld,                      &! Volume ratio
    267      n_derf,                        &! derf( (rb_cldco2(1)-dlog(riceco2(ig,l))) *dev2)
     268     n_derf,                        &! derf( (rb_cldco2(1)-log(riceco2(ig,l))) *dev2)
    268269     Qtemp,                         &! mean value in the interval during the interpolation
    269270     ltemp1(var_dim_qext),          &! abs(radv(:)-rb_cldco2(i))
     
    678679
    679680          ! density of co2 ice
    680           call density_co2_ice(ztsed(ig,l), rho_ice_co2T(ig,l))
     681          call density_co2_ice(dble(ztsed(ig,l)), rho_ice_co2T(ig,l))
    681682
    682683          ! assure positive value of co2_ice mmr, ccnco2 number, ccnco2 mass
     
    687688          ! Get density cloud and co2 ice particle radius
    688689          if (Niceco2.ne.0d0) then
    689             call updaterice_microco2(Niceco2, Qccnco2, Nccnco2, tauscaling(ig), riceco2(ig,l), rhocloudco2t(ig,l))
     690            call updaterice_microco2(dble(Niceco2), dble(Qccnco2), dble(Nccnco2), tauscaling(ig), riceco2(ig,l), rhocloudco2t(ig,l))
    690691          else
    691692            riceco2(ig,l) = 0.
     
    836837
    837838      ! Compute particle size
    838       call updaterice_microco2(Niceco2, Qccnco2, Nccnco2, tauscaling(ig), riceco2(ig,l), rhocloudco2(ig,l))
     839      call updaterice_microco2(dble(Niceco2), dble(Qccnco2), dble(Nccnco2), tauscaling(ig), riceco2(ig,l), rhocloudco2(ig,l))
    839840
    840841     ! Compute opacities
     
    843844        Qext1bins2(ig,l) = 0.
    844845      else
    845         n_derf = derf( (rb_cldco2(1)-dlog(riceco2(ig,l))) *dev2)
     846        n_derf = derf( (rb_cldco2(1)-log(riceco2(ig,l))) *dev2)
    846847        Qext1bins2(ig,l) = 0.
    847848
     
    849850          n_aer(i) = -0.5 * Nccnco2*tauscaling(ig) * n_derf
    850851
    851           n_derf = derf((rb_cldco2(i+1)-dlog(riceco2(ig,l))) *dev2)
     852          n_derf = derf((rb_cldco2(i+1)-log(riceco2(ig,l))) *dev2)
    852853          n_aer(i) = n_aer(i) + (0.5 * Nccnco2*tauscaling(ig) * n_derf)
    853854
  • trunk/LMDZ.MARS/libf/phymars/co2condens_mod4micro.F90

    r2447 r2456  
    374374!----------------------------------------------------------------------------------------------------------------------!
    375375!     Available CO2 tracer in layer 1 at end of timestep (kg/m2)
     376#ifndef MESOSCALE
    376377      availco2 = pq(ig,1,igcm_co2) * ( (ap(1)-ap(2)) + (bp(1)-bp(2)) * (pplev(ig,1)/g - zcondices(ig)*ptimestep) )
     378#else
     379      availco2 = pq(ig,1,igcm_co2)
     380      PRINT*, "MESOSCALE: CO2 tracer AT FIRST LEVEL IS NOT CORRECTED FROM SIGMA LEVELS"
     381#endif
    377382      if ( zcondices(ig) * ptimestep>availco2 ) then
    378383        zcondices(ig) = availco2/ptimestep
     
    438443      zmflux(1) = - zcondices(ig) - zfallice(ig)
    439444      do l = 1, nlayer
     445#ifndef MESOSCALE
    440446        zmflux(l+1) = zmflux(l) - zcondicea(ig,l) &
    441 #ifndef MESOSCALE
    442447                      + (bp(l)-bp(l+1)) * (-pdpsrf(ig)/g)
    443448! zmflux set to 0 if very low to avoid: top layer is disappearing in v1ld
     
    446451        end if
    447452#else
     453        zmflux(l+1) = zmflux(l) - zcondicea(ig,l)
    448454        if (abs(zmflux(l+1))<1E-13) then
    449455          zmflux(l+1) = 0.
    450456        end if
     457        PRINT*, "MESOSCALE: FLUX THROUGH SIGMA LEVELS from dPS HAVE TO BE IMPLEMENTED"
    451458#endif
    452459      end do
     
    455462!----------------------------------------------------------------------------------------------------------------------!
    456463      do l = 1, nlayer
     464#ifndef MESOSCALE
    457465        masse(l) = (pplev(ig,l) - pplev(ig,l+1) + (bp(l)-bp(l+1))*pdpsrf(ig)*ptimestep)/g
     466#else
     467        masse(l) = (pplev(ig,l) - pplev(ig,l+1))/g
     468        PRINT*, "MESOSCALE: MASS OF EACH LAYER IS NOT CORRECTED AT END OF TIMESTEP (from SIGMA LEVELS and dPS)"
     469#endif
    458470      end do
    459471!----------------------------------------------------------------------------------------------------------------------!
  • trunk/LMDZ.MARS/libf/phymars/improvedco2clouds_mod.F90

    r2447 r2456  
    214214    riceco2(ngrid,nlay),               &! CO2 ice mean radius (m)
    215215    vrat_cld,                          &! Volume ratio
    216     Proba,                             &! 1.0 - dexp(-1.*microtimestep*rate(i))
    217     Probah2o,                          &! 1.0 - dexp(-1.*microtimestep*rateh2o(i))
     216    Proba,                             &! 1.0 - exp(-1.*microtimestep*rate(i))
     217    Probah2o,                          &! 1.0 - exp(-1.*microtimestep*rateh2o(i))
    218218    mtemp(nbinco2_cld),                &! sum(meteor(lebon1:lebon2,ibin))
    219219    pression_meteor(nlev_meteor),      &! pressure from meteoritic flux input file
     
    338338
    339339      !T-dependant CO2 ice density
    340       call density_co2_ice(zt(ig,l), rho_ice_co2T(ig,l))
     340      call density_co2_ice(dble(zt(ig,l)), rho_ice_co2T(ig,l))
    341341
    342342      vo2co2 = m0co2 / dble(rho_ice_co2T(ig,l))
     
    355355        No = zq(ig,l,igcm_dust_number) * tauscaling(ig)
    356356
    357         Mo = (4./3.) * pi * rho_dust * No * rdust(ig,l)**3 *dexp(9.*nuiceco2_ref/2.)
     357        Mo = (4./3.) * pi * rho_dust * No * rdust(ig,l)**3 *exp(9.*nuiceco2_ref/2.)
    358358
    359359        if (No > threshold) then
    360           Rn = -dlog(rdust(ig,l))
     360          Rn = -log(rdust(ig,l))
    361361
    362362          Rm = Rn - 3. * sigma_iceco2 * sigma_iceco2
     
    398398            No = zq(ig,l,igcm_ccn_number) * tauscaling(ig) + threshold
    399399
    400             Rn = -dlog(rice(ig,l))
     400            Rn = -log(rice(ig,l))
    401401
    402402            Rm = Rn - 3. * sigma_ice * sigma_ice
     
    427427
    428428          do i = 1, nbinco2_cld
    429             Proba = 1.0 - dexp(-1.*microtimestep*rate(i))
     429            Proba = 1.0 - exp(-1.*microtimestep*rate(i))
    430430            dN = dN + n_aer(i) * Proba
    431431            dM = dM + m_aer(i) * Proba
     
    434434          if (co2useh2o) then
    435435            do i = 1, nbinco2_cld
    436               Probah2o = 1.0 - dexp(-1.*microtimestep*rateh2o(i))
     436              Probah2o = 1.0 - exp(-1.*microtimestep*rateh2o(i))
    437437              dNh2o = dNh2o + n_aer_h2oice(i) * Probah2o
    438438              dMh2o = dMh2o + m_aer_h2oice(i) * Probah2o
     
    492492      if (zq(ig,l,igcm_ccnco2_number) * tauscaling(ig) + threshold >= 1) then
    493493
    494         call updaterice_microco2(zq(ig,l,igcm_co2_ice), zq(ig,l,igcm_ccnco2_mass), zq(ig,l,igcm_ccnco2_number), &
     494        call updaterice_microco2(dble(zq(ig,l,igcm_co2_ice)), dble(zq(ig,l,igcm_ccnco2_mass)), dble(zq(ig,l,igcm_ccnco2_number)), &
    495495                                 tauscaling(ig), riceco2(ig,l), rhocloudco2(ig,l))
    496496
  • trunk/LMDZ.MARS/libf/phymars/nuclea.F

    r1268 r2456  
    8787
    8888        nh2o   = ph2o / kbz / temp
    89         rstar  = 2. * sig(temp) * vo1 / (rgp*temp*dlog(sat))
     89        rstar  = 2. * sig(temp) * vo1 / (rgp*temp*log(sat))
    9090        gstar  = 4. * nav * pi * (rstar * rstar * rstar) / (3.*vo1)
    9191       
     
    124124     &                  * ( nh2o*rad_cld(i) )
    125125     &                  / ( zefshape * nus * m0 )
    126      &                  * dexp (deltaf))
     126     &                  * exp (deltaf))
    127127          endif
    128128
  • trunk/LMDZ.MARS/libf/phymars/nucleaco2.F

    r2156 r2456  
    5858
    5959        nco2   = pco2 / kbz / temp
    60         rstar  = 2. * sigco2 * vo2co2 / (kbz*temp*dlog(sat))
     60        rstar  = 2. * sigco2 * vo2co2 / (kbz*temp*log(sat))
    6161        gstar  = 4. * pi * (rstar * rstar * rstar) / (3.*vo2co2)
    6262       
     
    9797     &                  * ( nco2*rad_cldco2(i) )
    9898     &                  / ( zefshapeco2 * nusco2 * m0co2 )
    99      &                  * dexp (deltaf))
     99     &                  * exp (deltaf))
    100100
    101101           
     
    133133     &                  * ( nco2*rad_h2oice(i) )
    134134     &                  / ( zefshapeco2 * nusco2 * m0co2 )
    135      &                  * dexp (deltaf))
     135     &                  * exp (deltaf))
    136136              endif
    137137            endif
  • trunk/LMDZ.MARS/libf/phymars/tcondco2.F90

    r2362 r2456  
    1717integer:: ig,l
    1818
    19 A=dlog(1.382d12)
     19A=log(1.382d12)
    2020B=-3182.48
    2121qco2=0.
     
    2323   DO ig=1,ngrid
    2424      pco2 = q(ig,l) * (mmean(ig,l)/44.01) * p(ig,l)
    25       tcond(ig,l)=B/(dlog(pco2)-A)
     25      tcond(ig,l)=B/(log(pco2)-A)
    2626    enddo
    2727enddo
Note: See TracChangeset for help on using the changeset viewer.