Changeset 3861
- Timestamp:
- Jan 7, 2016, 9:50:58 AM (9 years ago)
- Location:
- dynamico_lmdz/aquaplanet/ICOSAGCM/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
dynamico_lmdz/aquaplanet/ICOSAGCM/src/write_field.f90
r3845 r3861 1171 1171 INTEGER :: nij 1172 1172 CHARACTER(LEN=255) :: name 1173 1173 INTEGER :: l,level_size, levId, dimlevId 1174 1174 1175 1175 name=TRIM(ADJUSTL(name_in)) … … 1223 1223 status = NF90_DEF_DIM(ncid,'cell_i',ncell,ncellId) 1224 1224 status = NF90_DEF_DIM(ncid,'nvert_i',nvert,nvertid) 1225 1225 level_size=0 1226 1226 IF (Field(ind_b)%ndim==2) THEN 1227 1227 FieldVarId(NbField)%size=1 … … 1231 1231 ALLOCATE(FieldVarId(NbField)%nc_id(1)) 1232 1232 status = NF90_DEF_DIM(ncid,'lev',size(field(ind_b)%rval3d,2),dim3id) 1233 level_size=size(field(ind_b)%rval3d,2) 1233 1234 ELSE IF (Field(1)%ndim==4) THEN 1234 1235 FieldVarId(NbField)%size=size(field(ind_b)%rval4d,3) 1235 1236 ALLOCATE(FieldVarId(NbField)%nc_id(FieldVarId(NbField)%size)) 1236 1237 status = NF90_DEF_DIM(ncid,'lev',size(field(ind_b)%rval4d,2),dim3id) 1238 level_size=size(field(ind_b)%rval4d,2) 1237 1239 ! status = NF90_DEF_DIM(ncid,'Q',size(field(ind_b)%rval4d,3),dim4id) 1238 1240 ENDIF 1239 1241 PRINT*,"LEVEL_SIZE=",level_size 1242 1240 1243 status = NF90_DEF_DIM(ncid,'time_counter',NF90_UNLIMITED,timeId) 1241 1244 IF (level_size>0) THEN 1245 status = NF90_DEF_VAR(ncid,'lev',NF90_DOUBLE,(/ dim3id /),levId) 1246 status = NF90_PUT_ATT(ncid,levId,"axis","Z") 1247 ENDIF 1248 1242 1249 status = NF90_DEF_VAR(ncid,'lon_i',NF90_DOUBLE,(/ ncellId /),lonId) 1243 1250 status = NF90_PUT_ATT(ncid,lonId,"long_name","longitude") … … 1280 1287 1281 1288 status = NF90_ENDDEF(ncid) 1289 1290 if (level_size>0) status = NF90_PUT_VAR(ncid,levId,(/ (l,l=1,level_size) /)) 1282 1291 1283 1292 ALLOCATE(lon(ncell),lat(ncell),bounds_lon(0:nvert-1,ncell),bounds_lat(0:nvert-1,ncell)) -
dynamico_lmdz/aquaplanet/ICOSAGCM/src/xios_mod.F90
r3810 r3861 41 41 IMPLICIT NONE 42 42 TYPE(xios_context) :: ctx_hdl 43 TYPE(xios_ time) :: dtime43 TYPE(xios_duration) :: dtime 44 44 REAL(rstd) :: lev_value(llm) 45 45 REAL(rstd) :: lev_valuep1(llm+1) … … 56 56 lev_value(:) = (/ (l,l=1,llm) /) 57 57 lev_valuep1(:) = (/ (l,l=1,llm+1) /) 58 CALL xios_set_axis_attr("lev", size=llm ,value=lev_value) ;59 CALL xios_set_axis_attr("levp1", size=llm+1 ,value=lev_value) ;58 CALL xios_set_axis_attr("lev",n_glo=llm ,value=lev_value) ; 59 CALL xios_set_axis_attr("levp1",n_glo=llm+1 ,value=lev_value) ; 60 60 61 61 ncell=0 … … 104 104 105 105 106 CALL xios_set_domain _attr("i",ni_glo=ncell_tot, ibegin=displ+1, ni=ncell)107 CALL xios_set_domain _attr("i", data_dim=1, type='unstructured' , nvertex=6)108 CALL xios_set_domain _attr("i",lonvalue=lon, latvalue=lat, bounds_lon=bounds_lon, bounds_lat=bounds_lat)106 CALL xios_set_domaingroup_attr("i",ni_glo=ncell_tot, ibegin=displ, ni=ncell) 107 CALL xios_set_domaingroup_attr("i", data_dim=1, type='unstructured' , nvertex=6) 108 CALL xios_set_domaingroup_attr("i",lonvalue_1d=lon, latvalue_1d=lat, bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat) 109 109 110 110 DEALLOCATE(lon, lat, bounds_lon, bounds_lat) … … 183 183 184 184 185 CALL xios_set_domain_attr("v",ni_glo=ncell_tot, ibegin=displ +1, ni=ncell)185 CALL xios_set_domain_attr("v",ni_glo=ncell_tot, ibegin=displ, ni=ncell) 186 186 CALL xios_set_domain_attr("v", data_dim=1, type='unstructured' , nvertex=3) 187 CALL xios_set_domain_attr("v",lonvalue =lon, latvalue=lat, bounds_lon=bounds_lon, bounds_lat=bounds_lat)187 CALL xios_set_domain_attr("v",lonvalue_1d=lon, latvalue_1d=lat, bounds_lon_1d=bounds_lon, bounds_lat_1d=bounds_lat) 188 188 189 189 … … 239 239 240 240 END SUBROUTINE xios_write_field 241 242 SUBROUTINE xios_read_field(name,field) 243 USE field_mod 244 IMPLICIT NONE 245 CHARACTER(LEN=*),INTENT(IN) :: name 246 TYPE(t_field), POINTER :: field(:) 247 CHARACTER(LEN=10) :: str_number 248 INTEGER :: iq 249 250 !$OMP BARRIER 251 !$OMP MASTER 252 253 IF (Field(1)%field_type==field_T) THEN 254 IF (field(1)%ndim==2) THEN 255 CALL xios_read_field_scalar(name,field,1) 256 ELSE IF (field(1)%ndim==3) THEN 257 CALL xios_read_field_scalar(name,field,size(field(1)%rval3d,2)) 258 ELSE IF (field(1)%ndim==4) THEN 259 DO iq=1,size(field(1)%rval4d,3) 260 WRITE(str_number,'(i10)') iq 261 CALL xios_read_field_scalar(name//TRIM(ADJUSTL(str_number)),field,size(field(1)%rval4d,2),iq) 262 ENDDO 263 ELSE 264 PRINT *, "xios_write_field : dimension > 4 are not supported for now" 265 ENDIF 266 ELSE IF (Field(1)%field_type==field_Z) THEN 267 IF (field(1)%ndim==2) THEN 268 CALL xios_read_field_vort(name,field,1) 269 ELSE IF (field(1)%ndim==3) THEN 270 CALL xios_read_field_vort(name,field,size(field(1)%rval3d,2)) 271 ELSE IF (field(1)%ndim==4) THEN 272 DO iq=1,size(field(1)%rval4d,3) 273 WRITE(str_number,'(i10)') iq 274 CALL xios_read_field_vort(name//TRIM(ADJUSTL(str_number)),field,size(field(1)%rval4d,2),iq) 275 ENDDO 276 ELSE 277 PRINT *, "xios_write_field : dimension > 4 are not supported for now" 278 ENDIF 279 ENDIF 280 !$OMP END MASTER 281 !$OMP BARRIER 282 283 END SUBROUTINE xios_read_field 284 285 241 286 242 287 SUBROUTINE xios_write_field_scalar(name,field,nlev,iq) … … 311 356 312 357 END SUBROUTINE xios_write_field_scalar 358 359 360 SUBROUTINE xios_read_field_scalar(name,field,nlev,iq) 361 USE genmod 362 USE mpipara 363 USE xios 364 USE grid_param 365 USE domain_mod 366 USE dimensions 367 USE spherical_geom_mod 368 USE geometry 369 USE mpi_mod 370 IMPLICIT NONE 371 CHARACTER(LEN=*),INTENT(IN) :: name 372 TYPE(t_field), POINTER :: field(:) 373 INTEGER,INTENT(IN) :: nlev 374 INTEGER,INTENT(IN),OPTIONAL :: iq 375 376 REAL(rstd) :: field_tmp(ncell_i,nlev) 377 TYPE(t_domain),POINTER :: d 378 INTEGER :: n,i,j,ij,ind 379 380 CALL xios_recv_field(name,field_tmp) 381 382 IF (field(1)%ndim==2) THEN 383 n=0 384 DO ind=1,ndomain 385 386 d=>domain(ind) 387 388 DO j=d%jj_begin,d%jj_end 389 DO i=d%ii_begin,d%ii_end 390 IF (d%own(i,j)) THEN 391 n=n+1 392 ij=d%iim*(j-1)+i 393 field(ind)%rval2d(ij)=field_tmp(n,1) 394 ENDIF 395 ENDDO 396 ENDDO 397 ENDDO 398 ELSE IF (field(1)%ndim==3) THEN 399 n=0 400 DO ind=1,ndomain 401 d=>domain(ind) 402 403 DO j=d%jj_begin,d%jj_end 404 DO i=d%ii_begin,d%ii_end 405 IF (d%own(i,j)) THEN 406 n=n+1 407 ij=d%iim*(j-1)+i 408 field(ind)%rval3d(ij,:)=field_tmp(n,:) 409 ENDIF 410 ENDDO 411 ENDDO 412 ENDDO 413 ELSE IF (field(1)%ndim==4) THEN 414 n=0 415 DO ind=1,ndomain 416 d=>domain(ind) 417 418 DO j=d%jj_begin,d%jj_end 419 DO i=d%ii_begin,d%ii_end 420 IF (d%own(i,j)) THEN 421 n=n+1 422 ij=d%iim*(j-1)+i 423 field(ind)%rval4d(ij,:,iq)=field_tmp(n,:) 424 ENDIF 425 ENDDO 426 ENDDO 427 ENDDO 428 ENDIF 429 430 END SUBROUTINE xios_read_field_scalar 431 432 313 433 314 434 SUBROUTINE xios_write_field_vort(name,field,nlev,iq) … … 409 529 410 530 END SUBROUTINE xios_write_field_vort 531 532 SUBROUTINE xios_read_field_vort(name,field,nlev,iq) 533 USE genmod 534 USE mpipara 535 USE xios 536 USE grid_param 537 USE domain_mod 538 USE dimensions 539 USE spherical_geom_mod 540 USE geometry 541 USE mpi_mod 542 IMPLICIT NONE 543 CHARACTER(LEN=*),INTENT(IN) :: name 544 TYPE(t_field), POINTER :: field(:) 545 INTEGER,INTENT(IN) :: nlev 546 INTEGER,INTENT(IN),OPTIONAL :: iq 547 548 REAL(rstd) :: field_tmp(ncell_v,nlev) 549 TYPE(t_domain),POINTER :: d 550 INTEGER :: n,i,j,ij,ind 551 552 CALL xios_recv_field(name,field_tmp) 553 554 555 IF (field(1)%ndim==2) THEN 556 n=0 557 DO ind=1,ndomain 558 d=>domain(ind) 559 CALL swap_dimensions(ind) 560 561 DO j=d%jj_begin+1,d%jj_end 562 DO i=d%ii_begin,d%ii_end-1 563 n=n+1 564 ij=iim*(j-1)+i 565 field(ind)%rval2d(ij+z_down)=Field_tmp(n,1) 566 ENDDO 567 ENDDO 568 569 DO j=d%jj_begin,d%jj_end-1 570 DO i=d%ii_begin+1,d%ii_end 571 n=n+1 572 ij=iim*(j-1)+i 573 Field_tmp(n,1)=field(ind)%rval2d(ij+z_up) 574 field(ind)%rval2d(ij+z_up)=Field_tmp(n,1) 575 ENDDO 576 ENDDO 577 578 ENDDO 579 580 ELSE IF (field(1)%ndim==3) THEN 581 n=0 582 DO ind=1,ndomain 583 d=>domain(ind) 584 CALL swap_dimensions(ind) 585 586 DO j=d%jj_begin+1,d%jj_end 587 DO i=d%ii_begin,d%ii_end-1 588 n=n+1 589 ij=iim*(j-1)+i 590 field(ind)%rval3d(ij+z_down,:)=Field_tmp(n,:) 591 ENDDO 592 ENDDO 593 594 DO j=d%jj_begin,d%jj_end-1 595 DO i=d%ii_begin+1,d%ii_end 596 n=n+1 597 ij=iim*(j-1)+i 598 field(ind)%rval3d(ij+z_up,:)=Field_tmp(n,:) 599 ENDDO 600 ENDDO 601 602 ENDDO 603 604 ELSE IF (field(1)%ndim==4) THEN 605 n=0 606 DO ind=1,ndomain 607 d=>domain(ind) 608 CALL swap_dimensions(ind) 609 610 DO j=d%jj_begin+1,d%jj_end 611 DO i=d%ii_begin,d%ii_end-1 612 n=n+1 613 ij=iim*(j-1)+i 614 field(ind)%rval4d(ij+z_down,:,iq)=Field_tmp(n,:) 615 ENDDO 616 ENDDO 617 618 DO j=d%jj_begin,d%jj_end-1 619 DO i=d%ii_begin+1,d%ii_end 620 n=n+1 621 ij=iim*(j-1)+i 622 field(ind)%rval4d(ij+z_up,:,iq)=Field_tmp(n,:) 623 ENDDO 624 ENDDO 625 626 ENDDO 627 628 ENDIF 629 630 END SUBROUTINE xios_read_field_vort 631 632 633 634 411 635 412 636 SUBROUTINE xios_write_field_finalize
Note: See TracChangeset
for help on using the changeset viewer.