Outputting calculation grids (only in the case of a moving grid)¶
Outputs the calculation grid to the CGNS file.
If the grid shape does not change in the calculation process, this output is not necessary.
Before outputting the calculation grid at a specific time, be sure to output the time (or iteration count) information as described in Outputting time (or iteration count).
The subroutines described in this section should be used for outputting a calculation grid only when the grid shape is changed in the course of calculation. When outputting a grid in the following cases, use the subroutines described in Outputting calculation grids.
A new grid has been created in the solver.
A grid of different number of dimensions or a grid having a different grid node count has been created by performing re-division of the grid or the like.
A grid is created in the grid generating program
Subroutine |
Remarks |
---|---|
cg_iric_write_sol_grid2d_coords |
Outputs a two-dimensional structured grid |
cg_iric_write_sol_grid3d_coords |
Outputs a three-dimensional structured grid |
List 168 shows an example of outputting a two-dimensional structured grid after starting calculation.
1program Sample5
2 use iric
3 implicit none
4
5 integer:: fin, ier, isize, jsize
6 double precision:: time
7 double precision, dimension(:,:), allocatable:: grid_x, grid_y
8
9 ! Open CGNS file.
10 call cg_iric_open('test.cgn', IRIC_MODE_MODIFY, fin, ier)
11 if (ier /=0) STOP "*** Open error of CGNS file ***"
12
13 ! Check the grid size.
14 call cg_iric_read_grid2d_str_size(fin, isize, jsize, ier)
15 ! Allocate memory for loading the grid.
16 allocate(grid_x(isize,jsize), grid_y(isize,jsize))
17 ! Read the grid into memory.
18 call cg_iric_read_grid2d_coords(fin, grid_x, grid_y, ier)
19
20 ! Output the initial state information.
21 time = 0
22
23 call cg_iric_write_sol_start(fin, ier)
24 call cg_iric_write_sol_time(fin, time, ier)
25 ! Output the grid.
26 call cg_iric_write_sol_grid2d_coords(fin, grid_x, grid_y, ier)
27 call cg_iric_write_sol_end(fin, ier)
28
29 do
30 time = time + 10.0
31 ! (Perform calculation here.)
32 call cg_iric_write_sol_start(fin, ier)
33 call cg_iric_write_sol_time(fin, time, ier)
34 call cg_iric_write_sol_grid2d_coords(fin, grid_x, grid_y, ier)
35 call cg_iric_write_sol_end(fin, ier)
36 If (time > 1000) exit
37 end do
38
39 ! Close CGNS file
40 call cg_iric_close(fin, ier)
41 stop
42end program Sample5