Value defined at grid edges

When you output value defined at grid edges, please use the functions in Table 73.

List 105 shows an example of the process to output value defined at grid edges.

Table 73 Subroutines to use for outputting result defined at grid edges

Subroutine

Remarks

cg_iric_write_sol_iface_integer_f

Outputs integer-type calculation results, having a value for each grid edge at i-direction

cg_iric_write_sol_iface_real_f

Outputs double-precision real-type calculation results, having a value for each grid edge at i-direction

cg_iric_write_sol_jface_integer_f

Outputs integer-type calculation results, having a value for each grid edge at j-direction

cg_iric_write_sol_jface_real_f

Outputs double-precision real-type calculation results, having a value for each grid edge at j-direction

List 105 Example source code (Value defined at grid cells)
 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  double precision, dimension(:,:), allocatable:: fluxi, fluxj
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  ! Allocate memory for calculation result
28  allocate(depth(isize - 1, jsize - 1), wetflag(isize - 1, jsize - 1))
29  ! Read the grid into memory
30  call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)
31
32  ! Output the initial state information.
33  time = 0
34  convergence = 0.1
35  call cg_iric_write_sol_time_f(time, ier)
36  ! Output calculation results
37  call cg_iric_write_sol_iface_real_f('FluxI', fluxi, ier)
38  call cg_iric_write_sol_jface_real_f('FluxJ', fluxj, ier)
39  do
40    time = time + 10.0
41
42    ! (Perform calculation here)
43
44    call iric_check_cancel_f(canceled)
45    if (canceled == 1) exit
46
47    ! Output calculation results
48    call iric_write_sol_start_f(condFile, ier)
49    call cg_iric_write_sol_time_f(time, ier)
50    call cg_iric_write_sol_iface_real_f('FluxI', fluxi, ier)
51    call cg_iric_write_sol_jface_real_f('FluxJ', fluxj, ier)
52    call cg_iric_flush_f(condFile, fin, ier)
53    call iric_write_sol_end_f(condFile, ier)
54
55    if (time > 1000) exit
56  end do
57
58  ! Close CGNS file
59  call cg_close_f(fin, ier)
60  stop
61end program SampleProgram