Changeset 549 for XIOS/trunk/src/test/test_client.f90
- Timestamp:
- 01/26/15 14:39:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/test/test_client.f90
r545 r549 8 8 INTEGER :: size 9 9 INTEGER :: ierr 10 10 11 11 CHARACTER(len=*),PARAMETER :: id="client" 12 12 INTEGER :: comm 13 13 TYPE(xios_duration) :: dtime 14 14 TYPE(xios_date) :: date 15 CHARACTER(len=10) :: calendar_type 15 16 TYPE(xios_context) :: ctx_hdl 16 17 INTEGER,PARAMETER :: ni_glo=100 17 INTEGER,PARAMETER :: nj_glo=100 18 INTEGER,PARAMETER :: llm=5 18 INTEGER,PARAMETER :: nj_glo=100 19 INTEGER,PARAMETER :: llm=5 19 20 DOUBLE PRECISION :: lval(llm)=1 20 21 TYPE(xios_field) :: field_hdl … … 22 23 TYPE(xios_file) :: file_hdl 23 24 LOGICAL :: ok 24 25 25 26 DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo 26 27 DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm) … … 32 33 33 34 CALL MPI_INIT(ierr) 34 35 35 36 CALL init_wait 36 37 37 38 !!! XIOS Initialization (get the local communicator) 38 39 … … 40 41 41 42 CALL MPI_COMM_RANK(comm,rank,ierr) 42 CALL MPI_COMM_SIZE(comm,size,ierr) 43 43 CALL MPI_COMM_SIZE(comm,size,ierr) 44 44 45 DO j=1,nj_glo 45 46 DO i=1,ni_glo … … 57 58 nj=nj_glo/size 58 59 IF (n<MOD(nj_glo,size)) nj=nj+1 59 IF (n==rank) exit 60 IF (n==rank) exit 60 61 jbegin=jbegin+nj 61 62 ENDDO 62 63 63 64 iend=ibegin+ni-1 ; jend=jbegin+nj-1 64 65 … … 67 68 lat(:,:)=lat_glo(ibegin:iend,jbegin:jend) 68 69 field_A(1:ni,1:nj,:)=field_A_glo(ibegin:iend,jbegin:jend,:) 69 70 70 71 CALL xios_context_initialize("test",comm) 71 72 CALL xios_get_handle("test",ctx_hdl) 72 73 CALL xios_set_current_context(ctx_hdl) 73 74 CALL xios_set_context_attr("test",calendar_type="Gregorian") 74 75 CALL xios_get_calendar_type(calendar_type) 76 PRINT *, "calendar_type = ", calendar_type 77 75 78 CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ; 76 79 CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj) … … 78 81 CALL xios_set_domain_attr("domain_A",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/))) 79 82 CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.) 80 83 81 84 CALL xios_get_handle("field_definition",fieldgroup_hdl) 82 85 CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B") 83 86 CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B") 84 87 85 88 CALL xios_get_handle("output",file_hdl) 86 89 CALL xios_add_child(file_hdl,field_hdl) 87 90 CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C") 88 89 91 90 92 dtime%second = 3600 91 CALL xios_set_ context_attr("test", timestep=dtime)93 CALL xios_set_timestep(dtime) 92 94 93 ! Create the calendar before closing the context definition 94 ! so that calendar operations can be used 95 CALL xios_set_calendar() 96 CALL xios_get_context_attr("test", time_origin=date) 95 ! The calendar is created as soon as the calendar type is defined. This way 96 ! calendar operations can be used before the context definition is closed 97 CALL xios_get_time_origin(date) 98 PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year) 99 PRINT *, "--> day length = ", xios_get_day_length_in_seconds() 97 100 PRINT *, "time_origin = ", date 101 PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date) 102 PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date) 103 PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date) 104 PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date) 105 PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date) 98 106 dtime%timestep = 1 99 107 dtime = 0.5 * dtime … … 103 111 PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date) 104 112 PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour) 105 113 106 114 ni=0 ; lonvalue(:)=0 107 115 CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue=lonvalue) 108 116 109 117 print *,"ni",ni 110 118 print *,"lonvalue",lonvalue ; … … 113 121 PRINT *,"field_A : attribute enabled is defined ? ",ok 114 122 CALL xios_close_context_definition() 115 123 116 124 PRINT*,"field field_A is active ? ",xios_field_is_active("field_A") 117 125 DO ts=1,24*10 … … 123 131 CALL xios_context_finalize() 124 132 CALL xios_finalize() 125 133 126 134 CALL MPI_FINALIZE(ierr) 127 135 128 136 END PROGRAM test_client 129 137 130 138 131 132 139 133 140 141
Note: See TracChangeset
for help on using the changeset viewer.