iRIC Developer’s manual
Release 3.0.0

iRIC organization

Jul 09, 2022

Contents

1

About This Manual

1

2

Steps of developing a solver
2.1 Preparing development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.1
definition.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.2
Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.3
translation_ja_JP.ts etc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.4
README . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2.5
LICENSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3 Creating a folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 Creating a solver definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.1
Defining basic information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.2
Defining calculation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.3
Defining Grid attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.4
Defining Boundary Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5 Creating a solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5.1
Creating a skelton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5.2
Adding calculation data file opening and closing codes . . . . . . . . . . . . . . . . . . . .
2.5.3
Adding codes to load calculation conditions, calculation grids, and boundary conditions . . .
2.5.4
Adding codes to output time and calculation results . . . . . . . . . . . . . . . . . . . . . .
2.6 Creating a solver definition dictionary file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.7 Creating a README file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.8 Creating a LICENSE file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
3
3
4
4
4
4
4
4
6
6
7
12
14
17
17
18
19
22
23
25
27

3

Steps of developing a calculation result analysis program
3.1 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

31
31

4

Steps of developing a grid generating program
4.1 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.1
definition.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.2
Grid Generating program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.3
translation_ja_JP.ts etc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1.4
README . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Creating a folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3 Creating a grid generating program definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.1
Defining basic information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35
35
35
36
36
36
37
37
37
i

4.3.2
Defining grid generating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3.3
Defining error codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating a grid generating program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.1
Creating a scelton . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.2
Adding grid generating data file opening and closing codes . . . . . . . . . . . . . . . . . .
4.4.3
Adding codes to output a grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4.4
Adding codes to load grid generating condition . . . . . . . . . . . . . . . . . . . . . . . .
4.4.5
Adding error handling codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating a grid generating program definition dictionary file . . . . . . . . . . . . . . . . . . . . . .
Creating a README file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

38
42
43
43
44
45
46
49
49
52

5

About definition files (XML)5.1 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.1
Solver definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.2
Grid generating program definition file . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.1
Examples of calculation conditions, boundary conditions, and grid generating condition . . .
5.3.2
Example of condition to activate calculation conditions etc. . . . . . . . . . . . . . . . . . .
5.3.3
Example of dialog layout definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4 Elements reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.1
BoundaryCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.2
CalculationCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.3
Condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.4
Definition (when used under CalculationCondition element or BoundaryCondition element)
5.4.5
Definition (when used under the GridRelatedCondition element) . . . . . . . . . . . . . . .
5.4.6
Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.7
Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.8
ErrorCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.9ErrorCodes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.10 GridGeneratingCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.11 GridGeneratorDefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.12 GridLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.13 GridRelatedCondition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.14 GridType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.15 GridTypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.16 GroupBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.17 HBoxLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.18 Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.19 Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.20 Param . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.21 SolverDefinition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.22 Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.23 Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.24 VBoxLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5 Notes on solver version up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 XML files basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6.1
Defining Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6.2
About tabs, spaces, and line breaks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6.3
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55
55
55
55
58
58
58
70
70
74
74
75
76
77
79
80
81
81
82
82
83
84
84
85
85
86
87
87
88
88
89
91
91
92
93
94
94
95
95

6

iRIClib
6.1 What is iRIClib? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Languages supported by iRIClib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97
97
97

4.4

4.5
4.6

ii

6.3
6.4

6.5

6.2.1
FORTRAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.2
C/C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.3
Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How to read this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.1
Processes of the program and iRIClib subroutines . . . . . . . . . . . . . . . . . . . . . . .
6.4.2
Opening a CGNS file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.3
Initializing iRIClib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.4
Set up options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.5
Reading calculation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.6
Reading calculation grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.7
Reading boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.8
Reading geographic data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.9
Outputting calculation grids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.10 Outputting time (or iteration count) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.11 Outputting calculation grids (only in the case of a moving grid) . . . . . . . . . . . . . . . .
6.4.12 Outputting calculation results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.13 Reading calculation result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.14 Outputting Error code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.4.15 Closing a CGNS file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.1
List of subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.2
cg_open_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.3
cg_iric_init_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.4
cg_iric_initread_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.5
iric_initoption_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.6
cg_iric_read_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.7
cg_iric_read_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.8
cg_iric_read_realsingle_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.9
cg_iric_read_string_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.10 cg_iric_read_functionalsize_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.11 cg_iric_read_functional_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.12 cg_iric_read_functional_realsingle_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.13 cg_iric_read_functionalwithname_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.14 cg_iric_gotogridcoord2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.15 cg_iric_gotogridcoord3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.16 cg_iric_getgridcoord2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.17 cg_iric_getgridcoord3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.18 cg_iric_read_grid_integer_node_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.19 cg_iric_read_grid_real_node_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.20 cg_iric_read_grid_integer_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.21 cg_iric_read_grid_real_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.22 cg_iric_read_complex_count_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.23 cg_iric_read_complex_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.24 cg_iric_read_complex_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.25 cg_iric_read_complex_realsingle_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.26 cg_iric_read_complex_string_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.27 cg_iric_read_complex_functionalsize_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.28 cg_iric_read_complex_functional_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.29 cg_iric_read_complex_functionalwithname_f . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.30 cg_iric_read_complex_functional_realsingle_f . . . . . . . . . . . . . . . . . . . . . . . .
6.5.31 cg_iric_read_grid_complex_node_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.32 cg_iric_read_grid_complex_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.33 cg_iric_read_grid_functionaltimesize_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .

98
98
98
98
98
99
99
99
100
100
102
104
106
110
112
113
114
127
129
129
129
130
133
134
134
135
135
136
137
137
138
138
139
140
140
141
142
142
143
144
144
145
145
146
147
147
148
148
149
150
150
151
152
152

iii

6.5.34
6.5.356.5.366.5.37
6.5.386.5.396.5.406.5.41
6.5.426.5.436.5.446.5.456.5.46
6.5.47
6.5.486.5.496.5.506.5.51
6.5.52
6.5.53
6.5.546.5.55
6.5.56
6.5.57
6.5.586.5.596.5.606.5.61
6.5.626.5.636.5.646.5.656.5.66
6.5.67
6.5.686.5.696.5.706.5.71
6.5.72
6.5.736.5.746.5.756.5.76
6.5.77
6.5.786.5.796.5.806.5.81
6.5.826.5.836.5.846.5.856.5.86
6.5.87iv

cg_iric_read_grid_functionaltime_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functionaldimensionsize_f . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functionaldimension_integer_f . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functionaldimension_real_f . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functional_integer_node_f . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functional_real_node_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functional_integer_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_grid_functional_real_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_count_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_indicessize_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_indices_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_realsingle_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_string_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_functionalsize_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_functional_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_functional_realsingle_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_bc_functionalwithname_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_geo_count_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_read_geo_filename_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_open_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_integervalue_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_realvalue_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_pointcount_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_points_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_holecount_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_holepointcount_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_read_holepoints_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_polygon_close_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_open_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_count_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_position_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_direction_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_name_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_realname_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_leftshift_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_altitudecount_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_altitudes_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_fixedpointl_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_fixedpointr_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_read_watersurfaceelevation_f . . . . . . . . . . . . . . . . . . . . . .
iric_geo_riversurvey_close_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_writegridcoord1d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_writegridcoord2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_writegridcoord3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_grid_integer_node_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_grid_real_node_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_grid_integer_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_grid_real_cell_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_sol_time_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_sol_iteration_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_sol_gridcoord2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
cg_iric_write_sol_gridcoord3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

153
153
154
155
155
156
157
157
158
158
159
160
161
161
162
163
163
164
164
165
166
166
167
167
168
169
169
170
170
171
171
172
172
173
174
174
175
176
176
177
178
178
179
179
180
181
181
182
183
183
184
184
185
186

6.5.88 cg_iric_write_sol_baseiterative_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.89 cg_iric_write_sol_baseiterative_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.90 cg_iric_write_sol_baseiterative_string_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.91 cg_iric_write_sol_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.92 cg_iric_write_sol_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.93 cg_iric_write_sol_cell_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.94 cg_iric_write_sol_cell_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.95 cg_iric_write_sol_iface_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.96 cg_iric_write_sol_iface_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.97 cg_iric_write_sol_jface_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.98 cg_iric_write_sol_jface_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.99 cg_iric_write_sol_particle_pos2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.100 cg_iric_write_sol_particle_pos3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.101 cg_iric_write_sol_particle_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.102 cg_iric_write_sol_particle_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.103 cg_iric_write_sol_particlegroup_groupbegin_f . . . . . . . . . . . . . . . . . . . . . . . .
6.5.104 cg_iric_write_sol_particlegroup_groupend_f . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.105 cg_iric_write_sol_particlegroup_pos2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.106 cg_iric_write_sol_particlegroup_pos3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.107 cg_iric_write_sol_particlegroup_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.108 cg_iric_write_sol_particlegroup_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.109 cg_iric_write_sol_polydata_groupbegin_f . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.110 cg_iric_write_sol_polydata_groupend_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.111 cg_iric_write_sol_polydata_polygon_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.112 cg_iric_write_sol_polydata_polyline_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.113 cg_iric_write_sol_polydata_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.114 cg_iric_write_sol_polydata_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.115 iric_check_cancel_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.116 iric_check_lock_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.117 iric_write_sol_start_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.118 iric_write_sol_end_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.119 cg_iric_flush_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.120 cg_iric_read_sol_count_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.121 cg_iric_read_sol_time_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.122 cg_iric_read_sol_iteration_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.123 cg_iric_read_sol_baseiterative_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.124 cg_iric_read_sol_baseiterative_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.125 cg_iric_read_sol_baseiterative_string_f . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.126 cg_iric_read_sol_gridcoord2d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.127 cg_iric_read_sol_gridcoord3d_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.128 cg_iric_read_sol_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.129 cg_iric_read_sol_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.130 cg_iric_read_sol_cell_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.131 cg_iric_read_sol_cell_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.132 cg_iric_read_sol_iface_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.133 cg_iric_read_sol_iface_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.134 cg_iric_read_sol_jface_integer_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.135 cg_iric_read_sol_jface_real_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.136 cg_iric_write_errorcode_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.5.137 cg_close_f . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7

186
187
187
188
189
189
190
190
191
192
192
193
193
194
195
195
196
196
197
197
198
199
199
200
200
201
202
202
203
203
204
205
205
206
206
207
207
208
209
209
210
211
211
212
212
213
214
214
215
216

Other Informations
217
7.1 Handling command line arguments in Fortran programs . . . . . . . . . . . . . . . . . . . . . . . . 217
7.1.1
Intel Fortran Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217

v

7.2

7.3

7.4

7.5

8

vi

7.1.2
GNU Fortran, G95 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Linking iRIClib, cgnslib using Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.1Intel Fortran Compiler (Windows) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.2.2
GNU Fortran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Special names for grid attributes and calculation results . . . . . . . . . . . . . . . . . . . . . . . .
7.3.1
Grid attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3.2
Calculation results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Information on CGNS file and CGNS library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4.1
General concept of CGNS file format . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4.2
How to view a CGNS file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.4.3
Reference URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Registering file to Repository for iRIC installer build . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5.1
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5.2
Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5.3
Install Subversion client software (needed only for the first time) . . . . . . . . . . . . . . .
7.5.4
Get the folder from server (checkout) . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5.5
Copy new files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.5.6
Register new files to server (commit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

To Readers

217
218
218
218
219
219
219
220
220
220
224
224
224
224
224
225
228
228
231

CHAPTER

1

About This ManualThis manual provides information necessary for the following people:• Developers of solvers that run on iRIC.
• Developers of grid generating programs that run on iRIC
Developers of solvers should read Steps of developing a solver (page 3) first, to understand the steps of developing asolver. After that, please read About definition files (XML) (page 55), iRIClib (page 97), Other Informations (page 217)
when you need to.
Developers of grid generating programs should read Steps of developing a grid generating program (page 35) first,
to understand the steps of developing a grid generating program. After that, please read About definition files (XML)(page 55), iRIClib (page 97), Other Informations (page 217) when you need to.

1

iRIC Developer’s manual, Release 3.0.0

2Chapter 1. About This ManualCHAPTER

2

Steps of developing a solver

2.1 Preparing development environment
Prepare environment to develop iRIC solvers.
• To develop with C/C++, you can use Visual C/C++ 2013 or newer.
• To develop with FORTRAN, you can use Intel Fortran 2015 or newer.
When building solvers, you need to link against cgnslib and iriclib.
Headers and Libraries are bundled with iRIC GUI. If you’ve installed to standard folder, they are stored in the folder
below:
C:\Users\(userid)\iRIC\guis\prepost\sdk

2.2 Abstract
Solver is a program that load grid and calculation conditions, execute a river simulation, and output calculation results.
To add a solver to iRIC, it is necessary to make and deploy files shown in Table 2.1.
Solver developers have to create a new folder under “solvers” folder under iRIC install folder, and deploy files in Table
2.1 that you’ve prepared for your new solver.

File namedefinition.xml
solver.exe
translation_ja_JP.ts etc.
READMELICENSE

Table 2.1: Files related to a Solver
Description
Solver definition file
Executable module of the solver. Developers can select any name.
Dictionary files for a solver definition file
File explaining the solver
License information file for the solver

3

iRIC Developer’s manual, Release 3.0.0

Abstracts of each file are as follows:

2.2.1 definition.xml
File that defines the following information of solvers:• Basic Information• Calculation Conditions• Grid Attributes
iRIC loads definition xml, and provides interface for creating calculation conditions and grids that can be used by thesolver. Solver definition file should be written in English.

2.2.2 Solver
Executable module of a river simulation solver. It loads calculation condition and grids created using iRIC, executes
river simulation, and outputs result.
Solvers use calculation data files created by iRIC, for loading and writing calculation condition, grids, and calculation
results. Solvers can also use arbitrary files for data I/O that cannot be loaded from or written into calculation data files.
Solvers can be developed using FORTRAN, Python, C or C++. In this chapter, a sample solver is developed in
FORTRAN.

2.2.3 translation_ja_JP.ts etc.
Dictionary files for a solver definition file. It provides translation information for texts shown on dialogs or object
browser in iRIC. Dictionary files are created as separate files for each language. For example, “translation_ja_JP.ts”
for Japanese, “translation_ka_KR.ts” for Korean.

2.2.4 READMEREADME is a text file that describes about the solver. The content of README is shown in the “Description” tab in
the [Select Solver] dialog.

2.2.5 LICENSE
LICENSE is a text file that describes about the license of the solver. The content of LICENSE is shown in the “License”
tab in the [Select Solver] dialog.
Figure 2.1 shows the relationships of iRIC, solver and related files.
This chapter explains the steps to create the files described in this section.

2.3 Creating a folder
Create a special folder for the solver you develop under the “solvers” folder under the installation folder of iRIC. Thistime, please create “example” folder.

4

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Figure 2.1: Relationships between iRIC, solvers, and related files

2.3. Creating a folder

5

iRIC Developer’s manual, Release 3.0.0

2.4 Creating a solver definition file
Create a solver definition file.
In solver definition file, you are going to define the information shown in Table 2.2.
Table 2.2: Informations defined in solver definition file
Item
Description
Basic information
The solver name, developer name, release date, etc.
Calculation Condition Calculation condition for solver execution
Grid Attributes
Attributes defined at nodes or cells of calculation grids
Boundary Conditions
Boundary conditions defined at nodes or cells of calculation grids

Required
Yes
Yes
Yes

Solver definition file is described in XML language. The basic grammer of XML language is explained in XML files
basics (page 94).
In this section, we add definition information of a solver in the order shown in Table 2.2.

2.4.1 Defining basic information
Define basic information of a solver. Create a file with the content shown in List 2.1, and save it with name “definition.xml” under “example” folder that you created in Creating a folder (page 4)
List 2.1: Example solver definition file that contains basic information
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

<?xml version="1.0" encoding="UTF-8"?><SolverDefinition
name="samplesolver"
caption="Sample Solver 1.0"
version="1.0"
copyright="Example Company"
release="2012.04.01"
homepage="http://example.com/"
executable="solver.exe"
iterationtype="time"
gridtype="structured2d"><CalculationCondition></CalculationCondition><GridRelatedCondition></GridRelatedCondition></SolverDefinition>

At this point, the structure of the solver definition file is as shown in Figure 2.2.

Figure 2.2: Solver definition file structure
Now make sure the solver definition file is arranged correctly.

6

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Launch iRIC. The [iRIC Start Page] dialog ( Figure 2.3 ) is shown, so please click on [New Project]. The [Solver
Select] dialog (Figure 2.4 ) will open, so make sure if there is a new item “Sample Solver” in the solver list. Whenyou find it, select it and make sure that the basic information of the solver you wrote in solver definition file is shown.
Please note that the following attributes are not shown on this dialog:• name• executable• iterationtype• gridtype

Figure 2.3: The [iRIC Start Page] dialog
You sould take care about name attribute and version attribute, when you want to update a solver. Please refer to Notes
on solver version up (page 93) for the detail.

2.4.2 Defining calculation conditions
Define calculation conditions. Calculation conditions are defined in “CalculationCondition” element. Add descriptionof calculation condition to the solver definition file you created in Defining basic information (page 6) . Solver
definition file content is now as shown in List 2.2. The added part is shown with highlight.
List 2.2: Example of solver definition file that now has calculation condition definition
1
2<?xml version="1.0" encoding="UTF-8"?><SolverDefinition(continues on next page)2.4. Creating a solver definition file7

iRIC Developer’s manual, Release 3.0.0

Figure 2.4: The [Select Solver] dialog(continued from previous page)

name="samplesolver"
caption="Sample Solver"
version="1.0"
copyright="Example Company"
release="2012.04.01"
homepage="http://example.com/"
executable="solver.exe"
iterationtype="time"
gridtype="structured2d"

3
4
5
6
7
8
9
10
11
12

>

13

<CalculationCondition><Tab name="basic" caption="Basic Settings"><Item name="maxIteretions" caption="Maximum number of Iterations"><Definition valueType="integer" default="10"></Definition></Item><Item name="timeStep" caption="Time Step"><Definition valueType="real" default="0.1"></Definition></Item></Tab></CalculationCondition><GridRelatedCondition></GridRelatedCondition></SolverDefinition>

14
15
16
17
18
19
20
21
22
23
24
25
26
27

8

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

At this point, the structure of the solver definition file is as shown in Figure 2.5.

Figure 2.5: Solver definition file structure
Now make sure that solver definition file is arranged correctly.
Launch iRIC. The [iRIC Start page] dialog (Figure 2.3) will open, so please click on [Create New Project], select“Sample Solver” from the list, and click on [OK]. The Warning dialog (Figure 2.6) will be open, so click on [OK].

Figure 2.6: The [Warning] dialog
The [Pre-processing Window] will open, so perform the following:
Menu bar: –> [Calculation Condition] (C) –> [Setting] (S)The [Calculation Condition] dialog (Figure 2.7) will open. Now you can see that the calculation condition items you
defined in List 2.2 are shown.
Now add one more group and add calculation condition items. Add “Water Surface Elevation” Tab element just after“Basic Settings” Tab element. List 2.3 shows the solver definition file that has definition of “Water Surface Elevation”
Tab. The added part is shown with highlight.
List 2.3: Example of solver definition file that now has calculation condition definition (abbr.)
1
2
3
4
5
6
7
8
9
10
11
12

(abbr.)</Tab><Tab name="surfaceElevation" caption="Water Surface Elevation"><Item name="surfaceType" caption="Type"><Definition valueType="integer" default="0"><Enumeration caption="Constant" value="0" /><Enumeration caption="Time Dependent" value="1" /></Definition></Item><Item name="constantSurface" caption="Constant Value"><Definition valueType="real" default="1"><Condition type="isEqual" target="surfaceType" value="0"/>(continues on next page)2.4. Creating a solver definition file9

iRIC Developer’s manual, Release 3.0.0

Figure 2.7: The [Calculation Condition] dialog(continued from previous page)
13
14
15
16
17
18
19
20
21
22
23
24
25
26

</Definition></Item><Item name="variableSurface" caption="Time Dependent Value"><Definition valueType="functional"><Parameter valueType="real" caption="Time(s)"/><Value valueType="real" caption="Elevation(m) "/><Condition type="isEqual" target="surfaceType" value="1"/></Definition></Item></Tab></CalculationCondition><GridRelatedCondition></GridRelatedCondition></SolverDefinition>

At this point, the structure of the solver definition file is as shown in Figure 2.8.
Now make sure that solver definition file is arranged correctly. Do the operation you did again, to open The [Calculation Condition] dialog (Figure 2.9).
Now you can see that the new group “Water Surface Elevation” is added in the group list. You’ll also notice that the“Constant Value” item is enabled only when “Type” value is “Constant”, and the “Time Dependent Value” item isenabled only when “Type” value is “Time Dependent”.
What it comes down to is:• Calculation condition group is defined with “Tab” element, and calculation condition item is defined with “Item”
element.
• The Structure under “Definition” elements depends on the condition type (i. e. Integer, Real number, functional

10

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Figure 2.8: Solver definition file structure

Figure 2.9: The [Calculation Condition] dialog

2.4. Creating a solver definition file11

iRIC Developer’s manual, Release 3.0.0etc.). Refer to Examples of calculation conditions, boundary conditions, and grid generating condition (page 58)
for examples of calculation condition items for each type.
• Dependenciy between calculation condition items can be defined with “Condition” element. In “Condition”
element, define the condition when that item should be enabled. Refer to Example of condition to activate
calculation conditions etc. (page 70) for examples of “Condition” element.
• In this example, the calculation condition dialog shows the items as a simple list, but iRIC has feature to show
items with more complex layouts, like layout with group boxes. Refer to Example of dialog layout definition(page 70) for more complex layouts.

2.4.3 Defining Grid attributes
Define grid attributes. Grid attributes are defined with “GridRelatedCondition” element. Add definition of grid related
condition to the solver definition file you created, as shown in List 2.4. The added part is shown with highlight.
List 2.4: Example of solver definition file that now has grid related condition (abbr.)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

(abbr.)</CalculationCondition><GridRelatedCondition><Item name="Elevation" caption="Elevation"><Definition position="node" valueType="real" default="max" /></Item><Item name="Obstacle" caption="Obstacle"><Definition position="cell" valueType="integer" default="0"><Enumeration value="0" caption="Normal cell" /><Enumeration value="1" caption="Obstacle" /></Definition></Item><Item name="Rain" caption="Rain"><Definition position="cell" valueType="real" default="0"><Dimension name="Time" caption="Time" valueType="real" /></Definition></Item></GridRelatedCondition></SolverDefinition>

Now make sure that solver definition file is arranged correctly.
Launch iRIC, and starts a new project with solver “Sample Solver”. Now you will see the [Pre-processing Window]
like in Figure 2.10. When you create or import a grid, the [Pre-processing Window] will become like in Figure 2.11.
When you do not know how to create or import a grid, refer to the User Manual.
When you edit the grid attribute “Elevation” with the following procedure, the [Edit Elevation] dialog (Figure 2.12)
will open, and you can check that you can input real number as “Elevation” value.
• Select [Grid] –> [Node attributes] –> [Elevation] in the [Object Browser].
• Select grid nodes with mouse clicking in the canvas area
• Show context menu with right-clicking, and click on [Edit].
When you do the same operation against attribute “Obstacle” to edit “Obstacle” value, the [Obstacle edit dialog](Figure 2.13) will open, and you can check that you can select obstacle values from that you defined in solver definition
file, in List 2.4.
What it comes down to is:

12

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Figure 2.10: The [Pre-processing Window]

Figure 2.11: The [Pre-processing Window] after creating a grid2.4. Creating a solver definition file13

iRIC Developer’s manual, Release 3.0.0

Figure 2.12: The [Edit Elevation] dialog

Figure 2.13: The [Obstacle edit dialog]• Grid attribute is defined with “Item” element under “GridRelatedCondition” element.
• The structure under “Item” element is basically the same to that for calculation condition, but there are different
points:• You have to specify “position” attribute to determine whether that attribute is defined at nodes or cells.
• You can not use types “String”, “Functional”, “File name” and “Folder name”.
• You can not define dependency.
• You can define dimension of the attribute, using “Dimension” element.
For grid attributes, iRIC defines some special names. For attributes for certain purposes, you should use those names.
Refer to Special names for grid attributes and calculation results (page 219) for the special grid attribute names.

2.4.4 Defining Boundary Conditions
Define boundary conditions. You can define boundary conditions with “BoundaryCondition” element. Boundary
conditions are not required.
Add definition of “Boundary Condition” to the solver definition file you created, as shown in List 2.5. The added partis shown with highlight.
List 2.5: Example of solver definition file that now has boundary condition (abbr.)
1
2
3
4
5
6
7
8
9

(abbr.)</GridRelatedCondition><BoundaryCondition name="inflow" caption="Inflow" position="node"><Item name="Type" caption="Type"><Definition valueType="integer" default="0" ><Enumeration value="0" caption="Constant" /><Enumeration value="1" caption="Variable" /></Definition></Item>|(continues on next page)

14

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
10
11
12
13
14
15
16
17
18
19
20
21
22
23

<Item name="ConstantDischarge" caption="Constant Discharge"><Definition valueType="real" default="0"><Condition type="isEqual" target="Type" value="0"/></Definition></Item><Item name="FunctionalDischarge" caption="Variable Discharge"><Definition conditionType="functional"><Parameter valueType="real" caption="Time"/><Value valueType="real" caption="Discharge(m3/s)"/><Condition type="isEqual" target="Type" value="1"/></Definition></Item></BoundaryCondition></SolverDefinition>

Now make sure that solver definition file is arranged correctly.
Launch iRIC, and start a new project with solver “Sample Solver”. When you create or import a grid, the [Preprocessing Window] will become like Figure 2.14. When you do now know how to create or imprt a grid, refer to theUser Manual.

Figure 2.14: The [Pre-processing Window] after creating a grid
Click on [Add new Inflow] on the context menu on [Boundary Condition] node, and The [Boundary Condition] dialog(Figure 2.15) will open, and you can define boundary condition on this dialog.
When you have finished defining boundary condition, click on [OK]. Drag around the grid nodes to select nodes, andclick on [Assign Condition] in the context menu. Figure 2.16 shows an example of a grid with boundary condition.
What it comes down to is:• Boundary condition is defined Grid attribute is defined with “Item” element under “GridRelatedCondition”
element.
• The structure under “Item” element is the same to that for calculation condition.

2.4. Creating a solver definition file15

iRIC Developer’s manual, Release 3.0.0

Figure 2.15: The [Boundary Condition] dialog

Figure 2.16: Example of a grid with boundary condition

16

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

2.5 Creating a solver
Create a solver. In this example we will develop a solver with FORTRAN.
To develop a solver that works together with iRIC, you have to make it use calculation data file that iRIC generate, forloading calculation conditions and grid and outputting calculation results.
The calculation data file that iRIC generates is a CGNS file. You can use a library called iRIClib to write code forloading and writing CGNS files.
In this section, the procedure to develop a solver is described, that load calculation data file, that iRIC generates. Table
2.3 shows the input and output processing that the solver do against the calculation data file.
Table 2.3: The I/O processing flow of solver
Processing
Required
Opens calculation data file
Yes
Initializes iRIClib
Yes
Loads calculation condition Yes
Loads calculation grid
Yes
Outputs time (or iteration)
Yes
Outputs calculation result
Yes
Closes calculation data fileYes
In this section, we will develop a solver in the following procedure:
1. Create a scelton
2. Adds calculation data file opening and closing codes
3. Adds codes to load calculation conditions, calculation girds, and boundary conditions
4. Adds codes to output time and calculation results

2.5.1 Creating a skelton
First, create a scelton of a solver. Create a new file with the source code in List 2.6, and save as “sample.f90”. At thispoint, the solver does nothing.
Compile this source code. The way to compile a source code differs by the compiler. Refer to Linking iRIClib, cgnslib
using Fortran (page 218) for the procedure to compile using Intel Fortran Compiler and gfortran.
List 2.6: Sample solver source code12
3
4

program SampleProgram
implicit none
include 'cgnslib_f.h'include 'iriclib_f.h'

5
6
7
8

write(*,*) "Sample Program"stop
end program SampleProgram

When it was compiled successfully, copy the executable file to the folder you created in Creating a folder (page 4),
and rename it into the name you specified as [executable] attribute in Defining basic information (page 6). This time,
rename into “solver.exe”. Copy the DLL files into that folder, that is needed to run the solver.
Now check whether it can be launched from iRIC successfully.

2.5. Creating a solver

17

iRIC Developer’s manual, Release 3.0.0

Starts a new project that uses “Example Solver”, and performs the following:
Menu bar: [Simulation] (S) –> [Run] (R)The [Solver Console] opens, and the message “Sample Program” will be shown (Figure 2.17). If the message is shown,
it means that the solver was launched by iRIC successfully.

Figure 2.17: The [Solver Console]

2.5.2 Adding calculation data file opening and closing codes
Adds codes for opening and closing calculation data file.
The solver has to open calculation data file in the first step, and close it in the last step.
iRIC will handle the file name of calculation data file as a the first argument, so open that file.
The way to handle the number of arguments and the arguments differs by compilers. Refer to Handling command line
arguments in Fortran programs (page 217) for the way to handle them with Intel Fortran Compiler and gfortran. In
this chapter we will add codes that can be compiled using Intel Fortran Compiler.
Table List 2.7 shows the source code with the lines to open and close calculation data file. The added lines are shownwith highlight.
List 2.7: The source code with lines to open and close file
1
2
3
4
5
6
7

program SampleProgram
implicit none
include 'cgnslib_f.h'include 'iriclib_f.h'
integer:: fin, ier
integer:: icount, istatuscharacter(200)::condFile

8
9

write(*,*) "Sample Program"

10
11
12
13
14
15

icount = nargs()
if ( icount.eq.2 ) thencall getarg(1, condFile, istatus)
else
write(*,*) "Input File not specified."(continues on next page)

18

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
16
17

stop
endif

18
19
20
21

! Opens calculation data file.
call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) stop "*** Open error of CGNS file ***"

22
23
24
25
26
27
28

! Initializes iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"
! Set options
call iric_initoption_f(IRIC_OPTION_CANCEL, ier)
if (ier /=0) STOP "*** Initialize option error***"

29
30
31
32
33

! Closes calculation data file.
call cg_close_f(fin, ier)stop
end program SampleProgram

Compile and deploy the executable file, just like in Creating a skelton (page 17).
Check whether it can be launched from iRIC successfully, just like in Creating a skelton (page 17).
Refer to Opening a CGNS file (page 99), Initializing iRIClib (page 99) and Closing a CGNS file (page 129) for thedetails of the subroutines added in this section.

2.5.3 Adding codes to load calculation conditions, calculation grids, and boundary
conditions
Adds codes to load calculation conditions, calculation girds, and boundary conditions.
iRIC will output calculation conditions, grids, grid attributes, and boundary condition according to the solver definition
file that you’ve created in Creating a solver definition file (page 6). So, the solver has to load them to coincide withthe description in the solver definition file.
List 2.8 shows the source code with lines to load calculation condition, grid and boundary condition. The added lines
are shown with highlight.
List 2.8: The source code with lines to load calculation condition, gridand boundary condition
1
2
3
4
5
6
7
8
9
10
11
12
13
14

program SampleProgram
implicit none
include 'cgnslib_f.h'include 'iriclib_f.h'
integer:: fin, ier
integer:: icount, istatuscharacter(200)::condFile
integer:: maxiterations
double precision:: timestep
integer:: surfacetype
double precision:: constantsurface
integer:: variable_surface_size
double precision, dimension(:), allocatable:: variable_surface_time
double precision, dimension(:), allocatable:: variable_surface_elevation

15(continues on next page)2.5. Creating a solver

19

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
16
17
18
19

integer:: isize, jsize
double precision, dimension(:,:), allocatable:: grid_x, grid_y
double precision, dimension(:,:), allocatable:: elevation
integer, dimension(:,:), allocatable:: obstacle

20
21
22
23
24
25
26
27
28
29
30
31

integer:: inflowid
integer:: inflow_countinteger:: inflow_element_max
integer:: discharge_variable_sizemax
integer, dimension(:), allocatable:: inflow_element_countinteger, dimension(:,:,:), allocatable:: inflow_element
integer, dimension(:), allocatable:: discharge_type
double precision, dimension(:), allocatable:: discharge_constantinteger, dimension(:), allocatable:: discharge_variable_size
double precision, dimension(:,:), allocatable:: discharge_variable_time
double precision, dimension(:,:), allocatable:: discharge_variable_value

32
33

write(*,*) "Sample Program"34
35! (abbr)

36
37
38
39
40
41
42

! Initializes iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"
! Set options
call iric_initoption_f(IRIC_OPTION_CANCEL, ier)
if (ier /=0) STOP "*** Initialize option error***"

43
44
45
46
47
48

! Loads calculation condition
call cg_iric_read_integer_f("maxIteretions", maxiterations, ier)
call cg_iric_read_real_f("timeStep", timestep, ier)
call cg_iric_read_integer_f("surfaceType", surfacetype, ier)
call cg_iric_read_real_f("constantSurface", constantsurface, ier)

49
50
51
52
53

call cg_iric_read_functionalsize_f("variableSurface", variable_surface_size, ier)
allocate(variable_surface_time(variable_surface_size))
allocate(variable_surface_elevation(variable_surface_size))call cg_iric_read_functional_f("variableSurface", variable_surface_time, variable_
˓→surface_elevation, ier)

54
55
56

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)

57
58
59
60
61

! Allocate the memory to read grid coordinates
allocate(grid_x(isize,jsize), grid_y(isize,jsize))! Loads grid coordinates
call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)

62
63
64
65

! Allocate the memory to load grid attributes defined at grid nodes and grid cells
allocate(elevation(isize, jsize))
allocate(obstacle(isize - 1, jsize - 1))

66
67
68
69

! Loads grid attributes
call cg_iric_read_grid_real_node_f("Elevation", elevation, ier)
call cg_iric_read_grid_integer_cell_f("Obstacle", obstacle, ier)

70
71

! Allocate memory to load boundary conditions (inflow)(continues on next page)

20

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0(continued from previous page)

allocate(inflow_element_count(inflow_count))
allocate(discharge_type(inflow_count), discharge_constant(inflow_count))
allocate(discharge_variable_size(inflow_count))

72
73
74
75
76

! Check the number of grid nodes assigned as inflow, and the size of time-dependent
discharge.
inflow_element_max = 0
do inflowid = 1, inflow_count! Read the number of grid nodes assigned as inflow
call cg_iric_read_bc_indicessize_f('inflow', inflowid, inflow_element_
˓→count(inflowid))
if (inflow_element_max < inflow_element_count(inflowid)) theninflow_element_max = inflow_element_count(inflowid)
end if! Read the size of time-dependent discharge
call cg_iric_read_bc_functionalsize_f('inflow', inflowid, 'FunctionalDischarge',
˓→discharge_variable_size(inflowid), ier);
if (discharge_variable_sizemax < discharge_variable_size(inflowid)) thendischarge_variable_sizemax = discharge_variable_size(inflowid)
end ifend do
˓→

77
78
79
80

81
82
83
84
85

86
87
88
89
90
91

˓→
92
93
94

! Allocate the memory to load grid nodes assigned as inflow, and time-dependent
discharge.
allocate(inflow_element(inflow_count, 2, inflow_element_max))
allocate(discharge_variable_time(inflow_count, discharge_variable_sizemax))
allocate(discharge_variable_value(inflow_count, discharge_variable_sizemax))

