Changeset 3870 for trunk/LMDZ.MARS/libf
- Timestamp:
- Jul 29, 2025, 3:51:19 PM (6 months ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 3 edited
-
writediagfi.F (modified) (6 diffs)
-
writediagmicrofi.F (modified) (5 diffs)
-
writediagsoil.F90 (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/writediagfi.F
r3369 r3870 74 74 REAL area((nbp_lon+1),nbp_lat) 75 75 76 integer isample76 integer, save :: isample 77 77 integer ierr,ierr2 78 78 integer i,j,l, ig0 … … 122 122 123 123 !*************************************************************** 124 ! Compute the output rate125 126 isample=steps_per_sol/outputs_per_sol127 128 !***************************************************************129 124 130 125 ! At very first call, check if there is a "diagfi.def" to use and read it … … 132 127 IF (firstcall) THEN 133 128 firstcall=.false. 129 130 ! Compute the output rate 131 isample=steps_per_sol/outputs_per_sol 134 132 135 133 !$OMP MASTER … … 251 249 ENDIF 252 250 251 ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized 252 253 253 endif ! of if (is_master) 254 255 else256 257 if (is_master) then258 ! only the master is required to do this259 260 ! Open the NetCDF file261 ierr = NF_OPEN(fichnom,NF_WRITE,nid)262 endif ! of if (is_master)263 264 254 endif ! if (firstnom.eq.'1234567890') 265 255 … … 276 266 277 267 if ( MOD(zitau+1,isample) .eq.0.) then 278 268 279 269 ! Compute/write/extend 'Time' coordinate (date given in days) 280 270 ! (done every "first call" (at given time level) to writediagfi) 281 271 ! Note: date is incremented as 1 step ahead of physics time 282 272 !-------------------------------------------------------- 283 284 273 if (is_master) then 285 ! only the master is required to do this 286 if (nom.eq.firstnom) then 287 ! We have identified a "first call" (at given date) 288 ntime=ntime+1 ! increment # of stored time steps 289 ! compute corresponding date (in days and fractions thereof) 290 date=(zitau +1.)/steps_per_sol 291 ! Get NetCDF ID of 'Time' variable 292 ierr= NF_INQ_VARID(nid,"Time",varid) 293 ! Write (append) the new date to the 'Time' array 294 !#ifdef NC_DOUBLE 295 ! ierr= NF_PUT_VARA_DOUBLE(nid,varid,[ntime],[1],[date]) 274 ! 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 280 ! We have identified a "first call" (at given date) 281 ntime=ntime+1 ! increment # of stored time steps 282 ! compute corresponding date (in days and fractions thereof) 283 date=(zitau +1.)/steps_per_sol 284 ! Get NetCDF ID of 'Time' variable 285 ierr= NF_INQ_VARID(nid,"Time",varid) 286 ! Write (append) the new date to the 'Time' array 287 !#ifdef NC_DOUBLE 288 ! ierr= NF_PUT_VARA_DOUBLE(nid,varid,[ntime],[1],[date]) 296 289 !#else 297 ierr= NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date])290 ierr= NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date]) 298 291 !#endif 299 if (ierr.ne.NF_NOERR) then 300 write(*,*) "***** PUT_VAR matter in writediagfi_nc" 301 write(*,*) "***** with time" 302 write(*,*) 'ierr=', ierr,": ",NF_STRERROR(ierr) 303 c call abort 304 endif 305 306 write(6,*)'WRITEDIAGFI: date= ', date 307 end if ! of if (nom.eq.firstnom) 308 292 if (ierr.ne.NF_NOERR) then 293 write(*,*) "***** PUT_VAR matter in writediagfi_nc" 294 write(*,*) "***** with time" 295 write(*,*) 'ierr=', ierr,": ",NF_STRERROR(ierr) 296 c call abort 297 endif 298 299 write(6,*)'WRITEDIAGFI: date= ', date 300 end if ! of if (nom.eq.firstnom) 309 301 endif ! of if (is_master) 310 302 … … 621 613 endif ! of if (dim.eq.3) elseif(dim.eq.2)... 622 614 615 if (is_master) then 616 ! Close until next variable to dump or next dump iteration 617 ierr= NF_CLOSE(nid) 618 endif 619 623 620 endif ! of if ( MOD(zitau+1,isample) .eq.0.) 624 621 625 if (is_master) then626 ierr= NF_CLOSE(nid)627 endif628 629 622 end -
trunk/LMDZ.MARS/libf/phymars/writediagmicrofi.F
r3369 r3870 81 81 REAL area((nbp_lon+1),nbp_lat) 82 82 83 integer isample83 integer, save :: isample 84 84 integer ierr,ierr2 85 85 integer i,j,l, ig0 … … 124 124 #endif 125 125 126 !***************************************************************127 ! Compute the output rate128 129 isample = steps_per_sol/outputs_per_sol130 131 !***************************************************************132 133 126 ! At very first call, check if there is a "diagfi.def" to use and read it 134 127 ! ----------------------------------------------------------------------- 135 128 IF (firstcall) THEN 136 129 firstcall=.false. 130 131 ! Compute the output rate 132 isample = steps_per_sol/outputs_per_sol 137 133 138 134 !$OMP MASTER … … 264 260 ENDIF 265 261 262 ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized 263 266 264 endif ! of if (is_master) 267 268 else269 270 if (is_master) then271 ! only the master is required to do this272 273 ! Open the NetCDF file274 ierr = NF_OPEN(fichnom,NF_WRITE,nid)275 endif ! of if (is_master)276 277 265 endif ! if (firstnom.eq.'1234567890') 278 266 … … 297 285 if (is_master) then 298 286 ! 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 299 291 if ((nom.eq.firstnom) .and. (microstep.eq.1)) then 300 292 ! We have identified a "first call" (at given date) … … 669 661 endif ! of if (dim.eq.3) elseif(dim.eq.2)... 670 662 663 if (is_master) then 664 ! Close until next variable to dump or next dump iteration 665 ierr= NF_CLOSE(nid) 666 endif 667 671 668 endif ! of if ( MOD(zitau+1,isample) .eq.0.) 672 673 if (is_master) then 674 ierr= NF_CLOSE(nid) 675 endif 676 669 677 670 end -
trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90
r3369 r3870 159 159 call iniwritesoil(nid,ngrid,inertiafi_glo(1,:),areafi_glo(1),1,1,nsoilmx,mlayer) 160 160 endif 161 162 ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized 161 163 162 164 endif ! of if (is_master) … … 164 166 ! set zitau to -1 to be compatible with zitau incrementation step below 165 167 zitau=-1 166 167 else168 ! If not an initialization call, simply open the NetCDF file169 if (is_master) then170 ierr=NF_OPEN(filename,NF_WRITE,nid)171 endif172 168 endif ! of if (firstname.eq."1234567890") 173 169 … … 180 176 ! 3. Write data, if the time index matches the sample rate 181 177 if (mod(zitau+1,isample).eq.0) then 178 if (is_master) then 179 ! only the master is required to do this 180 181 ! Time to write data, open NETCDF file 182 ierr=NF_OPEN(filename,NF_WRITE,nid) 182 183 183 184 ! 3.1 If first call at this date, update 'time' variable 184 if (name.eq.firstname) then 185 ntime=ntime+1 186 date=float(zitau+1)/float(steps_per_sol) 187 188 if (is_master) then 189 ! Get NetCDF ID for "time" 190 ierr=NF_INQ_VARID(nid,"time",varid) 191 ! Add the current value of date to the "time" array 185 if (name.eq.firstname) then 186 ntime=ntime+1 187 date=float(zitau+1)/float(steps_per_sol) 188 ! Get NetCDF ID for "time" 189 ierr=NF_INQ_VARID(nid,"time",varid) 190 ! Add the current value of date to the "time" array 192 191 !#ifdef NC_DOUBLE 193 !ierr=NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date)192 ! ierr=NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date) 194 193 !#else 195 ierr=NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date])194 ierr=NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date]) 196 195 !#endif 197 196 if (ierr.ne.NF_NOERR) then … … 199 198 call abort_physic("writediagsoil","failed writing time",1) 200 199 endif 201 endif ! of if ( is_master)202 endif ! of if ( name.eq.firstname)200 endif ! of if (name.eq.firstname) 201 endif ! of if (is_master) 203 202 204 203 ! 3.2 Write the variable to the NetCDF file … … 409 408 410 409 endif ! of if (dimpx.eq.3) elseif (dimpx.eq.2) ... 410 411 ! 4. Close the NetCDF file 412 if (is_master) then 413 ! Close until next variable to dump or next dump iteration 414 ierr= NF_CLOSE(nid) 415 endif 416 411 417 endif ! of if (mod(zitau+1,isample).eq.0) 412 418 413 ! 4. Close the NetCDF file414 if (is_master) then415 ierr=NF_CLOSE(nid)416 endif417 418 419 end subroutine writediagsoil 419 420
Note: See TracChangeset
for help on using the changeset viewer.
