Reading geographic data

Reads geographic data that was imported into project and used for grid generation.

This function is used when you want to read river survey data or polygon data in solvers directly. The procedure of reading geographic data is as follows:

  1. Reads the number of geographic data, the file name of geographic data etc. from CGNS file.

  2. Open geographic data file and read data from that.

Table 72 Subroutine to use

Subroutine

Remarks

cg_iric_read_geo_count

Reads the number of geographic data

cg_iric_read_geo_filename

Reads the file name and data type of geographic data

iric_geo_riversurvey_open

Opens the geographic data file that contains river survey data

iric_geo_riversurvey_read_count

Reads the number of the crosssections in river survey data

iric_geo_riversurvey_read_position

Reads the coordinates of the crosssection center point

iric_geo_riversurvey_read_direction

Reads the direction of the crosssection as normalized vector

iric_geo_riversurvey_read_name

Reads the name of the crosssection as string

iric_geo_riversurvey_read_realname

Reads the name of the crosssection as real number

iric_geo_riversurvey_read_leftshift

Reads the shift offset value of the crosssection

iric_geo_riversurvey_read_altitudecount

Reads the number of altitude data of the crosssection

iric_geo_riversurvey_read_altitudes

Reads the altitude data of the crosssection

iric_geo_riversurvey_read_fixedpointl

Reads the data of left bank extension line of the crosssection

iric_geo_riversurvey_read_fixedpointr

Reads the data of right bank extension line of the crosssection

iric_geo_riversurvey_read_watersurfaceelevation

Reads the water elevation at the crosssection

iric_geo_riversurvey_close

Closes the geographic data file

List 165 shows an example of reading river survey data.

List 165 Example source code of reading river survey data
 1program TestRiverSurvey
 2  use iric
 3  implicit none
 4
 5  integer:: fin, ier
 6  integer:: icount, istatus
 7
 8  integer:: geoid
 9  integer:: elevation_geo_count
10  character(len=1000):: filename
11  integer:: geotype
12  integer:: rsid
13  integer:: xsec_count
14  integer:: xsec_id
15  character(len=20):: xsec_name
16  double precision:: xsec_x
17  double precision:: xsec_y
18  integer:: xsec_set
19  integer:: xsec_index
20  double precision:: xsec_leftshift
21  integer:: xsec_altid
22  integer:: xsec_altcount
23  double precision, dimension(:), allocatable:: xsec_altpos
24  double precision, dimension(:), allocatable:: xsec_altheight
25  integer, dimension(:), allocatable:: xsec_altactive
26  double precision:: xsec_wse
27
28  ! Opens CGNS file
29  call cg_iric_open("test.cgn", IRIC_MODE_MODIFY, fin, ier)
30  if (ier /=0) stop "*** Open error of CGNS file ***"
31
32  ! Reads the number or geographic data
33  call cg_iric_read_geo_count(fin, "Elevation", elevation_geo_count, ier)
34
35  do geoid = 1, elevation_geo_count
36    call cg_iric_read_geo_filename(fin, 'Elevation', geoid, &
37      filename, geotype, ier)
38    if (geotype .eq. iRIC_GEO_RIVERSURVEY) then
39      call iric_geo_riversurvey_open(filename, rsid, ier)
40      call iric_geo_riversurvey_read_count(rsid, xsec_count, ier)
41      do xsec_id = 1, xsec_count
42        call iric_geo_riversurvey_read_name(rsid, xsec_id, xsec_name, ier)
43        print *, 'xsec ', xsec_name
44        call iric_geo_riversurvey_read_position(rsid, xsec_id, xsec_x, xsec_y, ier)
45        print *, 'position: ', xsec_x, xsec_y
46        call iric_geo_riversurvey_read_direction(rsid, xsec_id, xsec_x, xsec_y, ier)
47        print *, 'direction: ', xsec_x, xsec_y
48        call iric_geo_riversurvey_read_leftshift(rsid, xsec_id, xsec_leftshift, ier)
49        print *, 'leftshift: ', xsec_leftshift
50        call iric_geo_riversurvey_read_altitudecount(rsid, xsec_id, xsec_altcount, ier)
51        print *, 'altitude count: ', xsec_altcount
52        allocate(xsec_altpos(xsec_altcount))
53        allocate(xsec_altheight(xsec_altcount))
54        allocate(xsec_altactive(xsec_altcount))
55        call iric_geo_riversurvey_read_altitudes( &
56          rsid, xsec_id, xsec_altpos, xsec_altheight, xsec_altactive, ier)
57        do xsec_altid = 1, xsec_altcount
58          print *, 'Altitude ', xsec_altid, ': ', &
59            xsec_altpos(xsec_altid:xsec_altid), ', ', &
60            xsec_altheight(xsec_altid:xsec_altid), ', ', &
61            xsec_altactive(xsec_altid:xsec_altid)
62        end do
63        deallocate(xsec_altpos, xsec_altheight, xsec_altactive)
64        call iric_geo_riversurvey_readixedpointl( &
65          rsid, xsec_id, xsec_set, xsec_x, xsec_y, xsec_index, ier)
66        print *, 'FixedPointL: ', xsec_set, xsec_x, xsec_y, xsec_index
67        call iric_geo_riversurvey_readixedpointr( &
68          rsid, xsec_id, xsec_set, xsec_x, xsec_y, xsec_index, ier)
69        print *, 'FixedPointR: ', xsec_set, xsec_x, xsec_y, xsec_index
70        call iric_geo_riversurvey_read_watersurfaceelevation( &
71          rsid, xsec_id, xsec_set, xsec_wse, ier)
72        print *, 'WaterSurfaceElevation: ', xsec_set, xsec_wse
73      end do
74      call iric_geo_riversurvey_close(rsid, ier)
75    end if
76  end do
77
78  ! Closes CGNS file
79  call cg_iric_close(fin, ier)
80  stop
81end program TestRiverSurvey