Ignore:
Timestamp:
06/14/18 13:42:14 (3 years ago)
Author:
yushan
Message:

bug fix for tests in prod mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/test/test_omp.f90

    r1196 r1544  
    2121  INTEGER,PARAMETER :: nj_glo=100 
    2222  INTEGER,PARAMETER :: llm=5 
    23   DOUBLE PRECISION  :: lval(llm)=1 
     23  DOUBLE PRECISION  :: lval(llm)=1, scalar = 5 
    2424  TYPE(xios_field) :: field_hdl 
    2525  TYPE(xios_fieldgroup) :: fieldgroup_hdl 
     
    2929  DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo 
    3030  DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm) 
    31   DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), lonvalue(:,:) ; 
     31  DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), lonvalue(:,:), axisValue(:), field_domain(:,:) 
    3232  INTEGER :: ni,ibegin,iend,nj,jbegin,jend 
    3333  INTEGER :: i,j,l,ts,n, provided 
     
    6262        lat_glo(i,j)=1000+(i-1)+(j-1)*ni_glo 
    6363        DO l=1,llm 
    64           field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo+10000*l 
     64          field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo*100+10000*l 
    6565        ENDDO 
    6666      ENDDO 
     
    7878    iend=ibegin+ni-1 ; jend=jbegin+nj-1 
    7979 
    80     ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni,nj)) 
     80    !ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni,nj)) 
     81    !lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
     82    !lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
     83    !field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
     84     
     85    ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni,nj), axisValue(nj_glo), field_domain(0:ni+1,-1:nj+2)) 
    8186    lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    8287    lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1) 
    8388    field_A(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:) 
     89    field_domain(1:ni,1:nj) = field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,1) 
     90    axisValue(1:nj_glo)=field_A_glo(1,1:nj_glo,1); 
     91   
    8492 
    85     !print*, "xios init OK", rank, size 
    8693 
    8794    CALL xios_context_initialize("test",comm) 
    88  
    89     !print*, "xios_context_initialize OK", rank, size 
    90  
    9195    CALL xios_get_handle("test",ctx_hdl) 
    9296    CALL xios_set_current_context(ctx_hdl) 
    9397   
    94    
    9598    CALL xios_get_calendar_type(calendar_type) 
    96     !print*, "xios_get_calendar_type OK", rank, size 
     99    PRINT *, "calendar_type = ", calendar_type 
    97100 
    98101    CALL xios_set_axis_attr("axis_A",n_glo=llm ,value=lval) ; 
     
    103106    !print*, "test block OK", rank, size 
    104107 
    105     CALL xios_get_handle("field_definition",fieldgroup_hdl) 
    106     CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
    107     CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
     108    !CALL xios_get_handle("field_definition",fieldgroup_hdl) 
     109    !CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 
     110    !CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 
    108111 
    109     CALL xios_get_handle("output",file_hdl) 
    110     CALL xios_add_child(file_hdl,field_hdl) 
    111     CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 
     112    !CALL xios_get_handle("output",file_hdl) 
     113    !CALL xios_add_child(file_hdl,field_hdl) 
     114    !CALL xios_set_attr(field_hdl,field_ref="field_A_zoom",name="field_C") 
    112115 
    113116    dtime%second = 3600 
     
    118121   ! calendar operations can be used before the context definition is closed 
    119122   CALL xios_get_time_origin(date) 
    120    !PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year) 
    121    !PRINT *, "--> day length = ", xios_get_day_length_in_seconds() 
     123   PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year) 
     124   PRINT *, "--> day length = ", xios_get_day_length_in_seconds() 
    122125   CALL xios_date_convert_to_string(date, date_str) 
    123    !PRINT *, "time_origin = ", date_str 
    124    !PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date) 
    125    !PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date) 
    126    !PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date) 
    127    !PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date) 
    128    !PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date) 
     126   PRINT *, "time_origin = ", date_str 
     127   PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date) 
     128   PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date) 
     129   PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date) 
     130   PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date) 
     131   PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date) 
    129132   dtime%timestep = 1 
    130133   dtime = 0.5 * dtime 
    131134   CALL xios_duration_convert_to_string(dtime, dtime_str) 
    132    !PRINT *, "duration = ", dtime_str 
     135   PRINT *, "duration = ", dtime_str 
    133136   date = date + 3 * (dtime + dtime) 
    134137   CALL xios_date_convert_to_string(date, date_str) 
    135    !PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str 
    136    !PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 
    137    !PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour) 
     138   PRINT *, "date = time_origin + 3 * (duration + duration) = ", date_str 
     139   PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 
     140   PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour) 
    138141 
    139142   ni=0 ; lonvalue(:,:)=0; 
    140143   CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lonvalue) 
    141    !print *,"ni",ni 
    142    !print *,"lonvalue",lonvalue; 
     144   print *,"ni",ni 
     145   print *,"lonvalue",lonvalue; 
    143146 
    144147   CALL xios_is_defined_field_attr("field_A",enabled=ok) 
    145    !PRINT *,"field_A : attribute enabled is defined ? ",ok  
    146  
     148   PRINT *,"field_A : attribute enabled is defined ? ",ok  
    147149   CALL xios_close_context_definition() 
    148    !print*, "xios_close_context_definition OK"   
    149150 
    150151   PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 
    151152 
    152    DO ts=1,6 
     153   DO ts=1,4 
    153154    CALL xios_update_calendar(ts) 
    154155    CALL xios_send_field("field_A",field_A) 
     156    CALL xios_send_field("field_Axis",axisValue) 
     157    ! CALL xios_send_field("field_Axis",lval) 
     158    CALL xios_send_field("field_Domain",field_domain) 
     159    CALL xios_send_field("field_Scalar",scalar) 
    155160    CALL wait_us(5000) 
    156161   ENDDO 
     
    162167    print*, "xios finalize OK", rank, size 
    163168 
    164     DEALLOCATE(lon, lat, field_A, lonvalue) 
     169    DEALLOCATE(lon, lat, field_A, lonvalue, axisValue, field_domain) 
    165170    !$omp master  
    166171    !call MPI_Barrier(comm) 
     
    168173    !$omp end master 
    169174 
    170      !$omp barrier 
    171  
    172      !print*, "MPI_COMM_FREE OK", rank, size 
     175    !$omp barrier 
    173176 
    174177 
Note: See TracChangeset for help on using the changeset viewer.