Changeset 3923 for trunk/LMDZ.MARS/libf/phymars/writediagfi.F
- Timestamp:
- Oct 6, 2025, 11:24:25 AM (3 months ago)
- File:
-
- 1 edited
-
trunk/LMDZ.MARS/libf/phymars/writediagfi.F (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/writediagfi.F
r3870 r3923 41 41 use surfdat_h, only: phisfi 42 42 use geometry_mod, only: cell_area 43 use time_phylmdz_mod, only: steps_per_sol, outputs_per_sol 44 use time_phylmdz_mod, only: day_ini43 use time_phylmdz_mod, only: steps_per_sol, outputs_per_sol, 44 & day_end, day_ini, slow_diagfi 45 45 USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root, 46 46 & is_master, gather … … 79 79 80 80 integer,save :: zitau=0 81 integer,save :: lastzitau=0 81 82 character(len=27),save :: firstnom='1234567890' 83 character(len=27),save :: prevnom='1234567890' 84 character(len=27),save :: lastnom='1234567890' 82 85 !$OMP THREADPRIVATE(zitau,firstnom) 83 86 … … 86 89 !$OMP THREADPRIVATE(ntime) 87 90 integer :: idim,varid 88 integer :: nid91 integer, save :: nid 89 92 character(len=*),parameter :: fichnom="diagfi.nc" 90 93 integer, dimension(4) :: id … … 130 133 ! Compute the output rate 131 134 isample=steps_per_sol/outputs_per_sol 132 135 lastzitau=(day_end-day_ini)*steps_per_sol-1 133 136 !$OMP MASTER 134 137 ! Open diagfi.def definition file if there is one: … … 254 257 endif ! if (firstnom.eq.'1234567890') 255 258 256 ! Increment time index 'zitau' if it is the "fist call" (at given time level) 259 ! Find lastnom 260 if (lastnom.eq.'1234567890') then 261 if (nom.eq.firstnom) then 262 if (prevnom.ne.'1234567890') then 263 lastnom=prevnom 264 endif 265 endif 266 prevnom=nom 267 endif 268 269 ! Increment time index 'zitau' if it is the "first call" (at given time level) 257 270 ! to writediagfi 258 271 !------------------------------------------------------------------------ … … 264 277 ! Write the variables to output file if it's time to do so 265 278 !-------------------------------------------------------- 266 267 279 if ( MOD(zitau+1,isample) .eq.0.) then 268 280 … … 273 285 if (is_master) then 274 286 ! only the master is required to do this 275 276 ! Time to write data, open NETCDF file 277 ierr=NF_OPEN(fichnom,NF_WRITE,nid) 278 279 if (nom.eq.firstnom) then 287 288 ! 1D and slow_diagfi=.false. => open/close once 289 if ((klon_glo.eq.1).and.(.not.slow_diagfi)) then 290 ! if the very first time to write, open 291 if ((nom.eq.firstnom).and.((zitau+1)/isample.eq.1)) then 292 write(*,*) "Open NETCDF file for firstnom=", firstnom, " and zitau=", zitau 293 ierr=NF_OPEN(fichnom,NF_WRITE,nid) ! open once in all simu 294 endif 295 else ! 3D or slow_diagfi=.true. => open/close at output frequency 296 ierr=NF_OPEN(fichnom,NF_WRITE,nid) 297 endif 298 299 if(nom.eq.firstnom) then 280 300 ! We have identified a "first call" (at given date) 281 301 ntime=ntime+1 ! increment # of stored time steps … … 613 633 endif ! of if (dim.eq.3) elseif(dim.eq.2)... 614 634 635 ! Only the master do it 615 636 if (is_master) then 616 ! Close until next variable to dump or next dump iteration 617 ierr= NF_CLOSE(nid) 637 ! 1D and slow_diagfi=.false. => open/close once 638 if ((klon_glo.eq.1).and.(.not.slow_diagfi)) then 639 ! if the very last time to write, close 640 if ((nom.eq.lastnom).and.(zitau.eq.lastzitau)) then 641 write(*,*) "Close NETCDF file for lastnom=",lastnom, "and zitau=", zitau 642 ierr = NF_CLOSE(nid) ! close once in all simu 643 endif 644 else ! 3D or slow_diagfi=.true. => open/close at output frequency 645 ierr = NF_CLOSE(nid) 646 endif 618 647 endif 619 648
Note: See TracChangeset
for help on using the changeset viewer.
