One value for each time step

When you output one value for each time step, please use the functions in Table 70.

List 102 shows an example of the process to output value for each time step.

Table 70 Subroutines to use for outputting result value that have one value for each time step

Subroutine

Remarks

cg_iric_write_sol_baseiterative_integer_f

Outputs integer-type calculation results

cg_iric_write_sol_baseiterative_real_f

Outputs double-precision real-type calculation results

cg_iric_write_sol_baseiterative_string_f

Outputs string-type calculation results

List 102 Example source code (One value for each time step)
 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:: convergence
10  double precision, dimension(:,:), allocatable::grid_x, grid_y
11  character(len=20):: condFile
12
13  condFile = 'test.cgn'
14
15  ! Open CGNS file
16  call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
17  if (ier /=0) STOP "*** Open error of CGNS file ***"
18
19  ! Initialize iRIClib
20  call cg_iric_init_f(fin, ier)
21  if (ier /=0) STOP "*** Initialize error of CGNS file ***"
22
23  ! Check the grid size
24  call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
25  ! Allocate memory for loading the grid
26  allocate(grid_x(isize,jsize), grid_y(isize,jsize))
27  ! Read the grid into memory
28  call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)
29
30  ! Output the initial state information.
31  time = 0
32  convergence = 0.1
33  call cg_iric_write_sol_time_f(time, ier)
34  ! Output calculation results
35  call cg_iric_write_sol_baseiterative_real_f('Convergence', convergence, ier)
36  do
37    time = time + 10.0
38
39    ! (Perform calculation here)
40
41    call iric_check_cancel_f(canceled)
42    if (canceled == 1) exit
43
44    ! Output calculation results
45    call iric_write_sol_start_f(condFile, ier)
46    call cg_iric_write_sol_time_f(time, ier)
47    call cg_iric_write_sol_baseiterative_real_f('Convergence', convergence, ier)
48    call cg_iric_flush_f(condFile, fin, ier)
49    call iric_write_sol_end_f(condFile, ier)
50
51    if (time > 1000) exit
52  end do
53
54  ! Close CGNS file
55  call cg_close_f(fin, ier)
56  stop
57end program SampleProgram