Ignore:
Timestamp:
Mar 24, 2014, 9:46:50 AM (11 years ago)
Author:
aslmd
Message:

LMDZ.MARS + MESOSCALE

A quite major commit, at least for MESOSCALE.
In a word: any ngrid deserves to be free.

  • no need to recompile when changing number of horizontal grid points or number of processors
  • latest version of LMDZ.MARS physics can be used
  • WARNING! Nesting is still yet to be fixed (since r1027)

Also some small bug fixes to LMDZ.MARS.

Changes in LMDZ.MARS


--> fixed a potential bug in thermal plume model because zlmax was computed both in thermcell_main_mars and calltherm_interface... so made it an OUT argument of calltherm_interface. also: changed the name to limz. and added precompiling flags to avoid the use of planetwide in MESOSCALE. in MESOSCALE we just go high enough (nlayer-5) and do not care about computational cost (although we certainly gain from not using MAXVAL).
--> moved allocations upward in inifis. does not change anything for GCM, but make MESOSCALE modifications simpler, and overall make inifis better organized: first allocations, then reading callphys.def file.
--> added precompiling flags around lines that are both useless for MESOSCALE (notably I/O) and recently adapted to parallel computations in the GCM
--> tidied up what is MESOSCALE vs. GCM in surfini

Changes in MESOSCALE


--> changed makemeso to allow dynamically set nx ny nprocs
--> changed makemeso to remove links to Fortran code adapted to parallel GCM and useless for mesoscale
--> changed ngridmx to ngrid in inifis includes

File:
1 edited

Legend:

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

    r1130 r1212  
    3737     &                  ,pu,pv,pt,pq,pq2  &
    3838     &                  ,pdtadj,pdqadj  &
    39      &                  ,fm,entr,detr,lmax,zmax  &
     39     &                  ,fm,entr,detr,lmax,zmax,limz  &
    4040     &                  ,zw2,fraca &
    4141     &                  ,zpopsk,heatFlux,heatFlux_down &
     
    4343
    4444      USE comtherm_h
     45#ifndef MESOSCALE
    4546      use planetwide_mod, only: planetwide_maxval
     47#endif
    4648
    4749      IMPLICIT NONE
     
    8587      REAL, INTENT(OUT) :: heatFlux_down(ngrid,nlayer) ! interface heat flux from downdraft
    8688
     89      INTEGER, INTENT(OUT) :: limz ! limit vertical index for integration
     90
    8791! ============== LOCAL ================
    8892      REAL :: pdqadj(ngrid,nlayer,nq) !tracer change from thermals dq/dt, only for CO2 (the rest can be advected outside of the loop)
     
    153157      REAL denom(ngrid)
    154158      REAL zlevinter(ngrid)
    155       INTEGER zlmax
    156159
    157160! =========================================
     
    765768! ===========================================================================
    766769
    767       !zlmax=MAXVAL(lmax(:))+2 ! OK, but in serial mode only; use planet
    768       call planetwide_maxval(lmax,zlmax)
    769       zlmax=zlmax+2
     770#ifdef MESOSCALE
     771      limz= nlayer-5 ! the most important is limz > max(PBLheight)+2
     772                     ! nlayer-5 is more than enough!
     773#else
     774      call planetwide_maxval(lmax,limz)
     775      limz=limz+2
     776#endif
    770777     
    771       if (zlmax .ge. nlayer) then
     778      if (limz .ge. nlayer) then
    772779        print*,'thermals have reached last layer of the model'
    773780        print*,'this is not good !'
    774         zlmax=nlayer
     781        limz=nlayer
    775782      endif
    776783! alim_star_clos is the source profile used for closure. It consists of the
     
    794801
    795802! llmax is the index of the heighest thermal in the simulation domain
    796       !llmax=1
    797       !do ig=1,ngrid
    798       !   if (lalim(ig)>llmax) llmax=lalim(ig)
    799       !enddo
     803#ifdef MESOSCALE
     804      !! AS: THIS IS PARALLEL SENSITIVE!!!!! to be corrected?
     805      llmax=1
     806      do ig=1,ngrid
     807         if (lalim(ig)>llmax) llmax=lalim(ig)
     808      enddo
     809#else
    800810      call planetwide_maxval(lalim,llmax)
     811#endif
    801812
    802813! Integral of a**2/(rho* Delta z), see equation 13 of appendix 4.2 in paper
     
    856867!-------------------------------------------------------------------------
    857868
    858       do l=1,zlmax
     869      do l=1,limz
    859870         entr(:,l)=f(:)*(entr_star(:,l)+alim_star(:,l))
    860871         detr(:,l)=f(:)*detr_star(:,l)
     
    863874! Reconstruct the updraft mass flux everywhere
    864875
    865       do l=1,zlmax
     876      do l=1,limz
    866877         do ig=1,ngrid
    867878            if (l.lt.lmax(ig)) then
     
    890901!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    891902
    892       do l=1,zlmax !loop on the levels
     903      do l=1,limz !loop on the levels
    893904!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    894905
     
    9921003!-----------------------------------------------------------------------
    9931004
    994       do l=1,zlmax
     1005      do l=1,limz
    9951006         do ig=1,ngrid
    9961007            eee0=entr(ig,l)
     
    11401151!------------------------------------------------------------------
    11411152      fraca(:,:)=0.
    1142       do l=2,zlmax
     1153      do l=2,limz
    11431154         do ig=1,ngrid
    11441155            if (zw2(ig,l).gt.1.e-10) then
     
    11611172      if (igcm_co2.ne.0) then
    11621173      detrmod(:,:)=0.
    1163       do k=1,zlmax
     1174      do k=1,limz
    11641175         do ig=1,ngrid
    11651176            detrmod(ig,k)=fm(ig,k)-fm(ig,k+1) &
     
    11741185      call thermcell_dqup(ngrid,nlayer,ptimestep     &
    11751186     &     ,fm,entr,detrmod,  &
    1176      &    masse,pq(:,:,igcm_co2),pdqadj(:,:,igcm_co2),ndt,zlmax)
     1187     &    masse,pq(:,:,igcm_co2),pdqadj(:,:,igcm_co2),ndt,limz)
    11771188
    11781189! Compute the ratio between theta and theta_m
    11791190     
    1180        do l=1,zlmax
     1191       do l=1,limz
    11811192          do ig=1,ngrid
    11821193             ratiom(ig,l)=1./(A*(pq(ig,l,igcm_co2)+pdqadj(ig,l,igcm_co2)*ptimestep)+B)
     
    11911202
    11921203      pdtadj(:,:)=0.
    1193       do l=1,zlmax
     1204      do l=1,limz
    11941205         do ig=1,ngrid
    11951206         pdtadj(ig,l)=(zdthladj(ig,l)+zdthladj_down(ig,l))*zpopsk(ig,l)*ratiom(ig,l)
     
    12251236        buoyancyEst(:,:)=0.
    12261237        heatFlux_down(:,:)=0.
    1227       do l=1,zlmax
     1238      do l=1,limz
    12281239       do ig=1,ngrid
    12291240        heatFlux(ig,l)=fm(ig,l)*(teta_th_int(ig,l)-teta_env_int(ig,l))/(rhobarz(ig,l))
Note: See TracChangeset for help on using the changeset viewer.