95
96
97
98
99

100
101

102
103

104
105

106

! Loads boundary condition
do inflowid = 1, inflow_count! Loads the grid nodes assigned as inflow
call cg_iric_read_bc_indices_f('inflow', inflowid, inflow_
˓→element(inflowid:inflowid,:,:), ier)
! Loads the inflow type (0 = constant, 1 = time-dependent)
call cg_iric_read_bc_integer_f('inflow', inflowid, 'Type', discharge_
˓→type(inflowid:inflowid), ier)
! Loads the discharge (constant)call cg_iric_read_bc_real_f('inflow', inflowid, 'ConstantDischarge', discharge_
˓→constant(inflowid:inflowid), ier)
! Loads the discharge (time-dependent)
call cg_iric_read_bc_functional_f('inflow', inflowid, 'FunctionalDischarge',
˓→discharge_variable_time(inflowid:inflowid,:), discharge_variable_
˓→value(inflowid:inflowid,:), ier)end do

107
108
109
110
111

! Closes the calculation data filecall cg_close_f(fin, ier)stop
end program SampleProgram

Note that the arguments passed to load calculation conditions, grid attributes and boundary conditions are the same tothe [name] attributes of Items defined in Defining calculation conditions (page 7), Defining Grid attributes (page 12).
Refer to Examples of calculation conditions, boundary conditions, and grid generating condition (page 58) for the
relationship between definitions of calculation condition, grid attributes, boundary conditions and the iRIClib subroutines to load them.
Refer to Reading calculation conditions (page 100), Reading calculation grid (page 102) and Reading boundary
2.5. Creating a solver

21

iRIC Developer’s manual, Release 3.0.0

conditions (page 104) for the detail of subroutines to load calculation condition, grids, and boundary conditions.

2.5.4 Adding codes to output time and calculation results
Adds codes to output time and calculation results.
When you develop a solver that is used for time-dependent flow, you have to repeat outputting time and calculation
results for the number of time steps.
Before starting outputting calculation results, the solver should check whether user canceled calculation. If canceled,the solver should stop.
In solver definition files, no definition is written about the calculation results the solver output. So, you do not have totake care about the correspondence relation between solver definition file and the solver code about them.
List 2.9 shows the source code with lines to output time and calculations. The added lines are shown with highlight.
List 2.9: Source code with lines to output time and calculation results! (abbr.)
integer:: isize, jsize
double precision, dimension(:,:), allocatable:: grid_x, grid_y
double precision, dimension(:,:), allocatable:: elevation
integer, dimension(:,:), allocatable:: obstacle
double precision:: time
integer:: iteration
integer:: canceled
integer:: locked
double precision, dimension(:,:), allocatable:: velocity_x, velocity_y
double precision, dimension(:,:), allocatable:: depth
integer, dimension(:,:), allocatable:: wetflag
double precision:: convergence

1
2
3
4
5
6
7
8
9
10
11
12
13
14

! (abbr.)15
16! Loads grid attributes
call cg_iric_read_grid_real_node_f("Elevation", elevation, ier)
call cg_iric_read_grid_integer_cell_f("Obstacle", obstacle, ier)

17
18
19
20
21
˓→
22
23
24
25
26

allocate(velocity_x(isize,jsize), velocity_y(isize,jsize), depth(isize,jsize),wetflag(isize,jsize))
iteration = 0
time = 0
dotime = time + timestep! (Execute the calculation here. The grid shape changes.)27

call iric_check_cancel_f(canceled)if (canceled == 1) exit
call iric_check_lock_f(condFile, locked)
do while (locked == 1)
sleep(1)call iric_check_lock_f(condFile, locked)
end docall iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
! Outputs gridcall cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, ier)

28
29
30
31
32
33
34
35
36
37
38

(continues on next page)

22

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
39
40
41
42
43
44
45
46
47
48
49

! Outputs calculation result
call cg_iric_write_sol_real_f ('VelocityX', velocity_x, ier)
call cg_iric_write_sol_real_f ('VelocityY', velocity_y, ier)
call cg_iric_write_sol_real_f ('Depth', depth, ier)
call cg_iric_write_sol_integer_f ('Wet', wetflag, ier)
call cg_iric_write_sol_baseiterative_real_f ('Convergence', convergence, ier)
call cg_iric_flush_f(condFile, fin, ier)
call iric_write_sol_end_f(condFile, ier)
iteration = iteration + 1
if (iteration > maxiterations) exit
end do

50
51
52
53
54

! Closes calculation data filecall cg_close_f(fin, ier)stop
end program SampleProgram

Refer to Outputting time (or iteration count) (page 112) and Outputting calculation results (page 114) for the detailsof the subroutines to output time and calculation results. Refer to Outputting calculation grids (only in the case of amoving grid) (page 113) for the details of the subroutines to output the grid coordinates in case of moving grid.
For the calculation results, some special names is named in iRIC. You should use that name for calculation results
used for a certain purpose. Refer to Calculation results (page 219) for the special names.

2.6 Creating a solver definition dictionary file
Create a solver definition dictionary file that is used to translate the strings used in solver definition files, and shownon dialogs etc.
First, launch iRIC and perform the following:
Menu bar: [Option] (O) –> [Create/Update Translation Files] (C)The [Definition File Translation Update Wizard] (Figure 2.18 to Figure 2.20) will open. Following the wizard, thedictionary files are created or updated.
The dictionary files are created in the folder that you created in Creating a folder (page 4). The files created only
include the texts before translation (i. e. English strings). The dictionary files are text files, so you can use text editors
to edit it. Save the dictionary files with UTF-8 encoding.
List 2.10 and List 2.11 show the example of editing a dictionary file. As the example shows, you have to add translated
texts in “translation” element.
List 2.10: The Dictionary file of solver definition file (before editing)
12
3
4<message><source>Basic Settings</source><translation></translation></message>

List 2.11: The Dictionary file of solver definition file (after editing)
12
3
4<message><source>Basic Settings</source><translation></translation></message>

2.6. Creating a solver definition dictionary file23

iRIC Developer’s manual, Release 3.0.0

Figure 2.18: The [Definition File Translation Update Wizard] (Page 1)

Figure 2.19: The [Definition File Translation Update Wizard] (Page 2)

24

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Figure 2.20: The [Definition File Translation Update Wizard] (Page 3)
You can use [Qt Linguist] for translating the dictionary file. [Qt Linguist] is bundled in Qt, and it provides GUI for
editing the dictionary file. Figure 2.21 shows the [Qt Linguist]. Qt can be downloaded from the following URL:
https://www.qt.io/download/
When the translation is finished, switch the iRIC language from Preferences dialog, restart iRIC, and check whether
the translation is complete. Figure 2.22 and Figure 2.23 shows examples of [Pre-processing Window] and [Calculation
Condition] dialog after completing transtaion of dictionary.

2.7 Creating a README file
Creates a text file that explains the abstract of the solver.
Creates a text file with name “README” in the folder you created in Creating a folder (page 4). Save the file with
UTF-8 encoding.
You should create the README file with the file names like below. When the language-specific README file does
not exists, “README” file (in English) will be used.
• English: “README”• Japanese: “README_ja_JP”
The postfix (ex. “ja_JP”) is the same to that for dictionary files created in Creating a solver definition dictionary file
(page 23).
The content of “README” will be shown in “Description” area on the [Select Solver] dialog. When you created“README”, opens the [Select Solver] dialog by starting a new project, and check whether the content is shown on

2.7. Creating a README file25

iRIC Developer’s manual, Release 3.0.0

Figure 2.21: The [Qt Linguist]

Figure 2.22: [Pre-processor Window] after completing translation of dictionary (Japanese mode)

26

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Figure 2.23: The [Calculation Condition] dialog after completing translation of dictionary (Japanese mode)that dialog.

2.8 Creating a LICENSE file
Creates a text file that explains the license information of the solver.
Creates a text file with name “LICENSE” in the folder you created in Creating a folder (page 4). Save the file with
UTF-8 encoding.
You should create the LICENSE file with the file names like below. When the language-specific LICENSE file does
not exists, “LICENSE” file (in English) will be used.
• English: “LICENSE”• Japanese: “LICENSE_ja_JP”
The postfix (ex. “ja_JP”) is the same to that for dictionary files created in Creating a solver definition dictionary file
(page 23).
The content of “LICENSE” will be shown in “License” area on the [Select Solver] dialog. When you created “LICENSE”, opens the [Select Solver] dialog by starting a new project, and check whether the content is shown on that
dialog.
Figure 2.25 shows an example of the [Select Solver] dialog.

2.8. Creating a LICENSE file27

iRIC Developer’s manual, Release 3.0.0

Figure 2.24: The [Select Solver] dialog

28

Chapter 2. Steps of developing a solver

iRIC Developer’s manual, Release 3.0.0

Figure 2.25: The [Select Solver] dialog

2.8. Creating a LICENSE file29

iRIC Developer’s manual, Release 3.0.030

Chapter 2. Steps of developing a solver

CHAPTER

3

Steps of developing a calculation result analysis program

3.1 Abstract
Calculation result analysis program is a program that reads calculation result of a soler from a CGNS file, execute
analysis or modify calculation result. Analysis result or modified calculation results can be output to another CGNS
file.
The steps of developing a calculation result analysis program is basically the same to that of a solver (See Steps ofdeveloping a solver (page 3)). The difference is that it handles multiple CGNS files.
To handle multiple CGNS files at the same time, you should use different functions than those used in Steps ofdeveloping a solver (page 3) (See List of subroutines (page 130)). The names of functions for handling multiple
CGNS files ends with “_mul_f”, and the first argument is the file ID. You should call “cg_iric_initread_f” instead of“cg_iric_init_f” when initializing the CGNS file to be used by iRIClib.
List 3.1 shows the source code to handle multiple CGNS files.
List 3.1: Source code that handles multiple CGNS files (abstract)1! (abbr.)2
3
4
5! File opening and initialization
call cg_open_f(cgnsfile, CG_MODE_MODIFY, fin1, ier)
call cg_iric_init_f(fin1, ier)67

! (abbr.)89
10! Reading calculation condition etc.
call cg_iric_read_functionalsize_mul_f(fin1, 'func', param_func_size, ier)1112

! (abbr.)

13
14
15
16

! File opening and initialization for reading calculation result
call cg_open_f(param_inputfile, CG_MODE_READ, fin2, ier)
call cg_iric_initread_f(fin2, ier)(continues on next page)

31

iRIC Developer’s manual, Release 3.0.0(continued from previous page)17
18! (abbr.)

19
20
21

! Reading calculation result etc.
call cg_iric_read_sol_count_mul_f(fin2, solcount, ier)2223

! (abbr.)24
25! Calculation result analysis code2627

! (abbr.)

28
29
30

! Outputting analysis result
call cg_iric_write_sol_time_mul_f(fin1, t, ier)31
32

! (abbr.)

33
34
35
36

! Closing files
call cg_close_f(fin1, ier)
call cg_close_f(fin2, ier)3738

! (abbr.)

List 3.2 shows the source code the analysis program that reads calculation result from CGNS file, and executes fish
habitat analysis.
List 3.2: Source code that reads calculation result from CGNS file andoutput analysis result12
3

program SampleProgram2
implicit none
include 'cgnslib_f.h'456integer icountcharacter(len=300) cgnsfile

7
8

integer:: fin1, fin2, ier, istatus

9
10
11
12
13
14
15
16

character(len=300) param_inputfile
integer:: param_result
character(len=100) param_resultotherinteger:: param_func_size
double precision, dimension(:), allocatable:: param_func_param
double precision, dimension(:), allocatable:: param_func_value
character(len=100) resultname

17
18
19
20
21
22
23

integer:: isize, jsize
double precision, dimension(:,:), allocatable:: grid_x, grid_y
double precision, dimension(:,:), allocatable:: target_result
double precision, dimension(:,:), allocatable:: analysis_result
double precision:: tmp_target_result
double precision:: tmp_analysis_result

24
25
26

integer:: i, j, f, solid, solcount, iter
double precision:: t

27(continues on next page)

32

Chapter 3. Steps of developing a calculation result analysis programiRIC Developer’s manual, Release 3.0.0(continued from previous page)
28
29
30
31
32
33
34
35

! Code for Intel Fortranicount = nargs()
if (icount.eq.2) thencall getarg(1, cgnsfile, istatus)
else
write(*,*) "Input File not specified."stop
end if

36
37
38
39
40
41

! Opening CGNS filecall cg_open_f(cgnsfile, CG_MODE_MODIFY, fin1, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"! Initializing internal variables
call cg_iric_init_f(fin1, ier)

42
43
44
45
46

! Read analysis conditions
call cg_iric_read_string_mul_f(fin1, 'inputfile', param_inputfile, ier)
call cg_iric_read_integer_mul_f(fin1, 'result', param_result, ier)
call cg_iric_read_string_mul_f(fin1, 'resultother', param_resultother, ier)

47
48
49
50

call cg_iric_read_functionalsize_mul_f(fin1, 'func', param_func_size, ier)
allocate(param_func_param(param_func_size), param_func_value(param_func_size))call cg_iric_read_functional_mul_f(fin1, 'func', param_func_param, param_func_value,
˓→ ier)

51
52
53
54

if (param_result .eq. 0) resultname = 'Depth(m)'if (param_result .eq. 1) resultname = 'Elevation(m)'if (param_result .eq. 2) resultname = param_resultother

55
56
57
58
59

! Read grid from the specified CGNS filecall cg_open_f(param_inputfile, CG_MODE_READ, fin2, ier)
if (ier /=0) STOP "*** Open error of CGNS file 2 ***"
call cg_iric_initread_f(fin2, ier)

60
61
62
63
64

! Reads gridcall cg_iric_gotogridcoord2d_mul_f(fin2, isize, jsize, ier)
allocate(grid_x(isize, jsize), grid_y(isize, jsize))call cg_iric_getgridcoord2d_mul_f(fin2, grid_x, grid_y, ier)

65
66
67
68

! Output the grid to CGNS filecall cg_iric_writegridcoord2d_mul_f(fin1, isize, jsize, &grid_x, grid_y, ier)

69
70
71

! Allocate memory used for analysis
allocate(target_result(isize, jsize), analysis_result(isize, jsize))

72
73
74

! Start analysis of calculation results
call cg_iric_read_sol_count_mul_f(fin2, solcount, ier)

75
76
77
78
79
80

do solid = 1, solcount! Read calculation result
call cg_iric_read_sol_time_mul_f(fin2, solid, t, ier)
call cg_iric_read_sol_real_mul_f(fin2, solid, resultname, &target_result, ier)

81
82
83

! Do fish habitat analysis
do i = 1, isize(continues on next page)

3.1. Abstract

33

iRIC Developer’s manual, Release 3.0.0(continued from previous page)

do j = 1, jsize
tmp_target_result = target_result(i, j)
do f = 1, param_func_size
if ( &
param_func_param(f) .le. tmp_target_result .and. &param_func_param(f + 1) .gt. tmp_target_result) thentmp_analysis_result = &param_func_value(f) + &(param_func_value(f + 1) - param_func_value(f)) / &(param_func_param(f + 1) - param_func_param(f)) * &(tmp_target_result - param_func_param(f))
endif
end doanalysis_result(i, j) = tmp_analysis_result
end doend do

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

! Output analysis result
call cg_iric_write_sol_time_mul_f(fin1, t, ier)
call cg_iric_write_sol_real_mul_f(fin1, 'fish_existence', analysis_result, ier)end do

105
106
107
108
109
110

! Close CGNS files
call cg_close_f(fin1, ier)
call cg_close_f(fin2, ier)stop
end program SampleProgram2

34

Chapter 3. Steps of developing a calculation result analysis programCHAPTER

4

Steps of developing a grid generating program

4.1 Abstract
Grid generating program is a program that load grid creating conditions and generate a grid. The program can be usedseamlessly from iRIC as one of the grid generating algorithms.
To add a grid generating program that can be used from iRIC, it is necessary to make and deploy files shown in Table
4.1.
Grid generating program developers have to create a new folder under “gridcreators” folder, and deploy files related
to the new grid generating program under that.

File namedefinition.xml
generator.exe
translation_ja_JP.ts etc.
README

Table 4.1: Files related to grid generating programs
Description
Grid generating program definition file.
Executable module of the grid generating program. Developers can select any name.
Dictionary files for a grid generating program definition file.
File that explains the grid generating program

Abstracts of each file are as follows:

4.1.1 definition.xml
File that defines the following information of grid generating programs:• Basic Information• Grid generating condition
iRIC loads definition.xml, and provides interface for creating grid generating conditions that can be used by the grid
generating program. iRIC make the grid generating program available only when the solver supports the grid type thatthe grid generating program generate.
definition.xml should be written in English.
35

iRIC Developer’s manual, Release 3.0.0

4.1.2 Grid Generating program
Executable module of a grid generating program. It loads grid generating condition, generate a grid, and outputs it.
Grid generating programs use grid generating data file created by iRIC, for loading and writing grid generating condition and grids.
Grid generating programs can be developed using FORTRAN, Python, C, or C++. In this chapter, a sample grid
generating program is developed in FORTRAN.

4.1.3 translation_ja_JP.ts etc.
Dictionary files for a grid generating program definition file. It provides translation information for strings shownon dialogs in iRIC. Dictionary files are created one file for each language. For example, “translation_ja_JP.ts” forJapanese, “translation_ka_KR.ts” for Korean.

4.1.4 READMEREADME is a text file that describes about the grid generating program. The content of README is shown in the“Description” area on [Select Grid Creating Algorithm] dialog].
Figure 4.1 shows the relationship between iRIC, grid generating program and related files.

Figure 4.1: The relationships between iRIC, grid generating programs, and related files
This chapter explains the steps to create the files described in this section.
36

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

4.2 Creating a folder
Create a special folder for the grid generating program you develop under “gridcreators” folder under the installation
folder of iRIC. This time, please create “example” folder.

4.3 Creating a grid generating program definition file
Create a grid generating program definition file.
In grid generating program definition file, you are going to define the information shown in Table 4.2.
Table 4.2: Information defined in grid generating program definition file
Item
Description
Basic Information
The grid generator name, developer name,release date etc.
Grid Generating Condition Grid generating condition required for the argorithmn.
Error Codes
Error codes and message that correspond to the code.

RequiredYes
Yes

Grid generating program definition file is described in XML language. The basic grammer of XML language is
explained in XML files basics (page 94).
In this section, we add definition information of a grid generating program in the order shown in Table 4.2.

4.3.1 Defining basic information
Define basic information of a grid generating program. Create a file with the content shown in List 4.1, and save itwith name “definition.xml” under “example” folder that you created in Creating a folder (page 37).
List 4.1: Example grid generating program definition file that contains
basic information
1
2
3
4
5
6
7
8
9
10
11
12

<?xml version="1.0" encoding="UTF-8"?><GridGeneratorDefinition
name="samplecreator"
caption="Sample Grid Creator"
version="1.0"
copyright="Example Company"
executable="generator.exe"
gridtype="structured2d"><GridGeneratingCondition></GridGeneratingCondition></GridGeneratorDefinition>

At this point, the structure of the grid generating program definition file is as shown in Figure 4.2.

Figure 4.2: Grid generating program definition file structure
Now make sure the grid generating file definition file is arranged correctly.
4.2. Creating a folder

37

iRIC Developer’s manual, Release 3.0.0

Launch iRIC. The [iRIC Start Page] dialog (Figure 4.3) is shown, so click on [New Project]. Now the [Solver Select]dialog (Figure 4.4) will open, so select “Nays2DH” in the solver list, and click on [OK]. The new project will start.
Open the [Select Grid Creating Algorithm] dialog (Figure 4.5) by processing the following action.
Menu bar: [Grid] (G) -> [Select Algorithm to Create Grid] (S)Check that the “Sample Grid Creator” is added in the list. When you finish checking, close the dialog by clicking on[Cancel].

Figure 4.3: The [iRIC Start Page] dialog

4.3.2 Defining grid generating conditions
Define grid generating conditions. Grid generating conditions are defined in “GridGeneratingCondition” element in agrid generating program definition file. Add description of grid generating condition to the grid generating program
definition file you created in Defining basic information (page 37), and overwrite it. Grid generating program definition
file content is now as shown in List 4.2. The added part is shown with highlight.
List 4.2: Example of grid generating program definition file that now has
grid generating condition definition
1
2
3
4
5

<?xml version="1.0" encoding="UTF-8"?><GridGeneratorDefinition
name="samplecreator"
caption="Sample Grid Creator"
version="1.0"(continues on next page)

38

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Figure 4.4: The [Select Solver] dialog

Figure 4.5: The [Select Grid Creating Algorithm] dialog

4.3. Creating a grid generating program definition file39

iRIC Developer’s manual, Release 3.0.0(continued from previous page)

copyright="Example Company"
executable="generator.exe"
gridtype="structured2d"

6
7
8
9

>

10

<GridGeneratingCondition><Tab name="size" caption="Grid Size"><Item name="imax" caption="IMax"><Definition valueType="integer" default="10" max="10000" min="1" /></Item><Item name="jmax" caption="JMax"><Definition valueType="integer" default="10" max="10000" min="1" /></Item></Tab></GridGeneratingCondition></GridGeneratorDefinition>

11
12
13
14
15
16
17
18
19
20

At this point, the structure of the grid generating program definition file is as shown in Figure 4.6.

Figure 4.6: Grid generating program definition file structure
Now make sure that grid generating program definition file is arranged correctly.
Launch iRIC, and opens the [Select Grid Generating Algorithm] dialog with the same procedure in Defining basic
information (page 37). Select “Sample Grid Creator” in the list, and click on [OK].
The [Grid Creation] dialog (Figure 4.7) will open. Now you can see that the grid generating condition items you
defined are shown. When you checked, click on [Cancel] to close the dialog.
Now add one more group and add grid generating condition items. Add “Elevation Output” Tab element just under“Grid Size” Tab element. The added part is shown with highlight.
List 4.3: Example of grid generating program definition file that now has
grid generating condition definition(abbr.)</Tab><Tab name="elevation" caption="Elevation Output"><Item name="elev_on" caption="Output"><Definition valueType="integer" default="0"><Enumeration caption="Enabled" value="1" /><Enumeration caption="Disabled" value="0" /></Definition></Item><Item name="elev_value" caption="Value"><Definition valueType="real" default="0">

1
2
3
4
5
6
7
8
9
10
11

(continues on next page)

40

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Figure 4.7: The [Grid Creation] dialog(continued from previous page)
12
13
14
15
16
17

<Condition type="isEqual" target="elev_on" value="1" /></Definition></Item></Tab></GridGeneratingCondition></GridGeneratorDefinition>

At this Point, the structure of grid generating program definition file is as shown in Figure 4.8.

Figure 4.8: Grid generating program definition file structure
Now make sure that grid generating program definition file is arranged correctly. Do the operation you did again, toshow the [Grid Creation] dialog (Figure 4.9).
Now you’ll see that the new group “Elevation Output” in the group list. You’ll also notice that “Value” item is enabled
only when “Output” value is “Enabled”.
What it comes down to is:

4.3. Creating a grid generating program definition file41

iRIC Developer’s manual, Release 3.0.0

Figure 4.9: The [Grid Creation] dialog• Grid generating condition group is defined with “Tab” element, and grid generating condition item is definedwith “Item” element.
• The Structure under “Definition” elements depends on the condition type (i. e. Integer, Real number, functionaletc.). Refer to Section Examples of calculation conditions, boundary conditions, and grid generating condition(page 58) for examples of grid generating condition items for each type.
• Dependenciy between grid generating condition items can be defined with “Condition” element. In “Condition”
element, define the condition when that item should be enabled. Refer to Example of condition to activate
calculation conditions etc. (page 70) for examples of “Condition” element.
• In this example, the calculation condition dialog shows the items as a simple list, but iRIC has feature to show
items with more complex layouts, like layout with group boxes. Refer to Example of dialog layout definition(page 70) for more complex calculation condition page layouts.

4.3.3 Defining error codes
Define error codes of errors that occurs in grid generating program, and the messages that correspond to them. Error
codes can be defined with ErrorCode elements in grid generating program definition file. Add definitions to thedefinition file you created, as shown in List 4.4. The added part is shown with highlight.
List 4.4: Example of grid generating program definition file that now has
error codes
1
2
3
4
5
6
7
8

(abbr.)</Item></Tab></GridGeneratingCondition><ErrorCodes><ErrorCode value="1" caption="IMax * JMax must be smaller than 100,000." /></ErrorCodes></GridGeneratorDefinition>

At this Point, the structure of grid generating program definition file is as shown in Figure 4.10. The ErrorCodes
element is not required.

42

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Figure 4.10: The grid generating program definition file structure
You can not check whether ErrorCode element is properly defined until you create a grid generating program. You aregoing to check it in Adding error handling codes (page 49).

4.4 Creating a grid generating program
Create a grid generating program. In this example we will develop a grid generating program with FORTRAN.
To develop a grid generating program that works together with iRIC, you have to make it use grid generating data filethat iRIC generate, for loading grid generation conditions and outputting a grid.
The grid generating data file that iRIC generates is a CGNS file. You can use a library called iRIClib to write code forloading and writing CGNS files.
In this section, We’ll explain the procedure to develop a grid generating program that load calculation data file, that
iRIC generates.
Creating a grid generating program definition file (page 37) shows the input and output processing that the grid
generating program do against the grid generating data file.
Table 4.3: The I/O processing flow of grid generating program
Processing
Opens grid generating data file
Initializes iRIClib
Loads grid generating condition
Outputs grid
Closes grid generating data fileIn this section, we will develop a grid generating program in the following procedure:
1. Create a scelton
2. Adds grid generating data file opening and closing codes
3. Adds codes to output grid
4. Adds codes to load grid generating conditions
5. Adds codes for error handling

4.4.1 Creating a scelton
First, create a scelton of a grid generating program. Create a new file with the source code in List 4.5, and save as“sample.f90”. At this point, the grid generating program does nothing.

4.4. Creating a grid generating program43

iRIC Developer’s manual, Release 3.0.0

Compile this source code. The way to compile a source code differs by the compiler. Refer to Intel Fortran Compiler(Windows) (page 218) for the procedure to compile using Intel Fortran Compiler and gfortran.
List 4.5: Sample grid generating program source code12
3
4

program SampleProgram
implicit none
include 'cgnslib_f.h'
end program SampleProgram

Make sure that the compilation succeeds.

4.4.2 Adding grid generating data file opening and closing codes
Adds codes for opening and closing grid generating data file.
The grid generating program has to open calculation data file in the first step, and close it in the last step.
iRIC will handle the file name of grid generating data file as the first argument, so open that file.
The way to handle the number of arguments and the arguments differs by compilers. Refer to List 4.6 for the way tohandle them with Intel Fortran Compiler and gfortran. In this chapter we will add codes that can be compiled using
Intel Fortran Compiler.
List 4.6 shows the source code with the lines to open and close grid generating data file. The added lines are shownwith highlight.
List 4.6: The source code with lines to open and close file1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'456integer:: fin, ier
integer:: icount, istatus

7
8

character(200)::condFile

9
10
11
12
13
14
15

icount = nargs()
if ( icount.eq.2 ) thencall getarg(1, condFile, istatus)
else
stop "Input File not specified."
endif

16
17
18
19

! Opens grid generating data filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) stop "*** Open error of CGNS file ***"

20
21
22

! Initializes iRIClib. ier will be 1, but that is not a problem.
call cg_iric_init_f(fin, ier)

23
24
25
26

! Closes grid generating data filecall cg_close_f(fin, ier)end program SampleProgram

Compile the executable file, just like in Creating a scelton (page 43).
Check that the source code can be compiled successfully.
44

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Refer to Opening a CGNS file (page 99), Initializing iRIClib (page 99) and Closing a CGNS file (page 129) for thedetails of the subroutines added in this section.

4.4.3 Adding codes to output a grid
Adds codes to output grid.
First, add codes to output a very simple grid, to check whether the program works together with iRIC successfully.
List 4.7 shows the source code with lines to output grid. The added lines are shown with highlight.
List 4.7: The source code with lines to output grid1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9

integer:: fin, ier
integer:: icount, istatus
integer:: imax, jmax
double precision, dimension(:,:), allocatable::grid_x, grid_ycharacter(200)::condFile

10
11
12
13
14
15
16

icount = nargs()
if ( icount.eq.2 ) thencall getarg(1, condFile, istatus)
else
stop "Input File not specified."
endif

17
18
19
20

! Opens grid generating data file.
call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) stop "*** Open error of CGNS file ***"

21
22
23

! Initializes iRIClib. ier will be 1, but that is not a problem.
call cg_iric_init_f(fin, ier)

24
25
26

imax = 10
jmax = 10

27
28
29

! Allocate memory for creating grid
allocate(grid_x(imax,jmax), grid_y(imax,jmax)

30
31
32
33
34
35
36
37

! Generate griddo i = 1, imax
do j = 1, jmax
grid_x(i, j) = i
grid_y(i, j) = j
end doend do38
39
40! Outputs grid
cg_iric_writegridcoord2d_f(imax, jmax, grid_x, grid_y, ier)

41
42
43
44

! Closes grid generating data file.
call cg_close_f(fin, ier)end program SampleProgram

4.4. Creating a grid generating program45

iRIC Developer’s manual, Release 3.0.0

When it was compiled successfully, copy the executable file to the folder you created in Creating a folder (page 37),
and rename it into the name you specified as [executable] attribute in Defining basic information (page 37). This time,
rename into “generator.exe”. Copy the DLL files into that folder, that is need to run the grid generating program.
Now check whether the grid generating program can be launched from iRIC successfully.
Starts a new project with solver “Nays2DH”, and select “Sample Grid Creator” as the grid generating algorithm likein Defining basic information (page 37). The [Grid Creation] dialog (Figure 4.11) will open.

Figure 4.11: The [Grid Creation] dialog
Click on [Create Grid], and a 10 x 10 grid will be created and loaded on the pre-processing window (Figure 4.12).
Refer to Outputting calculation grids (page 110) for the detail of subroutines to output grids. Note that in Outputting
calculation grids (page 110) the subroutines to output three-dimensional grids are listed, but they can not be used ingrid generating programs. In grid generating programs, only subroutines to output two-dimensional grids can be used.

4.4.4 Adding codes to load grid generating condition
Adds codes to load grid generating conditions.
iRIC will output grid generating conditions according to the grid generating program definition file. So, the grid
generating program have to load them to coincide with the description in the grid generating program definition file.
List 4.8 shows the source code with lines to load grid generating condition. The added lines are shown with highlight.
Note that the arguments passed to load grid generating conditions are the same to the [name] attributes of Items definedin Defining grid generating conditions (page 38).
When it is compiled successfully, create a grid from iRIC in the procedure same to Adding codes to output a grid
(page 45), and the grid will be created with the condition you specified on [Grid Creation] dialog.
Refer to Examples of calculation conditions, boundary conditions, and grid generating condition (page 58) for the
relation between definitions of grid generating condition and the iRIClib subroutines to load them. Refer to Reading
calculation conditions (page 100) for the detail of subroutines to load grid generating conditions.
List 4.8: Source codewith lines to load grid generating conditions
1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'(continues on next page)46

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Figure 4.12: The pre-processing window after creating grid

4.4. Creating a grid generating program47

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
4
5
6
7
8
9
10
11

integer:: fin, ier
integer:: icount, istatus
integer:: imax, jmax
integer:: elev_on
double precision:: elev_value
double precision, dimension(:,:), allocatable::grid_x, grid_y
double precision, dimension(:,:), elevation

12
13

character(200)::condFile

14
15
16
17
18
19
20

icount = nargs()
if ( icount.eq.2 ) thencall getarg(1, condFile, istatus)
else
stop "Input File not specified."
endif

21
22
23
24

! Opens grid generating data file.
call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) stop "*** Open error of CGNS file ***"

25
26
27

! Initializes iRIClib. ier will be 1, but that is not a problem.
call cg_iric_init_f(fin, ier)

28
29
30
31
32
33
34

! Loads grid generating condition! To make it simple, no error handling codes are written.
call cg_iric_read_integer_f("imax", imax, ier)
call cg_iric_read_integer_f("jmax", jmax, ier)
call cg_iric_read_integer_f("elev_on", elev_on, ier)
call cg_iric_read_real_f("elev_value", elev_value, ier)

35
36
37
38

