Changeset 313


Ignore:
Timestamp:
Oct 10, 2011, 12:03:17 PM (13 years ago)
Author:
acolaitis
Message:

* AC 10/10/2011 *

*
This commit aims at increasing the thermals speed. Using these corrections, gcm performances in 64x48x32 using 1 tracer goes from 27.9% elapsed time in thermals to 18.76%.

*
Additional work needs to be done in tracer advection to gain speed in high tracer number configuration. (tracer advection (but not momentum nor temperature) could be decoupled from sub-timestep, as they do not act on the thermals scheme (water vapor is neglected as we use theta and not theta_v, and radiative effect of dust is not computed in the thermals.))

*
=> TOP 5 of routine contributions to gcm runtime :

Each sample counts as 0.01 seconds.

% cumulative self self total

time seconds seconds calls s/call s/call name
18.76 6.33 6.33 960 0.01 0.01 thermcell_main_mars_
17.19 12.13 5.80 svml_powf4.A
13.72 16.76 4.63 10369 0.00 0.00 filtreg_

3.94 18.09 1.33 intel_new_memset
3.73 19.35 1.26 2880 0.00 0.00 thermcell_dqupdown_

note: thermcell_main_mars_ does call quite a lot power computations (see svml_powf4.A), but this number will not increase with tracer numbers.

*
=> LOG:

M 312 libf/phymars/thermcell_main_mars.F90
------------------- removed (commented) computations on buoyancy which is purely diagnostic

tuned internal convergence loop and added convergence criterion

M 312 libf/phymars/thermcell_dqupdown.F90
------------------- removed (commented) downdraft-related if-loops (as we do not advect tracers and momentum in downdrafts for now)

M 312 libf/phymars/calltherm_mars.F90
------------------- removed (commented) diagnostic-related computations

changed default thermals spliting and aspect ratio
corrected a bug where maximum height was not correctly computed and could result in convective adjustment used in place of thermals
when using certains sets of nsplit and r_aspect (was not happening with the baseline version, so that this correction is transparent to
users)


