Ignore:
Timestamp:
Jul 21, 2017, 5:30:44 PM (7 years ago)
Author:
jvatant
Message:

Optimization of the optci/cv routines

  • The repeated calls to huge matrices gasi/v increased dramatically the execution time because of memory access
  • Added a tmpk variable
  • Save ~ 50% time on the RT, ~30% on the whole code on the tested simulations

JVO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/libf/phytitan/optcv.F90

    r1722 r1725  
    8383
    8484  real*8  KCOEF(4)
     85 
     86  ! temporary variable to reduce memory access time to gasv
     87  real*8 tmpk(2,2)
    8588
    8689  ! temporary variables for multiple aerosol calculation
     
    233236           ! Now compute TAUGAS
    234237
    235            KCOEF(1) = GASV(MT(K),MP(K),1,NW,NG)
    236            KCOEF(2) = GASV(MT(K),MP(K)+1,1,NW,NG)
    237            KCOEF(3) = GASV(MT(K)+1,MP(K)+1,1,NW,NG)
    238            KCOEF(4) = GASV(MT(K)+1,MP(K),1,NW,NG)
     238           ! JVO 2017 : added tmpk because the repeated calls to gasi/v increased dramatically
     239           ! the execution time of optci/v -> ~ factor 2 on the whole radiative
     240           ! transfer on the tested simulations !
     241
     242           tmpk = GASV(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG)
     243             
     244           KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASV(MT(K),MP(K),1,NW,NG)
     245           KCOEF(2) = tmpk(1,2) ! KCOEF(2) = GASV(MT(K),MP(K)+1,1,NW,NG)
     246           KCOEF(3) = tmpk(2,2) ! KCOEF(3) = GASV(MT(K)+1,MP(K)+1,1,NW,NG)
     247           KCOEF(4) = tmpk(2,1) ! KCOEF(4) = GASV(MT(K)+1,MP(K),1,NW,NG)
    239248
    240249           ! Interpolate the gaseous k-coefficients to the requested T,P values
Note: See TracChangeset for help on using the changeset viewer.