Value defined at polygons or polylines

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

When outputting polygons or polylines, you can output multiple groups. To output data please call cg_iric_write_sol_polydata_groupbegin_f and cg_iric_write_sol_polydata_groupend_f, 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 76 Subroutines to use for outputting result defined at polygons or polylines

Subroutine

Remarks

cg_iric_write_sol_polydata_groupbegin_f

Start outputting calculation result defined at polygons or polylines.

cg_iric_write_sol_polydata_groupend_f

Finish outputting calculation result defined at polygons or polylines.

cg_iric_write_sol_polydata_polygon_f

Output calculation result defined as polygon

cg_iric_write_sol_polydata_polyline_f

Output calculation result defined as polyline

cg_iric_write_sol_polydata_integer_f

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

cg_iric_write_sol_polydata_real_f

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  implicit none
 3  include 'cgnslib_f.h'
 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_open_f(condFile, CG_MODE_MODIFY, fin, ier)
22  if (ier /=0) STOP "*** Open error of CGNS file ***"
23
24  ! Initialize iRIClib
25  call cg_iric_init_f(fin, ier)
26  if (ier /=0) STOP "*** Initialize error of CGNS file ***"
27
28  ! Check the grid size
29  call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
30  ! Allocate memory for loading the grid
31  allocate(grid_x(isize, jsize), grid_y(isize, jsize))
32  ! Allocate memory for calculation result. Each polygon has five points.
33  allocate(polydata_x(numpoints), polydata_y(numpoints))
34  ! Read the grid into memory
35  call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)
36
37  ! Output the initial state information.
38  time = 0
39  call cg_iric_write_sol_time_f(time, ier)
40
41  call cg_iric_write_sol_polydata_groupbegin_f('fish', ier)
42  do i = 1, numpolygons
43    ! (Specify values for polydata_x, polydata_y, temperature, status)
44    call cg_iric_write_sol_polydata_polygon_f(numpoints, polydata_x, polydata_y, ier)
45    call cg_iric_write_sol_polydata_real_f('Temperature', temperature, ier)
46    call cg_iric_write_sol_polydata_integer_f('Status', status, ier)
47  end do
48  call cg_iric_write_sol_polydata_groupend_f(ier)
49
50  do
51    time = time + 10.0
52
53    ! (Perform calculation here)
54
55    call iric_check_cancel_f(canceled)
56    if (canceled == 1) exit
57
58    ! Output calculation results
59    call iric_write_sol_start_f(condFile, ier)
60    call cg_iric_write_sol_time_f(time, ier)
61    call cg_iric_write_sol_polydata_groupbegin_f('fish', ier)
62    do i = 1, numpolygons
63      ! (Specify values for polydata_x, polydata_y, temperature, status)
64      call cg_iric_write_sol_polydata_polygon_f(numpoints, polydata_x, polydata_y, ier)
65      call cg_iric_write_sol_polydata_real_f('Temperature', temperature, ier)
66      call cg_iric_write_sol_polydata_integer_f('Status', status, ier)
67    end do
68    call cg_iric_write_sol_polydata_groupend_f(ier)
69
70    if (time > 1000) exit
71  end do
72
73  ! Close CGNS file
74  call cg_close_f(fin, ier)
75  stop
76end program SampleProgram