Changeset 4027 for trunk/LMDZ.PLUTO/libf/phypluto/writediagfi.F
- Timestamp:
- Jan 20, 2026, 10:46:15 AM (2 days ago)
- File:
-
- 1 edited
-
trunk/LMDZ.PLUTO/libf/phypluto/writediagfi.F (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/libf/phypluto/writediagfi.F
r3749 r4027 42 42 use geometry_mod, only: cell_area 43 43 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 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 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) 83 86 84 87 ! Ajouts … … 86 89 !$OMP THREADPRIVATE(ntime) 87 90 integer :: idim,varid 88 integer :: nid 91 integer, save :: nid 92 !$OMP THREADPRIVATE(nid) 89 93 character(len=*),parameter :: fichnom="diagfi.nc" 90 94 integer, dimension(4) :: id … … 132 136 IF (firstcall) THEN 133 137 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 134 146 135 147 !$OMP MASTER … … 256 268 ENDIF 257 269 270 ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized 271 258 272 endif ! of if (is_master) 259 273 260 else261 262 if (is_master) then263 ! only the master is required to do this264 265 ! Open the NetCDF file266 ierr = NF_OPEN(fichnom,NF_WRITE,nid)267 endif ! of if (is_master)268 269 274 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 270 285 271 286 ! Increment time index 'zitau' if it is the "fist call" (at given time level) … … 288 303 289 304 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 291 320 if (nom.eq.firstnom) then 292 321 ! We have identified a "first call" (at given date) … … 625 654 endif ! of if (dim.eq.3) elseif(dim.eq.2)... 626 655 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 627 671 endif ! of if ( MOD(zitau+1,isample) .eq.0.) 628 672 629 if (is_master) then630 ierr= NF_CLOSE(nid)631 endif632 633 673 end
Note: See TracChangeset
for help on using the changeset viewer.
