Changeset 1529 for trunk/LMDZ.GENERIC/libf/phystd/wstats.F90
- Timestamp:
- Apr 5, 2016, 10:51:51 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/wstats.F90
r1422 r1529 1 1 subroutine wstats(ngrid,nom,titre,unite,dim,px) 2 2 3 use statto_mod, only: istats,istime,count 3 4 use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather, klon_mpi_begin 4 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 5 use statto_mod, only: istats,istime,count 6 5 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, & 6 nbp_lon, nbp_lat, nbp_lev 7 7 implicit none 8 8 9 #include "dimensions.h" 10 !#include "dimphys.h" 11 #include "netcdf.inc" 9 include "netcdf.inc" 12 10 13 11 integer,intent(in) :: ngrid 14 12 character (len=*),intent(in) :: nom,titre,unite 15 13 integer,intent(in) :: dim 16 integer,parameter :: iip1=iim+1 17 integer,parameter :: jjp1=jjm+1 18 real,intent(in) :: px(ngrid,llm) 19 real, dimension(iip1,jjp1,llm) :: mean3d,sd3d,dx3 20 real, dimension(iip1,jjp1) :: mean2d,sd2d,dx2 14 real,intent(in) :: px(ngrid,nbp_lev) 15 real, dimension(nbp_lon+1,nbp_lat,nbp_lev) :: mean3d,sd3d,dx3 16 real, dimension(nbp_lon+1,nbp_lat) :: mean2d,sd2d,dx2 21 17 character (len=50) :: namebis 22 18 character (len=50), save :: firstvar … … 34 30 ! Added to work in parallel mode 35 31 #ifdef CPP_PARA 36 real px3_glop(klon_glo, llm) ! to store a 3D data set on global physics grid37 real px3_glo( iim,jjp1,llm) ! to store a global 3D data set on global lonxlat grid32 real px3_glop(klon_glo,nbp_lev) ! to store a 3D data set on global physics grid 33 real px3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set on global lonxlat grid 38 34 real px2_glop(klon_glo) ! to store a 2D data set on global physics grid 39 real px2_glo( iim,jjp1) ! to store a 2D data set on global lonxlat grid35 real px2_glo(nbp_lon,nbp_lat) ! to store a 2D data set on global lonxlat grid 40 36 real px2(ngrid) 41 real px3(ngrid, llm)37 real px3(ngrid,nbp_lev) 42 38 #else 43 39 ! When not running in parallel mode: 44 real px3_glop(ngrid, llm) ! to store a 3D data set on global physics grid45 real px3_glo( iim,jjp1,llm) ! to store a global 3D data set on global lonxlat grid40 real px3_glop(ngrid,nbp_lev) ! to store a 3D data set on global physics grid 41 real px3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set on global lonxlat grid 46 42 real px2_glop(ngrid) ! to store a 2D data set on global physics grid 47 real px2_glo( iim,jjp1) ! to store a 2D data set on global lonxlat grid43 real px2_glo(nbp_lon,nbp_lat) ! to store a 2D data set on global lonxlat grid 48 44 #endif 49 45 … … 67 63 #ifdef CPP_PARA 68 64 if (dim.eq.3) then 69 px3(1:ngrid,1: llm)=px(1:ngrid,1:llm)65 px3(1:ngrid,1:nbp_lev)=px(1:ngrid,1:nbp_lev) 70 66 ! Gather fieds on a "global" (without redundant longitude) array 71 67 call Gather(px3,px3_glop) … … 74 70 call Grid1Dto2D_glo(px3_glop,px3_glo) 75 71 ! copy dx3_glo() to dx3(:) and add redundant longitude 76 dx3(1: iim,:,:)=px3_glo(1:iim,:,:)77 dx3( iip1,:,:)=dx3(1,:,:)72 dx3(1:nbp_lon,:,:)=px3_glo(1:nbp_lon,:,:) 73 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 78 74 endif 79 75 !$OMP END MASTER … … 87 83 call Grid1Dto2D_glo(px2_glop,px2_glo) 88 84 ! copy px2_glo() to dx2(:) and add redundant longitude 89 dx2(1: iim,:)=px2_glo(1:iim,:)90 dx2( iip1,:)=dx2(1,:)85 dx2(1:nbp_lon,:)=px2_glo(1:nbp_lon,:) 86 dx2(nbp_lon+1,:)=dx2(1,:) 91 87 endif 92 88 !$OMP END MASTER … … 95 91 #else 96 92 if (dim.eq.3) then 97 px3_glop(:,1: llm)=px(:,1:llm)93 px3_glop(:,1:nbp_lev)=px(:,1:nbp_lev) 98 94 ! Passage variable physique --> variable dynamique 99 DO l=1, llm100 DO i=1, iim95 DO l=1,nbp_lev 96 DO i=1,nbp_lon 101 97 px3_glo(i,1,l)=px(1,l) 102 px3_glo(i, jjp1,l)=px(ngrid,l)98 px3_glo(i,nbp_lat,l)=px(ngrid,l) 103 99 ENDDO 104 DO j=2, jjm105 ig0= 1+(j-2)* iim106 DO i=1, iim100 DO j=2,nbp_lat-1 101 ig0= 1+(j-2)*nbp_lon 102 DO i=1,nbp_lon 107 103 px3_glo(i,j,l)=px(ig0+i,l) 108 104 ENDDO … … 112 108 px2_glop(:)=px(:,1) 113 109 ! Passage variable physique --> physique dynamique 114 DO i=1, iim110 DO i=1,nbp_lon 115 111 px2_glo(i,1)=px(1,1) 116 px2_glo(i, jjp1)=px(ngrid,1)112 px2_glo(i,nbp_lat)=px(ngrid,1) 117 113 ENDDO 118 DO j=2, jjm119 ig0= 1+(j-2)* iim120 DO i=1, iim114 DO j=2,nbp_lat-1 115 ig0= 1+(j-2)*nbp_lon 116 DO i=1,nbp_lon 121 117 px2_glo(i,j)=px(ig0+i,1) 122 118 ENDDO … … 198 194 if (dim.eq.3) then 199 195 start=(/1,1,1,indx/) 200 sizes=(/ iip1,jjp1,llm,1/)196 sizes=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 201 197 mean3d(:,:,:)=0 202 198 sd3d(:,:,:)=0 203 199 else if (dim.eq.2) then 204 200 start=(/1,1,indx,0/) 205 sizes=(/ iip1,jjp1,1,0/)201 sizes=(/nbp_lon+1,nbp_lev,1,0/) 206 202 mean2d(:,:)=0 207 203 sd2d(:,:)=0 … … 211 207 if (dim.eq.3) then 212 208 start=(/1,1,1,indx/) 213 sizes=(/ iip1,jjp1,llm,1/)209 sizes=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 214 210 #ifdef NC_DOUBLE 215 211 ierr = NF_GET_VARA_DOUBLE(nid,meanid,start,sizes,mean3d) … … 226 222 else if (dim.eq.2) then 227 223 start=(/1,1,indx,0/) 228 sizes=(/ iip1,jjp1,1,0/)224 sizes=(/nbp_lon+1,nbp_lat,1,0/) 229 225 #ifdef NC_DOUBLE 230 226 ierr = NF_GET_VARA_DOUBLE(nid,meanid,start,sizes,mean2d) … … 245 241 246 242 if (dim.eq.3) then 247 dx3(1: iim,:,:)=px3_glo(:,:,:)248 dx3( iip1,:,:)=dx3(1,:,:)243 dx3(1:nbp_lon,:,:)=px3_glo(:,:,:) 244 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 249 245 else ! dim.eq.2 250 dx2(1: iim,:)=px2_glo(:,:)251 dx2( iip1,:)=dx2(1,:)246 dx2(1:nbp_lon,:)=px2_glo(:,:) 247 dx2(nbp_lon+1,:)=dx2(1,:) 252 248 endif 253 249 … … 290 286 !====================================================== 291 287 subroutine inivar(nid,varid,ngrid,dim,indx,px,ierr) 288 use mod_grid_phy_lmdz, only : nbp_lon, nbp_lat, nbp_lev 292 289 293 290 implicit none 294 291 295 include "dimensions.h"296 !include "dimphys.h"297 292 include "netcdf.inc" 298 293 299 294 integer, intent(in) :: nid,varid,dim,indx,ngrid 300 real, dimension(ngrid, llm), intent(in) :: px295 real, dimension(ngrid,nbp_lev), intent(in) :: px 301 296 integer, intent(out) :: ierr 302 303 integer,parameter :: iip1=iim+1304 integer,parameter :: jjp1=jjm+1305 297 306 298 integer :: l,i,j,ig0 307 299 integer, dimension(4) :: start,sizes 308 real, dimension( iip1,jjp1,llm) :: dx3309 real, dimension( iip1,jjp1) :: dx2300 real, dimension(nbp_lon+1,nbp_lat,nbp_lev) :: dx3 301 real, dimension(nbp_lon+1,nbp_lat) :: dx2 310 302 311 303 if (dim.eq.3) then 312 304 313 305 start=(/1,1,1,indx/) 314 sizes=(/ iip1,jjp1,llm,1/)306 sizes=(/nbp_lon+1,nbp_lat,nbp_lev,1/) 315 307 316 308 ! Passage variable physique --> variable dynamique 317 309 318 DO l=1, llm319 DO i=1, iip1310 DO l=1,nbp_lev 311 DO i=1,nbp_lon+1 320 312 dx3(i,1,l)=px(1,l) 321 dx3(i, jjp1,l)=px(ngrid,l)313 dx3(i,nbp_lat,l)=px(ngrid,l) 322 314 ENDDO 323 DO j=2, jjm324 ig0= 1+(j-2)* iim325 DO i=1, iim315 DO j=2,nbp_lat-1 316 ig0= 1+(j-2)*nbp_lon 317 DO i=1,nbp_lon 326 318 dx3(i,j,l)=px(ig0+i,l) 327 319 ENDDO 328 dx3( iip1,j,l)=dx3(1,j,l)320 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 329 321 ENDDO 330 322 ENDDO … … 339 331 340 332 start=(/1,1,indx,0/) 341 sizes=(/ iip1,jjp1,1,0/)333 sizes=(/nbp_lon+1,nbp_lat,1,0/) 342 334 343 335 ! Passage variable physique --> physique dynamique 344 336 345 DO i=1, iip1337 DO i=1,nbp_lon+1 346 338 dx2(i,1)=px(1,1) 347 dx2(i, jjp1)=px(ngrid,1)339 dx2(i,nbp_lat)=px(ngrid,1) 348 340 ENDDO 349 DO j=2, jjm350 ig0= 1+(j-2)* iim351 DO i=1, iim341 DO j=2,nbp_lat-1 342 ig0= 1+(j-2)*nbp_lon 343 DO i=1,nbp_lon 352 344 dx2(i,j)=px(ig0+i,1) 353 345 ENDDO 354 dx2( iip1,j)=dx2(1,j)346 dx2(nbp_lon+1,j)=dx2(1,j) 355 347 ENDDO 356 348 … … 380 372 implicit none 381 373 382 #include "netcdf.inc"374 include "netcdf.inc" 383 375 384 376 integer,intent(in) :: nid ! NetCDF file ID
Note: See TracChangeset
for help on using the changeset viewer.