Value defined at polygons or polylines

When you output value defined at polygons or polylines, please use the functions in Table 78.

When outputting polygons or polylines, you can output multiple groups. To output data please call cg_iric_write_sol_polydata_groupbegin and cg_iric_write_sol_polydata_groupend, before and after outputting data.

List 108 shows an example of the process to output value defined at polygons or polylines.

Note

In functions for outputting value defined at particles, all coordinates and values are output with one function calls. But in case of polygons or polylines, data for only one polygon or polyline is output with each function call.

Note

The functions to output value defined at polygons or polylines support only two-dimension data.

Note

You can mix calculation result defined at polygons and polylines in one group.

Note

For polygons and polylines the scalar quantity value only is supported.

Table 78 Subroutines to use for outputting result defined at polygons or polylines

Subroutine

Remarks

cg_iric_write_sol_polydata_groupbegin

Start outputting calculation result defined at polygons or polylines.

cg_iric_write_sol_polydata_groupend

Finish outputting calculation result defined at polygons or polylines.

cg_iric_write_sol_polydata_polygon

Output calculation result defined as polygon

cg_iric_write_sol_polydata_polyline

Output calculation result defined as polyline

cg_iric_write_sol_polydata_integer

Outputs integer-type calculation results, giving a value for a polygon or polyline

cg_iric_write_sol_polydata_real

Outputs double-precision real-type calculation results, giving a value for a polygon or polyline

List 108 Example source code (Value defined at polygons or polylines)
 1program SampleProgram
 2  use iric
 3  implicit none
 4
 5  integer:: fin, ier, isize, jsize
 6  integer:: canceled
 7  integer:: locked
 8  double precision:: time
 9  double precision, dimension(:,:), allocatable::grid_x, grid_y
10  integer:: numpolygons = 10
11  integer:: numpoints = 5
12  double precision, dimension(:), allocatable:: polydata_x, polydata_y,
13  double precision:: temperature = 26
14  integer:: i
15  integer:: status = 1
16  character(len=20):: condFile
17
18  condFile = 'test.cgn'
19
20  ! Open CGNS file
21  call cg_iric_open(condFile, IRIC_MODE_MODIFY, fin, ier)
22  if (ier /=0) STOP "*** Open error of CGNS file ***"
23
24  ! Check the grid size
25  call cg_iric_read_grid2d_str_size(fin, isize, jsize, ier)
26  ! Allocate memory for loading the grid
27  allocate(grid_x(isize, jsize), grid_y(isize, jsize))
28  ! Allocate memory for calculation result. Each polygon has five points.
29  allocate(polydata_x(numpoints), polydata_y(numpoints))
30  ! Read the grid into memory
31  call cg_iric_read_grid2d_coords(fin, grid_x, grid_y, ier)
32
33  ! Output the initial state information.
34  time = 0
35  call cg_iric_write_sol_start(fin, ier)
36  call cg_iric_write_sol_time(fin, time, ier)
37
38  call cg_iric_write_sol_polydata_groupbegin(fin, 'fish', ier)
39  do i = 1, numpolygons
40    ! (Specify values for polydata_x, polydata_y, temperature, status)
41    call cg_iric_write_sol_polydata_polygon(fin, numpoints, polydata_x, polydata_y, ier)
42    call cg_iric_write_sol_polydata_real(fin, 'Temperature', temperature, ier)
43    call cg_iric_write_sol_polydata_integer(fin, 'Status', status, ier)
44  end do
45  call cg_iric_write_sol_polydata_groupend(fin, ier)
46  call cg_iric_write_sol_end(fin, ier)
47
48  do
49    time = time + 10.0
50
51    ! (Perform calculation here)
52
53    call iric_check_cancel(canceled)
54    if (canceled == 1) exit
55
56    ! Output calculation results
57    call cg_iric_write_sol_start(fin, ier)
58    call cg_iric_write_sol_time(fin, time, ier)
59    call cg_iric_write_sol_polydata_groupbegin(fin, 'fish', ier)
60    do i = 1, numpolygons
61      ! (Specify values for polydata_x, polydata_y, temperature, status)
62      call cg_iric_write_sol_polydata_polygon(fin, numpoints, polydata_x, polydata_y, ier)
63      call cg_iric_write_sol_polydata_real(fin, 'Temperature', temperature, ier)
64      call cg_iric_write_sol_polydata_integer(fin, 'Status', status, ier)
65    end do
66    call cg_iric_write_sol_polydata_groupend(fin, ier)
67    call cg_iric_write_sol_end(fin, ier)
68
69    if (time > 1000) exit
70  end do
71
72  ! Close CGNS file
73  call cg_iric_close(fin, ier)
74  stop
75end program SampleProgram