One value for each time step

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

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

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

Subroutine

Remarks

cg_iric_write_sol_baseiterative_integer

Outputs integer-type calculation results

cg_iric_write_sol_baseiterative_real

Outputs double-precision real-type calculation results

cg_iric_write_sol_baseiterative_string

Outputs string-type calculation results

List 169 Example source code (One value for each time step)
 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:: 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_iric_open(condFile, IRIC_MODE_MODIFY, fin, ier)
17  if (ier /=0) STOP "*** Open error of CGNS file ***"
18
19  ! Check the grid size
20  call cg_iric_read_grid2d_str_size(fin, isize, jsize, ier)
21  ! Allocate memory for loading the grid
22  allocate(grid_x(isize,jsize), grid_y(isize,jsize))
23  ! Read the grid into memory
24  call cg_iric_read_grid2d_coords(fin, grid_x, grid_y, ier)
25
26  ! Output the initial state information.
27  time = 0
28  convergence = 0.1
29
30  call cg_iric_write_sol_start(fin, ier)
31  call cg_iric_write_sol_time(fin, time, ier)
32  call cg_iric_write_sol_baseiterative_real(fin, 'Convergence', convergence, ier)
33  call cg_iric_write_sol_end(fin, ier)
34  do
35    time = time + 10.0
36
37    ! (Perform calculation here)
38
39    call iric_check_cancel(canceled)
40    if (canceled == 1) exit
41
42    ! Output calculation results
43    call cg_iric_write_sol_start(fin, ier)
44    call cg_iric_write_sol_time(fin, time, ier)
45    call cg_iric_write_sol_baseiterative_real(fin, 'Convergence', convergence, ier)
46    call cg_iric_write_sol_end(fin, ier)
47
48    if (time > 1000) exit
49  end do
50
51  ! Close CGNS file
52  call cg_iric_close(fin, ier)
53  stop
54end program SampleProgram