! Allocate memory for creating grid
allocate(grid_x(imax,jmax), grid_y(imax,jmax)
allocate(elevation(imax,jmax))

39
40
41
42
43
44
45
46
47

! Generate griddo i = 1, isize
do j = 1, jsize
grid_x(i, j) = i
grid_y(i, j) = jelevation(i, j) = elev_value
end doend do

48
49
50
51
52
53

! Outputs grid
cg_iric_writegridcoord2d_f(imax, jmax, grid_x, grid_y, ier)
if (elev_on == 1) thencg_iric_write_grid_real_node_f("Elevation", elevation, ier);
end if

54
55
56
57

! Closes grid generating data file.
call cg_close_f(fin, ier)end program SampleProgram

48

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

4.4.5 Adding error handling codes
Adds error handling code, to support cases that grid generating conditions have some problems.
Table:numref:gridgenerator_with_error_handling shows the source code with lines to handle errors. The added lines
are shown with highlight. With the lines added, the grid generating program will return error when the number of grid
nodes exceeds 100000.
When it is compiled successfully, create a grid with the algorithm in tha same way to Adding codes to output a grid
(page 45). Check that when you specify big imax and jmax values, the [Error] dialog (Figure 4.13) will open.
Refer to Outputting Error code (page 129) for the subroutines to output error codes.
List 4.9: Source code with lines to handle errors
1! (abbr.)

2
3
4
5
6
7
8

! Loads grid generating condition! To make it simple, no error handling codes are written.
call cg_iric_read_integer_f("imax", imax, ier)
call cg_iric_read_integer_f("jmax", jmax, ier)
call cg_iric_read_integer_f("elev_on", elev_on, ier)
call cg_iric_read_real_f("elev_value", elev_value, ier)

9
10
11
12
13
14
15
16

! Error handling
if (imax * jmax > 100000 ) then! It is now possible to create a grid with more than 100000 nodes
call cg_iric_write_errorcode(1, ier)
cg_close_f(fin, ier)
stop
endif

17
18
19
20

! Allocate memory for creating grid
allocate(grid_x(imax,jmax), grid_y(imax,jmax)
allocate(elevation(imax,jmax))

21
22! (abbr.)Figure 4.13: The [Error] dialog

4.5 Creating a grid generating program definition dictionary file
Create a grid generating program definition dictionary file that is used to translate the strings used in grid generating
program definition files, and shown on dialogs etc.
First, launch iRIC and perform the following:
Menu bar: [Option] (O) –> [Create/Update Translation Files] (C)4.5. Creating a grid generating program definition dictionary file49

iRIC Developer’s manual, Release 3.0.0

The [Definition File Translation Update Wizard] (Figure 4.14 to Figure 4.16) will open. Following the wizard, thedictionary files are created or updated.

Figure 4.14: The [Definition File Translation Update Wizard] (Page 1)
The dictionary files are created in the folder that you created in Creating a folder (page 37). The files created only
include the strings before the translation (i. e. English strings). The dictionary files are text files, so you can use text
editors to edit it. Save the dictionary files with UTF-8 encoding.
List 4.10 and List 4.11 show the example of editing a dictionary file. As the example shows, add translated string in“translation” element.
List 4.10: The Dictionary file of grid generating program definition file
(before editing)
12
3
4<message><source>Sample Grid Creator</source><translation></translation></message>

List 4.11: The Dictionary file of grid generating program definition file(after editing)
12
3
4<message><source>Sample Grid Creator</source><translation></translation></message>

You can use [Qt Linguist] for translating the dictionary file. [Qt Linguist] is bundled in Qt, and it provides GUI for
editing the dictionary file. Figure 4.17 shows the [Qt Linguist]. Qt can be downloaded from the following URL:

50

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Figure 4.15: The [Definition File Translation Update Wizard] (Page 2)

Figure 4.16: The [Definition File Translation Update Wizard] (Page 3)

4.5. Creating a grid generating program definition dictionary file51

iRIC Developer’s manual, Release 3.0.0

https://www.qt.io/download/

Figure 4.17: The [Qt Linguist]
When the translation is finished, switch the iRIC language from Preferences dialog, restart iRIC, and check whether
the translation is complete. Figure 4.18 shows an example of [Grid Creation] dialog after completing transtaion of
dictionary.

4.6 Creating a README file
Creates a text file that explains the abstract of the grid generating program.
Creates a text file with name “README” in the folder you created in Creating a folder (page 37). Save the file with
UTF-8 encoding.
You should create the README file with the file names like below. When the language-specific README file does
not exists, “README” file (in English) will be used.
• English: “README”• Japanese: “README_ja_JP”
The postfix (ex. “ja_JP”) is the same to that for dictionary files created in Creating a grid generating program definition
dictionary file (page 49).
The content of “README” will be shown in “Description” area on the [Select Grid Creating Algorithm] dialog. When
you created “README”, opens the [Select Grid Creating Algorithm] dialog, and check whether the content is shownon that dialog.
Figure 4.19 shows an example of the [Select Grid Creating Algorithm] dialog.
52

Chapter 4. Steps of developing a grid generating programiRIC Developer’s manual, Release 3.0.0

Figure 4.18: The [Grid Creation] dialog

Figure 4.19: The [Select Grid Creating Algorithm] dialog

4.6. Creating a README file53

iRIC Developer’s manual, Release 3.0.0

54

Chapter 4. Steps of developing a grid generating programCHAPTER

5

About definition files (XML)5.1 Abstract
iRIC loads definition files (solver definition files and grid generating program definition files), and provides graphic
interface to create input data for the corresponding programs (solvers and grid generating programs).

5.2 Structure
Structures of solver definition files, grid generating program definition files are described in this section.

5.2.1 Solver definition file
Structure of solver definition files for a solver that uses only one calculation grids is shown in Figure 5.1, and that fora solver that uses multiple types of calculation grids is shown in Figure 5.2, respectively.
When the solver uses multiple types of grids, Solver developers should add multiple GridType elements, and defines
grid structure, grid attributes, and boundary conditions under each GridType element.
An example of solver definition file for a solver that uses multiple grid types, is shown in List 5.1. In this example,
boundary condition definition is dropped, because that is not required. Please pay attention that the following point isdifferent:• Grid structure (gridtype attribute) is not definied in SolverDefinition elemenet, but in GridType elements.
When a user creates a new project and selects a solver that bundles the solver definition shown in List 5.1, a new
pre-processor in Figure 5.3 is shown.

55

iRIC Developer’s manual, Release 3.0.0

Figure 5.1: Structure of solver definition file

56

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Figure 5.2: Structure of solver definition files for a solver that uses multiple grid types

5.2. Structure

57

iRIC Developer’s manual, Release 3.0.0

List 5.1: An example of solver definition file for a solver that uses multiple types of grids
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

<?xml version="1.0" encoding="UTF-8"?><SolverDefinition
name="multigridsolver"
caption="Multi Grid Solver"
version="1.0"
copyright="Example Company"
release="2012.04.01"
homepage="http://example.com/"
executable="solver.exe"
iterationtype="time"><CalculationCondition><!-- Define calculation conditions here. --></CalculationCondition><GridTypes><GridType name="river" caption="River"><GridRelatedCondition><Item name="Elevation" caption="Elevation"><Definition valueType="real" position="node" /></Item><Item name="Roughness" caption="Roughness"><Definition valueType="real" position="node"/></Item><Item name="Obstacle" caption=" Obstacle"><Definition valueType="integer" position="cell"/></Item></GridRelatedCondition></GridType><GridType name="floodbed" caption="Flood Bed"><GridRelatedCondition><Item name="Elevation" caption="Elevation"><Definition valueType="real" position="node" /></Item></GridRelatedCondition></GridType></GridTypes></SolverDefinition>

5.2.2 Grid generating program definition file
Structure of grid generating program definition file is shown in Figure 5.4

5.3 Examples
5.3.1 Examples of calculation conditions, boundary conditions, and grid generating condition
Example of definitions of calculating conditions in solver definition files, grid generating condition if grid generating
program definition file is shown in this section. The position to describe the definition differs like shown in Table 5.1,
but the grammers are the same. Refer to Structure (page 55) for the whole structure of each file.

58

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Figure 5.3: Pre-processor image after loading the solver definition file with multiple grid type definitions

Figure 5.4: Structure of grid generating program definition file

5.3. Examples

59

iRIC Developer’s manual, Release 3.0.0

Item
Calculation condition
Grid generating condition

Table 5.1: Position to define definition elements
Target file
Definition position
Solver definition file
Under CalculationCondition element
Grid generating program definition file Under GridGeneratingCondition element

The types of items available, are shown in Table 5.2. In this subsection, the followings are described fore each type:• Definition example• Example of the corresponding widget shown on calculation condition edit dialog in iRIC
• Code example to load the values in solvers (or grid generating program).
In code examples to load the values, subroutines in iRIClib are used. Please refer to iRIClib (page 97) to know more
about iRIClib.
The examples only show the sample codes for loading, so please refer to Creating a solver (page 17), Creating a grid
generating program (page 43) to see examples of whole programs.

Type
StringFile name (Forreading)
File name (Forwriting)
Folder name
Integer
Integer(Choice)
Real number
Functional

Functional(with multiple
values)
CGNS
file
name
Calculation result in CGNS
file

Table 5.2: Types of calculation conditions and grid generating conditions
Description
Definition
Input string value
Specify "string" for valueType
Input file name for reading. Users can se- Specify "filename" for valueTypelect only files that already exist.
Input file name for writing. Users can se- Specify "filename_all" for valueTypelect any file name, including those does
not exists.
Input folder name.
Specify "foldername" for valueType
Input arbitrary integer value.
Specify "integer" for valueType
Select integer value from choices.
Specify "Integer" for valueType, and define choises
with Enumeration elements
Input arbitrary real number value.
Specify "real" for valueType
Input pairs of (X, Y) values.
Specify "functional" for valueType and define variable and value with a Parameter element and a
Value element.
Input trinity of (X, Y1, Y2) values.
Specify "functional" for valueType and define one
Parameter element and two Value elements.
Input CGNS file name for reading. Users
can select only files that already e3xists.
Select the name of calculatioin result

Specify "cgns_filename" for valueTypeSpecify "”result_gridNodeReal"” etc. for valueType”

StringList 5.2: Example of a string type condition definition
12
3<Item name="sampleitem" caption="Sample Item"><Definition valueType="string" /></Item>60

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Figure 5.5: Widget example of a string type condition

List 5.3: Code example to load a string type condition (for calculation
conditions and grid generating conditions)12

integer:: ier
character(200):: sampleitem

34call cg_iric_read_string_f("sampleitem", sampleitem, ier)

List 5.4: Code example to load a string type condition (for boundary
conditions)12

integer:: ier
character(200):: sampleitem

34call cg_iric_read_bc_string_f("inflow", 1, "sampleitem", sampleitem, ier)

File name (for reading)
List 5.5: Example of a file name type (for reading) condition definition
12
3<Item name="flowdatafile" caption="Flow data file"><Definition valueType="filename" default="flow.dat" /></Item>List 5.6: Code example to load a file name (for reading) type condition(for calculation conditions and grid generating conditions)12

integer:: ier
character(200):: flowdatafile

3
4

call cg_iric_read_string_f("flowdatafile", flowdatafile, ier)

List 5.7: Code example to load a file name (for reading) type condition(for boundary conditions)12

integer:: ier
character(200):: flowdatafile

3
4

call cg_iric_read_bc_string_f("inflow", 1, "flowdatafile", flowdatafile, ier)

File name (for writing)
List 5.8: Example of a file name (for writing) type condition definition
1
2<Item name="flowdatafile" caption="Flow data file"><Definition valueType="filename_all" default="flow.dat" />(continues on next page)

5.3. Examples

61

iRIC Developer’s manual, Release 3.0.0

Figure 5.6: Widget example of a file name (for reading) type condition(continued from previous page)
3</Item>List 5.9: Code example to load a file name (for writing) type condition(for calculation conditions and grid generating conditions)12

integer:: ier
character(200):: flowdatafile

3
4

call cg_iric_read_string_f("flowdatafile", flowdatafile, ier)

List 5.10: Code example to load a file name (for writing) type condition(for boundary conditions)12

integer:: ier
character(200):: flowdatafile

3
4

call cg_iric_read_bc_string_f("inflow", 1, "flowdatafile", flowdatafile, ier)

Folder name
List 5.11: Example of a folder name type condition definition
12
3<Item name="flowdatafolder" caption="Flow data folder"><Definition valueType="foldername" /></Item>62

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Figure 5.7: Widget example of a file name type (for writing) condition

Figure 5.8: Widget example of a folder name type condition

5.3. Examples

63

iRIC Developer’s manual, Release 3.0.0

List 5.12: Code example to load a folder name type condition (for calculation conditions and grid generating conditions)12

integer:: ier
character(200):: flowdatafolder

3
4

call cg_iric_read_string_f("flowdatafolder", flowdatafolder, ier)

List 5.13: Code example to load a folder name type condition (for boundary conditions)12

integer:: ier
character(200):: flowdatafolder

3
4

call cg_iric_read_bc_string_f("inflow", 1, "flowdatafolder", flowdatafolder, ier)

Integer
List 5.14: Example of a integer type condition definition
12
3<Item name="numsteps" caption="The Number of steps to calculate"><Definition valueType="integer" default="20" min="1" max="200" /></Item>Figure 5.9: Widget example of a integer type condition
List 5.15: Code example to load a integer type condition (for calculation
conditions and grid generating conditions)1

integer:: ier, numsteps

2
3

call cg_iric_read_integer_f("numsteps", numsteps, ier)

List 5.16: Code example to load a integer type condition (for boundary
conditions)1

integer:: ier, numsteps

2
3

call cg_iric_read_bc_integer_f("inflow", 1, "numsteps", numsteps, ier)

Integer (Choice)
List 5.17: Example of a integer (choise) type condition definition
12
34<Item name="flowtype" caption="Flow type"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Static Flow"/><Enumeration value="1" caption="Dynamic Flow"/>(continues on next page)

64

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0(continued from previous page)
5
6</Definition></Item>Figure 5.10: Widget example of a integer (choice) type condition
List 5.18: Code example to load a integer (choise) type condition (forcalculation conditions and grid generating conditions)1

integer:: ier, flowtype2
3

call cg_iric_read_integer_f("flowtype", flowtype, ier)

List 5.19: Code example to load a integer (choise) type condition (forboundary conditions)1

integer:: ier, flowtype2
3

call cg_iric_read_bc_integer_f("inflow", 1, "flowtype", flowtype, ier)

Real number
List 5.20: Example of a real number type condition definition
12
3<Item name="g" caption="Gravity [m/s2]"><Definition valueType="real" default="9.8" /></Item>Figure 5.11: Widget example of a real number type condition
List 5.21: Code example to load a real number type condition (for calculation conditions and grid generating conditions)12

integer:: ier
double precision:: g3
4call cg_iric_read_real_f("g", g, ier)

List 5.22: Code example to load a real number type condition (for boundary conditions)12

integer:: ier
double precision:: g3
4call cg_iric_read_bc_real_f("inflow", 1, "g", g, ier)

5.3. Examples

65

iRIC Developer’s manual, Release 3.0.0

Functional
List 5.23: Example of a functional type condition definition
1
2
3
4
5
6

<Item name="discharge" caption="Discharge time series"><Definition valueType="functional" ><Parameter valueType="real" caption="Time" /><Value valueType="real" caption="Discharge" /></Definition></Item>Figure 5.12: Widget example of a functional type condition
List 5.24: Code example to functional type condition (for calculation
conditions and grid generating conditions)12

integer:: ier, discharge_size
double precision, dimension(:), allocatable:: discharge_time, discharge_value

3
4
5! Read size
call cg_iric_read_functionalsize_f("discharge", discharge_size, ier)(continues on next page)

66

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0(continued from previous page)
6
7
8
9
10

! Allocate memory
allocate(discharge_time(discharge_size))
allocate(discharge_value(discharge_size))! Load values into the allocated memory
call cg_iric_read_functional_f("discharge", discharge_time, discharge_value, ier)

List 5.25: Code example to functional type condition (for boundary conditions)12

integer:: ier, discharge_size
double precision, dimension(:), allocatable:: discharge_time, discharge_value

3
4
5
6
7
8
9
10

! Read size
call cg_iric_read_bc_functionalsize_f("inflow", 1, "discharge", discharge_size, ier)
! Allocate memory
allocate(discharge_time(discharge_size))
allocate(discharge_value(discharge_size))! Load values into the allocated memory
call cg_iric_read_bc_functional_f("inflow", 1, "discharge", discharge_time, discharge_
˓→value, ier)

Functional (with multiple values)
List 5.26: Example of a functional (with multiple values) type condition
definition
1
2
3
4
5
6
7

<Item name="discharge_and_elev" caption="Discharge and Water Elevation time series"><Definition valueType="functional" ><Parameter name="time" valueType="real" caption="Time" /><Value name="discharge" valueType="real" caption="Discharge" /><Value name="elevation" valueType="real" caption="Water Elevation" /></Definition></Item>List 5.27: Code example to load a functional (with multiple values) typecondition (for calculation conditions and grid generating conditions)12
3

integer:: ier, discharge_size
double precision, dimension(:), allocatable:: time_value
double precision, dimension(:), allocatable:: discharge_value, elevation_value

4
5
6
7
8
9
10
11
12
13

! Read size
call cg_iric_read_functionalsize_f("discharge", discharge_size, ier)
! Allocate memory
allocate(time_value(discharge_size))
allocate(discharge_value(discharge_size), elevation_value(discharge_size))! Load values into allocated memory
call cg_iric_read_functionalwithname_f("discharge", "time", time_value)
call cg_iric_read_functionalwithname_f("discharge", "discharge", discharge_value)
call cg_iric_read_functionalwithname_f("discharge", "elevation", elevation_value)

5.3. Examples

67

iRIC Developer’s manual, Release 3.0.0

Figure 5.13: Widget example of a functional (with multiple values) type condition

68

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

List 5.28: Code example to load a functional (with multiple values) typecondition (for boundary condition)1
2
3

integer:: ier, discharge_size
double precision, dimension(:), allocatable:: time_value
double precision, dimension(:), allocatable:: discharge_value, elevation_value

4
5
6
7
8
9
10
11
12
13

! Read size
call cg_iric_read_bc_functionalsize_f("discharge", discharge_size, ier)
! Allocate memory
allocate(time_value(discharge_size))
allocate(discharge_value(discharge_size), elevation_value(discharge_size))! Load values into allocated memory
call cg_iric_read_bc_functionalwithname_f("discharge", "time", time_value)
call cg_iric_read_bc_functionalwithname_f("discharge", "discharge", discharge_value)
call cg_iric_read_bc_functionalwithname_f("discharge", "elevation", elevation_value)

CGNS file name etc.
“CGNS file name” and “Calculation result in CGNS file” is used together.
Widget to select CGNS file name can be created with valueType attribute “cgns_filename”.
Widget to select calculation result in CGNS file can be created with valueType attribute “result_gridNodeReal” etc.,
and cgnsFile attribute that refers the name of “CGNS file name” widget.
List 5.29: Example of a CGNS file name and Calculation result in CGNS
1
2
3
4
5
6

<Item name="input_file" caption="CGNS file for input"><Definition valueType="cgns_filename" /></Item><Item name="result_to_read" caption="Calculation result to read"><Definition valueType="result_gridNodeReal" cgnsFile="input_file" /></Item>Figure 5.14: Widget example of CGNS file name and Calculation result in CGNS

5.3. Examples

69

iRIC Developer’s manual, Release 3.0.0

List 5.30: Code example to load CGNS file name and Calculation resultin CGNS (for calculation conditions and grid generating conditions)12

integer:: ier
character(200):: cgnsName, resultName

3
4
5

call cg_iric_read_string_f("input_file", cgnsName, ier)
call cg_iric_read_string_f("result_to_read", resultName, ier)

List 5.31: Code example to load CGNS file name and Calculation resultin CGNS (for boundary condition)
1
2

integer:: ier
character(200):: cgnsName, resultName

3
4
5

call cg_iric_read_bc_string_f("inflow", 1, "input_file", cgnsName, ier)
call cg_iric_read_bc_string_f("inflow", 1, "result_to_read", resultName, ier)

5.3.2 Example of condition to activate calculation conditions etc.
Examples of conditions to activate calculation conditions, grid generating conditions, and boundary conditions areshown in this subsection. As these examples show, complex conditions can be defined using conditions with types“and” and “or”.
var1 = 1
1<Condition type="isEqual" target="var1" value="1" />var1 = 1 and var2 > 31234<Condition type="or"><Condition type="isEqual" target="var1" value="1" /><Condition type="isGreaterThan" target="var2" value="3" /></Condition>(var1 = 1 or var2 < 5) and var3 = 100
1
2
3
4
5
6
7

<Condition type="and"><Condition type="or"><Condition type="isEqual" target="var1" value="1" /><Condition type="isLessThan" target="var2" value="5" /></Condition><Condition type="isEqual" target="var3" value="100" /></Condition>

5.3.3 Example of dialog layout definition

70

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Simple layout
Simple layout (that only uses Item elements) example definition is shown in List 5.32, and the corresponding dialog isshown in Figure 5.15.
List 5.32: Simple layout definition example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

<Tab name="simple" caption="Simple"><Item name="jrep" caption="Periodic boundary condition"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Disabled"/><Enumeration value="1" caption="Enabled"/></Definition></Item><Item name="j_wl" caption="Water surface at downstream"><Definition valueType="integer" default="1"><Enumeration value="0" caption="Constant value"/><Enumeration value="1" caption="Uniform flow"/><Enumeration value="2" caption="Read from file"/></Definition></Item><Item name="h_down" caption="
Constant value (m)"><Definition valueType="real" default="0" /></Item><Item name="j_slope" caption="
Slope for uniform flow"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Calculated from geographic data"/><Enumeration value="1" caption="Constant value"/></Definition></Item><Item name="bh_slope" caption="
Slope value at downstream"><Definition valueType="real" default="0.001"></Definition></Item><Item name="j_upv" caption="Velocity at upstream"><Definition valueType="integer" default="1"><Enumeration value="1" caption="Uniform flow"/><Enumeration value="2" caption="Calculated from upstream depth"/></Definition></Item><Item name="j_upv_slope" caption="
Slope for uniform flow"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Calculated from geographic data"/><Enumeration value="1" caption="Constant value"/></Definition></Item><Item name="upv_slope" caption="
Slope value at upstream"><Definition valueType="real" default="0.001"></Definition></Item></Tab>

Layout that uses Group boxes
Layout example that uses group boxes is shown in List 5.33, and the corresponsing dialog is shown in Figure 5.16.
GroupBox elements can be used to define groups of items.

5.3. Examples

71

iRIC Developer’s manual, Release 3.0.0

Figure 5.15: Dialog for simple layout definition example

List 5.33: Layout definition example that uses group boxes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

<Tab name="grouping" caption="Group"><Item name="g_jrep" caption="Periodic boundary condition"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Disabled"/><Enumeration value="1" caption="Enabled"/></Definition></Item><GroupBox caption="Water surface at downstream"><Item name="g_j_wl" caption="Basic Setting"><Definition valueType="integer" default="1"><Enumeration value="0" caption="Constant value"/><Enumeration value="1" caption="Uniform flow"/><Enumeration value="2" caption="Read from file"/></Definition></Item><Item name="g_h_down" caption="Constant value (m)"><Definition valueType="real" default="0" /></Item><Item name="g_j_slope" caption="Slope for uniform flow"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Calculated from geographic data"/><Enumeration value="1" caption="Constant value"/></Definition></Item><Item name="g_bh_slope" caption="Slope value at downstream"><Definition valueType="real" default="0.001"></Definition></Item></GroupBox><GroupBox caption="Velocity at upstream"><Item name="g_j_upv" caption="Basic Setting"><Definition valueType="integer" default="1"><Enumeration value="1" caption="Uniform flow"/><Enumeration value="2" caption="Calculated from upstream depth"/>(continues on next page)

72

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0(continued from previous page)
35
36
37
38
39
40
41
42
43
44
45
46
47
48

</Definition></Item><Item name="g_j_upv_slope" caption="Slope for uniform flow"><Definition valueType="integer" default="0"><Enumeration value="0" caption="Calculated from geographic data"/><Enumeration value="1" caption="Constant value"/></Definition></Item><Item name="g_upv_slope" caption="Slope value at upstream"><Definition valueType="real" default="0.001"></Definition></Item></GroupBox></Tab>

Figure 5.16: Dialog for layout definition example that uses group boxes

Free layout
Free layout example, that uses GridLayout element, is shown in List 5.34, and the corresponsing dialog is shown in
Figure 5.17.
GridLayout, HBoxLayout, VBoxLayout can be used to layout widgets freely. When using these elements for layouting, caption attributes are not used to show labels, but Label elements are used to show labels instead.
GridLayout, HBoxLayout, VBoxLayout elements can be used recursively. GroupBox element can be used inside theseelements freely.
List 5.34: Free layout definition example
1
2
3
4
5
6

<Tab name="roughness" caption="Roughness"><Item name="diam" caption="Diameter of uniform bed material (mm)"><Definition valueType="real" default="0.55" /></Item><Item name="j_drg" caption="Bed roughness"><Definition valueType="integer" default="0">(continues on next page)

5.3. Examples

73

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

<Enumeration value="0" caption="Calculated from bed material"/><Enumeration value="1" caption="Constant value"/><Enumeration value="2" caption="Read from file"/></Definition></Item><GroupBox caption="Manning's roughness parameter"><GridLayout><Label row="0" col="0" caption="Low water channel" /><Item row="1" col="0" name="sn_l"><Definition valueType="real" default="0.01" /></Item><Label row="0" col="1" caption="Flood channel" /><Item row="1" col="1" name="sn_h"><Definition valueType="real" default="0.01" /></Item><Label row="0" col="2" caption="Fixed bed" /><Item row="1" col="2" name="sn_f"><Definition valueType="real" default="0.01" /></Item></GridLayout></GroupBox><Item name="snfile" caption="Input file for Manning's roughness"><Definition valueType="filename" default="Select File" /></Item></Tab>

Figure 5.17: Dialog for free layout definition example

5.4 Elements reference
5.4.1 BoundaryCondition
BoundaryCondition element contains boundary condition information.

74

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

ExampleList 5.35: Example of BoundaryCondition definition
1
2
3
4
5

<BoundaryCondition name="inflow" caption="In flow" position="node"><Item name="discharge" caption="Discharge"><Definition valueType="real" default="0" /></Item></BoundaryCondition>

Attributes

Name
name
captionposition

Table 5.3: Attributes of BoundaryCondition
Value
Required Description
StringYesName of element
StringYes
String to be displayed on dialog
Refer the table below Yes
Definition position

Table 5.4: position values
Value Meaning
node
Grid nodes
cell
Grid cells
edge
Grid edges

Child elements
Table 5.5: Child elements of BoundaryCondition
Name Required Description
Item
Definition of element

5.4.2 CalculationCondition
CalculationCondition element contains calculation condition information.
ExampleList 5.36: Example of CalculationCondition definition
1
2<CalculationCondition><Tab name="basic" caption="Basic Setting">

34(abbr.)

5
6
7</Tab><Tab name="time" caption="Calculation Time Setting">

89(abbr.)(continues on next page)

5.4. Elements reference75

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
10
11
12

</Tab></CalculationCondition>

Attributes
No attribute can be defined.
Child elements

Name

Required

Tab

Table 5.6: Child elements of CalculationCondition
Description
An element that contains information on a page (or tab) of the calculation condition input
dialog5.4.3 Condition
Condition element contains information of a condition that must be met when a certain input item of calculation
conditions become active.
ExampleList 5.37: Example of Condition definition 1
1<Condition conditionType="isEqual" target="type" value="1" />76

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

List 5.38: Example of Condition definition 2
12
34<Condition conditionType="and"><Condition conditionType="isEqual" target="type" value="1" /><Condition conditionType="isEqual" target="inflow" value="0" /></Condition>

Refer to ??? for other examples.
Attributes
Table 5.7: Attributes of Condition
Description

Name

Value

conditionTypetargetRefer to thetable below

valueStringStringRequiredYesType of condition

DeName of the calculation condition to be compared with. Needs to be sconditionpends Type Needs to be specified only if the conditionType value is none of "and", "or","not".
DeValue to be compared with. Needs to be sconditionType Needs to be specified
pends only if the conditionType value is none of "and", "or", "not".

Table 5.8: conditionType values
Value
Meaning
isEqualis equal toisGreaterEqual is greater than or equal toisGreaterThan
is greater thanisLessEqual
is less than or equal toisLessThan
is less than
and
and
or
or
not
not

Child elements
Table 5.9: Child elements of Condition
Name
Condition

Required
Depends

Description
The condition to which the AND, OR or NOT operator is applied. Need to be specified only if
the conditionType value is one of the following:

5.4.4 Definition (when used under CalculationCondition element or BoundaryCondition element)
Definition element contains definition information of calculation conditions or grid attributes or boundary conditions.

5.4. Elements reference77

iRIC Developer’s manual, Release 3.0.0

ExampleList 5.39: Example of Definition definition 1
1<Definition valueType="integer" default="1" />List 5.40: Example of Definition definition 2
1
2
3
4<Definition valueType="integer" default="0" ><Enumeration value="0" caption="Standard" /><Enumeration value="1" caption="Advanced" /></Definition>

Refer to Examples of calculation conditions, boundary conditions, and grid generating condition (page 58) for examples of Condition element definition.
Attributes

Name

Value

valueTypedefault
noSortRefer to the table
below
Stringtrue or false

Table 5.10: Attributes of Definition
ReDescription
quiredYes
Value type

Value
integerreal
stringfunctional
filenamefilename_allfoldername
result_gridNodeInteger
result_gridNodeReal
result_gridCellInteger
result_gridCellReal
result_gridEdgeIInteger
result_gridEdgeIReal
result_gridEdgeJInteger
result_gridEdgeJReal
result_baseIterativeInteger
result_baseIterativeReal

78

Default value
When value “true” isspecified

the table on the dialog is not sorted byParam value.

Table 5.11: valueType values
Meaning
Integer
Real number
String
Functional type
File namefilename; even a file that currently does not exist can be specified
Folder name
Select integer value calculation result defined at grid nodes
Select real value calculation result defined at grid nodes
Select integer value calculation result defined at grid cells
Select real value calculation result defined at grid cells
Select integer value calculation result defined at I-direction edges
Select real value calculation result defined at I-direction edges
Select integer value calculation result defined at J-direction edges
Select real value calculation result defined at J-direction edges
Select integer value calculation result defined globally
Select real value calculation result defined globally

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Child elements
Table 5.12: Child elements of Definition
Name

Required

Enumeration
Condition
Param
Value

Description
It should be specified when solver developers wants to limit the selection of the value. It canbe specified only when valueType is integer or real.
The condition that must be met when the element become active.
value for horizontal axis. It can be specified only when valueType is functional.
value for vertical axis. It can be specified only when valueType is functional.

5.4.5 Definition (when used under the GridRelatedCondition element)This element contains definition information of the attributes to be defined for an input grid.
ExampleList 5.41: Example of Definition definition
1<Definition valueType="integer" position="node" default="min" />Attributes

Name Value
valueTypeposition
default

Refer tothe table
below
Refer tothe table
below
StringTable 5.13: Attributes of Definition
Description

RequiredYes
Value type

Yes

Definition position

Default value.If "min" or "max" is specified, the minimum value or the maximum
value, respectively, of the input geographical information will be used for an area
devoid of geographical information.

Table 5.14: valueType values
Value
Meaning
integer
Integer
real
Real number
complex Complex type5.4. Elements reference

79

iRIC Developer’s manual, Release 3.0.0

Table 5.15: position values
Value Meaning
node
Grid nodes
cell
Grid cells

Child elements
Table 5.16: Child elements of Definition
Name

ReDescription
quiredIt should be specified when solver developers want to define a dimension (ex. Time).

Dimension
Enumeration
Item

Depends

Specify this when you want to limit choice for value

Required only if the valueType attribute value is "complex". The structure of Item element is
the same to that of Item element under Boundary Condition element.

5.4.6 Dimension
Dimension element contains information that defines a dimension of an attributes to be defined for an input grid.
ExampleList 5.42: Example of Dimension definition
1<Dimension name="Time" caption="Time" valueType="integer" />Attributes

Name
name
captionvalueType

Table 5.17: Attributes of Dimension
Value
Required Description
StringYesName of element
StringYes
String to be displayed in the [Pre-processor]
Refer to table below Yes
Value type

Table 5.18: valueType vaslues
Value
Meaning
integer Integer
real
Real numberChild elements
No child element can be defined.
80

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

5.4.7 Enumeration
Enumeration element contains information that defines an input option for the input item of calculation conditions or
grid generating condition.
ExampleList 5.43: Example of Enumeration definition
1<Enumeration value="0" caption="Standard" />Refer to Integer (Choice) (page 64) for examples of Enumeration element definitions.
Attributes

Name
value
caption

Value
StringStringTable 5.19: Attributes of Enumeration
Required Description
Yes
A string representing a value that corresponds to caption
Yes
String to be displayed.

Child elements
No child elements can be defined.

5.4.8 ErrorCode
ErrorCodes element contains a list of error codes.
ExamplesList 5.44: Example of ErrorCode definition
1<ErrorCode value="1" caption="Grid is data do not exist" />Attributes

Name
value
captionTable 5.20: Attributes of ErrorCode
Value
Required Description
Integer Yes
Error code
StringYes
String to be displayedChild elements
No child elements can be specified

5.4. Elements reference81

iRIC Developer’s manual, Release 3.0.0

5.4.9 ErrorCodes
ErrorCodes element contains a list of error codes.
ExampleList 5.45: Example of ErrorCodes definition
12
3
4<ErrorCodes><ErrorCode value="1" caption="Grid is data do not exist" /><ErrorCode value="2" caption="Grid size is too big" /></ErrorCodes>

Attributes
No attributes can be defined.
Child elements
Table 5.21: Child elements of ErrorCodes
Name
Required Description
ErrorCodeError code

5.4.10 GridGeneratingCondition
GridGeneratingCondition element contains information that defines a grid generating condition.
ExampleList 5.46: Example of GridGeneratingCondition definition
1
2<GridGeneratingCondition><Tab name="basic" caption="Basic Setting">

3(abbr.)

4
5
6
7</Tab><Tab name="time" caption="Calculation Time Setting">

8(abbr.)

9
10
11
12

</Tab></GridGeneratingCondition>

Attributes
No attributes can be defined.

82

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Child elements

Name

Required

Tab

Table 5.22: Child elements of GridGeneratingCondition
Description
An element that contains information on a page of the grid generationg condition input
dialog5.4.11 GridGeneratorDefinition
GridGeneratorDefinition element contains definition information of the grid generating program.
ExampleList 5.47: Example of GridGeneratorDefinition
1
2
3
4
5
6
7
8
9
10

<GridGeneratorDefinition
name="samplecreator"
caption="Sample Grid Creator"
version="1.0"
copyright="Example Company"
executable="generator.exe"
gridtype="structured2d"><GridGeneratingCondition><Tab name="basic" caption="Basic Setting">

11(Abbr.)

12
13
14
15
16

</Tab></GridGeneratingCondition></GridGeneratorDefinition>

Attributes

Name

Value

name

Stringcaptionversioncopyright
releasehomepage
executable
gridtype

StringStringStringStringStringTable 5.23: Attributes of GridGeneratorDefinition
ReDescription
quiredYes
Identification name of the grid generator (in alphanumeric characters
only)
Yes
Name of the grid generator (any characters can be used)
Yes
Version number, in a form such as "1.0" or "1.3.2"
Yes
Name of copyright owner; basically in English
Yes
Date of release, in a form such as "2010.01.01"
Yes
URL of the web page that provides information on the grid generator

StringYes

Filename of the executable program. (ex. GridGen.exe)

Refer to table below

Yes

Grid type5.4. Elements reference83

iRIC Developer’s manual, Release 3.0.0

Table 5.24: gridType values
Value
Meaning
structured2d
two-dimensional structured grid
unstructured2d two-dimensional unstructured gridChild elements
Table 5.25: Child elements of GridGeneratingCondition
Name
Required Description
GridGeneratingCondition Yes
Grid creating condition
ErrorCodes
List of error codes

5.4.12 GridLayout
GridLayout element contains information that defines the group box to be displayed in the calculation conditions input
dialog or grid generating condition input dialog.
ExampleRefer to Free layout (page 73) for an example of GridLayout element definition.
Attributes
No attributes can be defined.
Child elements
Table 5.26: Child elements of GridLayout
Name
Required Description
Item, VBoxLayout etc.
Definitions of elements of child layouts

5.4.13 GridRelatedCondition
GridRelatedCondition element contains information that defines the list of grid attributes.
ExampleList 5.48: Example of GridRelatedCondition definition
1
2
3
4
5

<GridRelatedCondition><Item name="Elevation" caption="Elevation(m)"><Definition valueType="real" position="node" default="max" /></Item></GridRelatedCondition>

84

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

Attributes
No attributes can be defined.
Child elements
Table 5.27: Child elements of GridRelatedCondition
Name Required Description
Item
Yes
Grid attribute definition

5.4.14 GridType
GridType element contains a list of definition information of input grids.
ExamplePlease refer to List 5.1.
Attributes

Namegridtype
multiple

Table 5.28: Attributes of GridType
Value
Required Description
Refer to the table below Yes
Grid type
true or false
true if two or more grids can be used

Value
1d
1.5d
1.5d_withcrosssection
structured2d
unstructured2d

Table 5.29: gridtype values
Meaning
one-dimensional grid
one-and-half dimensional grid
one-and-half dimensional grid having cross-sectional info
two-dimensional structured grid
two-dimensional unstructured gridChild elements
Table 5.30: Child elements of GridType
Name
Required Description
GridRelatedCondition Yes
Grid attribute definition list

5.4.15 GridTypes
GridTypes element contains a list of definition information of input grids types.

5.4. Elements reference85

iRIC Developer’s manual, Release 3.0.0

ExamplePlease refer to List 5.1.
Attributes
No attributes can be defined.
Child elements
Table 5.31: Child elements of GridTypes
Name
Required Description
GridType Yes
Grid type

5.4.16 GroupBox
GroupBox element contains information that defines a group box to be displayed in the calculation condition input
dialog or grid generating condition input dialog.
ExampleList 5.49: Example of GroupBox definition
1
2
3
4
5
6
7
8

<GroupBox caption="Time"><Item name="stime" caption="Start Time"><Definition valueType="real" /></Item><Item name="etime" caption="End Time"><Definition valueType="real" /></Item></GroupBox>

Refer to Layout that uses Group boxes (page 71) for an example of GroupBox element definition.
Attributes

NamecaptionTable 5.32: Attributes of GroupBox
Value Required Description
String Yes
String to be displayedChild elements
Table 5.33: Child elements of GroupBox
Name
Required Description
Item, VBoxLayout etc.
Definitions of elements of child layouts

86

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

5.4.17 HBoxLayout
HBoxLayout element contains information that defines layout to arrange elements horizontally in the calculation
condition input dialog or grid generating condition input dialog.
ExampleList 5.50: Example of HBoxLayout definition
1
2<HBoxLayout><Item name="stime" caption="Start Time">

34(abbr.)

5
6
7</Item><Item name="etime" caption="End Time">

89(abbr.)

1011
12</Item></HBoxLayout>

Attributes
No attributes can be defined.
Child elements
Table 5.34: Child elements of HBoxLayout
Name
Required Description
Item, VBoxLayout etc.
Definitions of elements of child layouts

5.4.18 Item
Item element contains information that defines an input item of calculation conditions, grid generating condtions,
attributes of the input grid, or .boundary conditions.
ExampleList 5.51: Example of Item definition
12
3<Item name="stime" caption="Start Time"><Definition valueType="real" default="0" /></Item>Refer to Examples of calculation conditions, boundary conditions, and grid generating condition (page 58) for examples of Item element definitions.

5.4. Elements reference

87

iRIC Developer’s manual, Release 3.0.0

Attributes

Name
name
caption

Value
StringStringTable 5.35: Attributes of Item
Required Description
Yes
Name of element
String to be displayed on the dialog

Child elements
Table 5.36: Child elements of Item
Name
Required Description
Definition Yes
Definition of elements

5.4.19 Label
Label element contains information that defines a label to be displayed in the calculation condition input dialog or gridcreating condition input dialog.
ExampleList 5.52: Example of Label definition
1<Label caption="Start Time" />Refer to Free layout (page 73) for Label element definition example.
Attributes

Namecaption

Value
StringTable 5.37: Attributes of Label
Required Description
String to be displayed on dialog

Child elements
No child elements can be defined.

5.4.20 Param
Param element contains information that defines an argument of functional type calculation conditions or grid creating
conditions.

88

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

ExampleList 5.53: Example of Param definition
1<Param caption="Time" valueType="real" />Refer to Functional (page 66) for Param element definition example.
Attributes

NamecaptionvalueTypeaxislog

Table 5.38: Attributes of Param
Value
Required Description
StringYes
String to be displayed on dialog
Refer to table below Yes
Data type
true or false
true when you want to make the horizontal axis log

Child elements
No child elements can be defined.

5.4.21 SolverDefinition
SolverDefinition element contains definition information of the solver.
ExamplesList 5.54: Example of SolverDefinition definition
1
2
3
4
5
6
7
8
9
10
11
12

<SolverDefinition
name="samplesolver"
caption="Sample Solver 1.0"
version="1.0"
copyright="Example Company"
release="2012.04.01"
homepage="http://example.com/"
executable="solver.exe"
iterationtype="time"
gridtype="structured2d"><CalculationCondition>

13
14(abbr.)

15
16
17</CalculationCondition><GridRelatedCondition>18
19(abbr.)

20
21
22</GridRelatedCondition></SolverDefinition>

5.4. Elements reference

89

iRIC Developer’s manual, Release 3.0.0

Attributes

Name

Value

name

Stringcaptionversioncopyright
releasehomepage

StringStringStringStringStringexecutable
iterationtype
gridtype

StringRefer to table below
Refer to table below
true or false

multiple

Table 5.39: Attributes of SolverDefinition
ReDescription
quiredYes
Identification name of the solver (in alphanumeric characters only)
Yes
Name of the solver (any characters can be used)
Yes
Version number, in a form such as "1.0", "1.3.2"
Yes
Name of copyright owner; basically in English
Yes
Date of release, in a form such as "2010.01.01"
Yes
URL of the web page that provides information on thesolverYes
Filename of the executable program. (e.g.
Yes
Unit of outputting result
Yes

Solver.exe)

Grid type
true if two or more grids can be used

Table 5.40: iterationtype value
Value
Meaningtime
Results are output by time
iteration Results are output by iteration

Value
1d
1.5d
1.5d_withcrosssection
structured2d
unstructured2d

Table 5.41: gridtype value
Meaning
one-dimensional grid
one-and-half dimensional grid
one-and-half dimensional grid having cross-sectional info
two-dimensional structured grid
two-dimensional unstructured grid

When solver developers want to update solvers, version attribute should be changed. Refer to Notes on solver version
up (page 93) for notes on solver version up.
Child elements

Name
CalculationCondition
GridRelatedCondition
GridTypes

90

RequiredYes

Table 5.42: Child elements of SolverDefinition
Description
Calculation condition
This should be defined only when a single type of input grid is used.
This should be defined only when two or more types of input grids are used.

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

5.4.22 Tab
Tab element contains the information that defines a page of the calculation condition input dialog.
ExampleList 5.55: Example of Tab definition
1
2<Tab caption="Basic Setting"><Item name="stime" caption="Start Time">

34(abbr.)

5
6
7</Item><Item name="etime" caption="End Time">

89(abbr.)

1011
12</Item></Tab>

Attributes

Namecaption

Value
StringTable 5.43: Attributes of Tab
Required Description
Yes
Name (Any characters can be used.)Child elements
Table 5.44: Child elements of Tab
Name
Required Description
Item, VBoxLayout etc. Yes
Definitions of elements of child layouts

5.4.23 Value
Value element contains information that defines a value of functional type calculation conditions or grid creating
conditions.
ExampleList 5.56: Example of Value definition1<value caption="Discharge" valueType="real" />Refer to Functional (page 66), for Value element definition example.

5.4. Elements reference91

iRIC Developer’s manual, Release 3.0.0

Attributes

Name

Value

captionvalueType
name

StringRefer to table
below
Stringaxis

Refer to table
below
true or false
true or false

axislog
axisreverse
span
step
hide

RequiredYes
Yestrue or false
true or false
true or false

Table 5.45: Attributes of Value
Description
String to be displayed on dialog
Data type
Identification name (in alphanumeric characters only). It is required only
when the condition has multiple values.
Specify on which side to show Y-axis.
true when you want to make the vertical axis log
true when you want to reverse the vertical axis
true when you want to define values at spanstrue when you want to show the chart as bar charttrue when you want to hide the data from chart

Table 5.46: valueType value
Value
Meaning
integer Integer
real
Real number

Table 5.47: axis value
Value Meaning
left
Use Y-axis on left sideright
Use Y-axis on right sideChild elements
No child elements can be defined.

5.4.24 VBoxLayout
VBoxLayout element contains information that defines layout to arrange elements vertically in the calculation condition input dialog or grid generating condition input dialog.
ExampleList 5.57: Example of VBoxLayout definition
1
2<VBoxLayout><Item name="stime" caption="Start Time">

3(abbr.)

4
5(continues on next page)

92

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0(continued from previous page)
6
7</Item><Item name="etime" caption="End Time">

89(abbr.)

1011
12</Item></VBoxLayout>

Attributes
No attributes can be defined.
Child elements
Table 5.48: Child elements of VBoxLayout
Name
Required Description
Item, VBoxLayout etc.
Definitions of elements of child layouts

5.5 Notes on solver version up
When you update the solver you developed, you have to modify not only solver source code but also solver definition
file. When you modify solver definition files you have to note the followings:• You must not edit “name” attribute of SolverDefinition element. When the “name” attribute is changed, iRIC
regard the solver as a completely different solver from the older version, and any project files that are created
for the older version become impossible to open with the new solver.
• You should modify the “caption” attribute of SolverDefinition element. “caption” element is an arbitrary stringthat is used to display the solver name and version information, so you should input “Sample Solver 1.0”,“Sample Solver 3.2 beta”, “Sample Solver 3.0 RC1” as caption value for example. The caption value can be set
independent from “version” attribute.
• You must modify the “version” attribute following the policy in Table 5.49.
Version number consists of several numbers joined with “.”. The numbers are called “Major number”, “Minor number”, and “Fix number” for each. Fix number can be omitted.

Element
to increment
Major
numberMinornumberFix number

Table 5.49: Elements of version number to increment
Condition to increment

When you changed a big modification so that the grid, calculation condition you created witholder version will not be compatible to the new solver.
When you changed a small modification to calculation condition and grid. When a old project
file that was created for an older solver is loaded, the default values are used for the newconditions, and that will cause no problem.
When you fixed bugs or changed inner algorithm. No modification is made to the interface (i.
e. grid and calculation condition) is made.

5.5. Notes on solver version up

Exmaple

2.1
–>
3.0
2.1
–>
2.2
2.1
–>
2.1.1
93

iRIC Developer’s manual, Release 3.0.0

In iRIC, project files compatibility is like the following:• Project files with different major number are not compatible.
• Project files with same major number and smaller minor number are compatible.
• Project files with same major number, same minor number and different fix number are compatible.
Figure 5.18 shows the examples of compatibility with different solver version numbers.

Figure 5.18: Examples of compatibility of project files with various version numbers
The basic policy is shown in Table 5.49, but in the last, solver developers should judge which number to increment,
taking account of compatibility.
When you deploy multiple versions of a same solver in one environment, create multiple folders under “solvers” folder
with different names, and deploy files related to each version under them. Folder names can be selected independentof solver names.

5.6 XML files basics
In this section, the basics of XML file format are described. XML file format is adopted as file format for solver
definition file and grid generating program definitioin file.

5.6.1 Defining Elements
Element start tag is described with “<” and “>”.
Element end tag is described with “</” and “>”.
List 5.58 shows an example of Item element definition.
List 5.58: Example of Item element<Item></Item>An element can have the followings:• Child element• Attributes
An element can have multiple child elements that have the same name. On the other hand, an element can have only
one attribute for each name. List 5.59 shows an example of a definition of Item element with two “Subitem” childelements and “name” attribute.
94

Chapter 5. About definition files (XML)iRIC Developer’s manual, Release 3.0.0

List 5.59: Example of Item element<Item name="sample"><SubItem></SubItem><SubItem></SubItem></Item>An element that do not have a child element can be delimited with “<” and “/>”. For example, List 5.60 and List 5.61
are processed as the same data by XML parsers.
List 5.60: Example of item without a child element<Item name="sample"></Item>List 5.61: Example of item without a child element<Item name="sample" />5.6.2 About tabs, spaces, and line breaks
In XML files, tabs, spaces, and line breaks are ignored, so you can add them freely to make XML files easier to read.
Please note that spaces in attribute values are not ignored. Elements in List 5.62, List 5.63, List 5.64 are processed as
the same data by XML parsers.
List 5.62: Example of element<Item name="sample"><SubItem></SubItem></Item>List 5.63: Example of element<Item
name="sample"><SubItem></SubItem></Item>List 5.64: Example of element<Item name="sample"><SubItem></SubItem></Item>

5.6.3 Comments
In XML files, strings between “<!–” and “–>” are treated as comments. List 5.65 shows an example of a comment.

5.6. XML files basics

95

iRIC Developer’s manual, Release 3.0.0

List 5.65: Example of comment<!--This is a comment --><Item name="sample"><SubItem></SubItem></Item>96

Chapter 5. About definition files (XML)CHAPTER

6iRIClib

6.1 What is iRIClib?
iRIClib is a library for interfacing a river simulation solver with iRIC.
iRIC uses a CGNS file for input/output to/from solvers and grid generating programs. Input-output subroutines for
CGNS files are published as an open-source library called cgnslib (see Information on CGNS file and CGNS library(page 220) ). However, describing the necessary input-output directly using cgnslib would require complicated processing description.
Therefore, the iRIC project offers iRIClib as a library of wrapper subroutines that makes possible the abbreviateddescription of input-output processing which is frequently used by solvers that work together with iRIC. With thesesubroutines, input-output processing of a solver that performs calculation using a single structured grid can be described easily.
Note that iRIClib does not offer subroutines necessary for a solver that uses multiple grids or an unstructured grid. Incase of such solvers, it is necessary to use cgnslib subroutines directly.
This chapter describes the groups of subroutines included in iRIClib, and examples of using them, along with compilation procedures.

6.2 Languages supported by iRIClib
iRIClib is supported for the following languages:• FORTRAN• C/C++• PythonIn this manual examples are described with FORTRAN mainly.
In this section, how to use iRIClib from FORTRAN, C/C++, and Python are briefly explained.

97

iRIC Developer’s manual, Release 3.0.0

Please note that arguments and returned values depends on the language. Please refer to the subsections for eachfunctions in Reference (page 129) about the format to use the functions from each languages.

6.2.1 FORTRAN
Call iRIClib functions after including the header, like shown in List 6.1.
List 6.1: Example of using iRIClib from FORTRAN
1

include 'iriclib_f.h'2
3

call cg_iric_init_f(fid, ier)

6.2.2 C/C++
Call iRIClib functions after including the header, like shown in List 6.2.
List 6.2: Example of using iRIClib from C/C++
1#include "iriclib.h"2
3
4// (abbr.)
ier = cg_iric_init(fid);

6.2.3 Python
Call iRIClib functions after importing iric module, like shown in List 6.3.
List 6.3: Example of using iRIClib from Python
1from iric import *23

cg_iric_init(fid)

6.3 How to read this chapter
In this chapter, first Overview (page 98) explains what kinds of information input/output iRIC assumes a solver toperform, and what subroutines are available for each kind of processing. First, read Section to understand the general
concept of iRIClib.
Since Overview (page 98) gives only an outline of subroutines, see Reference (page 129) for detailed information, suchas lists of arguments for those subroutines.

6.4 Overview
This section provides an overview of iRIClib.

98

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.4.1 Processes of the program and iRIClib subroutines
The I/O processings in solvers and grid generating programs are shown in Table 6.1 and Table 6.2 .
Table 6.1: I/O processings of solvers
Process
Opens a CGNS file
Initializes iRIClib
Sets up options
Reads calculation conditions
Reads grids
Reads boundary conditions
Reads geographic data (only when needed)
Outputs grids (only in cases when grid creation or re-division is performed)
Outputs time (or iteration count)Outputs grids (only in cases when grid moves)
Outputs calculation results
Closes a CGNS file

Table 6.2: I/O processings of a grid generating program
Process
Opens a CGNS file
Initializes iRIClib
Reads grid generating condition
Outputs error code
Outputs grid
Closes CGNS File

6.4.2 Opening a CGNS file
Open a CGNS file, read it in and make it into a writable state. The subroutine is defined in cgnslib.
Table 6.3: Subroutine to use
Subroutine Remarks
cg_open_f
Opens a CGNS file

6.4.3 Initializing iRIClib
Prepares the CGNS file that has been opened for use by iRIClib. After the CGNS file is opened, this should beexecuted.
When you add calculation result to the CGNS file, open the CGNS file with CG_MODE_MODIFY mode, and initialize
using “cg_iric_init_f”.
When you just read grid and calculation result from CGNS file, open the CGNS file with CG_MODE_READ mode,
and initialize using “cg_iric_initread_f”.

6.4. Overview

99

iRIC Developer’s manual, Release 3.0.0

Table 6.4: Subroutine to use
Subroutine
cg_iric_init_f
cg_iric_initread_f

Remarks
Initialize the internal variables that are used for reading and modifying the opened CGNS file.
Initialize the internal variables that are used for reading the opened CGNS file.

6.4.4 Set up options
Sets up options about the solver.
The options that can be set up currently are as follows:• IRIC_OPTION_CANCEL: The solver detects cancel request by calling iric_check_cancel_f.
Table 6.5: Subroutines to use
Subroutine
Remarks
iric_initoption_f Set up solver option

6.4.5 Reading calculation conditions
Reads calculation conditions from the CGNS file.

Subroutine
cg_iric_read_integer_f
cg_iric_read_real_f
cg_iric_read_realsingle_f
cg_iric_read_string_f
cg_iric_read_functionalsize_fcg_iric_read_functional_f
cg_iric_read_functional_realsingle_f
cg_iric_read_functionalwithname_f

Table 6.6: Subroutines to use
Remarks
Reads an integer calculation-condition value
Reads a double-precision real calculation-condition value
Reads a single-precision real calculation-condition value
Reads a string calculation-condition value
Checks the size of a functional-type calculation condition
Reads functional calculation condition data in double-precision real type
Reads functional calculation condition data in single-precision real type
Reads functional calculation condition data (with multiple values)

For reading calculation condition data other than in functional type, a subroutine reads a single calculation condition.
An example of reading an integer calculation condition value is shown in List 6.4.
List 6.4: Example of source code to read calculation conditions
1
2
3

program Sample1
implicit none
include 'cgnslib_f.h'45integer:: fin, ier, i_flow

6
7
8
9

! Open CGNS filecall cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

10
11
12
13

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

14

(continues on next page)

100

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)15
16

call cg_iric_read_integer_f('i_flow', i_flow, ier)
print *, i_flow;

17
18
19
20
21

! Close CGNS filecall cg_close_f(fin, ier)stop
end program Sample1

In contrast, for getting functional-type calculation conditions, it is necessary to use two subroutines:
cg_iric_read_functionalsize_f and cg_iric_read_functional_f. An example of getting functional-type calculation condition data is shown in List 6.5.
List 6.5: Example of source code to read functional-type calculation conditions
1
2
3

program Sample2
implicit none
include 'cgnslib_f.h'456integer:: fin, ier, discharge_size, idouble precision, dimension(:), allocatable:: discharge_time, discharge_value !
˓→Array for storing discharge time and discharge value

7
8
9
10

! Open CGNS filecall cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

11
12
13
14

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

15
16
17
18
19
20
21

! First, check the size of the functional-type input conditions
call cg_iric_read_functionalsize_f('discharge', discharge_size, ier)
! Allocate memory
allocate(discharge_time(discharge_size), discharge_value(discharge_size))! Read values into the allocated memory
call cg_iric_read_functional_f('discharge', discharge_time, discharge_value, ier)

22
23
24
25
26
27
28
29

! (Output)
if (ier ==0) thenprint *, 'discharge: discharge_size=', discharge_size
do i = 1, min(discharge_size, 5)
print *, ' i,time,value:', i, discharge_time(i), discharge_value(i)end doend if30
31
32! Deallocate memory that has been allocateddeallocate(discharge_time, discharge_value)

33
34
35
36
37

! Close CGNS filecall cg_close_f(fin, ier)stop
end program Sample2

Refer to Examples of calculation conditions, boundary conditions, and grid generating condition (page 58) for examples of codes to load calculation conditions (or grid generating conditions).

6.4. Overview

101

iRIC Developer’s manual, Release 3.0.0

6.4.6 Reading calculation gridReads a calculation grid from the CGNS file. iRIClib offers subroutines for reading structured grids only.
Table 6.7: Subroutine to use
Subroutine
Remarks
cg_iric_gotogridcoord2d_f
Makes preparations for reading a 2D structured grid
cg_iric_getgridcoord2d_f
Reads a 2D structured grid
cg_iric_gotogridcoord3d_f
Makes preparations for reading a 3D structured grid
cg_iric_getgridcoord3d_f
Reads a 3D structured grid
cg_iric_read_grid_integer_node_f
Reads the integer attribute values defined for grid nodes
cg_iric_read_grid_real_node_f
Reads the double-precision attribute values defined for grid nodes
cg_iric_read_grid_integer_cell_f
Reads the integer attribute values defined for cells
cg_iric_read_grid_real_cell_f
Reads the double-precision attribute values defined for cells
cg_iric_read_complex_count_f
Reads the number of groups of complex type grid attribute
cg_iric_read_complex_integer_f
Reads the integer attribute values of complex type grid attribute
cg_iric_read_complex_real_f
Reads the double precision attribute values of complex type grid attribute
cg_iric_read_complex_realsingle_f Reads the single precision attribute values of complex type grid attribute
cg_iric_read_complex_string_f
Reads the string attribute values of complex type grid attribute
cg_iric_read_complex_functionalsize_f
Checks the size of a functional-type attribute of complex type grid attribute
cg_iric_read_complex_functional_f Reads functional attribute data of complex type grid attribute
cg_iric_read_complex_functionalwithname_f
Reads functional attribute of complex type grid attribute (with multiple values)
cg_iric_read_complex_functional_realsingle_f
Reads functional attribute data of complex type grid attribute
cg_iric_read_grid_complex_node_f Reads the complex attribute values defined at grid nodes
cg_iric_read_grid_complex_cell_f Reads the complex attribute values defined at grid cells
cg_iric_read_grid_functionaltimesize_f
Reads the number of values of dimension “Time” for functional grid attribute
cg_iric_read_grid_functionaltime_f Reads the values of dimension “Time” for functional grid attribute
cg_iric_read_grid_functionaldimensionsize_f
Reads the number of values of dimension for functional grid attribute
cg_iric_read_grid_functionaldimension_integer_f
Reads the values of integer dimension for functional grid attribute
cg_iric_read_grid_functionaldimension_real_f
Reads the values of double-precision dimension for functional grid attribute
cg_iric_read_grid_functional_integer_node_f
Reads the values of functional integer grid attribute with dimension “Time”
definied at grid nodes.
cg_iric_read_grid_functional_real_node_f
Reads the values of functional double-precision grid attribute with dimension“Time” definied at grid nodes.
cg_iric_read_grid_functional_integer_cell_f
Reads the values of functional integer grid attribute with dimension “Time”
definied at grid cells.
cg_iric_read_grid_functional_real_cell_f
Reads the values of functional double-precision grid attribute with dimension“Time” definied at grid cells.
The same subroutines for getting attributes such as cg_iric_read_grid_integer_node_f can be used both for twodimensional structured grids and three-dimensional structured grids.
An example description for reading a two-dimensional structured grid is shown in List 6.6.
List 6.6: Example of source code to read a grid1
2
3

program Sample3
implicit none
include 'cgnslib_f.h'456integer:: fin, ier, discharge_size, i, j
integer:: isize, jsize(continues on next page)

102

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)

