Changeset 4130 for trunk/LMDZ.GENERIC
- Timestamp:
- Mar 16, 2026, 10:51:10 AM (3 weeks ago)
- Location:
- trunk/LMDZ.GENERIC
- Files:
-
- 4 edited
-
changelog.txt (modified) (1 diff)
-
libf/phygeneric/inifis_mod.F90 (modified) (2 diffs)
-
libf/phygeneric/iniwritesoil.F90 (modified) (2 diffs)
-
libf/phygeneric/writediagsoil.F90 (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/changelog.txt
r4121 r4130 2208 2208 == 12/03/2026 == CM 2209 2209 Added subsurface outputs for XIOS, and outputting tsoil for XIOS. 2210 2211 == 16/03/2026 == EM 2212 Follow-up of previous commit, cleanup output of soil variables in diagsoil.nc 2213 when not using XIOS. Added logical flag "diagsoil" (default .false.) to trigger 2214 outputs in diagsoil.nc -
trunk/LMDZ.GENERIC/libf/phygeneric/inifis_mod.F90
r4126 r4130 25 25 use callkeys_mod 26 26 use wstats_mod, only: callstats 27 use writediagsoil_mod, only: diagsoil 27 28 use ioipsl_getin_p_mod, only : getin_p 28 29 use mod_phys_lmdz_para, only : is_parallel, is_master, bcast … … 259 260 call getin_p("callstats",callstats) 260 261 if (is_master) write(*,*) trim(rname)//": callstats = ",callstats 262 263 if (is_master) write(*,*) trim(rname)//& 264 ": Write sub-surface fields in file diagsoil.nc ?" 265 diagsoil=.false. ! default value 266 call getin_p("diagsoil",diagsoil) 267 if (is_master) write(*,*) trim(rname)//": diagsoil = ",diagsoil 261 268 262 269 if (is_master) write(*,*) trim(rname)//& -
trunk/LMDZ.GENERIC/libf/phygeneric/iniwritesoil.F90
r1531 r4130 1 module iniwritesoil_mod 2 3 implicit none 4 5 contains 6 1 7 subroutine iniwritesoil(nid,ngrid,inertia,area,nbplon,nbplat) 2 8 … … 271 277 272 278 end subroutine iniwritesoil 279 280 end module iniwritesoil_mod -
trunk/LMDZ.GENERIC/libf/phygeneric/writediagsoil.F90
r3893 r4130 2 2 3 3 implicit none 4 5 logical,save :: diagsoil ! global flag to trigger generating a diagsoil.nc 6 ! file or not. Initialized in inifis() 7 !$OMP THREADPRIVATE(diagsoil) 4 8 5 9 contains … … 24 28 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, & 25 29 nbp_lon, nbp_lat 30 use mod_grid_phy_lmdz, only: grid_type, unstructured 31 use iniwritesoil_mod, only: iniwritesoil 26 32 27 33 implicit none … … 79 85 #endif 80 86 87 ! 0. Do we ouput a diagsoil.nc file? If not just bail out now. 88 if(.not.diagsoil) return 89 90 ! additional check: one can only output diagsoil.nc files 91 ! in lon-lat case (or 1D) 92 if (grid_type==unstructured) then 93 write(*,*) "writediagsoil: Error !!!" 94 write(*,*) "diagsoil.nc outputs not possible on unstructured grids!!" 95 call abort_physic("writediagsoil","impossible on unstructured grid",1) 96 endif 97 81 98 ! 1. Initialization step 82 99 if (firstname.eq."1234567890") then … … 100 117 call abort_physic("writediagsoil","Unable to crzate output file",1) 101 118 endif 119 endif ! of if ((is_master) 102 120 103 121 #ifdef CPP_PARA … … 111 129 #endif 112 130 131 if (is_master) then 113 132 ! build inertia() and area() 114 133 if (klon_glo>1) then … … 139 158 endif 140 159 160 ierr= NF_CLOSE(nid) ! Close the NETCDF file once initialized 161 141 162 endif ! of if (is_master) 142 163 … … 144 165 zitau=-1 145 166 146 else147 ! If not an initialization call, simply open the NetCDF file148 if (is_master) then149 ierr=NF_OPEN(filename,NF_WRITE,nid)150 endif151 167 endif ! of if (firstname.eq."1234567890") 152 168 … … 159 175 ! 3. Write data, if the time index matches the sample rate 160 176 if (mod(zitau+1,diagfi_output_rate).eq.0) then 177 if (is_master) then 178 ! only the master is required to do this 179 180 ! Time to write data, open NETCDF file 181 ierr=NF_OPEN(filename,NF_WRITE,nid) 161 182 162 183 ! 3.1 If first call at this date, update 'time' variable … … 164 185 ntime=ntime+1 165 186 date=(zitau+1)*(dtphys/daysec) 166 ! Note: day_step is known from control.h167 168 if (is_master) then169 187 ! Get NetCDF ID for "time" 170 188 ierr=NF_INQ_VARID(nid,"time",varid) … … 173 191 ! ierr=NF_PUT_VARA_DOUBLE(nid,varid,ntime,1,date) 174 192 !#else 175 ierr=NF_PUT_VARA_REAL(nid,varid, ntime,1,date)193 ierr=NF_PUT_VARA_REAL(nid,varid,[ntime],[1],[date]) 176 194 !#endif 177 195 if (ierr.ne.NF_NOERR) then 178 196 call abort_physic("writediagsoil", "Failed writing date to time variable",1) 197 call abort_physic("writediagsoil","failed writing time",1) 179 198 endif 180 endif ! of if ( is_master)181 endif ! of if ( name.eq.firstname)199 endif ! of if (name.eq.firstname) 200 endif ! of if (is_master) 182 201 183 202 ! 3.2 Write the variable to the NetCDF file 184 203 if (dimpx.eq.3) then ! Case of a 3D variable 185 204 ! A. Recast data along 'dynamics' grid 205 if (klon_glo>1) then ! General case 186 206 #ifdef CPP_PARA 187 207 ! gather field on a "global" (without redundant longitude) array … … 197 217 !$OMP BARRIER 198 218 #else 199 if (klon_glo>1) then ! General case200 219 do l=1,nsoilmx 201 220 ! handle the poles … … 213 232 enddo 214 233 enddo 234 #endif 215 235 else ! 1D model case 216 236 data3_1d(1,1:nsoilmx)=px(1,1:nsoilmx) 217 237 endif 218 #endif219 238 220 239 ! B. Write (append) the variable to the NetCDF file … … 270 289 271 290 ! A. Recast data along 'dynamics' grid 291 if (klon_glo>1) then ! General case 272 292 #ifdef CPP_PARA 273 293 ! gather field on a "global" (without redundant longitude) array … … 284 304 !$OMP BARRIER 285 305 #else 286 if (klon_glo>1) then ! general case287 306 ! handle the poles 288 307 do i=1,nbp_lon+1 … … 298 317 data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude 299 318 enddo 319 #endif 300 320 else ! 1D model case 301 321 data2_1d=px(1,1) 302 322 endif 303 #endif304 323 305 324 ! B. Write (append) the variable to the NetCDF file … … 340 359 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2) 341 360 else 342 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges, data2_1d)361 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,[data2_1d]) 343 362 endif 344 363 !#endif … … 380 399 ! ierr=NF_PUT_VARA_DOUBLE(nid,varid,corners,edges,data0) 381 400 !#else 382 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges, data0)401 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,[data0]) 383 402 !#endif 384 403 if (ierr.ne.NF_NOERR) then … … 388 407 389 408 endif ! of if (dimpx.eq.3) elseif (dimpx.eq.2) ... 409 410 ! 4. Close the NetCDF file 411 if (is_master) then 412 ! Close until next variable to dump or next dump iteration 413 ierr=NF_CLOSE(nid) 414 endif 415 390 416 endif ! of if (mod(zitau+1,diagfi_output_rate).eq.0) 391 417 392 ! 4. Close the NetCDF file393 if (is_master) then394 ierr=NF_CLOSE(nid)395 endif396 397 418 end subroutine writediagsoil 398 419
Note: See TracChangeset
for help on using the changeset viewer.
