Reading calculation result¶
Read calculation result from CGNS files.
Subroutine |
Remarks |
---|---|
cg_iric_read_sol_count |
Reads the number of calculation result |
cg_iric_read_sol_time |
Reads the time value |
cg_iric_read_sol_iteration |
Reads the loop iteration value |
cg_iric_read_sol_baseiterative_integer |
Reads the integer-type calculation result value |
cg_iric_read_sol_baseiterative_real |
Reads the double-precision real-type calculation result value |
cg_iric_read_sol_gridcoord2d |
Reads the 2D structured grid (for moving grid calculation) |
cg_iric_read_sol_gridcoord3d |
Reads the 3D structured grid (for moving grid calculation) |
cg_iric_read_sol_node_integer |
Reads the integer-type calculation result, having a value for each grid node |
cg_iric_read_sol_node_real |
Reads the double-precision real-type calculation result, having a value for each grid node |
cg_iric_read_sol_cell_integer |
Reads the integer-type calculation result, having a value for each grid cell |
cg_iric_read_sol_cell_real |
Reads the double-precision real-type calculation result, having a value for each grid cell |
List 176 shows an example of reading caluculation result from CGNS file, and output to standard output.
1program SampleX
2 use iric
3 implicit none
4
5 integer:: fin, ier, isize, jsize, solid, solcount, iter, i, j
6 double precision, dimension(:,:), allocatable::grid_x, grid_y, result_real
7
8 ! Opening CGNS file
9 call cg_iric_open('test.cgn', IRIC_MODE_READ, fin, ier)
10 if (ier /=0) STOP "*** Open error of CGNS file ***"
11
12 ! Reads grid size
13 call cg_iric_read_grid2d_str_size(fin, isize, jsize, ier)
14
15 ! Allocate memory for reading calculation result
16 allocate(grid_x(isize,jsize), grid_y(isize,jsize))
17 allocate(result_real(isize, jsize))
18
19 ! Reads calculation result, and output to standard output.
20 call cg_iric_read_sol_count(fin, solcount, ier)
21 do solid = 1, solcount
22 call cg_iric_read_sol_iteration(fin, solid, iter, ier)
23 call cg_iric_read_sol_gridcoord2d(fin, solid, grid_x, grid_y, ier)
24 call cg_iric_read_sol_real(fin, solid, 'result_real', result_real, ier)
25
26 print *, 'iteration: ', iter
27 print *, 'grid_x, grid_y, result: '
28 do i = 1, isize
29 do j = 1, jsize
30 print *, '(', i, ', ', j, ') = (', grid_x(i, j), ', ', grid_y(i, j), ', ', result_real(i, j), ')'
31 end do
32 end do
33 end do
34
35 ! Closing CGNS file
36 call cg_iric_close(fin, ier)
37 stop
38end program SampleX
The functions are used in calculation analysis program (See Steps of developing a calculation result analysis program).