double precision, dimension(:,:), allocatable:: grid_x, grid_y
double precision, dimension(:,:), allocatable:: elevation
integer, dimension(:,:), allocatable:: obstacle
integer:: rain_timeid
integer:: rain_timesize
double precision, dimension(:), allocatable:: rain_time
double precision, dimension(:,:), allocatable:: rain

7
8
9
10
11
12
13
14

! Open CGNS filecall cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

15
16
17
18

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

19
20
21
22

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)

23
24
25

! Allocate memory for loading the grid
allocate(grid_x(isize,jsize), grid_y(isize,jsize))! Read the grid into memory
call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)

26
27
28
29
30

if (ier /=0) STOP "*** No grid data ***"! (Output)
print *, 'grid x,y: isize, jsize=', isize, jsize
do i = 1, min(isize,5)do j = 1, min(jsize,5)print *, ' (',i,',',j,')=(',grid_x(i,j),',',grid_y(i,j),')'
end doend do

31
32
33
34
35
36
37
38
39

! Allocate memory for elevation attribute values that are defined for grid nodes.
allocate(elevation(isize, jsize))! Read the attribute values.
call cg_iric_read_grid_real_node_f('Elevation', elevation, ier)
print *, 'Elevation: isize, jsize=', isize, jsize
do i = 1, min(isize,5)do j = 1, min(jsize,5)print *, ' (',i,',',j,')=(',elevation(i,j),')'
end doend do

40
41
42
43
44
45
46
47
48
49
50
51
˓→
52
53
54
55
56
57
58
59
60
61
62

! Allocate memory for the obstacle attribute that is defined for cells. The size is(isize-1) * (jsize-1) since it is cell attribute.
allocate(obstacle(isize-1, jsize-1))! Read the attribute values in.
call cg_iric_read_grid_integer_cell_f('Obstacle', obstacle, ier)
print *, 'Obstacle: isize -1, jsize-1=', isize-1, jsize-1
do i = 1, min(isize-1,5)
do j = 1, min(jsize-1,5)
print *, ' (',i,',',j,')=(',obstacle(i,j),')'
end doend do! Read the number of times for Raincall cg_iric_read_grid_functionaltimesize_f('Rain', rain_timesize);(continues on next page)

6.4. Overview

103

iRIC Developer’s manual, Release 3.0.0(continued from previous page)! Allocate memory for time values of Rainallocate(rain_time(rain_timesize))

63
64
65
66
˓→
67
68
69
70
71
72
73
74
75

! Allocate memory for the rain attribute that is defined for cells. The size is(isize-1) * (jsize-1) since it is cell attribute. allocate(rain(isize-1, jsize-1))! Read the attribute at Time = 1
rain_timeid = 1
call cg_iric_read_grid_functional_real_cell_f('Rain', rain_timeid, rain, ier)
print *, 'Rain: isize -1, jsize-1=', isize-1, jsize-1
do i = 1, min(isize-1,5)
do j = 1, min(jsize-1,5)
print *, ' (',i,',',j,')=(',rain(i,j),')'
end doend do76
77
78! Deallocate memory that has been allocateddeallocate(grid_x, grid_y, elevation, obstacle, rain_time, rain)

79
80
81
82
83

! Close CGNS filecall cg_close_f(fin, ier)stop
end program Sample3

Processing for a three-dimensional grid can be described in the same manner.

6.4.7 Reading boundary conditions
Reads boundary conditions from CGNS file.
Table 6.8: Subroutine to use
Subroutine
Remarks
cg_iric_read_bc_count_f
Reads the number of boundary condition
cg_iric_read_bc_indicessize_f
Reads the number of nodes (or cells) where boundary condition is assigned.
cg_iric_read_bc_indices_f
Reads the indices of nodes (or cells) where boundary condition is assigned.
cg_iric_read_bc_integer_f
Reads a integer boundary condition value
cg_iric_read_bc_real_f
Reads a double-precision real boundary condition value
cg_iric_read_bc_realsingle_f
Reads a single-precision real boundary condition value
cg_iric_read_bc_string_f
Reads a string-type boundary condition value
cg_iric_read_bc_functionalsize_f
Reads a functional-type boundary condition value
cg_iric_read_bc_functional_f
Reads a functional-type boundary condition value
cg_iric_read_bc_functionalwithname_f Reads a functional-type boundary condition value (with multiple values)
You can define multiple boundary conditions with the same type, to one grid. For example, you can define multiple
inflows to a grid, and set discharge value for them independently.
List 6.7 shows an example to read boundary conditions. In this example the number of inflows is read by
cg_iric_read_bc_count_f first, memories are allocated, and at last, the values are loaded.
The name of boundary condition user specifys on iRIC GUI can be loaded using cg_iric_read_bc_string_f. Pleaserefer to 6.4.48 for detail.

104

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

List 6.7: Example of source code to read boundary conditions
1
2
3

program Sample8
implicit none
include 'cgnslib_f.h'4

integer:: fin, ier, isize, jsize, ksize, i, j, k, aret
integer:: condid, indexid
integer:: condcount, indexlenmax, funcsizemax
integer:: tmplen
integer, dimension(:), allocatable:: condindexlen
integer, dimension(:,:,:), allocatable:: condindicesinteger, dimension(:), allocatable:: intparam
double precision, dimension(:), allocatable:: realparamcharacter(len=200), dimension(:), allocatable:: stringparamcharacter(len=200):: tmpstr
integer, dimension(:), allocatable:: func_size
double precision, dimension(:,:), allocatable:: func_param;
double precision, dimension(:,:), allocatable:: func_value;

5
6
7
8
9
10
11
12
13
14
15
16
17
18

! Opens CGNS filecall cg_open_f('bctest.cgn', CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

19
20
21
22

! Initializes iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

23
24
25
26

! Reads the number of inflows
call cg_iric_read_bc_count_f('inflow', condcount)! Allocate memory to load parameters
allocate(condindexlen(condcount), intparam(condcount), realparam(condcount))
allocate(stringparam(condcount), func_size(condcount))
print *, 'condcount ', condcount

27
28
29
30
31
32
33
34

! Reads the number of grid node indices where boundary condition is assigned, andthe size of functional-type condition.
indexlenmax = 0
funcsizemax = 0
do condid = 1, condcountcall cg_iric_read_bc_indicessize_f('inflow', condid, condindexlen(condid), ier)
if (indexlenmax < condindexlen(condid)) thenindexlenmax = condindexlen(condid)
end ifcall cg_iric_read_bc_functionalsize_f('inflow', condid, 'funcparam', func_
˓→size(condid), ier);
if (funcsizemax < func_size(condid)) thenfuncsizemax = func_size(condid)
end ifend do

˓→
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
50
51
52
53

! Allocates memory to load grid node indices and functional-type boundary condition
allocate(condindices(condcount, 2, indexlenmax))
allocate(func_param(condcount, funcsizemax), func_value(condcount, funcsizemax))! Loads indices and boundary condition
do condid = 1, condcountcall cg_iric_read_bc_indices_f('inflow', condid, condindices(condid:condid,:,:),
˓→ier)(continues on next page)

6.4. Overview

105

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
54

55

56
57
58

59

call cg_iric_read_bc_integer_f('inflow', condid, 'intparam',
˓→intparam(condid:condid), ier)
call cg_iric_read_bc_real_f('inflow', condid, 'realparam',
˓→realparam(condid:condid), ier)
call cg_iric_read_bc_string_f('inflow', condid, 'stringparam', tmpstr, ier)
stringparam(condid) = tmpstr
call cg_iric_read_bc_functional_f('inflow', condid, 'funcparam', func_
˓→param(condid:condid,:), func_value(condid:condid,:), ier)end do

60
61
62
63
64
65
66
67
68
69
70
71

! Displays the boundary condition loaded.
do condid = 1, condcountdo indexid = 1, condindexlen(condid)
print *, 'condindices ', condindices(condid:condid,:,indexid:indexid)
end doprint *, 'intparam ', intparam(condid:condid)
print *, 'realparam ', realparam(condid:condid)
print *, 'stringparam ', stringparam(condid)
print *, 'funcparam X ', func_param(condid:condid, 1:func_size(condid))print *, 'funcparam Y ', func_value(condid:condid, 1:func_size(condid))end do

72
73
74
75
76

! Closes CGNS filecall cg_close_f(fin, ier)stop
end program Sample8

6.4.8 Reading geographic data
Reads geographic data that was imported into project and used for grid generation.
This function is used when you want to read river survey data or polygon data in solvers directly. The procedure of
reading geographic data is as follows:
1. Reads the number of geographic data, the file name of geographic data etc. from CGNS file.
2. Open geographic data file and read data from that.

106

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Table 6.9: Subroutine to use
Subroutine
Remarks
cg_iric_read_geo_count_f
Reads the number of geographic data
cg_iric_read_geo_filename_f
Reads the file name and data type of geographic data
iric_geo_polygon_open_f
Opens the geographic data file that contains polygon data
iric_geo_polygon_read_integervalue_f
Reads the value of polygon data as integer
iric_geo_polygon_read_realvalue_f
Reads the value of polygon datas double precision real
iric_geo_polygon_read_pointcount_f
Reads the number of polygon vertices
iric_geo_polygon_read_points_f
Reads the coorinates of polygon vertices
iric_geo_polygon_read_holecount_f
Reads the number of holes in the polygon
iric_geo_polygon_read_holepointcount_f
Reads the number of vertices of hole polygon
iric_geo_polygon_read_holepoints_f
Reads the coordinates of hole polygon vertices
iric_geo_polygon_close_f
Closes the geographic data fileiric_geo_riversurvey_open_f
Opens the geographic data file that contains river survey data
iric_geo_riversurvey_read_count_f
Reads the number of the crosssections in river survey data
iric_geo_riversurvey_read_position_f
Reads the coordinates of the crosssection center point
iric_geo_riversurvey_read_direction_f
Reads the direction of the crosssection as normalized vector
iric_geo_riversurvey_read_name_f
Reads the name of the crosssection as string
iric_geo_riversurvey_read_realname_f
Reads the name of the crosssection as real number
iric_geo_riversurvey_read_leftshift_f
Reads the shift offset value of the crosssection
iric_geo_riversurvey_read_altitudecount_f
Reads the number of altitude data of the crosssection
iric_geo_riversurvey_read_altitudes_f
Reads the altitude data of the crosssection
iric_geo_riversurvey_read_fixedpointl_f
Reads the data of left bank extension line of the crosssection
iric_geo_riversurvey_read_fixedpointr_f
Reads the data of right bank extension line of the crosssection
iric_geo_riversurvey_read_watersurfaceelevation_f Reads the water elevation at the crosssection
iric_geo_riversurvey_close_f
Closes the geographic data file
List 6.8 shows an example of reading polygon. List 6.9 shows an example of reading river survey data.
List 6.8: Example source code of reading polygon
1
2
3
4
5
6

program TestPolygon
implicit none
include 'cgnslib_f.h'include 'iriclib_f.h'
integer:: fin, ier
integer:: icount, istatus

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

integer:: geoid
integer:: elevation_geo_countcharacter(len=1000):: filename
integer:: geotype
integer:: polygonid
double precision:: polygon_value
integer:: region_pointcountdouble precision, dimension(:), allocatable:: region_pointx
double precision, dimension(:), allocatable:: region_pointy
integer:: hole_id
integer:: hole_countinteger:: hole_pointcountdouble precision, dimension(:), allocatable:: hole_pointx
double precision, dimension(:), allocatable:: hole_pointy

22(continues on next page)

6.4. Overview

107

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
23
24
25
26

! Opens CGNS filecall cg_open_f("test.cgn", CG_MODE_MODIFY, fin, ier)
if (ier /=0) stop "*** Open error of CGNS file ***"

27
28
29

! Initializes iRIClib
call cg_iric_init_f(fin, ier)

30
31
32

! Reads the number or geographic data
call cg_iric_read_geo_count_f("Elevation", elevation_geo_count, ier)

33
34
35
36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52
53

54
55
56
57

58
59
60
61
62
63
64
65

do geoid = 1, elevation_geo_countcall cg_iric_read_geo_filename_f('Elevation', geoid, &filename, geotype, ier)if (geotype .eq. iRIC_GEO_POLYGON) thencall iric_geo_polygon_open_f(filename, polygonid, ier)
call iric_geo_polygon_read_realvalue_f(polygonid, polygon_value, ier)
print *, polygon_value
call iric_geo_polygon_read_pointcount_f(polygonid, region_pointcount, ier)
allocate(region_pointx(region_pointcount))
allocate(region_pointy(region_pointcount))call iric_geo_polygon_read_points_f(polygonid, region_pointx, region_pointy,
˓→ier)
print *, 'region_x: ', region_pointx
print *, 'region_y: ', region_pointy
deallocate(region_pointx)
deallocate(region_pointy)
call iric_geo_polygon_read_holecount_f(polygonid, hole_count, ier)
print *, 'hole count: ', hole_countdo hole_id = 1, hole_countprint *, 'hole ', hole_id
call iric_geo_polygon_read_holepointcount_f(polygonid, hole_id, hole_
˓→pointcount, ier)
print *, 'hole pointcount: ', hole_pointcountallocate(hole_pointx(hole_pointcount))
allocate(hole_pointy(hole_pointcount))call iric_geo_polygon_read_holepoints_f(polygonid, hole_id, hole_pointx, hole_
˓→pointy, ier)
print *, 'hole_x: ', hole_pointx
print *, 'hole_y: ', hole_pointy
deallocate(hole_pointx)
deallocate(hole_pointy)
end docall iric_geo_polygon_close_f(polygonid, ier)
end ifend do

66
67
68
69
70

! Closes CGNS filecall cg_close_f(fin, ier)stop
end program TestPolygon

List 6.9: Example source code of reading river survey data
1
2

program TestRiverSurvey
implicit none(continues on next page)

108

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)3
4
5
6

