Changeset 541


Ignore:
Timestamp:
Feb 23, 2012, 2:20:06 AM (13 years ago)
Author:
aslmd
Message:

LMDZ.MARS. Added small optimizations in watercycle. 10% improvement.

Location:
trunk/LMDZ.MARS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/README

    r530 r541  
    14071407>> Code 35% faster with a Valles Marineris mesoscale run in springtime (set imicro=25)
    14081408   ... probably even better at cloudier seasons
     1409
     1410== 23/02/12 == AS
     1411>> In improvedclouds and waterclouds, added optimizations
     1412   ... moved calculations to firstcall
     1413   ... moved 'if' statement so that only useful calculations are performed
     1414>> Code about 10% faster [tests carried out with mesoscale summer Tharsis run]
     1415>> Check with a GCM run that results similar
  • trunk/LMDZ.MARS/libf/phymars/improvedclouds.F

    r531 r541  
    192192        write(*,'(i2,3x,e12.6)') nbin_cld+1,rb_cld(nbin_cld+1)
    193193        print*,'-----------------------------------'
     194
     195        do i=1,nbin_cld+1
     196            rb_cld(i) = dlog(rb_cld(i))  !! we save that so that it is not computed
     197                                         !! at each timestep and gridpoint
     198        enddo
    194199
    195200c       Contact parameter of water ice on dust ( m=cos(theta) )
     
    265270
    266271      Cste = ptimestep * 4. * pi * rho_ice
     272      dev2 = 1. / ( sqrt(2.) * sigma_ice )
    267273
    268274      call watersat(ngridmx*nlayermx,zt,pplay,zqsat)
     
    286292        Mo = zq(ig,l,igcm_dust_mass)* tauscaling(ig)
    287293        No = zq(ig,l,igcm_dust_number)* tauscaling(ig)+ 1.e-30
    288         dev2 = 1. / ( sqrt(2.) * sigma_ice )
    289294        Rn = rdust(ig,l)
    290295        Rn = -dlog(Rn)
    291296        Rm = Rn - 3. * sigma_ice*sigma_ice 
    292         yeah = dlog(rb_cld(1))
    293         yeahn = derf( (yeah+Rn) *dev2)
    294         yeahm = derf( (yeah+Rm) *dev2)
     297        yeahn = derf( (rb_cld(1)+Rn) *dev2)
     298        yeahm = derf( (rb_cld(1)+Rm) *dev2)
    295299        do i = 1, nbin_cld
    296300          n_aer(i) = -0.5 * No * yeahn !! this ith previously computed
    297301          m_aer(i) = -0.5 * Mo * yeahm !! this ith previously computed
    298           yeah = dlog(rb_cld(i+1))     !! this (i+1)th now computed
    299           yeahn = derf( (yeah+Rn) *dev2)
    300           yeahm = derf( (yeah+Rm) *dev2)
     302          yeahn = derf( (rb_cld(i+1)+Rn) *dev2)
     303          yeahm = derf( (rb_cld(i+1)+Rm) *dev2)
    301304          n_aer(i) = n_aer(i) + 0.5 * No * yeahn
    302305          m_aer(i) = m_aer(i) + 0.5 * Mo * yeahm
     
    363366     &                      / Mo * rho_dust
    364367          rhocloud(ig,l) = min(max(rhocloud(ig,l),rho_ice),rho_dust)
    365           rice(ig,l) =
    366      &      CBRT( real(Mo)/real(No) * 0.75 / pi / rhocloud(ig,l) ) !**(1./3.)
     368          if ((Mo.lt.1.e-20) .or. (No.le.1)) then
     369              rice(ig,l) = 1.e-8
     370          else
     371              rice(ig,l) =
     372     &          CBRT( real(Mo)/real(No) * 0.75 / pi / rhocloud(ig,l) ) !**(1./3.)
     373          endif
    367374c          nuice(ig,l)=nuice_ref ! used for rad. transfer calculations
    368           if ((Mo.lt.1.e-20) .or. (No.le.1)) rice(ig,l) = 1.e-8
    369375          seq  = exp( 2.*sig(zt(ig,l))*mh2o /
    370376     &           (rho_ice*rgp*zt(ig,l)*rice(ig,l)) )
     
    483489         
    484490          rice_out(ig,l)=rice(ig,l)
    485           rice(ig,l) =
    486      &      CBRT( real(Mo)/real(No) * 0.75 / pi / rhocloud(ig,l) ) !**(1./3.)
    487           if ((Mo.lt.1.e-20) .or. (No.le.1)) rice(ig,l) = 1.e-8
     491          if ((Mo.lt.1.e-20) .or. (No.le.1)) then
     492              rice(ig,l) = 1.e-8
     493          else
     494              rice(ig,l) =
     495     &          CBRT( real(Mo)/real(No) * 0.75 / pi / rhocloud(ig,l) ) !**(1./3.)
     496          endif
    488497          rice_out(ig,l)=rice(ig,l)-rice_out(ig,l)
    489498         
  • trunk/LMDZ.MARS/libf/phymars/watercloud.F

    r522 r541  
    402402     &                   *tauscaling(ig)/ Mo * rho_dust
    403403          rhocloud(ig,l) = min(max(rhocloud(ig,l),rho_ice),rho_dust)
    404           rice(ig,l)=(Mo / No * 0.75 / pi / rhocloud(ig,l))**(1./3.)
    405            if ((Mo.lt.1.e-15) .or. (No.le.50)) rice(ig,l) = 1.e-8
     404          if ((Mo.lt.1.e-15) .or. (No.le.50)) then
     405              rice(ig,l) = 1.e-8
     406          else
     407              !! AS: only perform computations if conditions not met
     408              rice(ig,l)=(Mo / No * 0.75 / pi / rhocloud(ig,l))**(1./3.)
     409          endif
    406410         ENDDO
    407411        ENDDO
     
    414418            rice(ig,l)=max( CBRT ( ((pq(ig,l,igcm_h2o_ice)
    415419     &       + pdqcloud(ig,l,igcm_h2o_ice)*ptimestep)/rho_ice
    416      &      +ccntyp*(4./3.)*pi*rdust(ig,l)**3.)
     420     &      +ccntyp*(4./3.)*pi*rdust(ig,l)*rdust(ig,l)*rdust(ig,l))
    417421     &      /(ccntyp*4./3.*pi) ), rdust(ig,l))
    418422          ENDDO
Note: See TracChangeset for help on using the changeset viewer.