Changeset 1529 for trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
- Timestamp:
- Apr 5, 2016, 10:51:51 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/writediagfi.F
r1525 r1529 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 51 include "netcdf.inc" 53 52 … … 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 … … 68 67 !$OMP THREADPRIVATE(date) 69 68 70 REAL phis(ip1jmp1) 69 REAL phis((nbp_lon+1),nbp_lat) 70 REAL area((nbp_lon+1),nbp_lat) 71 71 72 72 integer irythme 73 73 integer ierr,ierr2 74 integer iq 75 integer i,j,l,zmax , ig0 74 integer i,j,l, ig0 76 75 77 76 integer,save :: zitau=0 … … 102 101 #ifdef CPP_PARA 103 102 ! Added to work in parallel mode 104 real dx3_glop(klon_glo, llm)105 real dx3_glo( iim,jjp1,llm) ! to store a global 3D data set103 real dx3_glop(klon_glo,nbp_lev) 104 real dx3_glo(nbp_lon,nbp_lat,nbp_lev) ! to store a global 3D data set 106 105 real dx2_glop(klon_glo) 107 real dx2_glo( iim,jjp1) ! to store a global 2D (surface) data set106 real dx2_glo(nbp_lon,nbp_lat) ! to store a global 2D (surface) data set 108 107 real px2(ngrid) 109 ! real dx1_glo( llm) ! to store a 1D (column) data set108 ! real dx1_glo(nbp_lev) ! to store a 1D (column) data set 110 109 ! real dx0_glo 111 110 real phisfi_glo(klon_glo) ! surface geopotential on global physics grid 111 real areafi_glo(klon_glo) ! mesh area on global physics grid 112 112 #else 113 113 real phisfi_glo(ngrid) ! surface geopotential on global physics grid 114 real areafi_glo(ngrid) ! mesh area on global physics grid 114 115 #endif 115 116 … … 117 118 !Sortie des variables au rythme voulu 118 119 119 irythme = ecritphy! sortie au rythme de ecritphy120 irythme = int(ecritphy) ! sortie au rythme de ecritphy 120 121 ! irythme = iconser ! sortie au rythme des variables de controle 121 122 ! irythme = iphysiq ! sortie a tous les pas physique … … 188 189 ! Gather phisfi() geopotential on physics grid 189 190 call Gather(phisfi,phisfi_glo) 191 ! Gather airephy() mesh area on physics grid 192 call Gather(airephy,areafi_glo) 190 193 #else 191 194 phisfi_glo(:)=phisfi(:) 195 areafi_glo(:)=airephy(:) 192 196 #endif 193 197 … … 216 220 ierr = NF_ENDDEF(nid) 217 221 222 ! Build phis() and area() 223 do i=1,nbp_lon+1 ! poles 224 phis(i,1)=phisfi_glo(1) 225 phis(i,nbp_lat)=phisfi_glo(klon_glo) 226 ! for area, divide at the poles by nbp_lon 227 area(i,1)=areafi_glo(1)/nbp_lon 228 area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon 229 enddo 230 do j=2,nbp_lat-1 231 ig0= 1+(j-2)*nbp_lon 232 do i=1,nbp_lon 233 phis(i,j)=phisfi_glo(ig0+i) 234 area(i,j)=areafi_glo(ig0+i) 235 enddo 236 ! handle redundant point in longitude 237 phis(nbp_lon+1,j)=phis(1,j) 238 area(nbp_lon+1,j)=area(1,j) 239 enddo 240 218 241 ! write "header" of file (longitudes, latitudes, geopotential, ...) 219 call gr_fi_dyn(1,size(phisfi_glo),iip1,jjp1,phisfi_glo,phis) 220 call iniwrite(nid,day_ini,phis) 242 call iniwrite(nid,day_ini,phis,area) 221 243 222 244 endif ! of if (is_master) … … 234 256 235 257 if (ngrid.eq.1) then 236 ! in testphys1d, for the 1d version of the GCM, iphysiq 237 ! should be most likely 1 (because no dyn!)258 ! in testphys1d, for the 1d version of the GCM, iphysiq and irythme 259 ! are undefined; so set them to 1 238 260 iphysiq=1 261 irythme=1 239 262 ! NB: 240 263 endif … … 296 319 call Grid1Dto2D_glo(dx3_glop,dx3_glo) 297 320 ! copy dx3_glo() to dx3(:) and add redundant longitude 298 dx3(1: iim,:,:)=dx3_glo(1:iim,:,:)299 dx3( iip1,:,:)=dx3(1,:,:)321 dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:) 322 dx3(nbp_lon+1,:,:)=dx3(1,:,:) 300 323 endif 301 324 !$OMP END MASTER … … 304 327 ! Passage variable physique --> variable dynamique 305 328 ! recast (copy) variable from physics grid to dynamics grid 306 DO l=1, llm307 DO i=1, iip1329 DO l=1,nbp_lev 330 DO i=1,nbp_lon+1 308 331 dx3(i,1,l)=px(1,l) 309 dx3(i, jjp1,l)=px(ngrid,l)332 dx3(i,nbp_lat,l)=px(ngrid,l) 310 333 ENDDO 311 DO j=2, jjm312 ig0= 1+(j-2)* iim313 DO i=1, iim334 DO j=2,nbp_lat-1 335 ig0= 1+(j-2)*nbp_lon 336 DO i=1,nbp_lon 314 337 dx3(i,j,l)=px(ig0+i,l) 315 338 ENDDO 316 dx3( iip1,j,l)=dx3(1,j,l)339 dx3(nbp_lon+1,j,l)=dx3(1,j,l) 317 340 ENDDO 318 341 ENDDO … … 344 367 corner(4)=ntime 345 368 346 edges(1)= iip1347 edges(2)= jjp1348 edges(3)= llm369 edges(1)=nbp_lon+1 370 edges(2)=nbp_lat 371 edges(3)=nbp_lev 349 372 edges(4)=1 350 373 !#ifdef NC_DOUBLE … … 380 403 call Grid1Dto2D_glo(dx2_glop,dx2_glo) 381 404 ! copy dx2_glo() to dx2(:) and add redundant longitude 382 dx2(1: iim,:)=dx2_glo(1:iim,:)383 dx2( iip1,:)=dx2(1,:)405 dx2(1:nbp_lon,:)=dx2_glo(1:nbp_lon,:) 406 dx2(nbp_lon+1,:)=dx2(1,:) 384 407 endif 385 408 !$OMP END MASTER … … 390 413 ! recast (copy) variable from physics grid to dynamics grid 391 414 392 DO i=1, iip1415 DO i=1,nbp_lon+1 393 416 dx2(i,1)=px(1,1) 394 dx2(i, jjp1)=px(ngrid,1)417 dx2(i,nbp_lat)=px(ngrid,1) 395 418 ENDDO 396 DO j=2, jjm397 ig0= 1+(j-2)* iim398 DO i=1, iim419 DO j=2,nbp_lat-1 420 ig0= 1+(j-2)*nbp_lon 421 DO i=1,nbp_lon 399 422 dx2(i,j)=px(ig0+i,1) 400 423 ENDDO 401 dx2( iip1,j)=dx2(1,j)424 dx2(nbp_lon+1,j)=dx2(1,j) 402 425 ENDDO 403 426 #endif … … 426 449 corner(2)=1 427 450 corner(3)=ntime 428 edges(1)= iip1429 edges(2)= jjp1451 edges(1)=nbp_lon+1 452 edges(2)=nbp_lat 430 453 edges(3)=1 431 454 … … 457 480 ! Passage variable physique --> physique dynamique 458 481 ! recast (copy) variable from physics grid to dynamics grid 459 do l=1, llm482 do l=1,nbp_lev 460 483 dx1(l)=px(1,l) 461 484 enddo … … 479 502 corner(2)=ntime 480 503 481 edges(1)= llm504 edges(1)=nbp_lev 482 505 edges(2)=1 483 506 !#ifdef NC_DOUBLE … … 543 566 544 567 #endif 568 ! of #ifndef MESOSCALE 545 569 end
Note: See TracChangeset
for help on using the changeset viewer.