include 'cgnslib_f.h'include 'iriclib_f.h'
integer:: fin, ier
integer:: icount, istatus

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

integer:: geoid
integer:: elevation_geo_countcharacter(len=1000):: filename
integer:: geotype
integer:: rsid
integer:: xsec_countinteger:: xsec_id
character(len=20):: xsec_namedouble precision:: xsec_x
double precision:: xsec_y
integer:: xsec_set
integer:: xsec_index
double precision:: xsec_leftshift
integer:: xsec_altid
integer:: xsec_altcountdouble precision, dimension(:), allocatable:: xsec_altpos
double precision, dimension(:), allocatable:: xsec_altheight
integer, dimension(:), allocatable:: xsec_altactive
double precision:: xsec_wse

27
28
29
30

! Opens CGNS filecall cg_open_f("test.cgn", CG_MODE_MODIFY, fin, ier)
if (ier /=0) stop "*** Open error of CGNS file ***"

31
32
33

! Initializes iRIClib
call cg_iric_init_f(fin, ier)

34
35
36

! Reads the number or geographic data
call cg_iric_read_geo_count_f("Elevation", elevation_geo_count, ier)

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

54
55
56
57
58

do geoid = 1, elevation_geo_countcall cg_iric_read_geo_filename_f('Elevation', geoid, &filename, geotype, ier)if (geotype .eq. iRIC_GEO_RIVERSURVEY) thencall iric_geo_riversurvey_open_f(filename, rsid, ier)
call iric_geo_riversurvey_read_count_f(rsid, xsec_count, ier)
do xsec_id = 1, xsec_countcall iric_geo_riversurvey_read_name_f(rsid, xsec_id, xsec_name, ier)
print *, 'xsec ', xsec_namecall iric_geo_riversurvey_read_position_f(rsid, xsec_id, xsec_x, xsec_y, ier)
print *, 'position: ', xsec_x, xsec_y
call iric_geo_riversurvey_read_direction_f(rsid, xsec_id, xsec_x, xsec_y, ier)
print *, 'direction: ', xsec_x, xsec_y
call iric_geo_riversurvey_read_leftshift_f(rsid, xsec_id, xsec_leftshift, ier)
print *, 'leftshift: ', xsec_leftshiftcall iric_geo_riversurvey_read_altitudecount_f(rsid, xsec_id, xsec_altcount,
˓→ier)
print *, 'altitude count: ', xsec_altcountallocate(xsec_altpos(xsec_altcount))
allocate(xsec_altheight(xsec_altcount))
allocate(xsec_altactive(xsec_altcount))call iric_geo_riversurvey_read_altitudes_f( &(continues on next page)

6.4. Overview

109

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

rsid, xsec_id, xsec_altpos, xsec_altheight, xsec_altactive, ier)
do xsec_altid = 1, xsec_altcountprint *, 'Altitude ', xsec_altid, ': ', &xsec_altpos(xsec_altid:xsec_altid), ', ', &xsec_altheight(xsec_altid:xsec_altid), ', ', &xsec_altactive(xsec_altid:xsec_altid)
end dodeallocate(xsec_altpos, xsec_altheight, xsec_altactive)
call iric_geo_riversurvey_read_fixedpointl_f( &rsid, xsec_id, xsec_set, xsec_x, xsec_y, xsec_index, ier)
print *, 'FixedPointL: ', xsec_set, xsec_x, xsec_y, xsec_index
call iric_geo_riversurvey_read_fixedpointr_f( &rsid, xsec_id, xsec_set, xsec_x, xsec_y, xsec_index, ier)
print *, 'FixedPointR: ', xsec_set, xsec_x, xsec_y, xsec_index
call iric_geo_riversurvey_read_watersurfaceelevation_f( &rsid, xsec_id, xsec_set, xsec_wse, ier)
print *, 'WaterSurfaceElevation: ', xsec_set, xsec_wse
end docall iric_geo_riversurvey_close_f(rsid, ier)
end ifend do

80
81
82
83
84

! Closes CGNS filecall cg_close_f(fin, ier)stop
end program TestRiverSurvey

6.4.9 Outputting calculation grids
Outputs the calculation grid to the CGNS file.
Unlike ordinary solvers that simply read calculation grids from the CGNS file, these subroutines are to be used in aparticular kind of solver in which a grid is created on the solver side or a three-dimensional grid is generated from a
two-dimensional grid.
Grid creating program always uses these subroutines.
The subroutines here should be used when a solver output the grid in the initial state. When you want to output thegrid shape modified after starting calculation, use the subroutines described in Outputting calculation grids (only inthe case of a moving grid) (page 113).
Table 6.10: Subroutines to use
Subroutine
Remarks
cg_iric_writegridcoord1d_f
Outputs a one-dimensional structured grid
cg_iric_writegridcoord2d_f
Outputs a two-dimensional structured grid
cg_iric_writegridcoord3d_f
Outputs a three-dimensional structured grid
cg_iric_write_grid_real_node_f
Outputs a grid node attribute with real number value
cg_iric_write_grid_integer_node_f Outputs a grid node attribute with integer value
cg_iric_write_grid_real_cell_f
Outputs a grid cell attribute with real number value
cg_iric_write_grid_integer_cell_f
Outputs a grid cell attribute with integer value
List 6.10 shows an example of the procedure of reading a two-dimensional grid, dividing it to generate a threedimensional grid, and then outputting the resulting grid.

110

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

List 6.10: Example of source code to output a grid1
2
3

program Sample7
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10

integer:: fin, ier, isize, jsize, ksize, i, j, k, aret
double precision:: time
double precision:: convergence
double precision, dimension(:,:), allocatable::grid_x, grid_y, elevation
double precision, dimension(:,:,:), allocatable::grid3d_x, grid3d_y, grid3d_z
double precision, dimension(:,:,:), allocatable:: velocity, density

11
12
13
14

! Open CGNS file.
call cg_open_f('test3d.cgn', CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

15
16
17
18

! Initialize iRIClib.
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

19
20
21
22
23
24
25
26

! Check the grid size.
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid.
allocate(grid_x(isize,jsize), grid_y(isize,jsize), elevation(isize,jsize))! Read the grid into memory.
call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)
call cg_iric_read_grid_real_node_f('Elevation', elevation, ier)

27
28
29

! Generate a 3D grid from the 2D grid that has been read in.
! To obtain a 3D grid, the grid is divided into 5 __________ with a depth of 5.

30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

ksize = 6
allocate(grid3d_x(isize,jsize,ksize), grid3d_y(isize,jsize,ksize), grid3d_z(isize,
˓→jsize,ksize))
allocate(velocity(isize,jsize,ksize), STAT = aret)
print *, aret
allocate(density(isize,jsize,ksize), STAT = aret)
print *, aret
do i = 1, isize
do j = 1, jsize
do k = 1, ksize
grid3d_x(i,j,k) = grid_x(i,j)
grid3d_y(i,j,k) = grid_y(i,j)
grid3d_z(i,j,k) = elevation(i,j) + (k - 1)
velocity(i,j,k) = 0
density(i,j,k) = 0
end doend doend do! Output the generated 3D gridcall cg_iric_writegridcoord3d_f(isize, jsize, ksize, grid3d_x, grid3d_y, grid3d_z,
˓→ier)

50
51
52
53

! Output the initial state information
time = 0
convergence = 0.1(continues on next page)

6.4. Overview

111

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
54
55
56
57
58
59
60

call cg_iric_write_sol_time_f(time, ier)
! Output the grid.
call cg_iric_write_sol_gridcoord3d_f(grid3d_x, grid3d_y, grid3d_z, ier)
! Output calculation results.
call cg_iric_write_sol_real_f('Velocity', velocity, ier)
call cg_iric_write_sol_real_f('Density', density, ier)
call cg_iric_write_sol_baseiterative_real_f ('Convergence', convergence, ier)

61
62
63
64
65
66
67
68
69
70
71
72

do
time = time + 10.0
! (Perform calculation here. The grid shape also changes.)call cg_iric_write_sol_time_f(time, ier)
! Output the grid.
call cg_iric_write_sol_gridcoord3d_f(grid3d_x, grid3d_y, grid3d_z, ier)
! Output calculation results.
call cg_iric_write_sol_real_f('Velocity', velocity, ier)
call cg_iric_write_sol_real_f('Density', density, ier)
call cg_iric_write_sol_baseiterative_real_f ('Convergence', convergence, ier)

73
74
75

If (time > 100) exit
end do

76
77
78
79
80

! Close CGNS file.
call cg_close_f(fin, ier)stop
end program Sample7

6.4.10 Outputting time (or iteration count)Outputs the timestamp information or the iteration count to the CGNS file.
Be sure to perform this before outputting the calculation grid or calculation results.
Also note that the time and iteration-count information cannot be output at the same time. Output either, not both.
Table 6.11: Subroutines to use
Subroutine
Remarks
cg_iric_write_sol_time_f
Outputs time
cg_iric_write_sol_iteration_f Outputs iteration count
List 6.11 shows an example of source code to output timestamp information.
List 6.11: Example of source code to output time1
2
3

program Sample4
implicit none
include 'cgnslib_f.h'456integer:: fin, ier, idouble precision:: time

78
9

! Open CGNS file.
call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier)(continues on next page)

112

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)10

if (ier /=0) STOP "*** Open error of CGNS file ***"

11
12
13
14

! Initialize iRIClib.
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

15
16
17

! Output the initial state information.
time = 018
1920

call cg_iric_write_sol_time_f(time, ier)
! (Here, output initial calculation grid or calculation results.)

21
22
23
24
25
26
27
28

do
time = time + 10.0
! (Perform calculation here.)call cg_iric_write_sol_time_f(time, ier)
! (Here, output calculation grid or calculation results.)
If (time > 1000) exit
end do

29
30
31
32
33

! Close CGNS file.
call cg_close_f(fin, ier)stop
end program Sample4

6.4.11 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) (page 112).
The subroutines described in this section should be used for outputting a calculation grid only when the grid shape ischanged in the course of calculation. When outputting a grid in the following cases, use the subroutines described in
Outputting calculation grids (page 110).
• 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
Table 6.12: Subroutines to use
Subroutine
Remarks
cg_iric_write_sol_gridcoord2d_f Outputs a two-dimensional structured grid
cg_iric_write_sol_gridcoord3d_f Outputs a three-dimensional structured grid
List 6.12 shows an example of outputting a two-dimensional structured grid after starting calculation.

6.4. Overview

113

iRIC Developer’s manual, Release 3.0.0

List 6.12: Example of source code to output grids after starting calculation
1
2
3

program Sample5
implicit none
include 'cgnslib_f.h'

4
5
6
7

integer:: fin, ier, isize, jsize
double precision:: time
double precision, dimension(:,:), allocatable:: grid_x, grid_y

8
9
10
11

! Open CGNS file.
call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

12
13
14
15

! Initialize iRIClib.
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

16
17
18
19
20
21
22

! Check the grid size.
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid.
allocate(grid_x(isize,jsize), grid_y(isize,jsize))! Read the grid into memory.
call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)

23
24
25

! Output the initial state information.
time = 0

26
27
28
29

call cg_iric_write_sol_time_f(time, ier)
! Output the grid.
call cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, ier)

30
31
32
33
34
35
36
37

do
time = time + 10.0
! (Perform calculation here.)call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, ier)
If (time > 1000) exit
end do

38
39
40
41
42

! Close CGNS filecall cg_close_f(fin, ier)stop
end program Sample5

6.4.12 Outputting calculation results
Outputs the calculation results to the CGNS file.
The calculation result types that iRIClib can output are as follows:• One value for each time step
• Value defined at grid nodes• Value defined at grid cells

114

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0• Value defined at grid edges• Value defined at particles• Value defined at particles (groups supported)• Value defined at polygon or polydata
In case of outputting every types, you have to use the functions in Table 6.13 and Table 6.14.
Please refer to One value for each time step (page 116) to Value defined at polygons or polylines (page 125) for detailed
procedure to output each types.
Table 6.13: Subroutines to use before and after outputting calculation
result for each timestep
Subroutine
Remarks
iric_check_cancel_f
Checks whether user canceled solver execution
iric_check_lock_f
Checks whether the CGNS file is locked by GUI
iric_write_sol_start_f Inform the GUI that the solver started outputting result
iric_write_sol_end_f
Inform the GUI that the solver finished outputting result
cg_iric_flush_f
Flush calculation result into CGNS file

Table 6.14: Subroutines to output time and iteration count
Subroutine
Remarks
cg_iric_write_sol_time_f
Outputs time
cg_iric_write_sol_iteration_f Outputs iteration countNote: Vector quantities and scalar quantities
In iRIClib, the same subroutines are used to output vector quantities and scalar quantities.
When outputting vector quantities, output each component with names like “VelocityX” and “VelocityY”.
Please note that if you use names whose last character is “X”, “Y”, or “Z”, the value is not loaded properly by GUI,and user can not visualize the value. You can use lower case letters “x”, “y”, or “z” instead.

Note: Special names for calculation results
For calculation results, iRIC defines special names, and when you want to output calculation result for certain purposes,
you should use those names. Refer to Calculation results (page 219) for those names.

Note: Grid nodes, grid cells, and grid edges
For grid related values, now iRIClib has function to output values defined at grid nodes, grid cells and grid edges.
Basically, please select the functions so that you can output the values at the position where the variable is defined inyour solver.
There is an exception: Please output vector quantities at grid nodes. If you output vector quantities at grid cells, iRIC
GUI can not visualize arrows, streamlines or particles for that value.

6.4. Overview

115

iRIC Developer’s manual, Release 3.0.0

One value for each time step
When you output one value for each time step, please use the functions in Table 6.15.
List 6.13 shows an example of the process to output value for each time step.
Table 6.15: 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 6.13: Example source code (One value for each time step)
1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10
11

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision:: convergence
double precision, dimension(:,:), allocatable::grid_x, grid_ycharacter(len=20):: condFile

12
13

condFile = 'test.cgn'

14
15
16
17

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

18
19
20
21

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

22
23
24
25
26
27
28

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize,jsize), grid_y(isize,jsize))! Read the grid into memory
call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)

29
30
31
32
33
34
35
36
37

! Output the initial state information.
time = 0
convergence = 0.1
call cg_iric_write_sol_time_f(time, ier)
! Output calculation results
call cg_iric_write_sol_baseiterative_real_f('Convergence', convergence, ier)
dotime = time + 10.038

! (Perform calculation here)

39
40

call iric_check_cancel_f(canceled)41(continues on next page)

116

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)42

if (canceled == 1) exit

43
44
45
46
47
48
49

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_baseiterative_real_f('Convergence', convergence, ier)
call cg_iric_flush_f(condFile, fin, ier)
call iric_write_sol_end_f(condFile, ier)

50
51
52

if (time > 1000) exit
end do

53
54
55
56
57

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

Value defined at grid nodes
When you output value defined at grid nodes, please use the functions in Table 6.16.
List 6.14 shows an example of the process to output value defined at grid nodes.
Table 6.16: Subroutines to use for outputting result defined at grid nodes
Subroutine
Remarks
cg_iric_write_sol_integer_f Outputs integer-type calculation results, having a value for each grid node
cg_iric_write_sol_real_f
Outputs double-precision real-type calculation results, having a value for each grid
node
List 6.14: Example source code (Value defined at grid nodes)
1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10
11
12

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision, dimension(:,:), allocatable::grid_x, grid_y
double precision, dimension(:,:), allocatable:: velocity_x, velocity_y, depth
integer, dimension(:,:), allocatable:: wetflag
character(len=20):: condFile

13
14

condFile = 'test.cgn'

15
16
17
18

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

19
20
21
22

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

23

(continues on next page)

6.4. Overview

117

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
24
25
26
27
28
29

30
31

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize, jsize), grid_y(isize, jsize))! Allocate memory for calculation result
allocate(velocity_x(isize, jsize), velocity_y(isize, jsize), depth(isize, jsize),
˓→wetflag(isize, jsize))! Read the grid into memory
call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)

32
33
34
35
36
37
38
39
40
41

! Output the initial state information.
time = 0
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_real_f('VelocityX', velocity_x, ier)
call cg_iric_write_sol_real_f('VelocityY', velocity_y, ier)
call cg_iric_write_sol_real_f('Depth', depth, ier)
call cg_iric_write_sol_integer_f('Wet', wetflag, ier)
dotime = time + 10.042

! (Perform calculation here)

43
44

call iric_check_cancel_f(canceled)if (canceled == 1) exit

45
46
47

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_real_f('VelocityX', velocity_x, ier)
call cg_iric_write_sol_real_f('VelocityY', velocity_y, ier)
call cg_iric_write_sol_real_f('Depth', depth, ier)
call cg_iric_write_sol_integer_f('Wet', wetflag, ier)
call cg_iric_flush_f(condFile, fin, ier)
call iric_write_sol_end_f(condFile, ier)

48
49
50
51
52
53
54
55
56
57
58
59

if (time > 1000) exit
end do

60
61
62
63
64

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

Value defined at grid cells
When you output value defined at grid cells, please use the functions in Table 6.17.
List 6.15 shows an example of the process to output value defined at grid cells.
Table 6.17: Subroutines to use for outputting result defined at grid cells
Subroutine
Remarks
cg_iric_write_sol_cell_integer_f Outputs integer-type calculation results, having a value for each grid cell
cg_iric_write_sol_real_f
Outputs double-precision real-type calculation results, having a value for eachgrid cell

118

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

List 6.15: Example source code (Value defined at grid cells)
12
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10
11
12

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision, dimension(:,:), allocatable::grid_x, grid_y
double precision, dimension(:,:), allocatable:: depth
integer, dimension(:,:), allocatable:: wetflag
character(len=20):: condFile

13
14

condFile = 'test.cgn'

15
16
17
18

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

19
20
21
22

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

23
24
25
26
27
28
29
30
31

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize, jsize), grid_y(isize, jsize))! Allocate memory for calculation result
allocate(depth(isize - 1, jsize - 1), wetflag(isize - 1, jsize - 1))! Read the grid into memory
call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)

32
33
34
35
36
37
38
39
40
41

! Output the initial state information.
time = 0
convergence = 0.1
call cg_iric_write_sol_time_f(time, ier)
! Output calculation results
call cg_iric_write_sol_cell_real_f('Depth', depth, ier)
call cg_iric_write_sol_cell_integer_f('Wet', wetflag, ier)
dotime = time + 10.04243

! (Perform calculation here)

44
45
46

call iric_check_cancel_f(canceled)if (canceled == 1) exit

47
48
49
50
51
52
53
54

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_cell_real_f('Depth', depth, ier)
call cg_iric_write_sol_cell_integer_f('Wet', wetflag, ier)
call cg_iric_flush_f(condFile, fin, ier)
call iric_write_sol_end_f(condFile, ier)

55

(continues on next page)

6.4. Overview

119

iRIC Developer’s manual, Release 3.0.0(continued from previous page)56
57

if (time > 1000) exit
end do

58
59
60
61
62

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

Value defined at grid edges
When you output value defined at grid edges, please use the functions in Table 6.18.
List 6.16 shows an example of the process to output value defined at grid edges.
Table 6.18: 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 idirection
cg_iric_write_sol_iface_real_f Outputs double-precision real-type calculation results, having a value for each gridedge at i-direction
cg_iric_write_sol_jface_integer_f
Outputs integer-type calculation results, having a value for each grid edge at jdirection
cg_iric_write_sol_jface_real_f Outputs double-precision real-type calculation results, having a value for each gridedge at j-direction

List 6.16: Example source code (Value defined at grid cells)
12
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10
11

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision, dimension(:,:), allocatable::grid_x, grid_y
double precision, dimension(:,:), allocatable:: fluxi, fluxj
character(len=20):: condFile

12
13

condFile = 'test.cgn'

14
15
16
17

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

18
19
20
21

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

22
23
24
25
26

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize, jsize), grid_y(isize, jsize))(continues on next page)

120

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
27
28
29
30

! Allocate memory for calculation result
allocate(depth(isize - 1, jsize - 1), wetflag(isize - 1, jsize - 1))! Read the grid into memory
call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)

31
32
33
34
35
36
37
38
39
40

! Output the initial state information.
time = 0
convergence = 0.1
call cg_iric_write_sol_time_f(time, ier)
! Output calculation results
call cg_iric_write_sol_iface_real_f('FluxI', fluxi, ier)
call cg_iric_write_sol_jface_real_f('FluxJ', fluxj, ier)
dotime = time + 10.04142

! (Perform calculation here)

43
44
45

call iric_check_cancel_f(canceled)if (canceled == 1) exit

46
47
48
49
50
51
52
53

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_iface_real_f('FluxI', fluxi, ier)
call cg_iric_write_sol_jface_real_f('FluxJ', fluxj, ier)
call cg_iric_flush_f(condFile, fin, ier)
call iric_write_sol_end_f(condFile, ier)

54
55
56

if (time > 1000) exit
end do

57
58
59
60
61

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

Value defined at particles
When you output value defined at particles, please use the functions in Table 6.19.
List 6.17 shows an example of the process to output value defined at grid nodes.
Note: These functions are deprecatedWhen you want to output value defined at particles, we recommend that you use functions described at Value definedat particles (groups supported) (page 123). Using those new functions, you can output particles with multiple groups,
and you can visualize particles with different settings for color and size for each group.

6.4. Overview

121

iRIC Developer’s manual, Release 3.0.0

Table 6.19: Subroutines to use for outputting result defined at particles
Subroutine
Remarks
cg_iric_write_sol_particle_pos2d_f Outputs particle positions (two-dimensions)
cg_iric_write_sol_particle_pos3d_f Outputs particle positions (three-dimensions)
cg_iric_write_sol_particle_integer_fOutputs integer-type calculation results, giving a value for each particle.
cg_iric_write_sol_particle_real_f Outputs double-precision real-type calculation results, giving a value for eachparticle.
List 6.17: Example source code (Value defined at particles)
1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10
11
12
13

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision, dimension(:,:), allocatable::grid_x, grid_y
integer:: numparticles = 10
double precision, dimension(:), allocatable:: particle_x, particle_y
double precision, dimension(:), allocatable:: velocity_x, velocity_y, temperature
character(len=20):: condFile

14
15

condFile = 'test.cgn'

16
17
18
19

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

20
21
22
23

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

24
25
26
27
28
29
30
31

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize, jsize), grid_y(isize, jsize))! Allocate memory for calculation result
allocate(particle_x(numparticles), particle_y(numparticles))allocate(velocity_x(numparticles), velocity_y(numparticles),˓→temperature(numparticles))

32
33
34

! Read the grid into memory
call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier)

35
36
37
38
39
40
41
42
43
44

! Output the initial state information.
time = 0
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_particle_pos2d_f(numparticles, particle_x, particle_y, ier)
call cg_iric_write_sol_particle_real_f('VelocityX', velocity_x, ier)
call cg_iric_write_sol_particle_real_f('VelocityY', velocity_y, ier)
call cg_iric_write_sol_particle_real_f('Temperature', temperature, ier)
dotime = time + 10.045(continues on next page)

122

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)46! (Perform calculation here)

47
48
49

call iric_check_cancel_f(canceled)if (canceled == 1) exit

50
51
52
53
54
55
56
57
58
59

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_particle_pos2d_f(numparticles, particle_x, particle_y, ier)
call cg_iric_write_sol_particle_real_f('VelocityX', velocity_x, ier)
call cg_iric_write_sol_particle_real_f('VelocityY', velocity_y, ier)
call cg_iric_write_sol_particle_real_f('Temperature', temperature, ier)
call cg_iric_flush_f(condFile, fin, ier)
call iric_write_sol_end_f(condFile, ier)

60
61
62

if (time > 1000) exit
end do

63
64
65
66
67

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

Value defined at particles (groups supported)
When you output value defined at particles, please use the functions in Table 6.20.
Using the functions explained here, you can output multiple groups of particles. To output data please call
cg_iric_write_sol_particlegroup_groupbegin_f and cg_iric_write_sol_particlegroup_groupend_f, before and after
outputting data.
List 6.18 shows an example of the process to output value defined at particles.
Note: In functions explained here, data for one particle is output with each function call.

Table 6.20: Subroutines to use for outputting result defined at particles(groups supported)
Subroutine
Remarks
cg_iric_write_sol_particlegroup_groupbegin_fStart outputting calculation result defined at particles.
cg_iric_write_sol_particlegroup_groupend_f
Finish outputting calculation result defined at particles.
cg_iric_write_sol_particlegroup_pos2d_f Outputs particle positions (two-dimensions)
cg_iric_write_sol_particlegroup_pos3d_f Outputs particle positions (three-dimensions)
cg_iric_write_sol_particlegroup_integer_fOutputs integer-type calculation results, giving a value for each particle.
cg_iric_write_sol_particlegroup_real_f Outputs double-precision real-type calculation results, giving a value foreach particle.

List 6.18: Example source code (Value defined at particles (groups supported))1
2

program SampleProgram
implicit none(continues on next page)

6.4. Overview

123

iRIC Developer’s manual, Release 3.0.0(continued from previous page)3

include 'cgnslib_f.h'

4
5
6
7
8
9
10
11
12
13
14
15

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision, dimension(:,:), allocatable::grid_x, grid_y
integer:: numparticles = 10
double precision, dimension(:), allocatable:: particle_x, particle_y,double precision, dimension(:), allocatable:: velocity_x, velocity_y, temperature
integer:: iinteger:: status = 1
character(len=20):: condFile

16
17

condFile = 'test.cgn'

18
19
20
21

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

22
23
24
25

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

26
27
28
29
30
31
32
33

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize, jsize), grid_y(isize, jsize))! Allocate memory for calculation result.
allocate(particle_x(numparticles), particle_y(numparticles))allocate(velocity_x(numparticles), velocity_y(numparticles),˓→temperature(numparticles))

34
35
36

! Read the grid into memory
call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)

37
38
39
40

! Output the initial state information.
time = 0
call cg_iric_write_sol_time_f(time, ier)

41
42
43
44

45
46
47
48
49
50

call cg_iric_write_sol_particlegroup_groupbegin_f('driftwood', ier)
do i = 1, numparticles! (Input values to particle_x, particle_x, velocity_x, velocity_y, temperature
˓→here)call cg_iric_write_sol_particlegroup_pos2d_f(particle_x(i), particle_y(i), ier)
call cg_iric_write_sol_particlegroup_real_f('VelocityX', velocity_x(i), ier)
call cg_iric_write_sol_particlegroup_real_f('VelocityY', velocity_y(i), ier)
call cg_iric_write_sol_particlegroup_real_f('Temperature', temperature(i), ier)end docall cg_iric_write_sol_particlegroup_groupend_f(ier)

51
52
53

do
time = time + 10.054

! (Perform calculation here)

55
56

call iric_check_cancel_f(canceled)57(continues on next page)

124

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)58

if (canceled == 1) exit

59
60
61
62
63
64
65

66
67
68
69
70
71

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_particlegroup_groupbegin_f('driftwood', ier)
do i = 1, numparticles! (Input values to particle_x, particle_x, velocity_x, velocity_y, temperature
˓→here)call cg_iric_write_sol_particlegroup_pos2d_f(particle_x(i), particle_y(i), ier)
call cg_iric_write_sol_particlegroup_real_f('VelocityX', velocity_x(i), ier)
call cg_iric_write_sol_particlegroup_real_f('VelocityY', velocity_y(i), ier)
call cg_iric_write_sol_particlegroup_real_f('Temperature', temperature(i), ier)end docall cg_iric_write_sol_particlegroup_groupend_f(ier)

72
73
74

if (time > 1000) exit
end do

75
76
77
78
79

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

Value defined at polygons or polylines
When you output value defined at polygons or polylines, please use the functions in Table 6.21.
When outputting polygons or polylines, you can output multiple groups.
To output data please call
cg_iric_write_sol_polydata_groupbegin_f and cg_iric_write_sol_polydata_groupend_f, before and after outputting
data.
List 6.19 shows an example of the process to output value defined at polygons or polylines.
Note: In functions for outputting value defined at particles, all coordinates and values are output with one function
calls. But in case of polygons or polylines, data for only one polygon or polyline is output with each function call.

Note: The functions to output value defined at polygons or polylines support only two-dimension data.

Note: You can mix calculation result defined at polygons and polylines in one group.

Note: For polygons and polylines the scalar quantity value only is supported.

6.4. Overview

125

iRIC Developer’s manual, Release 3.0.0

Table 6.21: Subroutines to use for outputting result defined at polygons
or polylines
Subroutine
Remarks
cg_iric_write_sol_polydata_groupbegin_fStart outputting calculation result defined at polygons or polylines.
cg_iric_write_sol_polydata_groupend_f
Finish outputting calculation result defined at polygons or polylines.
cg_iric_write_sol_polydata_polygon_f
Output calculation result defined as polygon
cg_iric_write_sol_polydata_polyline_f
Output calculation result defined as polyline
cg_iric_write_sol_polydata_integer_fOutputs integer-type calculation results, giving a value for a polygon or polyline
cg_iric_write_sol_polydata_real_f Outputs double-precision real-type calculation results, giving a value for apolygon or polyline

List 6.19: Example source code (Value defined at polygons or polylines)
1
2
3

program SampleProgram
implicit none
include 'cgnslib_f.h'

4
5
6
7
8
9
10
11
12
13
14
15
16

integer:: fin, ier, isize, jsize
integer:: canceled
integer:: locked
double precision:: time
double precision, dimension(:,:), allocatable::grid_x, grid_y
integer:: numpolygons = 10
integer:: numpoints = 5
double precision, dimension(:), allocatable:: polydata_x, polydata_y,
double precision:: temperature = 26
integer:: iinteger:: status = 1
character(len=20):: condFile

17
18

condFile = 'test.cgn'

19
20
21
22

! Open CGNS filecall cg_open_f(condFile, CG_MODE_MODIFY, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

23
24
25
26

! Initialize iRIClib
call cg_iric_init_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

27
28
29
30
31
32
33
34
35

! Check the grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)
! Allocate memory for loading the grid
allocate(grid_x(isize, jsize), grid_y(isize, jsize))! Allocate memory for calculation result. Each polygon has five points.
allocate(polydata_x(numpoints), polydata_y(numpoints))! Read the grid into memory
call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier)

36
37
38
39

! Output the initial state information.
time = 0
call cg_iric_write_sol_time_f(time, ier)

40
41

call cg_iric_write_sol_polydata_groupbegin_f('fish', ier)(continues on next page)

126

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
42
43
44
45
46
47
48

do i = 1, numpolygons! (Specify values for polydata_x, polydata_y, temperature, status)
call cg_iric_write_sol_polydata_polygon_f(numpoints, polydata_x, polydata_y, ier)
call cg_iric_write_sol_polydata_real_f('Temperature', temperature, ier)
call cg_iric_write_sol_polydata_integer_f('Status', status, ier)end docall cg_iric_write_sol_polydata_groupend_f(ier)

49
50
51

do
time = time + 10.0

52
53

! (Perform calculation here)

54
55
56

call iric_check_cancel_f(canceled)if (canceled == 1) exit

57
58
59
60
61
62
63
64

65
66
67
68

! Output calculation results
call iric_write_sol_start_f(condFile, ier)
call cg_iric_write_sol_time_f(time, ier)
call cg_iric_write_sol_polydata_groupbegin_f('fish', ier)
do i = 1, numpolygons! (Specify values for polydata_x, polydata_y, temperature, status)
call cg_iric_write_sol_polydata_polygon_f(numpoints, polydata_x, polydata_y,
˓→ier)
call cg_iric_write_sol_polydata_real_f('Temperature', temperature, ier)
call cg_iric_write_sol_polydata_integer_f('Status', status, ier)end docall cg_iric_write_sol_polydata_groupend_f(ier)

69
70
71

if (time > 1000) exit
end do

72
73
74
75
76

! Close CGNS filecall cg_close_f(fin, ier)stop
end program SampleProgram

6.4.13 Reading calculation result
Read calculation result from CGNS files.

6.4. Overview

127

iRIC Developer’s manual, Release 3.0.0

Table 6.22: Subroutines to use
Subroutine
Remarks
cg_iric_read_sol_count_f
Reads the number of calculation result
cg_iric_read_sol_time_f
Reads the time value
cg_iric_read_sol_iteration_f
Reads the loop iteration value
cg_iric_read_sol_baseiterative_integer_f
Reads the integer-type calculation result value
cg_iric_read_sol_baseiterative_real_f Reads the double-precision real-type calculation result value
cg_iric_read_sol_gridcoord2d_f
Reads the 2D structured grid (for moving grid calculation)
cg_iric_read_sol_gridcoord3d_f
Reads the 3D structured grid (for moving grid calculation)
cg_iric_read_sol_integer_f
Reads the integer-type calculation result, having a value for each grid node
cg_iric_read_sol_real_f
Reads the double-precision real-type calculation result, having a value foreach grid node
cg_iric_read_sol_cell_integer_f
Reads the integer-type calculation result, having a value for each grid cell
cg_iric_read_sol_cell_real_f
Reads the double-precision real-type calculation result, having a value foreach grid cell
List 6.20 shows an example of reading caluculation result from CGNS file, and output to standard output.
List 6.20: Example of reading calculation result12
3

program SampleX
implicit none
include 'cgnslib_f.h'456integer:: fin, ier, isize, jsize, solid, solcount, iter, i, j
double precision, dimension(:,:), allocatable::grid_x, grid_y, result_real

7
8
9
10

! Opening CGNS filecall cg_open_f('test.cgn', CG_MODE_READ, fin, ier)
if (ier /=0) STOP "*** Open error of CGNS file ***"

11
12
13
14

! Initializing internal variables
call cg_iric_initread_f(fin, ier)
if (ier /=0) STOP "*** Initialize error of CGNS file ***"

15
16
17

! Reads grid size
call cg_iric_gotogridcoord2d_f(isize, jsize, ier)

18
19
20
21

! Allocate memory for reading calculation result
allocate(grid_x(isize,jsize), grid_y(isize,jsize))
allocate(result_real(isize, jsize))

22
23
24
25
26
27
28

! Reads calculation result, and output to standard output.
call cg_iric_read_sol_count_f(solcount, ier)
do solid = 1, solcountcall cg_iric_read_sol_iteration_f(solid, iter, ier)
call cg_iric_read_sol_gridcoord2d_f(solid, grid_x, grid_y, ier)
call cg_iric_read_sol_real_f(solid, 'result_real', result_real, ier)

29
30
31
32
33
34

print *, 'iteration: ', iter
print *, 'grid_x, grid_y, result: 'do i = 1, isize
do j = 1, jsize
print *, '(', i, ', ', j, ') = (', grid_x(i, j), ', ', grid_y(i, j), ', ',˓→result_real(i, j), ')'(continues on next page)

128

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0(continued from previous page)
35
36
37

end doend doend do

38
39
40
41
42

! Closing CGNS filecall cg_close_f(fin, ier)stop
end program SampleX

The functions are used in calculation analysis program (See Steps of developing a calculation result analysis program(page 31)).

6.4.14 Outputting Error code
Outputs error code to CGNS files. It is used only in grid generating programs.
Table 6.23: Subroutines to use
Subroutine
Remarks
cg_iric_write_errorcode_f Outputs error code

