Changeset 4027 for trunk/LMDZ.PLUTO


Ignore:
Timestamp:
Jan 20, 2026, 10:46:15 AM (2 days ago)
Author:
debatzbr
Message:

Pluto PCM: Adding a slow_diagfi flag for 1D model from Generic PCM (revision 3928).
BBT

Location:
trunk/LMDZ.PLUTO/libf
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/muphypluto/mp2m_clouds.F90

    r3957 r4027  
    360360        ! Saturation ratio:
    361361        !~~~~~~~~~~~~~~~~~~
    362         where ((z_Xvap / qsat) > 1e5)
    363           Xsat = 1e5
     362        where ((z_Xvap / qsat) > 1e8)
     363          Xsat = 1e8
    364364        elsewhere
    365365          Xsat = z_Xvap / qsat
  • trunk/LMDZ.PLUTO/libf/phypluto/inifis_mod.F90

    r3973 r4027  
    1818  use comgeomfi_h, only: totarea, totarea_planet
    1919  use comsoil_h, only: ini_comsoil_h, nsoilmx, lay1_soil, alpha_soil
    20   use time_phylmdz_mod, only: diagfi_output_rate,startfi_output_rate, &
     20  use time_phylmdz_mod, only: diagfi_output_rate,startfi_output_rate,slow_diagfi, &
    2121                              init_time, daysec, dtphys
    2222  use comcstfi_mod, only: rad, cpp, g, r, rcp, &
     
    185185                               diagfi_output_rate
    186186
     187     if ((is_master).and.(ngrid.eq.1)) write(*,*) trim(rname)//&
     188       ": Open/close diagfi.nc at output rate (rather than once) ?"
     189     slow_diagfi =.false. ! default value, open/close diagfi once (1D only)
     190           call getin_p("slow_diagfi",slow_diagfi) ! if true, open/close the diagfi.nc
     191                                                   ! at output frequency instead of once
     192                                                   ! (slower but required for debug)
     193           if ((is_master).and.(ngrid.eq.1)) write(*,*) trim(rname)//&
     194             ": slow_diagfi = ", slow_diagfi
     195     
    187196     if (is_master) write(*,*) trim(rname)//&
    188197       ": Output rate for start/startfi.nc files (in physics steps) ?"
  • trunk/LMDZ.PLUTO/libf/phypluto/time_phylmdz_mod.F90

    r3765 r4027  
    1414    INTEGER,SAVE :: startfi_output_rate ! mainly for debugging
    1515!$OMP THREADPRIVATE(diagfi_output_rate,startfi_output_rate)
     16
     17    LOGICAL,SAVE :: slow_diagfi ! to handle wether the netcdf file is
     18                                ! opened/close once or at output frequency
     19!$OMP THREADPRIVATE(slow_diagfi)
    1620
    1721CONTAINS
  • trunk/LMDZ.PLUTO/libf/phypluto/writediagfi.F

    r3749 r4027  
    4242      use geometry_mod, only: cell_area
    4343      use time_phylmdz_mod, only: diagfi_output_rate,dtphys,daysec
    44       use time_phylmdz_mod, only: day_ini
     44      use time_phylmdz_mod, only: day_ini, nday, slow_diagfi
    4545      USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root,
    4646     &                               is_master, gather
     
    7979
    8080      integer,save :: zitau=0
    81       character(len=40),save :: firstnom='1234567890'
    82 !$OMP THREADPRIVATE(zitau,firstnom)
     81      integer,save :: lastzitau=0
     82      character(len=27),save :: firstnom='1234567890'
     83      character(len=27),save :: prevnom='1234567890'
     84      character(len=27),save :: lastnom='1234567890'
     85!$OMP THREADPRIVATE(zitau,lastzitau,firstnom,prevnom,lastnom)
    8386
    8487! Ajouts
     
    8689!$OMP THREADPRIVATE(ntime)
    8790      integer :: idim,varid
    88       integer :: nid
     91      integer, save :: nid
     92!$OMP THREADPRIVATE(nid)
    8993      character(len=*),parameter :: fichnom="diagfi.nc"
    9094      integer, dimension(4) :: id
     
    132136      IF (firstcall) THEN
    133137         firstcall=.false.
     138
     139         ! Compute the lastzitau (i.e. last timestep-1)
     140               lastzitau=nday*nint(daysec/dtphys)-1
     141               if (MOD(lastzitau+1,diagfi_output_rate).ne.0.) then
     142                 ! If so, output rate is less than once per sol
     143                 ! We must adjust zitau to
     144                 lastzitau=lastzitau-MOD(lastzitau+1,diagfi_output_rate)
     145               endif
    134146
    135147!$OMP MASTER
     
    256268         ENDIF
    257269
     270         ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized
     271
    258272         endif ! of if (is_master)
    259273
    260       else
    261 
    262          if (is_master) then
    263            ! only the master is required to do this
    264 
    265            ! Open the NetCDF file
    266            ierr = NF_OPEN(fichnom,NF_WRITE,nid)
    267          endif ! of if (is_master)
    268 
    269274      endif ! if (firstnom.eq.'1234567890')
     275
     276      ! Find lastnom
     277            if (lastnom.eq.'1234567890') then
     278               if (nom.eq.firstnom) then
     279                  if (prevnom.ne.'1234567890') then
     280                     lastnom=prevnom
     281                  endif
     282               endif
     283               prevnom=nom
     284            endif
    270285
    271286! Increment time index 'zitau' if it is the "fist call" (at given time level)
     
    288303
    289304        if (is_master) then
    290            ! only the master is required to do this
     305          ! only the master is required to do this
     306
     307                ! 1D and slow_diagfi=.false. => open/close once
     308                if ((klon_glo.eq.1).and.(.not.slow_diagfi)) then
     309                  ! if the very first time to write, open
     310            if ((nom.eq.firstnom).and.
     311     &         (((zitau+1)/diagfi_output_rate).eq.1)) then
     312                    write(*,*) "Open NETCDF file for firstnom=", firstnom
     313                    write(*,*) "zitau=", zitau
     314                    ierr=NF_OPEN(fichnom,NF_WRITE,nid) ! open once in all simu
     315                  endif
     316                else ! 3D or slow_diagfi=.true. => open/close at output frequency
     317                  ierr=NF_OPEN(fichnom,NF_WRITE,nid)           
     318                endif
     319
    291320        if (nom.eq.firstnom) then
    292321        ! We have identified a "first call" (at given date)
     
    625654        endif ! of if (dim.eq.3) elseif(dim.eq.2)...
    626655
     656        ! Only the master do it
     657                    if (is_master) then
     658                      ! 1D and slow_diagfi=.false. => open/close once
     659                      if ((klon_glo.eq.1).and.(.not.slow_diagfi)) then
     660                        ! if the very last time to write, close
     661                        if ((nom.eq.lastnom).and.(zitau.eq.lastzitau)) then
     662                          write(*,*) "Close NETCDF file for lastnom=",lastnom
     663                          write(*,*) "zitau=",zitau
     664                          ierr = NF_CLOSE(nid) ! close once in all simu
     665                        endif
     666                      else ! 3D or slow_diagfi=.true. => open/close at output frequency
     667                        ierr = NF_CLOSE(nid)
     668                      endif
     669                    endif
     670
    627671      endif ! of if ( MOD(zitau+1,isample) .eq.0.)
    628672
    629       if (is_master) then
    630         ierr= NF_CLOSE(nid)
    631       endif
    632 
    633673      end
  • trunk/LMDZ.PLUTO/libf/phypluto/writediagspecIR.F

    r3749 r4027  
    180180           call iniwrite_specIR(nid,day_ini,areafi_glo(1),1,1)
    181181         ENDIF
     182         ! Close the NetCDF file
     183               ierr= NF_CLOSE(nid)
    182184         endif ! of if (is_master)
    183185
    184186         zitau = -1 ! initialize zitau
    185       else
    186          if (is_master) then
    187            ! Open the NetCDF file
    188            ierr = NF_OPEN(fichnom,NF_WRITE,nid)
    189          endif
    190187      endif ! if (firstnom.eq.'1234567890')
    191188
     
    202199
    203200      if ( MOD(zitau+1,isample) .eq.0.) then
     201
     202        if (is_master) then
     203                ! Open the NetCDF file
     204                ierr = NF_OPEN(fichnom,NF_WRITE,nid)
     205              endif
    204206
    205207! Compute/write/extend 'Time' coordinate (date given in days)
     
    334336        endif ! of if (dimpx.eq.3)
    335337
     338        ! Close the NetCDF file
     339              if (is_master) then
     340                ierr= NF_CLOSE(nid)
     341              endif
     342
    336343      endif ! of if ( MOD(zitau+1,isample) .eq.0.)
    337344
    338       ! Close the NetCDF file
    339       if (is_master) then
    340         ierr= NF_CLOSE(nid)
    341       endif
    342 
    343345      end
  • trunk/LMDZ.PLUTO/libf/phypluto/writediagspecVI.F

    r3749 r4027  
    179179           call iniwrite_specVI(nid,day_ini,areafi_glo(1),1,1)
    180180         ENDIF
     181         ! Close the NetCDF file
     182               ierr= NF_CLOSE(nid)
    181183         endif ! of if (is_master)
    182184
    183185         zitau = -1 ! initialize zitau
    184       else
    185          if (is_master) then
    186            ! Open the NetCDF file
    187            ierr = NF_OPEN(fichnom,NF_WRITE,nid)
    188          endif
    189186      endif ! if (firstnom.eq.'1234567890')
    190187
     
    207204!       (like the 'histoire' outputs)
    208205!--------------------------------------------------------
     206
     207        if (is_master) then
     208                ! Open the NetCDF file
     209                ierr = NF_OPEN(fichnom,NF_WRITE,nid)
     210              endif
    209211
    210212        if (nom.eq.firstnom) then
     
    333335        endif ! of if (dimpx.eq.3)
    334336
     337        ! Close the NetCDF file
     338              if (is_master) then
     339                ierr= NF_CLOSE(nid)
     340              endif
     341
    335342      endif ! of if ( MOD(zitau+1,irythme) .eq.0.)
    336343
    337       ! Close the NetCDF file
    338       if (is_master) then
    339         ierr= NF_CLOSE(nid)
    340       endif
    341 
    342344      end
Note: See TracChangeset for help on using the changeset viewer.