Value defined at grid edges¶
When you output value defined at grid edges, please use the functions in Table 81.
List 172 shows an example of the process to output value defined at grid edges.
Subroutine |
Remarks |
---|---|
cg_iric_write_sol_iface_integer |
Outputs integer-type calculation results, having a value for each grid edge at i-direction |
cg_iric_write_sol_iface_real |
Outputs double-precision real-type calculation results, having a value for each grid edge at i-direction |
cg_iric_write_sol_jface_integer |
Outputs integer-type calculation results, having a value for each grid edge at j-direction |
cg_iric_write_sol_jface_real |
Outputs double-precision real-type calculation results, having a value for each grid edge at j-direction |
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, 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_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 ! Allocate memory for calculation result
24 allocate(depth(isize - 1, jsize - 1), wetflag(isize - 1, jsize - 1))
25 ! Read the grid into memory
26 call cg_iric_read_grid2d_coords(fin, grid_x, grid_y, ier)
27
28 ! Output the initial state information.
29 time = 0
30 convergence = 0.1
31 call cg_iric_write_sol_start(fin, ier)
32 call cg_iric_write_sol_time(fin, time, ier)
33 call cg_iric_write_sol_iface_real(fin, 'FluxI', fluxi, ier)
34 call cg_iric_write_sol_jface_real(fin, 'FluxJ', fluxj, ier)
35 call cg_iric_write_sol_end(fin, ier)
36 do
37 time = time + 10.0
38
39 ! (Perform calculation here)
40
41 call iric_check_cancel(canceled)
42 if (canceled == 1) exit
43
44 ! Output calculation results
45 call cg_iric_write_sol_start(fin, ier)
46 call cg_iric_write_sol_time(fin, time, ier)
47 call cg_iric_write_sol_iface_real(fin, 'FluxI', fluxi, ier)
48 call cg_iric_write_sol_jface_real(fin, 'FluxJ', fluxj, ier)
49 call cg_iric_write_sol_end(fin, ier)
50
51 if (time > 1000) exit
52 end do
53
54 ! Close CGNS file
55 call cg_iric_close(fin, ier)
56 stop
57end program SampleProgram