6.4.15 Closing a CGNS file
Closes the CGNS file that has been opened by cg_open_f. The subroutine is defined in cgnslib.
Table 6.24: Subroutines to use
Subroutine Remarks
cg_close_f
Closes the CGNS file

6.5 Reference
In this section, functions, formats, arguments of each function is explained.
In each page for functions, the data type of arguments are described for FORTRAN. For data type of arguments in
C/C++ and Python, please refer to Table 6.25.
Please note that in Python, ier (that stores the error code) is not output, and exception is thrown instead, if error occurs.
To impelement error handling, please use try-except expression.
Table 6.25: Relathionship between argument data type
FORTRAN
C/C++
Pythonintegerint (int* for output)
int
double precision
double (double* for output) float
real
float (float* for output)–
character(*)
char*
str
integer, dimension(:), allocatableint*
numpy.ndarray(dtype=int32)
double precision, dimension(:), allocatable double*
numpy.ndarray(dtype=float64)
real, dimension(:), allocatablefloat*–

6.5. Reference

129

iRIC Developer’s manual, Release 3.0.0

6.5.1 List of subroutines
The table below shows a list of subroutines and their classifications.

Classification
Opening a CGNS file
Initializing iRIClib
Initializing iRIClib
Setting up options
Reading the calculation conditions
Reading the calculation conditions
Reading the calculation conditions
Reading the calculation conditions
Reading the calculation conditions
Reading the calculation conditions
Reading the calculation conditions
Reading the calculation conditions
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading a calculation grid
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions

130

Table 6.26: List of iRIClib subroutin
Name
Description
cg_open_f
Opens a CGNS
cg_iric_init_f
Initializes the C
cg_iric_initread_f
Initializes the C
cg_initoption_f
Set up solver o
cg_iric_read_integer_f
Gets the value
cg_iric_read_real_f
Gets the value
cg_iric_read_realsingle_f
Gets the value
cg_iric_read_string_f
Gets the value
cg_iric_read_functionalsize_f
Gets the size of
cg_iric_read_functional_f
Gets the value
cg_iric_read_functional_realsingle_f
Gets the value
cg_iric_read_functionalwithname_f
Gets the value
cg_iric_gotogridcoord2d_f
Makes prepara
cg_iric_gotogridcoord3d_f
Makes prepara
cg_iric_getgridcoord2d_f
Reads the x and
cg_iric_getgridcoord3d_f
Reads the x, y
cg_iric_read_grid_integer_node_f
Reads the integ
cg_iric_read_grid_real_node_f
Reads double-p
cg_iric_read_grid_integer_cell_f
Reads the integ
cg_iric_read_grid_real_cell_f
Reads the doubcg_iric_read_complex_count_f
Reads the num
cg_iric_read_complex_integer_f
Reads the integ
cg_iric_read_complex_real_f
Reads the doubcg_iric_read_complex_realsingle_f
Reads the singl
cg_iric_read_complex_string_f
Reads the strin
cg_iric_read_complex_functionalsize_f
Checks the size
cg_iric_read_complex_functional_f
Reads function
cg_iric_read_complex_functionalwithname_f
Reads function
cg_iric_read_complex_functional_realsingle_f
Reads function
cg_iric_read_grid_complex_node_f
Reads the comp
cg_iric_read_grid_complex_cell_f
Reads the comp
cg_iric_read_grid_functionaltimesize_f
Reads the num
cg_iric_read_grid_functionaltime_f
Reads the value
cg_iric_read_grid_functionaldimensionsize_f
Reads the num
cg_iric_read_grid_functionaldimension_integer_f
Reads the value
cg_iric_read_grid_functionaldimension_real_f
Reads the value
cg_iric_read_grid_functional_integer_node_f
Reads the value
cg_iric_read_grid_functional_real_node_f
Reads the value
cg_iric_read_grid_functional_integer_cell_f
Reads the value
cg_iric_read_grid_functional_real_cell_f
Reads the value
cg_iric_read_bc_count_f
Reads the num
cg_iric_read_bc_indicessize_f
Reads the num
cg_iric_read_bc_indices_f
Reads the list ocg_iric_read_bc_integer_f
Gets the value
cg_iric_read_bc_real_f
Gets the value

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Classification
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions
Reading boundary conditions
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Reading geographic data
Outputting a calculation grid
Outputting a calculation grid
Outputting a calculation grid
Outputting a calculation grid
Outputting a calculation grid
Outputting a calculation grid
Outputting a calculation grid
Outputting time (or iteration count) information
Outputting time (or iteration count) information
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results

6.5. Reference

Table 6.26 – continued from previou
Name
Description
cg_iric_read_bc_realsingle_f
Gets the value
cg_iric_read_bc_string_f
Gets the value
cg_iric_read_bc_functionalsize_f
Gets the size of
cg_iric_read_bc_functional_f
Gets the value
cg_iric_read_bc_functional_realsingle_f
Gets the value
cg_iric_read_bc_functionalwithname_f
Gets the value
cg_iric_read_geo_count_f
Reads the num
cg_iric_read_geo_filename_f
Reads the file niric_geo_polygon_open_f
Opens the geog
iric_geo_polygon_read_integervalue_f
Reads the value
iric_geo_polygon_read_realvalue_f
Reads the value
iric_geo_polygon_read_pointcount_f
Reads the num
iric_geo_polygon_read_points_f
Reads the coor
iric_geo_polygon_read_holecount_f
Reads the num
iric_geo_polygon_read_holepointcount_f
Reads the num
iric_geo_polygon_read_holepoints_f
Reads the coor
iric_geo_polygon_close_f
Closes the geog
iric_geo_riversurvey_open_f
Opens the geog
iric_geo_riversurvey_read_count_f
Reads the num
iric_geo_riversurvey_read_position_f
Reads the coor
iric_geo_riversurvey_read_direction_f
Reads the direc
iric_geo_riversurvey_read_name_f
Reads the nameiric_geo_riversurvey_read_realname_f
Reads the nameiric_geo_riversurvey_read_leftshift_f
Reads the shiftiric_geo_riversurvey_read_altitudecount_f
Reads the num
iric_geo_riversurvey_read_altitudes_f
Reads the altitu
iric_geo_riversurvey_read_fixedpointl_f
Reads the data
iric_geo_riversurvey_read_fixedpointr_f
Reads the data
iric_geo_riversurvey_read_watersurfaceelevation_f Reads the wateiric_geo_riversurvey_close_f
Closes the geog
cg_iric_writegridcoord1d_f
Outputs a one-d
cg_iric_writegridcoord2d_f
Outputs a twocg_iric_writegridcoord3d_f
Outputs a three
cg_iric_write_grid_integer_node_f
Outputs a grid
cg_iric_write_grid_real_node_f
Outputs a grid
cg_iric_write_grid_integer_cell_f
Outputs a grid
cg_iric_write_grid_real_cell_f
Outputs a grid
cg_iric_write_sol_time_f
Outputs time
cg_iric_write_sol_iteration_f
Outputs the iter
cg_iric_write_sol_gridcoord2d_f
Outputs a twocg_iric_write_sol_gridcoord3d_f
Outputs a three
cg_iric_write_sol_baseiterative_integer_f
Outputs integer
cg_iric_write_sol_baseiterative_real_f
Outputs double
cg_iric_write_sol_baseiterative_string_f
Outputs stringcg_iric_write_sol_integer_f
Outputs integer
cg_iric_write_sol_real_f
Outputs double
cg_iric_write_sol_cell_integer_f
Outputs integer
cg_iric_write_sol_cell_real_f
Outputs double
cg_iric_write_sol_iface_integer_f
Outputs integer

131

iRIC Developer’s manual, Release 3.0.0

Classification
Outputting calculation results
Outputting calculation results
Outputting calculation results
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (particles)
Outputting calculation results (polygons, polylines)
Outputting calculation results (polygons, polylines)
Outputting calculation results (polygons, polylines)
Outputting calculation results (polygons, polylines)
Outputting calculation results (polygons, polylines)
Outputting calculation results (polygons, polylines)
Functions to call befor and after outputting calculation results
Functions to call befor and after outputting calculation results
Functions to call befor and after outputting calculation results
Functions to call befor and after outputting calculation results
Functions to call befor and after outputting calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Reading calculation results
Outputting error codes
Closing the CGNS file

Table 6.26 – continued from previou
Name
Description
cg_iric_write_sol_iface_real_f
Outputs double
cg_iric_write_sol_jface_integer_f
Outputs integer
cg_iric_write_sol_jface_real_f
Outputs double
cg_iric_write_sol_particle_pos2d_f
Outputs particl
cg_iric_write_sol_particle_pos3d_f
Outputs particl
cg_iric_write_sol_particle_integer_f
Outputs integer
cg_iric_write_sol_particle_real_f
Outputs double
cg_iric_write_sol_particlegroup_groupbegin_fStart outputting
cg_iric_write_sol_particlegroup_groupend_f
Finish outputtin
cg_iric_write_sol_particlegroup_pos2d_f
Outputs particl
cg_iric_write_sol_particlegroup_pos3d_f
Outputs particl
cg_iric_write_sol_particlegroup_integer_f
Outputs integer
cg_iric_write_sol_particlegroup_real_f
Outputs double
cg_iric_write_sol_polydata_groupbegin_fStart outputting
cg_iric_write_sol_polydata_groupend_f
Finish outputtin
cg_iric_write_sol_polydata_polygon_f
Output calculat
cg_iric_write_sol_polydata_polyline_f
Output calculat
cg_iric_write_sol_polydata_integer_f
Outputs integer
cg_iric_write_sol_polydata_real_f
Outputs double
iric_check_cancel_f
Checks whethe
iric_check_lock_f
Checks whethe
iric_write_sol_start_f
Inform the GU
iric_write_sol_end_f
Inform the GU
cg_iric_flush_f
Flush calculatio
cg_iric_read_sol_count_f
Reads the num
cg_iric_read_sol_time_f
Reads the time
cg_iric_read_sol_iteration_f
Reads the loop
cg_iric_read_sol_baseiterative_integer_f
Reads the integ
cg_iric_read_sol_baseiterative_real_f
Reads the doubcg_iric_read_sol_baseiterative_string_f
Reads the strin
cg_iric_read_sol_gridcoord2d_f
Reads the 2D s
cg_iric_read_sol_gridcoord3d_f
Reads the 3D s
cg_iric_read_sol_integer_f
Reads the integ
cg_iric_read_sol_real_f
Reads the doubcg_iric_read_sol_cell_integer_f
Reads the integ
cg_iric_read_sol_cell_real_f
Reads the doubcg_iric_read_sol_iface_integer_f
Reads the integ
cg_iric_read_sol_iface_real_f
Reads the doubcg_iric_read_sol_jface_integer_f
Reads the integ
cg_iric_read_sol_jface_real_f
Reads the doubcg_iric_write_errorcode_f
Outputs error c
cg_close_f
Closes a CGNS

The functions with “O” value for column “Multi” has functions that are used for the same purpose and used whenhandling multiple CGNS files. The “Multi” version of the functions end with “_mul_f” instead of “_f”, and the firstargument is file ID.
For example, the functions used for reading integer-type calculation result are as follows:• Function used when handling single CGNS file132

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

call cg_iric_read_integer_f(label, intvalue, ier)

• Function used when handling multiple CGNS file.
call cg_iric_read_integer_mul_f(fid, label, intvalue, ier)

The difference between single version and multiple version is shown in Table 6.27.

Item
Name
Arguments
TargetCGNS
file

Table 6.27: Differences between functions for handling single or mulitple CGNS file
For Single CGNS file
For Multiple CGNS fileEnds with “_f”
Ends with “_mul_f”
See the following sections
The first argument is File ID (integer)
File that is identified by the File ID that was specified as theargument of “cg_iric_init_f” or “cg_iric_initread_f”

File that is identified by the File ID thatis specified as the first argument.

6.5.2 cg_open_f• Opens a CGNS file.
Format (FORTRAN)
call cg_open_f(filename, mode, fid, ier)

Format (C/C++)
ier = cg_open(filename, mode, fid);

Format (Python)fid = cg_open(filename, mode)

Arguments

Variable namefilename
mode
fid
ier

6.5. Reference

Table 6.28: Arguments of cg_open_f
Type
I/O Description
character(*)
I
Filenameparameter (integer) I
File Open mode
integerO
File ID
integerO
Error code. 0 means success.

133

iRIC Developer’s manual, Release 3.0.0

6.5.3 cg_iric_init_f• Initializes the internal variables that are used for reading andFormat (FORTRAN)
call cg_iric_init_f(fid, ier)

Format (C/C++)
ier = cg_iRIC_Init(fid);

Format (Python)
cg_iRIC_Init(fid)Arguments

Variable
name
fid
ier

Type

I/O

Table 6.29: Arguments of cg_iric_init_f
Description

integer
integerI

File ID

O

Error code. 0 means success. In case of grid generating program, 1 means
success.

6.5.4 cg_iric_initread_f• Initializes the internal variables that are used for reading CGNSFormat (FORTRAN)
call cg_iric_initread_f(fid, ier)

Format (C/C++)
ier = cg_iRIC_InitRead(fid);

Format (Python)
cg_iRIC_InitRead(fid)134

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.30: Arguments of cg_iric_initread_f
Variable name TypeI/O Description
fid
integer I
File IDier
integer O
Error code. 0 means success.

6.5.5 iric_initoption_f• Set up the options for the solver.
Format (FORTRAN)
call iric_initoption_f(optionval, ier)

Format (C/C++)
ier = iRIC_InitOption(optionval);

Format (Python)
iRIC_InitOption(optionval)

Arguments
Table 6.31: Arguments of cg_iric_initoption_f
Variable name TypeI/O Description
optionval
integer I
The value that corresponds to an optionier
integer O
Error code. 0 means success.

Appendix
Table 6.32: Values for optionval
optionval value
Content
IRIC_OPTION_CANCEL
Inform that the solver detects cancel operation using iric_check_cancel_f
IRIC_OPTION_DIVIDESOLUTIONS Saves calculation results in divided CGNS files

6.5.6 cg_iric_read_integer_f• Reads the value of a integer-type variable from the CGNS file.