Location:
trunk/LMDZ.MARS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/README

    r311 r313  
    10341034>> Bug correction in lect_start_archive.F ; in some cases layer(:) was not
    10351035   initialized.
     1036
     1037
     1038== 10/10/2011 == AC
     1039
     1040***********
     1041This commit aims at increasing the thermals speed. Using these corrections, gcm performances in 64x48x32 using 1 tracer goes from 27.9% elapsed time in thermals to 18.76%.
     1042
     1043***********
     1044Additional work needs to be done in tracer advection to gain speed in high tracer number configuration. (tracer advection (but not momentum nor temperature) could be decoupled from sub-timestep, as they do not act on the thermals scheme (water vapor is neglected as we use theta and not theta_v, and radiative effect of dust is not computed in the thermals.))
     1045
     1046***********
     1047=> TOP 5 of routine contributions to gcm runtime :
     1048
     1049Each sample counts as 0.01 seconds.
     1050  %   cumulative   self              self     total
     1051 time   seconds   seconds    calls   s/call   s/call  name
     1052 18.76      6.33     6.33      960     0.01     0.01  thermcell_main_mars_
     1053 17.19     12.13     5.80                             __svml_powf4.A
     1054 13.72     16.76     4.63    10369     0.00     0.00  filtreg_
     1055  3.94     18.09     1.33                             __intel_new_memset
     1056  3.73     19.35     1.26     2880     0.00     0.00  thermcell_dqupdown_
     1057
     1058note: thermcell_main_mars_ does call quite a lot power computations (see __svml_powf4.A), but this number will not increase with tracer numbers.
     1059
     1060***********
     1061=> LOG:
     1062
     1063M             312   libf/phymars/thermcell_main_mars.F90
     1064^------------------- removed (commented) computations on buoyancy which is purely diagnostic
     1065                     tuned internal convergence loop and added convergence criterion
     1066
     1067M             312   libf/phymars/thermcell_dqupdown.F90
     1068^------------------- removed (commented) downdraft-related if-loops (as we do not advect tracers and momentum in downdrafts for now)
     1069
     1070M             312   libf/phymars/calltherm_mars.F90
     1071^------------------- removed (commented) diagnostic-related computations
     1072                     changed default thermals spliting and aspect ratio
     1073                     corrected a bug where maximum height was not correctly computed and could result in convective adjustment used in place of thermals
     1074                     when using certains sets of nsplit and r_aspect (was not happening with the baseline version, so that this correction is transparent to
     1075                     users)
     1076********************
     1077
  • trunk/LMDZ.MARS/libf/phymars/calltherm_mars.F90

    r300 r313  
    66     &      ,u_seri,v_seri,t_seri,pq_therm,q2_therm  &
    77     &      ,d_u_ajs,d_v_ajs,d_t_ajs,d_q_ajs,dq2_therm  &
    8      &      ,fm_therm,entr_therm,detr_therm,lmax,zmax,&
     8     &      ,fm_therm,entr_therm,detr_therm,lmax,zmaxth,&
    99     &   zw2,fraca,zpopsk,ztla,heatFlux,heatFlux_down,&
    1010     &     buoyancyOut,buoyancyEst,hfmax,wmax)
     
    4949      real hfmax(ngridmx)
    5050      integer lmax(ngridmx)
    51       real zmax(ngridmx)
     51      real lmax_real(ngridmx)
     52      real zmax(ngridmx),zmaxth(ngridmx)
    5253
    5354!nouvelles variables pour la convection
     
    99100         r_aspect_thermals=0.7
    100101#else
    101          nsplit_thermals=50
    102          r_aspect_thermals=1.5
     102         nsplit_thermals=20
     103         r_aspect_thermals=2.
    103104#endif
    104105
    105106         call getin("nsplit_thermals",nsplit_thermals)
    106 
    107          fm_therm(:,:)=0.
    108          detr_therm(:,:)=0.
    109          entr_therm(:,:)=0.
     107         call getin("r_aspect_thermals",r_aspect_thermals)
     108
     109!         fm_therm(:,:)=0.
     110!         detr_therm(:,:)=0.
     111!         entr_therm(:,:)=0.
    110112
    111113         heatFlux(:,:)=0.
    112114         heatFlux_down(:,:)=0.
    113          buoyancyOut(:,:)=0.
    114          buoyancyEst(:,:)=0.
     115!         buoyancyOut(:,:)=0.
     116!         buoyancyEst(:,:)=0.
    115117
    116118         zw2(:,:)=0.
     119         zmaxth(:)=0.
     120         lmax_real(:)=0.
    117121
    118122         zdt=dtime/REAL(nsplit_thermals)
     
    126130! cas de splitting
    127131
    128          zfm_therm(:,:)=0.
    129          zentr_therm(:,:)=0.
    130          zdetr_therm(:,:)=0.
    131 
     132!         zfm_therm(:,:)=0.
     133!         zentr_therm(:,:)=0.
     134!         zdetr_therm(:,:)=0.
     135!
    132136         zheatFlux(:,:)=0.
    133137         zheatFlux_down(:,:)=0.
    134          zbuoyancyOut(:,:)=0.
    135          zbuoyancyEst(:,:)=0.
     138!         zbuoyancyOut(:,:)=0.
     139!         zbuoyancyEst(:,:)=0.
    136140
    137141         zzw2(:,:)=0.
     142         zmax(:)=0.
     143         lmax(:)=0.
    138144
    139145         d_t_the(:,:)=0.
    140146         d_u_the(:,:)=0.
    141147         d_v_the(:,:)=0.
    142          dq2_the(:,:)=0.
     148!         dq2_the(:,:)=0.
    143149         if (nqmx .ne. 0) then
    144150            d_q_the(:,:,:)=0.
     
    146152
    147153             CALL thermcell_main_mars(zdt  &
     154!             CALL thermcell_main_mars_coupled_v2(zdt  &
    148155     &      ,pplay,paprs,pphi,zzlev,zzlay  &
    149156     &      ,u_seri,v_seri,t_seri,pq_therm,q2_therm  &
     
    161168            d_u_the(:,:)=d_u_the(:,:)*fact
    162169            d_v_the(:,:)=d_v_the(:,:)*fact
    163             dq2_the(:,:)=dq2_the(:,:)*fact           
     170!            dq2_the(:,:)=dq2_the(:,:)*fact           
    164171
    165172            if (nqmx .ne. 0) then
     
    167174            endif
    168175
    169             fm_therm(:,:)=fm_therm(:,:)  &
    170      &      +zfm_therm(:,:)*fact
    171             entr_therm(:,:)=entr_therm(:,:)  &
    172      &       +zentr_therm(:,:)*fact
    173             detr_therm(:,:)=detr_therm(:,:)  &
    174      &       +zdetr_therm(:,:)*fact
     176             zmaxth(:)=zmaxth(:)+zmax(:)*fact
     177             lmax_real(:)=lmax_real(:)+float(lmax(:))*fact
     178!            fm_therm(:,:)=fm_therm(:,:)  &
     179!     &      +zfm_therm(:,:)*fact
     180!            entr_therm(:,:)=entr_therm(:,:)  &
     181!     &       +zentr_therm(:,:)*fact
     182!            detr_therm(:,:)=detr_therm(:,:)  &
     183!     &       +zdetr_therm(:,:)*fact
    175184
    176185            heatFlux(:,:)=heatFlux(:,:) &
     
    178187            heatFlux_down(:,:)=heatFlux_down(:,:) &
    179188     &       +zheatFlux_down(:,:)*fact
    180             buoyancyOut(:,:)=buoyancyOut(:,:) &
    181      &       +zbuoyancyOut(:,:)*fact
    182             buoyancyEst(:,:)=buoyancyEst(:,:) &
    183      &       +zbuoyancyEst(:,:)*fact
     189!            buoyancyOut(:,:)=buoyancyOut(:,:) &
     190!     &       +zbuoyancyOut(:,:)*fact
     191!            buoyancyEst(:,:)=buoyancyEst(:,:) &
     192!     &       +zbuoyancyEst(:,:)*fact
    184193
    185194            zw2(:,:)=zw2(:,:) + zzw2(:,:)*fact
     
    191200            d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:)
    192201            d_q_ajs(:,:,:)=d_q_ajs(:,:,:)+d_q_the(:,:,:)
    193             dq2_therm(:,:)=dq2_therm(:,:)+dq2_the(:,:)
     202!            dq2_therm(:,:)=dq2_therm(:,:)+dq2_the(:,:)
    194203!  incrementation des variables meteo
    195204     
     
    198207            v_seri(:,:) = v_seri(:,:) + d_v_the(:,:)
    199208            pq_therm(:,:,:) = pq_therm(:,:,:) + d_q_the(:,:,:)
    200             q2_therm(:,:) = q2_therm(:,:) + dq2_therm(:,:)
     209!            q2_therm(:,:) = q2_therm(:,:) + dq2_therm(:,:)
    201210
    202211
     
    220229            wmax(i)=MAXVAL(zw2(i,:))
    221230          ENDDO
    222  
     231 
     232         lmax(:)=nint(lmax_real(:))
     233         
    223234      return
    224235
  • trunk/LMDZ.MARS/libf/phymars/thermcell_dqupdown.F90

    r278 r313  
    5454      qa(:,:)=q_therm(:,:)
    5555      q(:,:)=q_therm(:,:)
    56       qd(:,:)=q_therm(:,:)
    57       active(:,:)=.false.
     56!      qd(:,:)=q_therm(:,:)
     57!      active(:,:)=.false.
    5858
    5959! previous calculation of zdthl_down uses the divergence of fmd
     
    6161! of fmd in the equations, so it has to be positive
    6262!
    63       fmd(:,:)=-fm_down(:,:)
     63!      fmd(:,:)=-fm_down(:,:)
    6464!
    6565!! ========== Entrainment, Detrainement and Mass =================
     
    248248
    249249      do ig=1,ngridmx
    250          if(active(ig,1)) then
    251 
    252          dq_therm(ig,1)=(detr0(ig,1)*qa(ig,1)+detrd(ig,1)*qd(ig,1) &
    253       &               +fm0(ig,2)*q(ig,2)   &
    254       &               -entr0(ig,1)*q(ig,1)-entrd(ig,1)*q(ig,1)   &
    255       &               -fmd(ig,2)*q(ig,1)) &
    256       &               *ptimestep/masse0(ig,1)
    257 
    258          else
     250!         if(active(ig,1)) then
     251!
     252!         dq_therm(ig,1)=(detr0(ig,1)*qa(ig,1)+detrd(ig,1)*qd(ig,1) &
     253!      &               +fm0(ig,2)*q(ig,2)   &
     254!      &               -entr0(ig,1)*q(ig,1)-entrd(ig,1)*q(ig,1)   &
     255!      &               -fmd(ig,2)*q(ig,1)) &
     256!      &               *ptimestep/masse0(ig,1)
     257!
     258!         else
    259259         dq_therm(ig,1)=(detr0(ig,1)*qa(ig,1)+fm0(ig,2)*q(ig,2) &
    260260      &               -entr0(ig,1)*q(ig,1)) &
    261261      &               *ptimestep/masse0(ig,1)
    262262
    263          endif
     263!         endif
    264264       enddo
    265265     
     
    267267         do ig=1, ngridmx
    268268
    269          if(active(ig,k)) then
    270 
    271          dq_therm(ig,k)=(detr0(ig,k)*qa(ig,k)+detrd(ig,k)*qd(ig,k) &
    272       &               +fm0(ig,k+1)*q(ig,k+1)+fmd(ig,k)*q(ig,k-1)   &
    273       &               -entr0(ig,k)*q(ig,k)-entrd(ig,k)*q(ig,k)   &
    274       &               -fm0(ig,k)*q(ig,k)-fmd(ig,k+1)*q(ig,k))      &
    275       &               *ptimestep/masse0(ig,k)
    276 
    277 
    278          else
     269!         if(active(ig,k)) then
     270!
     271!         dq_therm(ig,k)=(detr0(ig,k)*qa(ig,k)+detrd(ig,k)*qd(ig,k) &
     272!      &               +fm0(ig,k+1)*q(ig,k+1)+fmd(ig,k)*q(ig,k-1)   &
     273!      &               -entr0(ig,k)*q(ig,k)-entrd(ig,k)*q(ig,k)   &
     274!      &               -fm0(ig,k)*q(ig,k)-fmd(ig,k+1)*q(ig,k))      &
     275!     &               *ptimestep/masse0(ig,k)
     276
     277
     278!         else
    279279         dq_therm(ig,k)=(detr0(ig,k)*qa(ig,k)+fm0(ig,k+1)*q(ig,k+1) &
    280280      &               -entr0(ig,k)*q(ig,k)-fm0(ig,k)*q(ig,k))  &
     
    282282
    283283
    284          endif
     284!         endif
    285285
    286286         enddo
     
    289289         do ig=1, ngridmx
    290290
    291          if(active(ig,nlayermx)) then
    292 
    293          dq_therm(ig,nlayermx)=(detr0(ig,nlayermx)*qa(ig,nlayermx)+detrd(ig,nlayermx)*qd(ig,nlayermx) &
    294       &               +fmd(ig,nlayermx)*q(ig,nlayermx-1)   &
    295       &         -entr0(ig,nlayermx)*q(ig,nlayermx)-entrd(ig,nlayermx)*q(ig,nlayermx)   &
    296       &               -fm0(ig,nlayermx)*q(ig,nlayermx)) &
    297       &               *ptimestep/masse0(ig,nlayermx)
    298 
    299          else
     291!         if(active(ig,nlayermx)) then
     292!
     293!         dq_therm(ig,nlayermx)=(detr0(ig,nlayermx)*qa(ig,nlayermx)+detrd(ig,nlayermx)*qd(ig,nlayermx) &
     294!      &               +fmd(ig,nlayermx)*q(ig,nlayermx-1)   &
     295!      &         -entr0(ig,nlayermx)*q(ig,nlayermx)-entrd(ig,nlayermx)*q(ig,nlayermx)   &
     296!      &               -fm0(ig,nlayermx)*q(ig,nlayermx)) &
     297!      &               *ptimestep/masse0(ig,nlayermx)
     298
     299!         else
    300300         dq_therm(ig,nlayermx)=(detr0(ig,nlayermx)*qa(ig,nlayermx) &
    301301      &             -entr0(ig,nlayermx)*q(ig,nlayermx)-fm0(ig,nlayermx)*q(ig,nlayermx)) &
    302302      &               *ptimestep/masse0(ig,nlayermx)
    303          endif
     303!         endif
    304304         
    305305         enddo
  • trunk/LMDZ.MARS/libf/phymars/thermcell_main_mars.F90

    r300 r313  
    4141      REAL, INTENT(OUT) :: pdvadj(ngridmx,nlayermx)
    4242      REAL, INTENT(OUT) :: pdqadj(ngridmx,nlayermx,nqmx)
    43       REAL, INTENT(OUT) :: pdq2adj(ngridmx,nlayermx)
     43!      REAL, INTENT(OUT) :: pdq2adj(ngridmx,nlayermx)
     44      REAL :: pdq2adj(ngridmx,nlayermx)
    4445      REAL, INTENT(OUT) :: zw2(ngridmx,nlayermx+1)
    4546
    4647! Diagnostics
    4748      REAL, INTENT(OUT) :: heatFlux(ngridmx,nlayermx)   ! interface heatflux
    48       REAL, INTENT(OUT) :: heatFlux_down(ngridmx,nlayermx) ! interface heat flux from downdraft
    49       REAL, INTENT(OUT) :: buoyancyOut(ngridmx,nlayermx)  ! interlayer buoyancy term
    50       REAL, INTENT(OUT) :: buoyancyEst(ngridmx,nlayermx)  ! interlayer estimated buoyancy term
     49     REAL, INTENT(OUT) :: heatFlux_down(ngridmx,nlayermx) ! interface heat flux from downdraft
     50!      REAL, INTENT(OUT) :: buoyancyOut(ngridmx,nlayermx)  ! interlayer buoyancy term
     51!      REAL, INTENT(OUT) :: buoyancyEst(ngridmx,nlayermx)  ! interlayer estimated buoyancy term
    5152
    5253! dummy variables when output not needed :
     
    5455!      REAL :: heatFlux(ngridmx,nlayermx)   ! interface heatflux
    5556!      REAL :: heatFlux_down(ngridmx,nlayermx) ! interface heat flux from downdraft
    56 !      REAL :: buoyancyOut(ngridmx,nlayermx)  ! interlayer buoyancy term
    57 !      REAL :: buoyancyEst(ngridmx,nlayermx)  ! interlayer estimated buoyancy term
     57      REAL :: buoyancyOut(ngridmx,nlayermx)  ! interlayer buoyancy term
     58      REAL :: buoyancyEst(ngridmx,nlayermx)  ! interlayer estimated buoyancy term
    5859
    5960
     
    526527!---------------------------------------------------------------------------
    527528
    528       DO tic=0,3
    529 
     529      DO tic=0,6  ! internal convergence loop
    530530      activetmp(:)=active(:) .and. f_star(:,l+1)>1.e-10
    531531      do ig=1,ngridmx
     
    538538        endif
    539539      enddo
     540
     541      activetmp(:)=activetmp(:).and.(abs(ztla(:,l)-ztva(:,l)).gt.0.01)
    540542
    541543      do ig=1,ngridmx
     
    600602      enddo
    601603
    602       ENDDO
     604      ENDDO   ! of tic
     605
    603606!---------------------------------------------------------------------------
    604607!initialisations pour le calcul de la hauteur du thermique, de l'inversion et de la vitesse verticale max
     
    14021405!------------------------------------------------------------------
    14031406
    1404       modname='tke'
    1405       call thermcell_dqupdown(ngridmx,nlayermx,ptimestep,fm,entr,detr,  &
    1406       &      masse,pq2,pdq2adj,ztvd,fm_down,ztv,modname,lmax)
     1407!      modname='tke'
     1408!      call thermcell_dqupdown(ngridmx,nlayermx,ptimestep,fm,entr,detr,  &
     1409!      &      masse,pq2,pdq2adj,ztvd,fm_down,ztv,modname,lmax)
    14071410
    14081411! ===========================================================================
     
    14341437       do ig=1,ngridmx
    14351438        heatFlux(ig,l)=fm(ig,l)*(teta_th_int(ig,l)-teta_env_int(ig,l))/(rhobarz(ig,l))
    1436         buoyancyOut(ig,l)=g*(ztva(ig,l)-ztv(ig,l))/ztv(ig,l)
    1437         buoyancyEst(ig,l)=g*(ztva_est(ig,l)-ztv(ig,l))/ztv(ig,l)
     1439!        buoyancyOut(ig,l)=g*(ztva(ig,l)-ztv(ig,l))/ztv(ig,l)
     1440!        buoyancyEst(ig,l)=g*(ztva_est(ig,l)-ztv(ig,l))/ztv(ig,l)
    14381441        heatFlux_down(ig,l)=fm_down(ig,l)*(teta_down_int(ig,l)-teta_env_int(ig,l))/rhobarz(ig,l)
    14391442       enddo
Note: See TracChangeset for help on using the changeset viewer.