Ignore:
Timestamp:
Jul 29, 2025, 3:51:19 PM (3 months ago)
Author:
jmauxion
Message:

Mars PCM:
In writediag* routines, the files are now opened and closed only at dump time instead of every physical step (sensible speed up in 1D mainly).
JM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/writediagmicrofi.F

    r3369 r3870  
    8181      REAL area((nbp_lon+1),nbp_lat)
    8282
    83       integer isample
     83      integer, save :: isample
    8484      integer ierr,ierr2
    8585      integer i,j,l, ig0
     
    124124#endif
    125125
    126 !***************************************************************
    127 ! Compute the output rate
    128 
    129       isample = steps_per_sol/outputs_per_sol
    130 
    131 !***************************************************************
    132 
    133126! At very first call, check if there is a "diagfi.def" to use and read it
    134127! -----------------------------------------------------------------------
    135128      IF (firstcall) THEN
    136129         firstcall=.false.
     130         
     131         ! Compute the output rate
     132         isample = steps_per_sol/outputs_per_sol
    137133
    138134!$OMP MASTER
     
    264260         ENDIF
    265261
     262         ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized
     263
    266264         endif ! of if (is_master)
    267 
    268       else
    269 
    270          if (is_master) then
    271            ! only the master is required to do this
    272 
    273            ! Open the NetCDF file
    274            ierr = NF_OPEN(fichnom,NF_WRITE,nid)
    275          endif ! of if (is_master)
    276 
    277265      endif ! if (firstnom.eq.'1234567890')
    278266
     
    297285        if (is_master) then
    298286           ! only the master is required to do this
     287
     288           ! Time to write data, open NETCDF file
     289           ierr=NF_OPEN(fichnom,NF_WRITE,nid)
     290
    299291        if ((nom.eq.firstnom) .and. (microstep.eq.1)) then
    300292        ! We have identified a "first call" (at given date)
     
    669661        endif ! of if (dim.eq.3) elseif(dim.eq.2)...
    670662
     663        if (is_master) then
     664          ! Close until next variable to dump or next dump iteration
     665          ierr= NF_CLOSE(nid)
     666        endif
     667
    671668      endif ! of if ( MOD(zitau+1,isample) .eq.0.)
    672 
    673       if (is_master) then
    674         ierr= NF_CLOSE(nid)
    675       endif
    676 
     669     
    677670      end
Note: See TracChangeset for help on using the changeset viewer.