Changeset 1528 for trunk/LMDZ.MARS/libf/phymars/writediagfi.F
- Timestamp:
- Apr 2, 2016, 4:09:43 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/writediagfi.F
r1525 r1528 40 40 !================================================================= 41 41 use surfdat_h, only: phisfi 42 use comgeomphy, only: airephy 42 43 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini 43 44 USE mod_phys_lmdz_para, only : is_parallel, is_mpi_root, 44 45 & is_master, gather 45 USE mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo 46 USE mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, 47 & nbp_lon, nbp_lat, nbp_lev 46 48 implicit none 47 49 48 50 ! Commons 49 #include "dimensions.h" 50 #include "paramet.h" 51 #include "comgeom.h" 52 #include "netcdf.inc" 51 include "netcdf.inc" 53 52 54 53 ! Arguments on input: … … 56 55 character (len=*),intent(in) :: nom,titre,unite 57 56 integer,intent(in) :: dim 58 real,intent(in) :: px(ngrid, llm)57 real,intent(in) :: px(ngrid,nbp_lev) 59 58 60 59 ! Local variables: 61 60 62 real*4 dx3( iip1,jjp1,llm) ! to store a 3D data set63 real*4 dx2( iip1,jjp1) ! to store a 2D (surface) data set64 real*4 dx1( llm) ! to store a 1D (column) data set61 real*4 dx3(nbp_lon+1,nbp_lat,nbp_lev) ! to store a 3D data set 62 real*4 dx2(nbp_lon+1,nbp_lat) ! to store a 2D (surface) data set 63 real*4 dx1(nbp_lev) ! to store a 1D (column) data set 65 64 real*4 dx0 66 65 67 66 real*4,save :: date 68 67 69 REAL phis(ip1jmp1) 68 REAL phis((nbp_lon+1),nbp_lat) 69 REAL area((nbp_lon+1),nbp_lat) 70 70 71 71 integer irythme 72 72 integer ierr,ierr2 73 integer iq 74 integer i,j,l,zmax , ig0 73 integer i,j,l, ig0 75 74 76 75 integer,save :: zitau=0 … … 98 97 #ifdef CPP_PARA 99 98 ! Added to work in parallel mode 100 real dx3_glop(klon_glo, llm)101 real dx3_glo( iim,jjp1,llm) ! to store a global 3D data set99 real dx3_glop(klon_glo,nbp_lev) 100 real dx3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set 102 101 real dx2_glop(klon_glo) 103 real dx2_glo( iim,jjp1) ! to store a global 2D (surface) data set102 real dx2_glo(nbp_lon,nbp_lat) ! to store a global 2D (surface) data set 104 103 real px2(ngrid) 105 ! real dx1_glo( llm) ! to store a 1D (column) data set104 ! real dx1_glo(nbp_lev) ! to store a 1D (column) data set 106 105 ! real dx0_glo 107 106 real phisfi_glo(klon_glo) ! surface geopotential on global physics grid 107 real areafi_glo(klon_glo) ! mesh area on global physics grid 108 108 #else 109 109 real phisfi_glo(ngrid) ! surface geopotential on global physics grid 110 real areafi_glo(ngrid) ! mesh area on global physics grid 110 111 #endif 111 112 … … 181 182 ! Gather phisfi() geopotential on physics grid 182 183 call Gather(phisfi,phisfi_glo) 184 ! Gather airephy() mesh area on physics grid 185 call Gather(airephy,areafi_glo) 183 186 #else 184 187 phisfi_glo(:)=phisfi(:) 188 areafi_glo(:)=airephy(:) 185 189 #endif 186 190 … … 209 213 ierr = NF_ENDDEF(nid) 210 214 215 ! Build phis() and area() 216 do i=1,nbp_lon+1 ! poles 217 phis(i,1)=phisfi_glo(1) 218 phis(i,nbp_lat)=phisfi_glo(klon_glo) 219 ! for area, divide at the poles by nbp_lon 220 area(i,1)=areafi_glo(1)/nbp_lon 221 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 222 enddo 223 do j=2,nbp_lat-1 224 ig0= 1+(j-2)*nbp_lon 225 do i=1,nbp_lon 226 phis(i,j)=phisfi_glo(ig0+i) 227 area(i,j)=areafi_glo(ig0+i) 228 enddo 229 ! handle redundant point in longitude 230 phis(nbp_lon+1,j)=phis(1,j) 231 area(nbp_lon+1,j)=area(1,j) 232 enddo 233 211 234 ! write "header" of file (longitudes, latitudes, geopotential, ...) 212 call gr_fi_dyn(1,size(phisfi_glo),iip1,jjp1,phisfi_glo,phis) 213 call iniwrite(nid,day_ini,phis) 235 call iniwrite(nid,day_ini,phis,area) 214 236 215 237 endif ! of if (is_master) … … 290 312 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 291 313 ! copy dx3_glo() to dx3(:) and add redundant longitude 292 dx3(1: iim,:,:)=dx3_glo(1:iim,:,:)293 dx3( iip1,:,:)=dx3(1,:,:)314 dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 315 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 294 316 endif 295 317 !$OMP END MASTER … … 298 320 ! Passage variable physique --> variable dynamique 299 321 ! recast (copy) variable from physics grid to dynamics grid 300 DO l=1, llm301 DO i=1, iip1322 DO l=1,nbp_lev 323 DO i=1,nbp_lon+1 302 324 dx3(i,1,l)=px(1,l) 303 dx3(i, jjp1,l)=px(ngrid,l)325 dx3(i,nbp_lat,l)=px(ngrid,l) 304 326 ENDDO 305 DO j=2, jjm306 ig0= 1+(j-2)* iim307 DO i=1, iim327 DO j=2,nbp_lat-1 328 ig0= 1+(j-2)*nbp_lon 329 DO i=1,nbp_lon 308 330 dx3(i,j,l)=px(ig0+i,l) 309 331 ENDDO 310 dx3( iip1,j,l)=dx3(1,j,l)332 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 311 333 ENDDO 312 334 ENDDO … … 338 360 corner(4)=ntime 339 361 340 edges(1)= iip1341 edges(2)= jjp1342 edges(3)= llm362 edges(1)=nbp_lon+1 363 edges(2)=nbp_lat 364 edges(3)=nbp_lev 343 365 edges(4)=1 344 366 !#ifdef NC_DOUBLE … … 374 396 call Grid1Dto2D_glo(dx2_glop,dx2_glo) 375 397 ! copy dx2_glo() to dx2(:) and add redundant longitude 376 dx2(1: iim,:)=dx2_glo(1:iim,:)377 dx2( iip1,:)=dx2(1,:)398 dx2(1:nbp_lon,:)=dx2_glo(1:nbp_lon,:) 399 dx2(nbp_lon+1,:)=dx2(1,:) 378 400 endif 379 401 !$OMP END MASTER … … 384 406 ! recast (copy) variable from physics grid to dynamics grid 385 407 386 DO i=1, iip1408 DO i=1,nbp_lon+1 387 409 dx2(i,1)=px(1,1) 388 dx2(i, jjp1)=px(ngrid,1)410 dx2(i,nbp_lat)=px(ngrid,1) 389 411 ENDDO 390 DO j=2, jjm391 ig0= 1+(j-2)* iim392 DO i=1, iim412 DO j=2,nbp_lat-1 413 ig0= 1+(j-2)*nbp_lon 414 DO i=1,nbp_lon 393 415 dx2(i,j)=px(ig0+i,1) 394 416 ENDDO 395 dx2( iip1,j)=dx2(1,j)417 dx2(nbp_lon+1,j)=dx2(1,j) 396 418 ENDDO 397 419 #endif … … 420 442 corner(2)=1 421 443 corner(3)=ntime 422 edges(1)= iip1423 edges(2)= jjp1444 edges(1)=nbp_lon+1 445 edges(2)=nbp_lat 424 446 edges(3)=1 425 447 … … 451 473 ! Passage variable physique --> physique dynamique 452 474 ! recast (copy) variable from physics grid to dynamics grid 453 do l=1, llm475 do l=1,nbp_lev 454 476 dx1(l)=px(1,l) 455 477 enddo … … 473 495 corner(2)=ntime 474 496 475 edges(1)= llm497 edges(1)=nbp_lev 476 498 edges(2)=1 477 499 !#ifdef NC_DOUBLE
Note: See TracChangeset
for help on using the changeset viewer.