Changeset 1532 for trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90
- Timestamp:
- Apr 7, 2016, 3:53:15 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/writediagsoil.F90
r1528 r1532 36 36 real*4,dimension(nbp_lon+1,nbp_lat) :: data2 ! to store 2D data 37 37 real*4 :: data0 ! to store 0D data 38 real*4 :: data3_1d(1,nsoilmx) ! to store a profile in 1D model 39 real*4 :: data2_1d ! to store surface value with 1D model 38 40 integer :: i,j,l ! for loops 39 41 integer :: ig0 … … 51 53 character(len=20),save :: firstname="1234567890" 52 54 integer,save :: zitau=0 55 !$OMP THREADPRIVATE(date,isample,ntime,firstname,zitau) 53 56 54 57 character(len=30) :: filename="diagsoil.nc" … … 107 110 108 111 ! build inertia() and area() 109 do i=1,nbp_lon+1 ! poles 112 if (klon_glo>1) then 113 do i=1,nbp_lon+1 ! poles 110 114 inertia(i,1,1:nsoilmx)=inertiafi_glo(1,1:nsoilmx) 111 115 inertia(i,nbp_lat,1:nsoilmx)=inertiafi_glo(klon_glo,1:nsoilmx) … … 113 117 area(i,1)=areafi_glo(1)/nbp_lon 114 118 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 115 enddo116 do j=2,nbp_lat-1119 enddo 120 do j=2,nbp_lat-1 117 121 ig0= 1+(j-2)*nbp_lon 118 122 do i=1,nbp_lon … … 123 127 inertia(nbp_lon+1,j,1:nsoilmx)=inertia(1,j,1:nsoilmx) 124 128 area(nbp_lon+1,j)=area(1,j) 125 enddo 129 enddo 130 endif 126 131 127 132 ! write "header" of file (longitudes, latitudes, geopotential, ...) 128 call iniwritesoil(nid,ngrid,inertia,area) 133 if (klon_glo>1) then ! general 3D case 134 call iniwritesoil(nid,ngrid,inertia,area,nbp_lon+1,nbp_lat) 135 else ! 1D model 136 call iniwritesoil(nid,ngrid,inertiafi_glo(1,:),areafi_glo(1),1,1) 137 endif 129 138 130 139 endif ! of if (is_master) … … 188 197 !$OMP BARRIER 189 198 #else 190 do l=1,nsoilmx 199 if (klon_glo>1) then ! General case 200 do l=1,nsoilmx 191 201 ! handle the poles 192 202 do i=1,nbp_lon+1 … … 202 212 data3(nbp_lon+1,j,l)=data3(1,j,l) ! extra (modulo) longitude 203 213 enddo 204 enddo 214 enddo 215 else ! 1D model case 216 data3_1d(1,1:nsoilmx)=px(1,1:nsoilmx) 217 endif 205 218 #endif 206 219 … … 229 242 corners(4)=ntime 230 243 231 edges(1)=nbp_lon+1 244 if (klon_glo==1) then 245 edges(1)=1 246 else 247 edges(1)=nbp_lon+1 248 endif 232 249 edges(2)=nbp_lat 233 250 edges(3)=nsoilmx … … 238 255 ! ierr=NF_PUT_VARA_DOUBLE(nid,varid,corners,edges,data3) 239 256 !#else 240 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data3) 257 if (klon_glo>1) then 258 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data3) 259 else 260 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data3_1d) 261 endif 241 262 !#endif 242 263 if (ierr.ne.NF_NOERR) then … … 263 284 !$OMP BARRIER 264 285 #else 265 ! handle the poles 266 do i=1,nbp_lon+1 267 data2(i,1)=px(1,1) 268 data2(i,nbp_lat)=px(ngrid,1) 269 enddo 270 ! rest of the grid 271 do j=2,nbp_lat-1 272 ig0=1+(j-2)*nbp_lon 273 do i=1,nbp_lon 274 data2(i,j)=px(ig0+i,1) 275 enddo 276 data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude 277 enddo 286 if (klon_glo>1) then ! general case 287 ! handle the poles 288 do i=1,nbp_lon+1 289 data2(i,1)=px(1,1) 290 data2(i,nbp_lat)=px(ngrid,1) 291 enddo 292 ! rest of the grid 293 do j=2,nbp_lat-1 294 ig0=1+(j-2)*nbp_lon 295 do i=1,nbp_lon 296 data2(i,j)=px(ig0+i,1) 297 enddo 298 data2(nbp_lon+1,j)=data2(1,j) ! extra (modulo) longitude 299 enddo 300 else ! 1D model case 301 data2_1d=px(1,1) 302 endif 278 303 #endif 279 304 … … 300 325 corners(3)=ntime 301 326 302 edges(1)=nbp_lon+1 327 if (klon_glo==1) then 328 edges(1)=1 329 else 330 edges(1)=nbp_lon+1 331 endif 303 332 edges(2)=nbp_lat 304 333 edges(3)=1 … … 308 337 ! ierr=NF_PUT_VARA_DOUBLE(nid,varid,corners,edges,data2) 309 338 !#else 310 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2) 339 if (klon_glo>1) then ! General case 340 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2) 341 else 342 ierr=NF_PUT_VARA_REAL(nid,varid,corners,edges,data2_1d) 343 endif 311 344 !#endif 312 345 if (ierr.ne.NF_NOERR) then
Note: See TracChangeset
for help on using the changeset viewer.