6.5. Reference135

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_integer_f(label, intvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_Integer(label, &intvalue);

Format (Python)
intvalue = cg_iRIC_Read_Integer(label)

Arguments

Variable namelabel
intvalueier

Table 6.33: Arguments of cg_iric_read_integer_f
Type
I/O Description
character(*) I
Name of the variable defined in the solver definition file
integerO
Integer read from the CGSN file
integerO
Error code. 0 means success.

6.5.7 cg_iric_read_real_f• Reads the value of a double-precision real-type variable from theFormat (FORTRAN)
call cg_iric_read_real_f(label, realvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_Real(label, &realvalue);

Format (Python)
realvalue = cg_iRIC_Read_Real(label)

136

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable namelabel
realvalueier

Table 6.34: Arguments of cg_iric_read_real_f
Type
I/O Description
character(*)
I
Name of the variable defined in the solver definition file
double precision O
Real number read from the CGSN file
integerO
Error code. 0 means success.

6.5.8 cg_iric_read_realsingle_f• Reads the value of a single-precision real-type variable from theFormat (FORTRAN)
call cg_iric_read_realsingle_f(label, realvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_RealSingle(label, &realvalue);

Format (Python)This function does not exists for Python.
Arguments

Variable namelabel
realvalueier

Table 6.35: Arguments of cg_iric_read_realsingle_f
Type
I/O Description
character(*) I
Name of the variable defined in the solver definition filereal
OReal number read from the CGSN file
integerO
Error code. 0 means success.

6.5.9 cg_iric_read_string_f• Reads the value of a string-type variable from the CGNS file.
Format (FORTRAN)
call cg_iric_read_string_f(label, strvalue, ier)

6.5. Reference137

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_String(label, strvalue);

Format (Python)strvalue = cg_iRIC_Read_String(label)

Arguments

Variable namelabel
strvalueier

Table 6.36: Arguments of cg_iric_read_string_f
Type
I/O Description
character(*) I
Name of the variable defined in the solver definition filecharacter(*) O
Character string read from the CGSN file
integerO
Error code. 0 means success.

6.5.10 cg_iric_read_functionalsize_f• Reads the size of a functional-type variable from the CGNS file.
Format (FORTRAN)
call cg_iric_read_functionalsize_f(label, size, ier)

Format (C/C++)
ier = cg_iRIC_Read_FunctionalSize(label, &size);

Format (Python)This function does not exists for Python.
Arguments

Variable name
label
size
ier

Table 6.37: Arguments of cg_iric_read_functionalsize_f
Type
I/O Description
character(*) I
Name of the variable defined in the solver definition file
integerO
Length of the array that has been read from the CGSN file
integerO
Error code. 0 means success.

6.5.11 cg_iric_read_functional_f• Reads the value of a functional-type double-precision real variable
138

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_functional_f(label, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Read_Functional(label, x, y);Format (Python)x, y = cg_iRIC_Read_Functional(label)

Arguments
Table 6.38: Arguments of cg_iric_read_functional_f
I/O Description

Variable
name
label

Type
character(*)

Ixdouble precision , dimension(:), allocatabledouble precision, dimension(:), allocatable
integerO

Name of the variable defined in the solver definition file
Array of x values

O

Array of y values

O

Error code. 0 means success.

yier

6.5.12 cg_iric_read_functional_realsingle_f• Reads the value of a functional-type single-precision real variable
Format (FORTRAN)
call cg_iric_read_functional_realsingle_f(label, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Read_Functional_RealSingle(label, x, y);Format (Python)This function does not exists for Python.

6.5. Reference

139

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.39: Arguments of cg_iric_read_functional_realsingle_f
Type
I/O Description
character(*)
I
Name of the variable defined in the solver definition file
real , dimension(:), allocatable O
Array of x values
real, dimension(:), allocatable O
Array of y values
integerO
Error code. 0 means success.

Variable name
label
x
y
ier

6.5.13 cg_iric_read_functionalwithname_f• Reads the value of a functional-type real variable from the CGNSFormat (FORTRAN)
call cg_iric_read_functionalwithname_f(label, name, data, ier)

Format (C/C++)
ier = cg_iRIC_Read_FunctionalWithName(label, name, data);

Format (Python)data = cg_iRIC_Read_FunctionalWithName(label, name)Arguments
Table 6.40: Arguments of cg_iric_read_functionalwithname_f
I/O Description

Variable
name
label
name

Type

character(*)
character(*)

I
I

data

real , dimension(:), allocatable
integerO

Name of the variable defined in the solver definition file
Name of the variable value name defined in the solver definition file
Array of values

O

Error code. 0 means success.

ier

6.5.14 cg_iric_gotogridcoord2d_f• Makes preparations for reading a two-dimensional structured grid.

140

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_gotogridcoord2d_f(nx, ny, ier)

Format (C/C++)
ier = cg_iRIC_GotoGridCoord2d(nx, ny);

Format (Python)nx, ny = cg_iRIC_GotoGridCoord2d()

Arguments
Table 6.41: Arguments of cg_iric_gotogridcoord2d_f
Variable name TypeI/O Descriptionnx
integer O
Number of grid nodes in the i directionny
integer O
Number of grid nodes in the j directionier
integer O
Error code. 0 means success.

6.5.15 cg_iric_gotogridcoord3d_f• Makes preparations for reading a 3D structured grid.
Format (FORTRAN)
call cg_iric_gotogridcoord3d_f(nx, ny, nz, ier)

Format (C/C++)
ier = cg_iRIC_GotoGridCoord3d(nx, ny, nz);

Format (Python)nx, ny, nz = cg_iRIC_GotoGridCoord3d()6.5. Reference141

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.42: Arguments of cg_iric_gotogridcoord3d_f
Variable name TypeI/O Descriptionnx
integer O
Number of grid nodes in the i directionny
integer O
Number of grid nodes in the j directionnz
integer O
Number of grid nodes in the k directionier
integer O
Error code. 0 means success.

6.5.16 cg_iric_getgridcoord2d_f• Reads a two-dimensional structured grid.
Format (FORTRAN)
call cg_iric_getgridcoord2d_f(x, y, ier)

Format (C/C++)
ier = cg_iRIC_GetGridCoord2d(x, y);Format (Python)x, y = cg_iRIC_GetGridCoord2d()

Arguments

Variable namexyierTable 6.43: Arguments of cg_iric_getgridcoord2d_f
Type
I/O Description
double precision, dimension(:), allocatable O
x coordinate value of a grid node
double precision, dimension(:), allocatable O
y coordinate value of a grid node
integerO
Error code. 0 means success.

6.5.17 cg_iric_getgridcoord3d_f• Subroutine to reads a three-dimensional structured grid
Format (FORTRAN)
call cg_iric_getgridcoord3d_f(x, y, z, ier)

142

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_GetGridCoord3d(x, y, z);Format (Python)x, y, z = cg_iRIC_GetGridCoord3d()

Arguments

Variable name
x
y
z
ier

Table 6.44: Arguments of cg_iric_getgridcoord3d_f
Type
I/O Description
double precision, dimension(:), allocatable O
x coordinate value of a grid node
double precision, dimension(:), allocatable O
y coordinate value of a grid node
double precision, dimension(:), allocatable Oz coordinate value of a grid node
integerO
Error code. 0 means success.

6.5.18 cg_iric_read_grid_integer_node_f• Reads the integer attribute values defined for nodes of a structured
Format (FORTRAN)
call cg_iric_read_grid_integer_node_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Integer_Node(label, values);

Format (Python)values = cg_iRIC_Read_Grid_Integer_Node(label)

Arguments
Table 6.45: Arguments of cg_iric_read_grid_integer_node_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namevaluesinteger, dimension(:), allocatable O
Attribute valueier
integerO
Error code. 0 means success.

6.5. Reference143

iRIC Developer’s manual, Release 3.0.0

6.5.19 cg_iric_read_grid_real_node_f• Reads the double-precision real-type attribute values defined forFormat (FORTRAN)
call cg_iric_read_grid_real_node_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Real_Node(label, values);

Format (Python)values = cg_iRIC_Read_Grid_Real_Node(label)

Arguments

Variable namelabel
valuesier

Table 6.46: Arguments of cg_iric_read_grid_real_node_f
Type
I/O Description
character(*)
I
Attribute namedouble precision, dimension(:), allocatable O
Attribute value
integerO
Error code. 0 means success.

6.5.20 cg_iric_read_grid_integer_cell_f• Reads the integer attribute values defined for cells of a structured
Format (FORTRAN)
call cg_iric_read_grid_integer_cell_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Integer_Cell(label, values);

Format (Python)values = cg_iRIC_Read_Grid_Integer_Cell(label)

144

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.47: Arguments of cg_iric_read_grid_integer_cell_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namevaluesinteger, dimension(:), allocatable O
Attribute valueier
integerO
Error code. 0 means success.

6.5.21 cg_iric_read_grid_real_cell_f• Reads the double-precision real-type attribute values defined forFormat (FORTRAN)
call cg_iric_read_grid_real_cell_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Real_Cell(label, values);

Format (Python)values = cg_iRIC_Read_Grid_Real_Cell(label)

Arguments

Variable namelabel
valuesier

Table 6.48: Arguments of cg_iric_read_grid_real_cell_fType
I/O Description
character(*)
I
Attribute namedouble precision, dimension(:), allocatable O
Attribute value
integerO
Error code. 0 means success.

6.5.22 cg_iric_read_complex_count_f• Reads the number of groups of complex type grid attribute
Format (FORTRAN)
call cg_iric_read_complex_count_f(type, num, ier)

6.5. Reference145

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_Complex_Count(type, &num);

Format (Python)num = cg_iRIC_Read_Complex_Count(type)

Arguments

Variable name
type
num
ier

Table 6.49: Arguments of cg_iric_read_complex_count_f
Type
I/O Description
character(*) I
Attribute nameintegerO
The number of complex type grid attribute group
integerO
Error code. 0 means success.

6.5.23 cg_iric_read_complex_integer_f• Reads the integer attribute values of complex type grid attribute
Format (FORTRAN)
call cg_iric_read_complex_integer_f(type, num, name, value, ier)

Format (C/C++)
ier = cg_iRIC_Read_Complex_Integer(type, num, name, &value);

Format (Python)value = cg_iRIC_Read_Complex_Integer(type, num, name)Arguments
Table 6.50: Arguments of cg_iric_read_complex_integer_f
Variable name TypeI/O Description
type
character(*) I
Attribute namenum
integer
I
Group number
namecharacter(*) I
Condition namevalue
integerO
Attribute valueier
integerO
Error code. 0 means success.

146

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.24 cg_iric_read_complex_real_f• Reads the double precision attribute values of complex type grid
Format (FORTRAN)
call cg_iric_read_complex_real_f(type, num, name, value, ier)

Format (C/C++)
ier = cg_iRIC_Read_Complex_Real(type, num, name, &value);

Format (Python)value = cg_iRIC_Read_Complex_Real(type, num, name)Arguments
Table 6.51: Arguments of cg_iric_read_complex_real_f
Variable name TypeI/O Description
type
character(*)
I
Attribute namenum
integer
I
Group number
namecharacter(*)
I
Condition namevalue
double precision O
Attribute valueier
integerO
Error code. 0 means success.

6.5.25 cg_iric_read_complex_realsingle_f• Reads the single precision attribute values of complex type grid
Format (FORTRAN)
call cg_iric_read_complex_realsingle_f(type, num, name, value, ier)

Format (C/C++)
ier = cg_iRIC_Read_Complex_RealSingle(type, num, name, &value);

Format (Python)This function does not exists for Python.

6.5. Reference147

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.52: Arguments of cg_iric_read_complex_realsingle_f
Variable name TypeI/O Description
type
character(*) I
Attribute namenum
integer
I
Group number
namecharacter(*) I
Condition name
value
Real
O
Attribute valueier
integerO
Error code. 0 means success.

6.5.26 cg_iric_read_complex_string_f• Reads the string attribute values of complex type grid attribute
Format (FORTRAN)
call cg_iric_read_complex_string_f(type, num, name, value, ier)

Format (C/C++)
ier = cg_iRIC_Read_Complex_String(type, num, name, value);

Format (Python)value = cg_iRIC_Read_Complex_String(type, num, name)Arguments
Table 6.53: Arguments of cg_iric_read_complex_string_f
Variable name TypeI/O Description
type
character(*) I
Attribute namenum
integer
I
Group number
namecharacter(*) I
Condition namevalue
character(*) O
Attribute valueier
integerO
Error code. 0 means success.

6.5.27 cg_iric_read_complex_functionalsize_f• Checks the size of a functional-type attribute of complex type grid
Format (FORTRAN)

148

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

call cg_iric_read_complex_functionalsize_f(type, num, name, size, ier)

Format (C/C++)
ier = cg_iric_read_complexunctionalsize(type, num, name, &size);

Format (Python)This function does not exists for Python.
Arguments
Table 6.54: Arguments of cg_iric_read_complex_functionalsize_f
Variable name TypeI/O Description
type
character(*) I
Attribute namenum
integer
I
Group number
namecharacter(*) I
Condition namesize
integerO
The length of condition value arrayier
integerO
Error code. 0 means success.

6.5.28 cg_iric_read_complex_functional_f• Reads functional attribute data of complex type grid attribute
Format (FORTRAN)
call cg_iric_read_complex_functional_f(type, num, name, x, y, ier)

Format (C/C++)
ier = cg_iric_read_complexunctional(type, num, name, x, y);Format (Python)x, y = cg_iric_read_complexunctional(type, num, name)

6.5. Reference149

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable name
type
num
name
x
ier

Table 6.55: Arguments of cg_iric_read_complex_functional_f
Type
I/O Description
character(*)
I
Attribute nameinteger
I
Group number
character(*)
I
Condition namedouble precision, dimension(:), allocatable O
x value array
integerO
Error code. 0 means success.

6.5.29 cg_iric_read_complex_functionalwithname_f• Reads functional attribute of complex type grid attribute (withFormat (FORTRAN)
call cg_iric_read_complex_functionalwithname_f(type, num, name, paramname, data, ier)

Format (C/C++)
ier = cg_iRIC_Read_Complex_FunctionalWithName(type, num, name, paramname, data);

Format (Python)data = cg_iRIC_Read_Complex_FunctionalWithName(type, num, name, paramname)Arguments
Table 6.56: Arguments of cg_iric_read_complex_functionalwithname_f
Variable name TypeI/O Description
type
character(*)
I
Attribute namenum
integer
I
Group number
namecharacter(*)
I
Condition nameparamnamecharacter(*)
I
Value namedata
double precision, dimension(:), allocatable O
Value arrayier
integerO
Error code. 0 means success.

6.5.30 cg_iric_read_complex_functional_realsingle_f• Reads functional attribute data of complex type grid attribute

150

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_complex_functional_realsingle_f(type, num, name, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Read_Complex_Functional_RealSingle(type, num, name, x, y);Format (Python)This function does not exists for Python.
Arguments
Table 6.57: Arguments of cg_iric_read_complex_functional_realsingle_f
Variable name TypeI/O Description
type
character(*)
I
Attribute namenum
integer
I
Group number
namecharacter(*)
I
Condition namexreal, dimension(:), allocatable O
x value arrayyreal, dimension(:), allocatable O
y value arrayier
integerO
Error code. 0 means success.

6.5.31 cg_iric_read_grid_complex_node_f• Reads the complex attribute values defined for grid nodes
Format (FORTRAN)
call cg_iric_read_grid_complex_node_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Complex_Node(label, values);

Format (Python)values = cg_iRIC_Read_Grid_Complex_Node(label)

6.5. Reference151

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.58: Arguments of cg_iric_read_grid_complex_node_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namevaluesinteger, dimension(:), allocatable O
Attribute valueier
integerO
Error code. 0 means success.

6.5.32 cg_iric_read_grid_complex_cell_f• Reads the complex attribute values defined for grid cells
Format (FORTRAN)
call cg_iric_read_grid_complex_cell_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Complex_Cell(label, values);

Format (Python)values = cg_iRIC_Read_Grid_Complex_Cell(label)

Arguments
Table 6.59: Arguments of cg_iric_read_grid_complex_cell_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namevaluesinteger, dimension(:), allocatable O
Attribute valueier
integerO
Error code. 0 means success.

6.5.33 cg_iric_read_grid_functionaltimesize_f• Reads the number of values of dimension “Time” for functional grid
Format (FORTRAN)
call cg_iric_read_grid_functionaltimesize_f(label, count, ier)

152

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_Grid_FunctionalTimeSize(label, &count);

Format (Python)This function does not exists for Python.
Arguments
Table 6.60: Arguments of cg_iric_read_grid_functionaltimesize_f
Variable name TypeI/O Descriptionlabelcharacter(*) I
Attribute namecountintegerO
The number of values of dimension “Time”
ier
integerO
Error code. 0 means success.

6.5.34 cg_iric_read_grid_functionaltime_f• Reads the values of dimension “Time” for functional grid attribute
Format (FORTRAN)
call cg_iric_read_grid_functionaltime_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_FunctionalTime(label, values);

Format (Python)values = cg_iRIC_Read_Grid_FunctionalTime(label)

Arguments

Variable namelabel
valuesier

Table 6.61: Arguments of cg_iric_read_grid_functionaltime_f
Type
I/O Description
character(*)
I
Attribute namedouble precision, dimension(:), allocatable O
The values of dimension “Time”
integerO
Error code. 0 means success.

6.5.35 cg_iric_read_grid_functionaldimensionsize_f• Reads the number of values of dimension for functional grid attribute
6.5. Reference

153

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_grid_functionaldimensionsize_f(label, dimname, count, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_FunctionalTime(label, dimname, &count);

Format (Python)This function does not exists for Python.
Arguments
Table 6.62: Arguments of cg_iric_read_grid_functionaldimensionsize_f
Variable name TypeI/O Descriptionlabelcharacter(*) I
Attribute name
dimnamecharacter(*) I
Dimension namecountintegerO
The number of values of dimension “Time”
ier
integerO
Error code. 0 means success.

6.5.36 cg_iric_read_grid_functionaldimension_integer_f• Reads the values of integer dimension for functional grid attribute
Format (FORTRAN)
call cg_iric_read_grid_functionaldimension_integer_f(label, dimname, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_FunctionalDimension_Integer(label, dimname, values);

Format (Python)values = cg_iRIC_Read_Grid_FunctionalDimension_Integer(label, dimname)154

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.63: Arguments of cg_iric_read_grid_functionaldimension_integer_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute name
dimnamecharacter(*)
I
Dimension namevaluesinteger, dimension(:), allocatable O
The values of dimensionier
integerO
Error code. 0 means success.

6.5.37 cg_iric_read_grid_functionaldimension_real_f• Reads the values of double-precision dimension for functional grid
Format (FORTRAN)
call cg_iric_read_grid_functionaldimension_real_f(label, dimname, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_FunctionalDimension_Real(label, dimname, values);

Format (Python)values = cg_iRIC_Read_Grid_FunctionalDimension_Real(label, dimname)Arguments
Table 6.64: Arguments of cg_iric_read_grid_functionaldimension_real_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute name
dimnamecharacter(*)
I
Dimension namevaluesdouble precision, dimension(:), allocatable O
The values of dimensionier
integerO
Error code. 0 means success.

6.5.38 cg_iric_read_grid_functional_integer_node_f• Reads the values of functional integer grid attribute with dimension
Format (FORTRAN)
call cg_iric_read_grid_functional_integer_node_f(label, dimid, values, ier)

6.5. Reference

155

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_Grid_Functional_Integer_Node(label, dimid, values);

Format (Python)values = cg_iRIC_Read_Grid_Functional_Integer_Node(label, dimid)

Arguments
Table 6.65: Arguments of cg_iric_read_grid_functional_integer_node_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namedimid
integerI
ID of “Time” (1 to the number of Time)valuesinteger, dimension(:), allocatable O
Attribute valueier
integerO
Error code. 0 means success.

6.5.39 cg_iric_read_grid_functional_real_node_f• Reads the values of functional double-precision grid attribute withFormat (FORTRAN)
call cg_iric_read_grid_functional_real_node_f(label, dimid, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Functional_Real_Node(label, dimid, values);

Format (Python)values = cg_iRIC_Read_Grid_Functional_Real_Node(label, dimid)

Arguments

Variable name
label
dimid
valuesier

156

Table 6.66: Arguments of cg_iric_read_grid_functional_real_node_f
Type
I/O Description
character(*)
I
Attribute nameintegerI
ID of “Time” (1 to the number of Time)double precision, dimension(:), allocatable O
Attribute value
integerO
Error code. 0 means success.

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.40 cg_iric_read_grid_functional_integer_cell_f• Reads the values of functional integer grid attribute with dimension
Format (FORTRAN)
call cg_iric_read_grid_functional_integer_cell_f(label, dimid, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Functional_Integer_Cell(label, dimid, values);

Format (Python)values = cg_iRIC_Read_Grid_Functional_Integer_Cell(label, dimid)

Arguments
Table 6.67: Arguments of cg_iric_read_grid_functional_integer_cell_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namedimid
integerI
ID of “Time” (1 to the number of Time)valuesinteger, dimension(:), allocatable O
Attribute valueier
integerO
Error code. 0 means success.

6.5.41 cg_iric_read_grid_functional_real_cell_f• Reads the values of functional double-precision grid attribute withFormat (FORTRAN)
call cg_iric_read_grid_functional_real_cell_f(label, dimid, values, ier)

Format (C/C++)
ier = cg_iRIC_Read_Grid_Functional_Real_Cell(label, dimid, values);

Format (Python)values = cg_iRIC_Read_Grid_Functional_Real_Cell(label, dimid)

6.5. Reference157

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable name
label
dimid
valuesier

Table 6.68: Arguments of cg_iric_read_grid_functional_real_cell_fType
I/O Description
character(*)
I
Attribute nameintegerI
ID of “Time” (1 to the number of Time)double precision, dimension(:), allocatable O
Attribute value
integerO
Error code. 0 means success.

6.5.42 cg_iric_read_bc_count_f• Reads the number of boundary condition.
Format (FORTRAN)
call cg_iric_read_bc_count_f(type, num)

Format (C/C++)
cg_iRIC_Read_BC_Count(type, &num);

Format (Python)num = cg_iRIC_Read_BC_Count(type)

Arguments

Variable name
type
num

Table 6.69: Arguments of cg_iric_bc_count_f
Type
I/O Description
character(*) I
The type name of boundary condition you want to know the count.
integerO
The number of boundary condition

6.5.43 cg_iric_read_bc_indicessize_f• Reads the number of elements (nodes or cells) where the boundary
Format (FORTRAN)
call cg_iric_bc_indicessize_f(type, num, size, ier)

158

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_BC_IndicesSize(type, num, &size);

Format (Python)This function does not exists for Python.
Arguments

Variable
name
type

Type

Table 6.70: Arguments of cg_iric_read_bc_indicessize_f
I/O Description
I

The type name of boundary condition you want to know the indices size

num
size

character(*)
integer
integerOO

ier

integerO

The boundary condition ID number
The number of elements (nodes or cells) where the boundary condition is
set.
Error code. 0 means success.

6.5.44 cg_iric_read_bc_indices_f• Reads the elements (nodes or cells) where the boundary condition is
Format (FORTRAN)
call cg_iric_bc_indices_f(type, num, indices, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_Indices(type, num, indices);

Format (Python)
indices = cg_iRIC_Read_BC_Indices(type, num)

Arguments

Variable name
type
num
ier

6.5. Reference

Table 6.71: Arguments of cg_iric_read_bc_indices_f
Type
I/O Description
character(*) I
The type name of boundary condition you want to know the indices size
integerO
The boundary condition ID number
integerO
Error code. 0 means success.

159

iRIC Developer’s manual, Release 3.0.0

Note
Values returned to indices depends on the position where boundary condition is defined, like shown in Table 6.72.
Please note that when the boundary condition is defined at nodes or cells, it outputs two values for each element, andwhen defined at edges, it outputs four values for each element.
Table 6.72: Relationship between the position where boundary condition
is defined and the values of indices
Position where boundary condition is defined
Values of indices
Nodes
I of grid node 1, J of grid node 1...,
I of grid node N, J of grid node N
Cells
I of grid cell 1, J of grid cell 1...,
I of grid cell N, J of grid cell N
Edges
I of start position of edge 1, J of start position of edge 1,
I of end position of edge 1, J of end position of edge 1...,
I of start position of edge N, J of start position of edge
N,
I of end position of edge N, J of end position of edge N

6.5.45 cg_iric_read_bc_integer_f• Reads the value of a string-type variable from the CGNS file.
Format (FORTRAN)
call cg_iric_read_integer_f(type, num, label, intvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_Integer(type, num, name, &value);

Format (Python)value = cg_iRIC_Read_BC_Integer(type, num, name)160

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable
name
type
num
label
intvalueier

Table 6.73: Arguments of cg_iric_read_bc_integer_f
I/O Description

Typecharacter(*)
integercharacter(*)
integer
integerI

Name of boundary condition

I
I

Boundary condition number
Name of the boundary condition variable defined in the solver definition
file
Integer read from the CGSN file
Error code. 0 means success.

OO

6.5.46 cg_iric_read_bc_real_f• Reads the value of a double-precision real-type variable from theFormat (FORTRAN)
call cg_iric_read_bc_real_f(type, num, label, realvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_Real(type, num, name, &value);

Format (Python)value = cg_iRIC_Read_BC_Real(type, num, name)Arguments

Variable name
type
num
label
realvalueier

Table 6.74: Arguments of cg_iric_read_bc_real_f
Type
I/O Description
character(*)
I
Name of boundary condition
integerI
Boundary condition number
character(*)
I
Name of the variable defined in the solver definition file
double precision O
Real number read from the CGSN file
integerO
Error code. 0 means success.

6.5.47 cg_iric_read_bc_realsingle_f• Reads the value of a single-precision real-type variable from the

6.5. Reference161

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_bc_realsingle_f(type, num, label, realvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_RealSingle(type, num, label, &realvalue);

Format (Python)This function does not exists for Python.
Arguments of cg_iric_read_bc_realsingle_ffile cg_iric_read_bc_realsingle_f_args.csv
header-rows 1

6.5.48 cg_iric_read_bc_string_f• Reads the value of a string-type variable from the CGNS file.
Format (FORTRAN)
call cg_iric_read_bc_string_f(type, num, label, strvalue, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_String(type, num, name, value);

Format (Python)value = cg_iRIC_Read_BC_String(type, num, name)Arguments

Variable name
type
num
label
strvalueier

162

Table 6.75: Arguments of cg_iric_read_bc_string_f
Type
I/O Description
character(*) I
Name of boundary condition
integerI
Boundary condition number
character(*) I
Name of the variable defined in the solver definition filecharacter(*) O
Character string read from the CGSN file
integerO
Error code. 0 means success.

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.49 cg_iric_read_bc_functionalsize_f• Reads the size of a functional-type variable from the CGNS file.
Format (FORTRAN)
call cg_iric_read_bc_functionalsize_f(type, num, name, size, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_FunctionalSize(type, num, name, &size);

Format (Python)This function does not exists for Python.
Arguments of cg_iric_read_bc_functionalsize_ffile cg_iric_read_bc_functionalsize_f_args.csv
header-rows 1

6.5.50 cg_iric_read_bc_functional_f• Reads the value of a functional-type double-precision real variable
Format (FORTRAN)
call cg_iric_read_bc_functional_f(type, num, label, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_Functional(type, num, name, x, y);Format (Python)x, y = cg_iRIC_Read_BC_Functional(type, num, name)

6.5. Reference163

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.76: Arguments of cg_iric_read_bc_functional_f
I/O Description

Variable
name
type
num
label

Type

character(*)
integercharacter(*)

I
I
I

x

double precision, dimension(:), allocatabledouble precision, dimension(:), allocatable
integerO

Name of boundary condition
Boundary condition number
Name of the variable defined in the solver definition file
Array of x values

O

Array of y values

O

Error code. 0 means success.

yier

6.5.51 cg_iric_read_bc_functional_realsingle_f• Reads the value of a functional-type single-precision real variable
Format (FORTRAN)
call cg_iric_read_bc_functional_realsingle_f(type, num, name, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Read_BC_Functional_RealSingle(type, num, name, x, y);Format (Python)This function does not exists for Python.
Arguments of cg_iric_read_bc_functional_realsingle_ffile cg_iric_read_bc_functional_realsingle_f_args.csv
header-rows 1

6.5.52 cg_iric_read_bc_functionalwithname_f• Reads the value of a functional-type real variable from the CGNSFormat (FORTRAN)
call cg_iric_read_bc_functionalwithname_f(type, num, label, name, data, ier)

164

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_BC_FunctionalWithName(type, num, name, paramname, data);

Format (Python)data = cg_iRIC_Read_BC_FunctionalWithName(type, num, name, paramname)Arguments
Table 6.77: Arguments of cg_iric_read_bc_functionalwithname_f
I/O Description

Variable
name
type
num
label
name

Type

character(*)
integercharacter(*)
character(*)

I
I
I
I

data

real , dimension(:), allocatable
integerO

Name of boundary condition
Boundary condition number
Name of the variable defined in the solver definition file
Name of the variable value name defined in the solver definition file
Array of values

O

Error code. 0 means success.

ier

6.5.53 cg_iric_read_geo_count_f• Reads the number of geographic data
Format (FORTRAN)
call cg_iric_read_geo_count_f(name, geocount, ier)

Format (C/C++)
ier = cg_iRIC_Read_Geo_Count(name, geocount);

Format (Python)This function does not exists for Python.

6.5. Reference165

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.78: Arguments of cg_iric_read_geo_count_f
Variable name TypeI/O Description
namecharacter(*) I
Geographic data group namegeocount
integerO
The number of geographic dataier
integerO
Error code. 0 means success.

6.5.54 cg_iric_read_geo_filename_f• Reads the file name and data type of geographic data
Format (FORTRAN)
call cg_iric_read_geo_filename_f(name, geoid, geofilename, geotype, ier)

Format (C/C++)
ier = cg_iRIC_Read_Geo_Filename(name, geoid, geofilename, &geotype);

Format (Python)This function does not exists for Python.
Arguments
Table 6.79: Arguments of cg_iric_read_geo_filename_f
Variable name TypeI/O Description
namecharacter(*) I
Geographic data group namegeoid
integerI
Geographic data number
geofilename
character(*) O
FilenamegeotypeintegerO
Geographic data typeier
integerO
Error code. 0 means success.

6.5.55 iric_geo_polygon_open_f• Opens the geographic data file that contains polygon data
Format (FORTRAN)
call iric_geo_polygon_open_f(filename, pid, ier)

166

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = iRIC_Geo_Polygon_Open(filename, &pid);

Format (Python)This function does not exists for Python.
Arguments
Table 6.80: Arguments of iric_geo_polygon_open_f
Variable name TypeI/O Description
filenamecharacter(*) I
File namepid
integerO
Polygon ID for opened fileier
integerO
Error code. 0 means success.

6.5.56 iric_geo_polygon_read_integervalue_f• Reads the value of polygon data as integer
Format (FORTRAN)
call iric_geo_polygon_read_integervalue_f(pid, intval, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_IntegerValue(pid, &intval);

Format (Python)This function does not exists for Python.
Arguments
Table 6.81: Arguments of iric_geo_polygon_read_integervalue_f
Variable name TypeI/O Description
Pid
integer I
Polygon ID
intvalinteger O
The value of the polygon
Ier
integer O
Error code. 0 means success.

6.5.57 iric_geo_polygon_read_realvalue_f• Reads the value of polygon datas double precision real

6.5. Reference

167

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call iric_geo_polygon_read_realvalue_f(pid, realval, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_RealValue(pid, &realval);

Format (Python)This function does not exists for Python.
Arguments
Table 6.82: Arguments of iric_geo_polygon_read_realvalue_f
Variable name TypeI/O Description
Pid
integerI
Polygon ID
realvaldouble precision O
The value of the polygon
Ier
integerO
Error code. 0 means success.

6.5.58 iric_geo_polygon_read_pointcount_f• Reads the number of polygon vertices
Format (FORTRAN)
call iric_geo_polygon_read_pointcount_f(pid, count, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_PointCount(pid, &count);

Format (Python)This function does not exists for Python.
Arguments
Table 6.83: Arguments of iric_geo_polygon_read_pointcount_f
Variable name TypeI/O Description
pid
integer I
Polygon ID
count
integer O
The number of vertices of the polygon
ier
integer O
Error code. 0 means success.
168

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.59 iric_geo_polygon_read_points_f• Reads the coorinates of polygon vertices
Format (FORTRAN)
call iric_geo_polygon_read_points_f(pid, x, y, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_Points(pid, x, y);Format (Python)This function does not exists for Python.
Arguments

Variable name
pid
x
y
ier

Table 6.84: Arguments of iric_geo_polygon_read_points_f
Type
I/O Description
integerI
Polygon ID
double precision , dimension(:), allocatable O
X coordinates of polygon vertices
double precision , dimension(:), allocatable O
Y coordinates of polygon vertices
integerO
Error code. 0 means success.

6.5.60 iric_geo_polygon_read_holecount_f• Reads the number of holes in the polygon
Format (FORTRAN)
call iric_geo_polygon_read_holecount_f(pid, holecount, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_HoleCount(pid, &holecount);

Arguments
Table 6.85: Arguments of iric_geo_polygon_read_holecount_f
Variable name TypeI/O Description
pid
integer I
Polygon ID
holecountinteger O
The number of holesier
integer O
Error code. 0 means success.
6.5. Reference

169

iRIC Developer’s manual, Release 3.0.0

6.5.61 iric_geo_polygon_read_holepointcount_f• Reads the number of vertices of hole polygon
Format (FORTRAN)
call iric_geo_polygon_read_holepointcount_f(pid, holeid, count, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_HolePointCount(pid, holeid, &count);

Format (Python)This function does not exists for Python.
Arguments
Table 6.86: Arguments of iric_geo_polygon_read_holepointcount_f
Variable name TypeI/O Description
pid
integer I
Polygon ID
holeidinteger I
Hole IDcount
integer O
The number of vertices of the hole polygon
ier
integer O
Error code. 0 means success.

6.5.62 iric_geo_polygon_read_holepoints_f• Reads the coordinates of hole polygon vertices
Format (FORTRAN)
call iric_geo_polygon_read_holepoints_f(pid, holeid, x, y, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Read_HolePoints(pid, holeid, x, y);Format (Python)This function does not exists for Python.

170

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable namepid
holeidxyier

Table 6.87: Arguments of iric_geo_polygon_read_holepoints_f
Type
I/O Description
integerI
Polygon ID
integer
I
Hole ID
double precision , dimension(:), allocatable O
X coordinates of hole polygon vertices
double precision , dimension(:), allocatable O
Y coordinates of hole polygon vertices
integerO
Error code. 0 means success.

6.5.63 iric_geo_polygon_close_f• Closes the geographic data file
Format (FORTRAN)
call iric_geo_polygon_close_f(pid, ier)

Format (C/C++)
ier = iRIC_Geo_Polygon_Close(pid);

Format (Python)This function does not exists for Python.
Arguments
Table 6.88: Arguments of iric_geo_polygon_close_f
Variable name TypeI/O Description
pid
integer I
Polygon ID
ier
integer O
Error code. 0 means success.

6.5.64 iric_geo_riversurvey_open_f• Opens the geographic data file that contains river survey data
Format (FORTRAN)
call iric_geo_riversurvey_open_f(filename, rid, ier)

6.5. Reference

171

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Open(filename, rid);

Format (Python)This function does not exists for Python.
Arguments
Table 6.89: Arguments of iric_geo_riversurvey_open_f
Variable name TypeI/O Description
filenamecharacter(*) I
Filename
rid
integerORiver Survey Data ID
ier
integerO
Error code. 0 means success.

6.5.65 iric_geo_riversurvey_read_count_f• Reads the number of the crosssections in river survey data
Format (FORTRAN)
call iric_geo_riversurvey_read_count_f(rid, count, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_Count(rid, &count);

Format (Python)This function does not exists for Python.
Arguments
Table 6.90: Arguments of iric_geo_riversurvey_read_count_f
Variable name TypeI/O Description
rid
integer I
River Survey Data ID
count
integer O
The number of crosssectionsier
integer O
Error code. 0 means success.

6.5.66 iric_geo_riversurvey_read_position_f• Reads the coordinates of the crosssection center point

172

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call iric_geo_riversurvey_read_position_f(rid, pointid, x, y, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_Position(rid, pointid, &x, &y);Format (Python)This function does not exists for Python.
Arguments
Table 6.91: Arguments of iric_geo_riversurvey_read_position_f
Variable name TypeI/O Description
rid
integer
I
River Survey Data ID
pointid
integerI
Crosssection IDxdouble precision O
X coordinate of the center pointydouble precision O
Y coordinate of the center pointier
integerO
Error code. 0 means success.

6.5.67 iric_geo_riversurvey_read_direction_f• Reads the direction of the crosssection as normalized vector
Format (FORTRAN)
call iric_geo_riversurvey_read_direction_f(rid, pointid, vx, vy, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_Direction(rid, pointid, &vx, &vy);

Format (Python)This function does not exists for Python.

6.5. Reference

173

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.92: Arguments of iric_geo_riversurvey_read_direction_f
Variable name TypeI/O Description
rid
integer
I
River Survey Data ID
pointid
integerI
Crosssection ID
vx
double precision O
X component of the normalized direction vectorvx
double precision O
Y component of the normalized direction vectorier
integerO
Error code. 0 means success.

6.5.68 iric_geo_riversurvey_read_name_f• Reads the name of the crosssection as string
Format (FORTRAN)
call iric_geo_riversurvey_read_name_f(rid, pointid, name, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_Name(rid, pointid, name);

Format (Python)This function does not exists for Python.
Arguments
Table 6.93: Arguments of iric_geo_riversurvey_read_name_f
Variable name TypeI/O Description
rid
integer
I
River Survey Data ID
pointid
integerI
Crosssection ID
namecharacter(*) O
Name of the crosssectionier
integerO
Error code. 0 means success.

6.5.69 iric_geo_riversurvey_read_realname_f• Reads the name of the crosssection as real number
Format (FORTRAN)
call iric_geo_riversurvey_read_realname_f(rid, pointid, realname, ier)

174

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_RealName(rid, pointid, &realname);

Format (Python)This function does not exists for Python.
Arguments
Table 6.94: Arguments of iric_geo_riversurvey_read_realname_f
Variable name TypeI/O Description
rid
integer
I
River Survey Data ID
pointid
integerI
Crosssection ID
realname
double precision O
Name of the crosssectionier
integerO
Error code. 0 means success.

6.5.70 iric_geo_riversurvey_read_leftshift_f• Reads the shift offset value of the crosssection
Format (FORTRAN)
call iric_geo_riversurvey_read_leftshift_f(rid, pointid, shift, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_LeftShift(rid, pointid, &shift);

Format (Python)This function does not exists for Python.
Arguments
Table 6.95: Arguments of iric_geo_riversurvey_read_leftshift_f
Variable name TypeI/O Description
rid
integer
I
River Survey Data ID
pointid
integerI
Crosssection ID
shiftdouble precision O
The amount of left shiftier
integerO
Error code. 0 means success.

6.5. Reference

175

iRIC Developer’s manual, Release 3.0.0

6.5.71 iric_geo_riversurvey_read_altitudecount_f• Reads the number of altitude data of the crosssection
Format (FORTRAN)
call iric_geo_riversurvey_read_altitudecount_f(rid, pointid, count, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_AltitudeCount(rid, pointid, &count);

Format (Python)This function does not exists for Python.
Arguments
Table 6.96: Arguments of iric_geo_riversurvey_read_altitudecount_f
Variable name TypeI/O Description
rid
integer I
River Survey Data ID
pointid
integer I
Crosssection ID
count
integer O
The number of altitude dataier
integer O
Error code. 0 means success.

6.5.72 iric_geo_riversurvey_read_altitudes_f• Reads the altitude data of the crosssection
Format (FORTRAN)
call iric_geo_riversurvey_read_altitudes_f(rid, pointid, position, height, active,
˓→ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_Altitudes(rid, pointid, position, height, active);

Format (Python)This function does not exists for Python.

176

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variablenameridpointid
positionheightactiveier

Type

Table 6.97: Arguments of iric_geo_riversurvey_read_altitudes_f
I/O Description

integerpointiddouble precision , dimension(:),
allocatabledouble precision , dimension(:),
allocatable
integer, dimension(:), allocatable
integerI
I
OO

River Survey Data ID
Crosssection ID
Altitude position (less than 0: left bank side, grater than
0: right bank side)
Altitude height (elevation)

O
O

Altitude data active/inactive (1: active, 0: inactive)
Error code. 0 means success.

6.5.73 iric_geo_riversurvey_read_fixedpointl_f• Reads the data of left bank extension line of the crosssection
Format (FORTRAN)
call iric_geo_riversurvey_read_fixedpointl_f(rid, pointid, set, directionx,
˓→directiony, index, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_FixedPointL(rid, pointid, &set, &directionx, &˓→directiony, &index);

Format (Python)This function does not exists for Python.
Arguments

Variable namerid
pointidset
directionx
direction
index
ier

6.5. Reference

Table 6.98: Arguments of iric_geo_riversurvey_read_fixedpointl_f
Type
I/O Description
integer
I
River Survey Data ID
integerI
Crosssection ID
integerO
If defined, the value is 1
double precision O
X component of normalized direction vector
double precision O
Y component of normalized direction vector
integerO
The ID of the altitude data where the left bank extension line starts
integerO
Error code. 0 means success.

177

iRIC Developer’s manual, Release 3.0.0

6.5.74 iric_geo_riversurvey_read_fixedpointr_f• Reads the data of right bank extension line of the crosssection
Format (FORTRAN)
call iric_geo_riversurvey_read_fixedpointr_f(rid, pointid, set, directionx,
˓→directiony, index, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_FixedPointR(rid, pointid, &set, &directionx, &˓→directiony, &index);

Format (Python)This function does not exists for Python.
Arguments

Variable namerid
pointidset
directionx
direction
index
ier

Table 6.99: Arguments of iric_geo_riversurvey_read_fixedpointr_f
Type
I/O Description
integer
I
River Survey Data ID
integerI
Crosssection ID
integerO
If defined, the value is 1
double precision O
X component of normalized direction vector
double precision O
Y component of normalized direction vector
integerO
The ID of the altitude data where the right bank extension line starts
integerO
Error code. 0 means success.

6.5.75 iric_geo_riversurvey_read_watersurfaceelevation_f• Reads the water elevation at the crosssection
Format (FORTRAN)
call iric_geo_riversurvey_read_watersurfaceelevation_f(rid, pointid, set, value, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Read_WaterSurfaceElevation(rid, pointid, set, &value);

178

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (Python)This function does not exists for Python.
Arguments
Table 6.100: Arguments of iric_geo_riversurvey_read_watersurfaceelevation_f
Variable name TypeI/O Description
rid
integer
I
River Survey Data ID
pointid
integerI
Crosssection ID
set
integerO
If defined the value is 1
value
double precision O
Water surface elevationier
integerO
Error code. 0 means success.

6.5.76 iric_geo_riversurvey_close_f• Closes the geographic data file
Format (FORTRAN)
call iric_geo_ riversurvey_close_f(pid, ier)

Format (C/C++)
ier = iRIC_Geo_RiverSurvey_Close(pid);

Format (Python)This function does not exists for Python.
Arguments
Table 6.101: Arguments of iric_geo_riversurvey_close_f
Variable name TypeI/O Description
rid
integer I
River Survey Data ID
ier
integer O
Error code. 0 means success.

6.5.77 cg_iric_writegridcoord1d_f• Outputs a one-dimensional structured grid.

6.5. Reference

179

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_writegridcoord1d_f(nx, x, ier)

Format (C/C++)
ier = cg_iRIC_WriteGridCoord1d(nx, x);

Format (Python)
cg_iRIC_WriteGridCoord1d(nx, x)

Arguments

Variable name
nx
x
ier

Table 6.102: Arguments of cg_iric_writegridcoord1d_f
Type
I/O Description
integerI
Number of grid nodes in the i direction
double precision, dimension(:), allocatable I
x coordinate value of a grid node
integerO
Error code. 0 means success.

6.5.78 cg_iric_writegridcoord2d_f• Outputs a two-dimensional structured grid.
Format (FORTRAN)
call cg_iric_writegridcoord2d_f(nx, ny, x, y, ier)

Format (C/C++)
ier = cg_iRIC_WriteGridCoord2d(nx, ny, x, y);Format (Python)
cg_iRIC_WriteGridCoord2d(nx, ny, x, y)

180

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable name
nx
ny
x
y
ier

Table 6.103: Arguments of cg_iric_writegridcoord2d_f
Type
I/O Description
integerI
Number of grid nodes in the i direction
integerI
Number of grid nodes in the j direction
double precision, dimension(:,:), allocatable I
x coordinate value of a grid node
double precision, dimension(:,:), allocatable I
y coordinate value of a grid node
integerO
Error code. 0 means success.

6.5.79 cg_iric_writegridcoord3d_f• Outputs a three-dimensional structured grid.
Format (FORTRAN)
call cg_iric_writegridcoord2d_f(nx, ny, x, y, ier)

Format (C/C++)
ier = cg_iRIC_WriteGridCoord3d(nx, ny, nz, x, y, z);Format (Python)
cg_iRIC_WriteGridCoord3d(nx, ny, nz, x, y, z)

Arguments

Variable name
nx
ny
nz
x
y
z
ier

Table 6.104: Arguments of cg_iric_writegridcoord3d_f
Type
I/O Description
integerI
Number of grid nodes in the i direction
integerI
Number of grid nodes in the j direction
integerI
Number of grid nodes in the k direction
double precision, dimension(:), allocatable I
x coordinate value of a grid node
double precision, dimension(:), allocatable I
y coordinate value of a grid node
double precision, dimension(:), allocatable Iz coordinate value of a grid node
integerO
Error code. 0 means success.

6.5.80 cg_iric_write_grid_integer_node_f• Outputs grid attribute values defined at grid nodes with integer

6.5. Reference

181

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_write_grid_integer_node_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Write_Grid_Integer_Node(label, values);

Format (Python)
cg_iRIC_Write_Grid_Integer_Node(label, values)

Arguments
Table 6.105: Arguments of cg_iric_write_grid_integer_node_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namevaluesinteger, dimension(:), llocatable O
Attribute values
ier
integerO
Error code. 0 means success.

6.5.81 cg_iric_write_grid_real_node_f• Outputs grid attribute values defined at grid nodes with real number
Format (FORTRAN)
call cg_iric_write_grid_real_node_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Write_Grid_Real_Node(label, values);

Format (Python)
cg_iRIC_Write_Grid_Real_Node(label, values)

182

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable namelabel
valuesier

Table 6.106: Arguments of cg_iric_write_grid_real_node_f
Type
I/O Description
character(*)
I
Attribute namedouble precision, dimension(:), allocatable O
Attribute values
integerO
Error code. 0 means success.

6.5.82 cg_iric_write_grid_integer_cell_f• Outputs grid attribute values defined at grid cells with integer value.
Format (FORTRAN)
call cg_iric_write_grid_integer_cell_f(label, values, ier)

Format (C/C++)
ier = cg_iRIC_Write_Grid_Integer_Cell(label, values);

Format (Python)
cg_iRIC_Write_Grid_Integer_Cell(label, values)

Arguments
Table 6.107: Arguments of cg_iric_write_grid_integer_cell_f
Variable name TypeI/O Descriptionlabelcharacter(*)
I
Attribute namevaluesinteger, dimension(:), allocatable O
Attribute values
ier
integerO
Error code. 0 means success.

6.5.83 cg_iric_write_grid_real_cell_f• Outputs grid attribute values defined at grid cells with real number value.
Format (FORTRAN)
call cg_iric_read_grid_real_cell_f(label, values, ier)

6.5. Reference

183

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Write_Grid_Real_Cell(label, values);

Format (Python)
cg_iRIC_Write_Grid_Real_Cell(label, values)

Arguments

Variable namelabel
valuesier

Table 6.108: Arguments of cg_iric_write_grid_real_cell_fType
I/O Description
character(*)
I
Attribute namedouble precision, dimension(:), allocatable O
Attribute values
integerO
Error code. 0 means success.

6.5.84 cg_iric_write_sol_time_f• Outputs time.
Format (FORTRAN)
call cg_iric_write_sol_time_f(time, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Time(time);

Format (Python)
cg_iRIC_Write_Sol_Time(time)

Arguments
Table 6.109: Arguments of cg_iric_write_sol_time_f
Variable name TypeI/O Description
time
double precision ITime
ierintegerO
Error code. 0 means success.

6.5.85 cg_iric_write_sol_iteration_f• Outputs iteration count.
184

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_write_sol_iteration_f(iteration, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Iteration(iteration);

Format (Python)
cg_iRIC_Write_Sol_Iteration(iteration)

Arguments
Table 6.110: Arguments of cg_iric_write_sol_iteration_f
Variable name TypeI/O Description
iteration
integer I
Iteration countier
integer O
Error code. 0 means success.

6.5.86 cg_iric_write_sol_gridcoord2d_f• Outputs a two-dimensional structured grid.
Format (FORTRAN)
call cg_iric_write_sol_gridcoord2d_f(x, y, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_GridCoord2d(x, y);Format (Python)
cg_iRIC_Write_Sol_GridCoord2d(x, y)

Arguments

Variable namexyier
6.5. Reference

Table 6.111: Arguments of cg_iric_write_sol_gridcoord2d_f
Type
I/O Description
double precision, dimension(:), allocatable I
x coordinate.
double precision, dimension(:), allocatable I
y coordinate
integerO
Error code. 0 means success.
185

iRIC Developer’s manual, Release 3.0.0

6.5.87 cg_iric_write_sol_gridcoord3d_f• Outputs a three-dimensional structured grid.
Format (FORTRAN)
call cg_iric_write_sol_gridcoord3d_f(x, y, z, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_GridCoord3d(x, y, z);Format (Python)
cg_iRIC_Write_Sol_GridCoord3d(x, y, z)

Arguments

Variable name
x
y
z
ier

Table 6.112: Arguments of cg_iric_write_sol_gridcoord3d_f
Type
I/O Description
double precision, dimension(:), allocatable I
x coordinate.
double precision, dimension(:), allocatable I
y coordinate.
double precision, dimension(:), allocatable Iz coordinate
integerO
Error code. 0 means success.

6.5.88 cg_iric_write_sol_baseiterative_integer_f• Outputs integer-type calculation results.
Format (FORTRAN)
call cg_iric_write_sol_baseiterative_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_BaseIterative_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_BaseIterative_Integer(label, val)

186

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.113: Arguments of cg_iric_write_sol_baseiterative_integer_f
Variable name TypeI/O Descriptionlabelcharacter* I
Name of the value to be output
val
integerI
Value to be output
ier
integerO
Error code. 0 means success.

6.5.89 cg_iric_write_sol_baseiterative_real_f• Outputs double-precision real-type calculation results.
Format (FORTRAN)
call cg_iric_write_sol_baseiterative_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_BaseIterative_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_BaseIterative_Real(label, val)

Arguments
Table 6.114: Arguments of cg_iric_write_sol_baseiterative_real_f
Variable name TypeI/O Descriptionlabelcharacter*I
Name of the value to be output
val
double precision I
Value to be output
ier
integerO
Error code. 0 means success.

6.5.90 cg_iric_write_sol_baseiterative_string_f• Outputs string-type calculation results.
Format (FORTRAN)
call cg_iric_write_sol_baseiterative_string_f(label, val, ier)

6.5. Reference

187

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Write_Sol_BaseIterative_String(label, val);

Format (Python)
cg_iRIC_Write_Sol_BaseIterative_String(label, val)

Arguments
Table 6.115: Arguments of cg_iric_write_sol_baseiterative_string_f
Variable name TypeI/O Descriptionlabelcharacter* I
Name of the value to be output
valcharacter* I
Value to be output
ier
integerO
Error code. 0 means success.

6.5.91 cg_iric_write_sol_integer_f• Outputs integer-type calculation results, giving a value for each grid node.
Format (FORTRAN)
call cg_iric_write_sol_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_Integer(label, val)

Arguments

Variable
name
label
val
ier

188

Type

Table 6.116: Arguments of cg_iric_write_sol_integer_f
I/O Description

character*
integer, dimension(:,:),
allocatable
integerI
I
O

Name of the value to be output
Value to be output In the case of a 3D grid, the type should be integer, dimension(:,:,:), allocatable.
Error code. 0 means success.

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.92 cg_iric_write_sol_real_f• Outputs double-precision real-type calculation results, having a value for each grid node.
Format (FORTRAN)
call cg_iric_write_sol_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_Real(label, val)

Arguments

Variable
name
label
val
ier

Type

Table 6.117: Arguments of cg_iric_write_sol_real_f
I/O Description

character*double precision, dimension(:,:), allocatable
integerI
I
O

Name of the value to be output.
Value to be output In the case of a 3D grid, the type should be
double precision, dimension(:,:,:), allocatable.
Error code. 0 means success.

6.5.93 cg_iric_write_sol_cell_integer_f• Outputs integer-type calculation results, giving a value for each grid cell.
Format (FORTRAN)
call cg_iric_write_sol_cell_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Cell_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_Cell_Integer(label, val)

6.5. Reference

189

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable
name
label
val
ier

Type

Table 6.118: Arguments of cg_iric_write_sol_cell_integer_f
I/O Description

character*
integer, dimension(:,:),
allocatable
integerI
I

Name of the value to be output
Value to be output In the case of a 3D grid, the type should be integer, dimension(:,:,:), allocatable.
Error code. 0 means success.

O

6.5.94 cg_iric_write_sol_cell_real_f• Outputs double-precision real-type calculation results, having a value for each grid cell.
Format (FORTRAN)
call cg_iric_write_sol_cell_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Cell_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_Cell_Real(label, val)

Arguments

Variable
name
label
val
ier

Type

Table 6.119: Arguments of cg_iric_write_sol_cell_real_f
I/O Description

character*double precision, dimension(:,:), allocatable
integerI
I
O

Name of the value to be output.
Value to be output In the case of a 3D grid, the type should be
double precision, dimension(:,:,:), allocatable.
Error code. 0 means success.

6.5.95 cg_iric_write_sol_iface_integer_f• Outputs integer-type calculation results, giving a value for each grid edge at i-direction.
Format (FORTRAN)

190

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

call cg_iric_write_sol_iface_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_IFace_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_IFace_Integer(label, val)

Arguments

Variable name
label
val
ier

Table 6.120: Arguments of cg_iric_write_sol_iface_integer_f
Type
I/O Description
character*I
Name of the value to be output.
integer, dimension(:,:), allocatable I
Value
integerO
Error code. 0 means success.

6.5.96 cg_iric_write_sol_iface_real_f• Outputs double-precision real-type calculation results, giving a value for each grid edge at i-direction.
Format (FORTRAN)
call cg_iric_write_sol_iface_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_IFace_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_IFace_Real(label, val)

Arguments

Variable name
label
val
ier

6.5. Reference

Table 6.121: Arguments of cg_iric_write_sol_iface_real_f
Type
I/O Description
character*I
Name of the value to be output.
double precision, dimension(:,:), allocatable I
Value
integerO
Error code. 0 means success.

191

iRIC Developer’s manual, Release 3.0.0

6.5.97 cg_iric_write_sol_jface_integer_f• Outputs integer-type calculation results, giving a value for each grid edge at j-direction.
Format (FORTRAN)
call cg_iric_write_sol_jface_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_JFace_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_JFace_Integer(label, val)

Arguments
Table 6.122: Arguments of cg_iric_write_sol_jface_integer_f
Variable name TypeI/O Descriptionlabelcharacter*I
Name of the value to be output.
val
integer, dimension(:,:), allocatable I
Value
ier
integerO
Error code. 0 means success.

6.5.98 cg_iric_write_sol_jface_real_f• Outputs double-precision real-type calculation results, giving a value for each grid edge at j-direction.
Format (FORTRAN)
call cg_iric_write_sol_jface_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_JFace_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_JFace_Real(label, val)

192

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable name
label
val
ier

Table 6.123: Arguments of cg_iric_write_sol_jface_real_f
Type
I/O Description
character*I
Name of the value to be output.
double precision, dimension(:,:), allocatable I
Value
integerO
Error code. 0 means success.

6.5.99 cg_iric_write_sol_particle_pos2d_f• Outputs particle positions (two-dimensions)
Format (FORTRAN)
call cg_iric_write_sol_particle_pos2d_f(count, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Particle_Pos2d(count, x, y);Format (Python)
cg_iRIC_Write_Sol_Particle_Pos2d(x, y)

Arguments

Variable name
count
x
y
ier

Table 6.124: Arguments of cg_iric_write_sol_particle_pos2d_f
Type
I/O Description
integerI
The number of particles
double precision, dimension(:), allocatable I
x coordinate.
double precision, dimension(:), allocatable I
y coordinate.
integerO
Error code. 0 means success.

6.5.100 cg_iric_write_sol_particle_pos3d_f• Outputs particle positions (three-dimensions)
Format (FORTRAN)
call cg_iric_write_sol_particle_pos3d_f(count, x, y, z, ier)

6.5. Reference

193

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Write_Sol_Particle_Pos3d(count, x, y, z);Format (Python)
cg_iRIC_Write_Sol_Particle_Pos3d(x, y, z)

Arguments

Variable name
count
x
y
z
ier

Table 6.125: Arguments of cg_iric_write_sol_particle_pos3d_f
Type
I/O Description
integerI
The number of particles
double precision, dimension(:), allocatable I
x coordinate.
double precision, dimension(:), allocatable I
y coordinate.
double precision, dimension(:), allocatable Iz coordinate.
integerO
Error code. 0 means success.

6.5.101 cg_iric_write_sol_particle_integer_f• Outputs integer-type calculation results, giving a value for each particle.
Format (FORTRAN)
call cg_iric_write_sol_particle_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Particle_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_Particle_Integer(label, val)

Arguments
Table 6.126: Arguments of cg_iric_write_sol_particle_integer_f
Variable name TypeI/O Descriptionlabelcharacter*I
Name of the value to be output.
val
integer, dimension(:), allocatable I
Value to be output
ier
integerO
Error code. 0 means success.

194

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.102 cg_iric_write_sol_particle_real_f• Outputs double-precision real-type calculation results, giving a value for each particle.
Format (FORTRAN)
call cg_iric_write_sol_particle_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_Particle_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_Particle_Real(label, val)

Arguments

Variable name
label
val
ier

Table 6.127: Arguments of cg_iric_write_sol_particle_real_f
Type
I/O Description
character*I
Name of the value to be output.
double precision, dimension(:), allocatable I
Value to be output
integerO
Error code. 0 means success.

6.5.103 cg_iric_write_sol_particlegroup_groupbegin_f• Start outputting calculation result defined at particles
Format (FORTRAN)
call cg_iric_write_sol_particlegroup_groupbegin_f(name, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(name);

Format (Python)
cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(name)

6.5. Reference

195

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.128: Arguments of cg_iric_write_sol_particlegroup_groupbegin_f
Variable name TypeI/O Description
namecharacter* I
Name of the group to be output.
ier
integerO
Error code. 0 means success.

6.5.104 cg_iric_write_sol_particlegroup_groupend_f• Finish outputting calculation result defined as particles.
Format (FORTRAN)
call cg_iric_write_sol_particlegroup_groupend_f(ier)Format (C/C++)
ier = cg_iRIC_Write_Sol_ParticleGroup_GroupEnd();Format (Python)
cg_iRIC_Write_Sol_ParticleGroup_GroupEnd()

Arguments
Table 6.129: Arguments of cg_iric_write_sol_particlegroup_groupend_f
Variable name TypeI/O Descriptionier
integer O
Error code. 0 means success.

6.5.105 cg_iric_write_sol_particlegroup_pos2d_f• Outputs particle positions (two-dimensions)
Format (FORTRAN)
call cg_iric_write_sol_particlegroup_pos2d_f(x, y, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_ParticleGroup_Pos2d(x, y);196

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (Python)
cg_iRIC_Write_Sol_ParticleGroup_Pos2d(x, y)

Arguments
Table 6.130: Arguments of cg_iric_write_sol_particlegroup_pos2d_f
Variable name TypeI/O Descriptionx
double precision I
x coordinate.
ydouble precision I
y coordinate.
ier
integerO
Error code. 0 means success.

6.5.106 cg_iric_write_sol_particlegroup_pos3d_f• Outputs particle positions (three-dimensions)
Format (FORTRAN)
call cg_iric_write_sol_particlegroup_pos3d_f(x, y, z, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_ParticleGroup_Pos3d(x, y, z);Format (Python)
cg_iRIC_Write_Sol_ParticleGroup_Pos3d(x, y, z)

Arguments
Table 6.131: Arguments of cg_iric_write_sol_particlegroup_pos3d_f
Variable name TypeI/O Descriptionx
double precision I
x coordinate.
ydouble precision I
y coordinate.
zdouble precision Iz coordinate.
ier
integerO
Error code. 0 means success.

6.5.107 cg_iric_write_sol_particlegroup_integer_f• Outputs integer-type calculation results, giving a value for each particle.

6.5. Reference

197

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_write_sol_particlegroup_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_ParticleGroup_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_ParticleGroup_Integer(label, val)

Arguments
Table 6.132: Arguments of cg_iric_write_sol_particlegroup_integer_f
Variable name TypeI/O Descriptionlabelcharacter* I
Name of the value to be output.
val
integerI
Value to be output
ier
integerO
Error code. 0 means success.

6.5.108 cg_iric_write_sol_particlegroup_real_f• Outputs double-precision real-type calculation results, giving a value for each particle.
Format (FORTRAN)
call cg_iric_write_sol_particlegroup_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_ParticleGroup_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_ParticleGroup_Real(label, val)

198

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.133: Arguments of cg_iric_write_sol_particlegroup_real_f
Variable name TypeI/O Descriptionlabelcharacter*I
Name of the value to be output.
val
double precision I
Value to be output
ier
integerO
Error code. 0 means success.

6.5.109 cg_iric_write_sol_polydata_groupbegin_f• Start outputting calculation result defined at polygons or polylines.
Format (FORTRAN)
call cg_iric_write_sol_polydata_groupbegin_f(name, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_PolyData_GroupBegin(name);

Format (Python)
cg_iRIC_Write_Sol_PolyData_GroupBegin(name)Arguments
Table 6.134: Arguments of cg_iric_write_sol_polydata_groupbegin_f
Variable name TypeI/O Description
namecharacter* I
Name of the group to be output.
ier
integerO
Error code. 0 means success.

6.5.110 cg_iric_write_sol_polydata_groupend_f• Finish outputting calculation result defined at polygons or polylines.
Format (FORTRAN)
call cg_iric_write_sol_polydata_groupend_f(ier)Format (C/C++)

6.5. Reference

199

iRIC Developer’s manual, Release 3.0.0

ier = cg_iRIC_Write_Sol_PolyData_GroupEnd();Format (Python)
cg_iRIC_Write_Sol_PolyData_GroupEnd()

Arguments
Table 6.135: Arguments of cg_iric_write_sol_polydata_groupend_f
Variable name TypeI/O Descriptionier
integer O
Error code. 0 means success.

6.5.111 cg_iric_write_sol_polydata_polygon_f• Output calculation result defined as polygon.
Format (FORTRAN)
call cg_iric_write_sol_polydata_polygon_f(numpoints, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_PolyData_Polygon(numpoints, x, y);Format (Python)
cg_iRIC_Write_Sol_PolyData_Polygon(x, y)

Arguments

Variable namenumpointsxyier

Table 6.136: Arguments of cg_iric_write_sol_polydata_polygon_fType
I/O Description
integerI
The number of points in the polygon
double precision, dimension(:), allocatable I
x coordinate.
double precision, dimension(:), allocatable I
y coordinate.
integerO
Error code. 0 means success.

6.5.112 cg_iric_write_sol_polydata_polyline_f• Output calculation result defined as polyline.

200

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_write_sol_polydata_polyline_f(numpoints, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_PolyData_Polyline(numpoints, x, y);Format (Python)
cg_iRIC_Write_Sol_PolyData_Polyline(x, y)

Arguments

Variable namenumpointsxyier

Table 6.137: Arguments of cg_iric_write_sol_polydata_polyline_f
Type
I/O Description
integerI
The number of points in the polyline
double precision, dimension(:), allocatable I
x coordinate.
double precision, dimension(:), allocatable I
y coordinate.
integerO
Error code. 0 means success.

6.5.113 cg_iric_write_sol_polydata_integer_f• Outputs integer-type calculation results, giving a value for a polygon or polyline.
Format (FORTRAN)
call cg_iric_write_sol_polydata_integer_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_PolyData_Integer(label, val);

Format (Python)
cg_iRIC_Write_Sol_PolyData_Integer(label, val)

6.5. Reference201

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.138: Arguments of cg_iric_write_sol_polydata_integer_f
Variable name TypeI/O Descriptionlabelcharacter* I
Name of the value to be output.
val
integerI
Value to be output
ier
integerO
Error code. 0 means success.

6.5.114 cg_iric_write_sol_polydata_real_f• Outputs double-precision real-type calculation results, giving a value for a polygon or polyline.
Format (FORTRAN)
call cg_iric_write_sol_polydata_real_f(label, val, ier)

Format (C/C++)
ier = cg_iRIC_Write_Sol_PolyData_Real(label, val);

Format (Python)
cg_iRIC_Write_Sol_PolyData_Real(label, val)

Arguments
Table 6.139: Arguments of cg_iric_write_sol_polydata_real_f
Variable name TypeI/O Descriptionlabelcharacter*I
Name of the value to be output.
val
double precision I
Value to be output
ier
integerO
Error code. 0 means success.

6.5.115 iric_check_cancel_f• Checks whether user canceled solver execution
Format (FORTRAN)
call iric_check_cancel_f(canceled)

202

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
iRIC_Check_Cancel(&canceled);

Format (Python)canceled = iRIC_Check_Cancel()Arguments
Table 6.140: Arguments of iric_check_cancel_f
Variable name TypeI/O Description
canceled
integer O
If canceled 1 returned

6.5.116 iric_check_lock_f• Checks whether the CGNS file is locked by GUI
Format (FORTRAN)
call iric_check_lock_f(filename, locked)

Format (C/C++)
iRIC_Check_Lock(filename, locked);

Format (Python)This function does not exists for Python.
Arguments
Table 6.141: Arguments of iric_check_lock_f
Variable name TypeI/O Description
filenamecharacter(*) I
FilenamelockedintegerO
If locked 1 returned.

6.5.117 iric_write_sol_start_f• Inform the GUI that the solver started outputting result

6.5. Reference203

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call iric_write_sol_start_f(filename, ier)

Format (C/C++)
ier = iRIC_Write_Sol_Start(filename);

Format (Python)This function does not exists for Python.
Arguments
Table 6.142: Arguments of iric_write_sol_start_f
Variable name TypeI/O Description
filenamecharacter(*) I
Filenameier
integerO
Error code. 0 means success.

6.5.118 iric_write_sol_end_f• Inform the GUI that the solver finished outputting result
Format (FORTRAN)
call iric_write_sol_end_f(filename, ier)

Format (C/C++)
ier = iRIC_Write_Sol_End(filename);

Format (Python)This function does not exists for Python.
Arguments
Table 6.143: Arguments of iric_write_sol_end_f
Variable name TypeI/O Description
filenamecharacter(*) I
Filenameier
integerO
Error code. 0 means success.

204

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.119 cg_iric_flush_f• Flush calculation result into CGNS file
Format (FORTRAN)
call cg_iric_flush_f(filename, fin, ier)

Format (C/C++)
ier = cg_iRIC_Flush(filename, fin);

Format (Python)
fin = cg_iRIC_Flush(filename, fin)Arguments
Table 6.144: Arguments of cg_iric_flush_f
Variable name TypeI/O Description
filenamecharacter(*) I
Filename
fid
integer
I/O File ID
ier
integerO
Error code. 0 means success.

6.5.120 cg_iric_read_sol_count_f• Reads the number of calculation result
Format (FORTRAN)
call cg_iric_read_sol_count_f(count, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_Count(&count);

Format (Python)count = cg_iRIC_Read_Sol_Count()

6.5. Reference

205

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.145: Arguments of cg_iric_read_sol_count_f
Variable name TypeI/O Description
countinteger O
The number of the calculation resultier
integer O
Error code. 0 means success.

6.5.121 cg_iric_read_sol_time_f• Reads the time value
Format (FORTRAN)
call cg_iric_read_sol_time_f(step, time, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_Time(step, &time);

Format (Python)time = cg_iRIC_Read_Sol_Time(step)

Arguments
Table 6.146: Arguments of cg_iric_read_sol_time_f
Variable name TypeI/O Description
step
integerI
Result Step Number
time
double precision OTime
ierintegerO
Error code. 0 means success.

6.5.122 cg_iric_read_sol_iteration_f• Reads the loop iteration value
Format (FORTRAN)
call cg_iric_read_sol_iteration_f(step, iteration, ier)

Format (C/C++)

206

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

ier = cg_iRIC_Read_Sol_Iteration(step, &iteration);

Format (Python)
iteration = cg_iRIC_Read_Sol_Iteration(step)

Arguments
Table 6.147: Arguments of cg_iric_read_sol_iteration_f
Variable name TypeI/O Description
step
integer I
Result Step Number
iteration
integer O
Iteration valueier
integer O
Error code. 0 means success.

6.5.123 cg_iric_read_sol_baseiterative_integer_f• Reads the integer-type calculation result value
Format (FORTRAN)
call cg_iric_read_sol_baseiterative_integer_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_BaseIterative_Integer(step, label, &val);

Format (Python)val = cg_iRIC_Read_Sol_BaseIterative_Integer(step, label)

Arguments
Table 6.148: Arguments of cg_iric_read_sol_baseiterative_integer_f
Variable name TypeI/O Description
step
integerI
Result Step Number
labelcharacter(*) I
NamevalintegerO
Value
ier
integerO
Error code. 0 means success.

6.5.124 cg_iric_read_sol_baseiterative_real_f• Reads the double-precision real-type calculation result value
6.5. Reference

207

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_sol_baseiterative_real_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_BaseIterative_Real(step, label, &val);

Format (Python)val = cg_iRIC_Read_Sol_BaseIterative_Real(step, label)

Arguments
Table 6.149: Arguments of cg_iric_read_sol_baseiterative_real_f
Variable name TypeI/O Description
step
integerI
Result Step Number
labelcharacter(*)
I
Name
val
double precision O
Value
ier
integerO
Error code. 0 means success.

6.5.125 cg_iric_read_sol_baseiterative_string_f• Reads the string-type calculation result value
Format (FORTRAN)
call cg_iric_read_sol_baseiterative_string_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_BaseIterative_String(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_BaseIterative_String(step, label)

208

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Arguments
Table 6.150: Arguments of cg_iric_read_sol_baseiterative_string_f
Variable name TypeI/O Description
step
integerI
Result Step Number
labelcharacter(*) I
Namevalcharacter(*) O
Value
ier
integerO
Error code. 0 means success.

6.5.126 cg_iric_read_sol_gridcoord2d_f• Reads the 2D structured grid (for moving grid calculation)
Format (FORTRAN)
call cg_iric_read_sol_gridcoord2d_f(step, x, y, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_GridCoord2d(step, x, y);Format (Python)x, y = cg_iRIC_Read_Sol_GridCoord2d(step)

Arguments

Variable name
step
x
y
ier

Table 6.151: Arguments of cg_iric_read_sol_gridcoord2d_f
Type
I/O Description
integerI
Result Step Number
double precision, dimension(:), allocatable O
x coordinates
double precision, dimension(:), allocatable O
y coordinates
integerO
Error code. 0 means success.

6.5.127 cg_iric_read_sol_gridcoord3d_f• Reads the 3D structured grid (for moving grid calculation)
Format (FORTRAN)
call cg_iric_read_sol_gridcoord3d_f(step, x, y, z, ier)

6.5. Reference

209

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_Sol_GridCoord3d(step, x, y, z);Format (Python)x, y, z = cg_iRIC_Read_Sol_GridCoord3d(step)

Arguments

Variable name
step
x
y
z
ier

Table 6.152: Arguments of cg_iric_read_sol_gridcoord3d_f
Type
I/O Description
integerI
Result Step Number
double precision, dimension(:), allocatable O
Xcoordinates
double precision, dimension(:), allocatable O
Y coordinates
double precision, dimension(:), allocatable O
Z coordinates
integerO
Error code. 0 means success.

6.5.128 cg_iric_read_sol_integer_f• Reads the integer-type calculation result, having a value for each grid node.
Format (FORTRAN)
call cg_iric_read_sol_integer_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_Integer(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_Integer(step, label)

Arguments

Variable
name
step
label
val
ier
210

Type

Table 6.153: Arguments of cg_iric_read_sol_integer_f
I/O Description

integercharacter(*)
integer,sion(:,:),allocatable
integerdimen-I
I
O
O

Result Step Number
Name
Value (In case of 3D grid, integer, dimension(:,:,:), allocatable)
Error code. 0 means success.
Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

6.5.129 cg_iric_read_sol_real_f• Reads the double-precision real-type calculation result, having a value for each grid node.
Format (FORTRAN)
call cg_iric_read_sol_real_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_Real(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_Real(step, label)

Arguments

Variable
name
step
label
val
ier

Type

Table 6.154: Arguments of cg_iric_read_sol_real_f
I/O Description

integercharacter(*)
double precision, dimension(:,:),
allocatable
integerI
I
OO

Result Step Number
Name
Value (In case of 3D grid, double precision, dimension(:,:,:), allocatable)
Error code. 0 means success.

6.5.130 cg_iric_read_sol_cell_integer_f• Reads the integer-type calculation result, having a value for each grid cell.
Format (FORTRAN)
call cg_iric_read_sol_cell_integer_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_Cell_Integer(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_Cell_Integer(step, label)

6.5. Reference211

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable
name
step
label
val

Type

Table 6.155: Arguments of cg_iric_read_sol_cell_integer_f
I/O Description

integercharacter(*)
integer,sion(:,:),allocatable
integerier

dimen-I
I
O
O

Result Step Number
Name
Value (In case of 3D grid, integer, dimension(:,:,:), allocatable)
Error code. 0 means success.

6.5.131 cg_iric_read_sol_cell_real_f• Reads the double-precision real-type calculation result, having a value for each grid cell.
Format (FORTRAN)
call cg_iric_read_sol_cell_real_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_Cell_Real(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_Cell_Real(step, label)

Arguments

Variable
name
step
label
val
ier

Type

Table 6.156: Arguments of cg_iric_read_sol_cell_real_f
I/O Description

integercharacter(*)
double precision, dimension(:,:),
allocatable
integerI
I
OO

Result Step Number
Name
Value (In case of 3D grid, double precision, dimension(:,:,:), allocatable)
Error code. 0 means success.

6.5.132 cg_iric_read_sol_iface_integer_f• Reads the integer-type calculation result, having a value for each grid edge at i-direction.

212

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (FORTRAN)
call cg_iric_read_sol_iface_integer_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_IFace_Integer(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_IFace_Integer(step, label)

Arguments
Table 6.157: Arguments of cg_iric_read_sol_iface_integer_f
Variable name TypeI/O Description
step
integerI
Result Step Number
labelcharacter(*)
I
Name
val
integer, dimension(:,:), allocatable O
Value
ier
integerO
Error code. 0 means success.

6.5.133 cg_iric_read_sol_iface_real_f• Reads the double-precision real-type calculation result, having a value for each grid edge at i-direction.
Format (FORTRAN)
call cg_iric_read_sol_iface_real_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_IFace_Real(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_IFace_Real(step, label)

6.5. Reference213

iRIC Developer’s manual, Release 3.0.0

Arguments

Variable name
step
label
val
ier

Table 6.158: Arguments of cg_iric_read_sol_iface_real_f
Type
I/O Description
integerI
Result Step Number
character(*)
I
Namedouble precision, dimension(:,:), allocatable O
Value
integerO
Error code. 0 means success.

6.5.134 cg_iric_read_sol_jface_integer_f• Reads the integer-type calculation result, having a value for each grid edge at j-direction.
Format (FORTRAN)
call cg_iric_read_sol_jface_integer_f(step, label, val, ier)

Format (C/C++)
ier = cg_iRIC_Read_Sol_JFace_Integer(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_JFace_Integer(step, label)

Arguments
Table 6.159: Arguments of cg_iric_read_sol_jface_integer_f
Variable name TypeI/O Description
step
integerI
Result Step Number
labelcharacter(*)
I
Name
val
integer, dimension(:,:), allocatable O
Value
ier
integerO
Error code. 0 means success.

6.5.135 cg_iric_read_sol_jface_real_f• Reads the double-precision real-type calculation result, having a value for each grid edge at j-direction.
Format (FORTRAN)
call cg_iric_read_sol_jface_real_f(step, label, val, ier)

214

Chapter 6. iRIClib

iRIC Developer’s manual, Release 3.0.0

Format (C/C++)
ier = cg_iRIC_Read_Sol_JFace_Real(step, label, val);

Format (Python)val = cg_iRIC_Read_Sol_JFace_Real(step, label)

Arguments

Variable name
step
label
val
ier

Table 6.160: Arguments of cg_iric_read_sol_jface_real_f
Type
I/O Description
integerI
Result Step Number
character(*)
I
Namedouble precision, dimension(:,:), allocatable O
Value
integerO
Error code. 0 means success.

6.5.136 cg_iric_write_errorcode_f• Outputs error code
Format (FORTRAN)
call cg_iric_write_errorcode_f(code, ier)

Format (C/C++)
ier = cg_iRIC_Write_ErrorCode(code);

Format (Python)
cg_iRIC_Write_ErrorCode(code)

Arguments

Variable name
code
ier

6.5. Reference

Table 6.161: Arguments of cg_iric_write_errorcode_f
Type
I/O Description
integer I
The error code that the grid generating program returns.
integer O
Error code. 0 means success.

215

iRIC Developer’s manual, Release 3.0.0

6.5.137 cg_close_f• Closing the CGNS file
Format (FORTRAN)
call cg_close_f(fid, ier)

Format (C/C++)
ier = cg_close(fid);

Format (Python)
cg_close(fid)Arguments
Table 6.162: Arguments of cg_close_f
Variable name TypeI/O Description
fid
integer I
File IDier
integer O
Error code. 0 means success.

216

Chapter 6. iRIClib

CHAPTER

7Other Informations

7.1 Handling command line arguments in Fortran programs
When iRIC launches solvers (or grid generating programs), the name of calculation data file (or grid generating datafile) is passed as an argument. So, solvers (or grid generating programs) have to process the file name and opens thatfile.
In FORTRAN, the functions prepared for handling arguments are different by compilers. In this section, functions forhandling arguments are explained for Intel Fortran Complier and GNU Fortran compiler.

7.1.1 Intel Fortran Compiler
Obtain the number of command line arguments using nargs(), and obtain the argument value using getarg().
List 7.1: Example source code for reading arguments for Intel FortranCompiler
1

2
3
4
5
6
7

icount = nargs() ! The number includes the executable name, so if user passed one
˓→argument, 2 is returned.
if ( icount.eq.2 ) thencall getarg(1, condFile, istatus)
else
write(*,*) "Input File not specified."
stop
endif

7.1.2 GNU Fortran, G95
Obtain the number of command line arguments using iargc(), and obtain the argument value using getarg().
Note that nargs(), getargs() in GNU Fortran has different specification to those in Intel Fortran Compiler.

217

iRIC Developer’s manual, Release 3.0.0

List 7.2: Example source code for reading arguments for GNU Fortranor G95
1

2
3
4
5
6
7
8

icount = iargc() ! The number does not includes the executable name, so if user
˓→passed one argument, 1 is returned.
if ( icount.eq.1 ) thencall getarg(0, str1)! The file name of the executable.
call getarg(1, condfile) ! The first argument
else
write(*,*) "Input File not specified."
stop
endif

7.2 Linking iRIClib, cgnslib using Fortran
When you develop solvers (or grid generating programs), you have to link the program with iRIClib and cgnslib. You
have to use different library files for different compilers like Intel Fortran Compiler and GNU Fortran. Table 7.1 shows
the files prepared for each compiler.
For header file, “libcgns_f.h”, “iriclib_f.h” can be used for all compilers commonly.
Table 7.1: Files prepared fore each compiler
Compiler
iRIClib librarycgnslib libraray
Intel Fortran Compiler iriclib_x64_ifort.lib cgnsdll_x64_ifort.lib
GNU Fortran(gfortran) iriclib.lib
cgnsdll.lib
We will explain the procedure to compile the source code (solver.f). We assume that the settings for compilers (likepath settings) are already finished.

7.2.1 Intel Fortran Compiler (Windows)
Put solver.f, cgnsdll_x64_ifort.lib, iriclib_x64_ifort.lib, cgnslib_f.h, iriclib_f.h in a same folder, move to that folder
with command prompt, and run the following command to create an executable file named solver.exe.
ifort solver.f cgnsdll_x64_ifort.lib iriclib_x64_ifort.lib /MD

When compiling is done, a file named solver.exe.manifest is also created. When copying the solver to another machine,
make sure to copy this file and to place them together in the same folder.

7.2.2 GNU FortranPut solver.f, cgnsdll.lib, iriclib.lib, cgnslib_f.h, iriclib_f.h in a same folder, move to that folder with command prompt,
and run the following command to create an executable file named solver.exe.
gfortran -c solver.fg++ -o solver.exe -lgfortran solver.o cgnsdll.lib iriclib.lib

218

Chapter 7. Other Informations

iRIC Developer’s manual, Release 3.0.0

7.3 Special names for grid attributes and calculation results
In iRIC, some special names for grid attribute and calculation results are defined for certain purposes. Use those names
when the solver uses the grid attributes or calculation results that match the purposes.

7.3.1 Grid attributes
Table 7.2 shows the special names defined for grid attributes.
Table 7.2: Special names for grid attributes
Name
Elevation

Description
Grid attribute that contains elevation of grid nodes (Unit: meter). Define “Elevation” attribute as an
attribute defined at grid node, with real number type.

When you use “Elevation” for grid attribute, define an Item element as a child of GridRelatedCondition element, like
List 7.3. You can change caption attribute value to an arbitrary value.
List 7.3: Example of "Elevation" element definition<Item name="Elevation" caption="Elevation"><Definition position="node" valueType="real" default="max" /></Item>When you create a grid generating program and want to output elevation value, use name “Elevation”. iRIC willautomatically load “Elevation” value.
List 7.4 shows an example of code written in Fortran.
List 7.4: Example of source code to output elevation value in grid generating program
cg_iric_write_grid_real_node_f("Elevation", elevation, ier);

7.3.2 Calculation results
Table 7.3 shows the special names defined for calculation results. Specify these names as arguments of subroutines
defined in iRIClib.
List 7.5 shows an example of solver source code that outputs all special calculation result.
Table 7.3: Special names for calculation results
Name

Description

Elevation

Outputs bed elevation (unit: meter). Output the value as real number calculation result.
You can add unit in the tail as the part of the name, like “Elevation(m)”.
Outputs water surface elevation (unit: meter). Output the value as real number calculation
result. You can add unit in the tail, like “WaterSurfaceElevation(m)”.

WaterSurfaceElevation
IBC

RequiredYes

Valid/invalid flag. At invalid region (i. e. dry region), the value is 0, and at valid region (i.
e. wet region), the value is 1.

7.3. Special names for grid attributes and calculation results

219

iRIC Developer’s manual, Release 3.0.0

List 7.5: Example of source code to output calculation results with thespecial names
call cg_iric_write_sol_real_f('Elevation(m)', elevation_values, ier)
call cg_iric_write_sol_real_f('WaterSurfaceElevation(m)', surface_values, ier)
call cg_iric_write_sol_integer_f('IBC', IBC_values, ier)

7.4 Information on CGNS file and CGNS library
7.4.1 General concept of CGNS file format
CGNS, which stands for CFG General Notation System, refers to a general-purpose file format for storing data foruse in numeric hydrodynamics. It can be used across various platforms of different OSes and CPUs. In addition to its
standard data format being defined for use in numeric hydrodynamics, it has expandability that allows the addition ofelements specific to each solver.
An input/output library for CGNS, called cgnslib, is provided. It can be used in the following languages.
• C, C++• FORTRAN• Python
Originally developed by the Boeing Company and NASA, it is currently maintained by an open-source community.

7.4.2 How to view a CGNS file
This section describes how to view a CGNS file that has been created by iRIC using HDFView. HDFView is a softwaretool published as free software.
Installing HDFViewFirst, install HDFView. The installer of HDFView can be downloaded fromhttps://www.hdfgroup.org/downloads/index.html
From the HDF web page, click the “Current Release” link in Figure 7.1. You will be taken to download page. On thisscreen, click on the file that fits your environment (64 bit or 32 bit) to download.
by unzipping and running the installer, you can install HDFView.
Viewing a CGNS file using HDFView
Launch HDFView and view a CGNS file.
To do so, first launch HDFView from the start menu. Then, from the following menu, select the CGNS to open.
File –> Open
Please note that “\*.cgn” is not included in the open target in default. Switch file type to “all files” to select CGNS fileas open target.
An example of the HDFView screen after opening a CGNS file is shown in Figure 7.3.

220

Chapter 7. Other Informations

iRIC Developer’s manual, Release 3.0.0

Figure 7.1: HDF group web page

7.4. Information on CGNS file and CGNS library

221

iRIC Developer’s manual, Release 3.0.0

Figure 7.2: Download page

222

Chapter 7. Other Informations

iRIC Developer’s manual, Release 3.0.0

Figure 7.3: Example of ADFviewer screen

7.4. Information on CGNS file and CGNS library

223

iRIC Developer’s manual, Release 3.0.0

In the left side of the screen, the tree structure of the CGNS file contents is shown. When you double click on the itemin the tree structure, The data contained in that node is displayed in the main region.

7.4.3 Reference URLs
For information on CGNS files and CGNS libraries, refer to the URLs in Table 7.4 .
Table 7.4: Reference URLs for CGNS file format CGNS libraries
Item
URL
Homepage
http://cgns.sourceforge.net/
Function reference
http://cgns.github.io/CGNS_docs_current/midlevel/index.html
Data structure inside a CGNS file http://cgns.github.io/CGNS_docs_current/sids/index.html
Sample programs
http://cgns.github.io/CGNS_docs_current/user/examples.html

7.5 Registering file to Repository for iRIC installer build
7.5.1 Abstract
iRIC project uses we service github for managing the files to publish through iRIC offline installer, and online update.
Solver developer can do the following things by registering the files for your newest solvers, to github:• Update the solver that is going to be bundled to offline installer, that is going to be built next time.
• Make iRIC users who have already installed iRIC can get the newest solver through online update, using menu
[Option] -> [Maintainance].
In this section the procedure to register the files for newest solver to github.

7.5.2 Procedure
Solver developer can register the files through the procedure below:
1. Install Subversion client software (needed only for the first time)
2. Get the folder from server (checkout)
3. Copy new files
4. Register new files to server (commit)
You can register files through two verson management systems: Subversion and git. In this document, the way to use
Subversion is described, because it is more simple than git.
The detail of the procedure is described below:

7.5.3 Install Subversion client software (needed only for the first time)
Install
Install the client software for Subversion. In this procedure, we adopt TortoiseSVN, that is the de facto standard
Subversion client for Windows.
Access the following URL, and download the installer for TortoiseSVN.
224

Chapter 7. Other Informations

iRIC Developer’s manual, Release 3.0.0

https://tortoisesvn.net/downloads.html
On the page there are two buttons for downloading installer: One for 32bit OS, another for 64bit OS. Please download
the installer that is suitable your environment.
When installer finished installing, restart Windows.
Setting
If you use an environment where you need to access internet through Proxy server, Please setup the setting in theprocedure below:
Select the menu below, from the right-clicking menu of explorer:
TortoiseSVN –> Settings
The Setting dialog is shown. Please select “Network” in the tree view shown in the left side of the dialog, and page
like Figure 7.4 is shown. Setup the setting to fit your environment, and click on [OK] button.

Figure 7.4: [TortoiseSVN Setting] dialog

7.5.4 Get the folder from server (checkout)
Checkout the folder, that stores the solver you want to update, that is a subfolder of the following URL:
https://github.com/i-RIC/online_update.git/trunk/dev_src/packages
For example, in case of FaSTMECH, please checkout the following URL:
https://github.com/i-RIC/online_update.git/trunk/dev_src/packages/solver.fastmech
In the procedure below, the way to get the folder for FaSTMECH is shown.

7.5. Registering file to Repository for iRIC installer build

225

iRIC Developer’s manual, Release 3.0.0

Create folder
Create the folder in which you are going to save files you get from the server.
In this example, we create a folder e:tmpfastmech.
Get the folder from server
Get the folder from server, using TortoiseSVN.
On the explorer, select the folder that you’ve created in the step above, and select the folloing menu from the rightclicking menu:
SVN Checkout
Then, the dialog in Figure 7.5 is shown.

Figure 7.5: The dialog to checkout files
In the text box next to [URL], input the following URL.
https://github.com/i-RIC/online_update.git/trunk/dev_src/packages
Then, click on the button with caption [. . . ] next to the text box. Then, the dialog in Figure 7.6 is shown.
In this dialog, please select the folder that stores the files for the solver you want to update (In this case“solver.fastmech”), and click on [OK]. Then, the [URL] is updated.
On the dialog Figure 7.5, please check again that URLand are set up correctly, and then click on [OK].
Then the dialog like Figure 7.7 is shown, and it starts downloading files from the server.
When downloading files finishes, explorer looks like in Figure 7.8. You’ll notice that the files checked out from theserver is shown with check mark icon.

226

Chapter 7. Other Informations

iRIC Developer’s manual, Release 3.0.0

Figure 7.6: The dialog to checkout files (select folder)

Figure 7.7: File checkout progress dialog

7.5. Registering file to Repository for iRIC installer build

227

iRIC Developer’s manual, Release 3.0.0

Figure 7.8: The example of explorer to show files checked out from server

7.5.5 Copy new files
Copy new files that you want to bundle to installer, to the folder you’ve checked out in the step above.
When you copy files, The icon next to each files will be like below:• Files that are overwritten is shown with an icon mark [!].
• Files that are copyed as new files is shown without an additional icon mark.
To copy files added as new files to the server, select the file, and select the file below from the right-clicking menu:
TortoiseSVN –> Add
After you do the step above, the file will be shown with an icon mark [+].
Figure 7.9 shows an example of explorer after overwriting “Fastmech.exe”, and adding “newdll.dll”.
Warning
When you update solver, you have to update not only the exolver executable files, but also definition.xml, to update
the value of version number. This is because [iRIC maintainance] can not recognize that the solver is updated, if theversion number is the same.
The version number you have to update is stored as version attribute of SolverDefinition element in definition.xml.

7.5.6 Register new files to server (commit)
Register the new files to server.
Select the folder in which you’ve registered new files, and select the menu below, from right-clicking menu:
SVN Commit
Then the dialog in Figure 7.10 is shown.

228

Chapter 7. Other Informations

iRIC Developer’s manual, Release 3.0.0

Figure 7.9: The example of explorer to after copying files

Figure 7.10: The dialog to commit new files

7.5. Registering file to Repository for iRIC installer build

229

iRIC Developer’s manual, Release 3.0.0

Make sure that the files you want to update or add are shown with check boxes checked, Add log message about the
update, and click on [OK].
The dialog in Figure 7.11 will be shown. Please input the Username and Password, and click on [OK].

Figure 7.11: [Authentication] dialog
Please contact the adninistrator of iRIC, to know the username and password.

230

Chapter 7. Other Informations

8

CHAPTERTo Readers• Please indicate that using the iRIC software, if you publish a paper with the results using the iRIC software.
• The datasets provided at the Web site are sample data. Please use them only for test computation.
• Let us know your suggestions, comments and concerns at http://i-ric.org.

231