Ignore:
Timestamp:
03/10/15 10:49:02 (9 years ago)
Author:
mhnguyen
Message:

Implementing a grid formed by only one axis or group of axis

+) Add several new attributes to axis. From now on, each axis can be distributed on client side
+) Modify mask of grid to make it more flexible to different dimension
+) Fix some bugs relating to calculation of local data index on client
+) Clean some redundant codes

Test
+) On Curie, only test_new_features.f90
+) Test cases:

  • Grid composed of: 1 domain and 1 axis, 3 axis, 1 axis
  • Mode: Attached and connected
  • No of client-server: 6-2(Connected), 2 (Attached)

+) All tests passed and results are correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/test/test_new_features.f90

    r557 r567  
    2525 
    2626  DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo 
    27   DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm) 
    28   DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), lonvalue(:) ; 
    29   INTEGER :: ni,ibegin,iend,nj,jbegin,jend 
     27  DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm), lval_ni(ni_glo), lval_nj(nj_glo) 
     28  DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), field_All_Axis(:,:,:), lonvalue(:) , field_Axis(:) 
     29  INTEGER :: ni,ibegin,iend,nj,jbegin,jend, nAxis, axisBegin, axisEnd 
    3030  INTEGER :: i,j,l,ts,n 
    3131 
     
    4747      lon_glo(i,j)=(i-1)+(j-1)*ni_glo 
    4848      lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo 
     49      lval_ni(i) = i-1 
    4950      DO l=1,llm 
    5051        field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo+10000*l 
    5152      ENDDO 
    5253    ENDDO 
     54    lval_nj(j) = j-1 
    5355  ENDDO 
    5456  ni=ni_glo ; ibegin=0 
     
    6163    jbegin=jbegin+nj 
    6264  ENDDO 
    63  
    6465  iend=ibegin+ni-1 ; jend=jbegin+nj-1 
    6566 
    66   ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj)) 
     67  axisBegin = 0 
     68  nAxis = llm 
     69!  DO n=0, size -1 
     70!    nAxis = llm/size 
     71!    IF (n<MOD(llm,size)) nAxis=nAxis+1 
     72!    IF (n==rank) exit 
     73!    axisBegin=axisBegin+nAxis 
     74!  ENDDO 
     75  axisEnd=axisBegin+nAxis-1 
     76 
     77  ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj), field_Axis(nAxis), field_All_Axis(1:ni,1:nj,llm)) 
    6778  lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    6879  lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    69   field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
     80  field_A(1:ni,1:nj,:) = field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
     81  field_Axis(1:nAxis)  = field_A_glo(1,1,axisBegin+1:axisEnd+1) 
     82  field_All_Axis(1:ni,1:nj,:) = field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
    7083 
    7184  CALL xios_context_initialize("test",comm) 
     
    7386  CALL xios_set_current_context(ctx_hdl) 
    7487 
    75   CALL xios_get_calendar_type(calendar_type) 
    76   PRINT *, "calendar_type = ", calendar_type 
     88!  CALL xios_get_calendar_type(calendar_type) 
     89!  PRINT *, "calendar_type = ", calendar_type 
    7790 
    78   CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ; 
     91  CALL xios_set_axis_attr("axis_A", size=ni_glo, ibegin=ibegin, ni=ni, value=lval_ni) 
     92  CALL xios_set_axis_attr("axis_B", size=nj_glo, ibegin=jbegin, ni=nj, value=lval_nj) 
     93  CALL xios_set_axis_attr("axis_C", size=llm, value=lval) 
     94  CALL xios_set_axis_attr("axis_D", size=llm, value=lval) 
    7995  CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj) 
    8096  CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4) 
     
    89105  CALL xios_add_child(file_hdl,field_hdl) 
    90106  CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 
     107 
     108  CALL xios_get_handle("output_Axis",file_hdl) 
     109  CALL xios_add_child(file_hdl,field_hdl) 
     110  CALL xios_set_attr(field_hdl,field_ref="field_All_Axis",name="field_C") 
    91111 
    92112  dtime%second = 3600 
     
    126146    CALL xios_update_calendar(ts) 
    127147    CALL xios_send_field("field_A",field_A) 
     148    CALL xios_send_field("field_Axis",field_Axis) 
     149    CALL xios_send_field("field_All_Axis",field_All_Axis) 
    128150    CALL wait_us(5000) ; 
    129151  ENDDO 
Note: See TracChangeset for help on using the changeset viewer.