iRIC Software Developer’s Manual¶
About This Manual¶
This 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 first, to understand the steps of developing a solver. After that, please read About definition files (XML), iRIClib, Other Informations when you need to.
Developers of grid generating programs should read Steps of developing a grid generating program first, to understand the steps of developing a grid generating program. After that, please read About definition files (XML), iRIClib, Other Informations when you need to.
Steps of developing a solver¶
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
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 1.
Solver developers have to create a new folder under “solvers” folder under iRIC install folder, and deploy files in Table 1 that you’ve prepared for your new solver.
File name | Description |
---|---|
definition.xml | Solver definition file |
solver.exe | Executable module of the solver. Developers can select any name. |
translation_ja_JP.ts etc. | Dictionary files for a solver definition file |
README | File explaining the solver |
LICENSE | License information file for the solver |
Abstracts of each file are as follows:
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 the solver. Solver definition file should be written in English.
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.
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.
README¶
README is a text file that describes about the solver. The content of README is shown in the “Description” tab in the [Select Solver] dialog.
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 1 shows the relationships of iRIC, solver and related files.
This chapter explains the steps to create the files described in this section.
Creating a folder¶
Create a special folder for the solver you develop under the “solvers” folder under the installation folder of iRIC. This time, please create “example” folder.
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.
Item | Description | Required |
---|---|---|
Basic information | The solver name, developer name, release date, etc. | Yes |
Calculation Condition | Calculation condition for solver execution | Yes |
Grid Attributes | Attributes defined at nodes or cells of calculation grids | Yes |
Boundary Conditions | Boundary conditions defined at nodes or cells of calculation grids |
Solver definition file is described in XML language. The basic grammer of XML language is explained in XML files basics.
In this section, we add definition information of a solver in the order shown in Table 2.
Defining basic information¶
Define basic information of a solver. Create a file with the content shown in List 1, and save it with name “definition.xml” under “example” folder that you created in Creating a folder
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.
Now make sure the solver definition file is arranged correctly.
Launch iRIC. The [iRIC Start Page] dialog ( Figure 3 ) is shown, so please click on [New Project]. The [Solver Select] dialog (Figure 4 ) will open, so make sure if there is a new item “Sample Solver” in the solver list. When you 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
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 for the detail.
Defining calculation conditions¶
Define calculation conditions. Calculation conditions are defined in “CalculationCondition” element. Add description of calculation condition to the solver definition file you created in Defining basic information . Solver definition file content is now as shown in List 2. The added part is shown with highlight.
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 | <?xml version="1.0" encoding="UTF-8"?> <SolverDefinition 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" > <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> |
At this point, the structure of the solver definition file is as shown in Figure 5.
Now make sure that solver definition file is arranged correctly.
Launch iRIC. The [iRIC Start page] dialog (Figure 3) will open, so please click on [Create New Project], select “Sample Solver” from the list, and click on [OK]. The Warning dialog (Figure 6) will be open, so click on [OK].
The [Pre-processing Window] will open, so perform the following:
Menu bar: –> [Calculation Condition] (C) –> [Setting] (S)
The [Calculation Condition] dialog (Figure 7) will open. Now you can see that the calculation condition items you defined in List 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 3 shows the solver definition file that has definition of “Water Surface Elevation” Tab. The added part is shown with highlight.
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 | (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"/> </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 8.
Now make sure that solver definition file is arranged correctly. Do the operation you did again, to open The [Calculation Condition] dialog (Figure 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 is enabled 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 etc.). Refer to Examples of calculation conditions, boundary conditions, and grid generating condition 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. 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 for more complex layouts.
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 4. The added part is shown with highlight.
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 10. When you create or import a grid, the [Pre-processing Window] will become like in Figure 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 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 13) will open, and you can check that you can select obstacle values from that you defined in solver definition file, in List 4.
What it comes down to is:
- 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 for the special grid attribute names.
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 5. The added part is shown with highlight.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | (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> <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 [Pre-processing Window] will become like Figure 14. When you do now know how to create or imprt a grid, refer to the User Manual.
Click on [Add new Inflow] on the context menu on [Boundary Condition] node, and The [Boundary Condition] dialog (Figure 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, and click on [Assign Condition] in the context menu. Figure 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.
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, for loading 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 for loading and writing CGNS files.
In this section, the procedure to develop a solver is described, that load calculation data file, that iRIC generates. Table 3 shows the input and output processing that the solver do against the calculation data file.
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 file | Yes |
In this section, we will develop a solver in the following procedure:
- Create a scelton
- Adds calculation data file opening and closing codes
- Adds codes to load calculation conditions, calculation girds, and boundary conditions
- Adds codes to output time and calculation results
Creating a skelton¶
First, create a scelton of a solver. Create a new file with the source code in List 6, and save as “sample.f90”. At this point, 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 for the procedure to compile using Intel Fortran Compiler and gfortran.
1 2 3 4 5 6 7 8 | program SampleProgram implicit none include 'cgnslib_f.h' include 'iriclib_f.h' 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, and rename it into the name you specified as [executable] attribute in Defining basic information. 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.
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 17). If the message is shown, it means that the solver was launched by iRIC successfully.
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 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 7 shows the source code with the lines to open and close calculation data file. The added lines are shown with highlight.
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 | program SampleProgram implicit none include 'cgnslib_f.h' include 'iriclib_f.h' integer:: fin, ier integer:: icount, istatus character(200)::condFile write(*,*) "Sample Program" icount = nargs() if ( icount.eq.2 ) then call getarg(1, condFile, istatus) else write(*,*) "Input File not specified." stop endif ! Opens calculation data file. call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! 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***" ! 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.
Check whether it can be launched from iRIC successfully, just like in Creating a skelton.
Refer to Opening a CGNS file, Initializing iRIClib and Closing a CGNS file for the details of the subroutines added in this section.
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. So, the solver has to load them to coincide with the description in the solver definition file.
List 8 shows the source code with lines to load calculation condition, grid and boundary condition. The added lines are shown with highlight.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | program SampleProgram implicit none include 'cgnslib_f.h' include 'iriclib_f.h' integer:: fin, ier integer:: icount, istatus character(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 integer:: isize, jsize double precision, dimension(:,:), allocatable:: grid_x, grid_y double precision, dimension(:,:), allocatable:: elevation integer, dimension(:,:), allocatable:: obstacle integer:: inflowid integer:: inflow_count integer:: inflow_element_max integer:: discharge_variable_sizemax integer, dimension(:), allocatable:: inflow_element_count integer, dimension(:,:,:), allocatable:: inflow_element integer, dimension(:), allocatable:: discharge_type double precision, dimension(:), allocatable:: discharge_constant integer, dimension(:), allocatable:: discharge_variable_size double precision, dimension(:,:), allocatable:: discharge_variable_time double precision, dimension(:,:), allocatable:: discharge_variable_value write(*,*) "Sample Program" ! (abbr) ! 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***" ! 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) 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) ! Check the grid size call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 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) ! Allocate the memory to load grid attributes defined at grid nodes and grid cells allocate(elevation(isize, jsize)) allocate(obstacle(isize - 1, jsize - 1)) ! 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) ! Allocate memory to load boundary conditions (inflow) allocate(inflow_element_count(inflow_count)) allocate(discharge_type(inflow_count), discharge_constant(inflow_count)) allocate(discharge_variable_size(inflow_count)) ! 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)) then inflow_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)) then discharge_variable_sizemax = discharge_variable_size(inflowid) end if end do ! 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)) ! 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 ! Closes the calculation data file call 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 to the [name] attributes of Items defined in Defining calculation conditions, Defining Grid attributes.
Refer to Examples of calculation conditions, boundary conditions, and grid generating condition for the relationship between definitions of calculation condition, grid attributes, boundary conditions and the iRIClib subroutines to load them.
Refer to Reading calculation conditions, Reading calculation grid and Reading boundary conditions for the detail of subroutines to load calculation condition, grids, and boundary conditions.
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 to take care about the correspondence relation between solver definition file and the solver code about them.
List 9 shows the source code with lines to output time and calculations. The added lines are shown with highlight.
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 45 46 47 48 49 50 51 52 53 54 | ! (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 ! (abbr.) ! 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) allocate(velocity_x(isize,jsize), velocity_y(isize,jsize), depth(isize,jsize), wetflag(isize,jsize)) iteration = 0 time = 0 do time = time + timestep ! (Execute the calculation here. The grid shape changes.) 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 do call iric_write_sol_start_f(condFile, ier) call cg_iric_write_sol_time_f(time, ier) ! Outputs grid call cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, ier) ! 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 ! Closes calculation data file call cg_close_f(fin, ier) stop end program SampleProgram |
Refer to Outputting time (or iteration count) and Outputting calculation results for the details of the subroutines to output time and calculation results. Refer to Outputting calculation grids (only in the case of a moving grid) 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 for the special names.
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 shown on 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 18 to Figure 20) will open. Following the wizard, the dictionary files are created or updated.
The dictionary files are created in the folder that you created in Creating a folder. 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 10 and List 11 show the example of editing a dictionary file. As the example shows, you have to add translated texts in “translation” element.
1 2 3 4 | <message> <source>Basic Settings</source> <translation></translation> </message> |
1 2 3 4 | <message> <source>Basic Settings</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 21 shows the [Qt Linguist]. Qt can be downloaded from the following URL:
When the translation is finished, switch the iRIC language from Preferences dialog, restart iRIC, and check whether the translation is complete. Figure 22 and Figure 23 shows examples of [Pre-processing Window] and [Calculation Condition] dialog after completing transtaion of dictionary.
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. 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.
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 that dialog.
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. 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.
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 25 shows an example of the [Select Solver] dialog.
Steps of developing a calculation result analysis program¶
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 of developing a solver). 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 of developing a solver (See List of subroutines). 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 12 shows the source code to handle multiple CGNS files.
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 | ! (abbr.) ! File opening and initialization call cg_open_f(cgnsfile, CG_MODE_MODIFY, fin1, ier) call cg_iric_init_f(fin1, ier) ! (abbr.) ! Reading calculation condition etc. call cg_iric_read_functionalsize_mul_f(fin1, 'func', param_func_size, ier) ! (abbr.) ! 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) ! (abbr.) ! Reading calculation result etc. call cg_iric_read_sol_count_mul_f(fin2, solcount, ier) ! (abbr.) ! Calculation result analysis code ! (abbr.) ! Outputting analysis result call cg_iric_write_sol_time_mul_f(fin1, t, ier) ! (abbr.) ! Closing files call cg_close_f(fin1, ier) call cg_close_f(fin2, ier) ! (abbr.) |
List 13 shows the source code the analysis program that reads calculation result from CGNS file, and executes fish habitat analysis.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | program SampleProgram2 implicit none include 'cgnslib_f.h' integer icount character(len=300) cgnsfile integer:: fin1, fin2, ier, istatus character(len=300) param_inputfile integer:: param_result character(len=100) param_resultother integer:: param_func_size double precision, dimension(:), allocatable:: param_func_param double precision, dimension(:), allocatable:: param_func_value character(len=100) resultname 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 integer:: i, j, f, solid, solcount, iter double precision:: t ! Code for Intel Fortran icount = nargs() if (icount.eq.2) then call getarg(1, cgnsfile, istatus) else write(*,*) "Input File not specified." stop end if ! Opening CGNS file call 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) ! 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) 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) if (param_result .eq. 0) resultname = 'Depth(m)' if (param_result .eq. 1) resultname = 'Elevation(m)' if (param_result .eq. 2) resultname = param_resultother ! Read grid from the specified CGNS file call 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) ! Reads grid call 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) ! Output the grid to CGNS file call cg_iric_writegridcoord2d_mul_f(fin1, isize, jsize, & grid_x, grid_y, ier) ! Allocate memory used for analysis allocate(target_result(isize, jsize), analysis_result(isize, jsize)) ! Start analysis of calculation results call cg_iric_read_sol_count_mul_f(fin2, solcount, ier) 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) ! Do fish habitat analysis do i = 1, isize 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) then tmp_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 do analysis_result(i, j) = tmp_analysis_result end do end do ! 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 ! Close CGNS files call cg_close_f(fin1, ier) call cg_close_f(fin2, ier) stop end program SampleProgram2 |
Steps of developing a grid generating program¶
Abstract¶
Grid generating program is a program that load grid creating conditions and generate a grid. The program can be used seamlessly 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.
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 name | Description |
---|---|
definition.xml | Grid generating program definition file. |
generator.exe | Executable module of the grid generating program. Developers can select any name. |
translation_ja_JP.ts etc. | Dictionary files for a grid generating program definition file. |
README | File that explains the grid generating program |
Abstracts of each file are as follows:
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 that the grid generating program generate.
definition.xml should be written in English.
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.
translation_ja_JP.ts etc.¶
Dictionary files for a grid generating program definition file. It provides translation information for strings shown on dialogs in iRIC. Dictionary files are created one file for each language. For example, “translation_ja_JP.ts” for Japanese, “translation_ka_KR.ts” for Korean.
README¶
README 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 26 shows the relationship between iRIC, grid generating program and related files.
This chapter explains the steps to create the files described in this section.
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.
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 5.
Item | Description | Required |
---|---|---|
Basic Information | The grid generator name, developer name,release date etc. | Yes |
Grid Generating Condition | Grid generating condition required for the argorithmn. | Yes |
Error Codes | Error codes and message that correspond to the code. |
Grid generating program definition file is described in XML language. The basic grammer of XML language is explained in XML files basics.
In this section, we add definition information of a grid generating program in the order shown in Table 5.
Defining basic information¶
Define basic information of a grid generating program. Create a file with the content shown in List 14, and save it with name “definition.xml” under “example” folder that you created in Creating a folder.
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 27.
Now make sure the grid generating file definition file is arranged correctly.
Launch iRIC. The [iRIC Start Page] dialog (Figure 28) is shown, so click on [New Project]. Now the [Solver Select] dialog (Figure 29) 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 30) 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].
Defining grid generating conditions¶
Define grid generating conditions. Grid generating conditions are defined in “GridGeneratingCondition” element in a grid generating program definition file. Add description of grid generating condition to the grid generating program definition file you created in Defining basic information, and overwrite it. Grid generating program definition file content is now as shown in List 15. The added part is shown with highlight.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?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> <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> |
At this point, the structure of the grid generating program definition file is as shown in Figure 31.
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. Select “Sample Grid Creator” in the list, and click on [OK].
The [Grid Creation] dialog (Figure 32) 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | (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"> <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 33.
Now make sure that grid generating program definition file is arranged correctly. Do the operation you did again, to show the [Grid Creation] dialog (Figure 34).
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:
- Grid generating condition group is defined with “Tab” element, and grid generating condition item is defined with “Item” element.
- The Structure under “Definition” elements depends on the condition type (i. e. Integer, Real number, functional etc.). Refer to Section Examples of calculation conditions, boundary conditions, and grid generating condition 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. 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 for more complex calculation condition page layouts.
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 the definition file you created, as shown in List 17. The added part is shown with highlight.
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 35. The ErrorCodes element is not required.
You can not check whether ErrorCode element is properly defined until you create a grid generating program. You are going to check it in Adding error handling codes.
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 file that 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 for loading 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 shows the input and output processing that the grid generating program do against the grid generating data file.
Processing |
---|
Opens grid generating data file |
Initializes iRIClib |
Loads grid generating condition |
Outputs grid |
Closes grid generating data file |
In this section, we will develop a grid generating program in the following procedure:
- Create a scelton
- Adds grid generating data file opening and closing codes
- Adds codes to output grid
- Adds codes to load grid generating conditions
- Adds codes for error handling
Creating a scelton¶
First, create a scelton of a grid generating program. Create a new file with the source code in List 18, and save as “sample.f90”. At this point, the grid generating program does nothing.
Compile this source code. The way to compile a source code differs by the compiler. Refer to Intel Fortran Compiler (Windows) for the procedure to compile using Intel Fortran Compiler and gfortran.
1 2 3 4 | program SampleProgram implicit none include 'cgnslib_f.h' end program SampleProgram |
Make sure that the compilation succeeds.
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 19 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.
List 19 shows the source code with the lines to open and close grid generating data file. The added lines are shown with highlight.
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 | program SampleProgram implicit none include 'cgnslib_f.h' integer:: fin, ier integer:: icount, istatus character(200)::condFile icount = nargs() if ( icount.eq.2 ) then call getarg(1, condFile, istatus) else stop "Input File not specified." endif ! Opens grid generating data file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! Initializes iRIClib. ier will be 1, but that is not a problem. call cg_iric_init_f(fin, ier) ! Closes grid generating data file call cg_close_f(fin, ier) end program SampleProgram |
Compile the executable file, just like in Creating a scelton.
Check that the source code can be compiled successfully.
Refer to Opening a CGNS file, Initializing iRIClib and Closing a CGNS file for the details of the subroutines added in this section.
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 20 shows the source code with lines to output grid. The added lines are shown with highlight.
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 | program SampleProgram implicit none include 'cgnslib_f.h' integer:: fin, ier integer:: icount, istatus integer:: imax, jmax double precision, dimension(:,:), allocatable::grid_x, grid_y character(200)::condFile icount = nargs() if ( icount.eq.2 ) then call getarg(1, condFile, istatus) else stop "Input File not specified." endif ! Opens grid generating data file. call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! Initializes iRIClib. ier will be 1, but that is not a problem. call cg_iric_init_f(fin, ier) imax = 10 jmax = 10 ! Allocate memory for creating grid allocate(grid_x(imax,jmax), grid_y(imax,jmax) ! Generate grid do i = 1, imax do j = 1, jmax grid_x(i, j) = i grid_y(i, j) = j end do end do ! Outputs grid cg_iric_writegridcoord2d_f(imax, jmax, grid_x, grid_y, ier) ! Closes grid generating data file. call cg_close_f(fin, ier) end program SampleProgram |
When it was compiled successfully, copy the executable file to the folder you created in Creating a folder, and rename it into the name you specified as [executable] attribute in Defining basic information. 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 like in Defining basic information. The [Grid Creation] dialog (Figure 36) will open.
Click on [Create Grid], and a 10 x 10 grid will be created and loaded on the pre-processing window (Figure 37).
Refer to Outputting calculation grids for the detail of subroutines to output grids. Note that in Outputting calculation grids the subroutines to output three-dimensional grids are listed, but they can not be used in grid generating programs. In grid generating programs, only subroutines to output two-dimensional grids can be used.
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 21 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 defined in Defining grid generating conditions.
When it is compiled successfully, create a grid from iRIC in the procedure same to Adding codes to output a grid, 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 for the relation between definitions of grid generating condition and the iRIClib subroutines to load them. Refer to Reading calculation conditions for the detail of subroutines to load grid generating conditions.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 | program SampleProgram implicit none include 'cgnslib_f.h' 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 character(200)::condFile icount = nargs() if ( icount.eq.2 ) then call getarg(1, condFile, istatus) else stop "Input File not specified." endif ! Opens grid generating data file. call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! Initializes iRIClib. ier will be 1, but that is not a problem. call cg_iric_init_f(fin, ier) ! 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) ! Allocate memory for creating grid allocate(grid_x(imax,jmax), grid_y(imax,jmax) allocate(elevation(imax,jmax)) ! Generate grid do i = 1, isize do j = 1, jsize grid_x(i, j) = i grid_y(i, j) = j elevation(i, j) = elev_value end do end do ! Outputs grid cg_iric_writegridcoord2d_f(imax, jmax, grid_x, grid_y, ier) if (elev_on == 1) then cg_iric_write_grid_real_node_f("Elevation", elevation, ier); end if ! Closes grid generating data file. call cg_close_f(fin, ier) end program SampleProgram |
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. Check that when you specify big imax and jmax values, the [Error] dialog (Figure 38) will open.
Refer to Outputting Error code for the subroutines to output error codes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ! (abbr.) ! 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) ! 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 ! Allocate memory for creating grid allocate(grid_x(imax,jmax), grid_y(imax,jmax) allocate(elevation(imax,jmax)) ! (abbr.) |
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)
The [Definition File Translation Update Wizard] (Figure 39 to Figure 41) will open. Following the wizard, the dictionary files are created or updated.
The dictionary files are created in the folder that you created in Creating a folder. 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 23 and List 24 show the example of editing a dictionary file. As the example shows, add translated string in “translation” element.
1 2 3 4 | <message> <source>Sample Grid Creator</source> <translation></translation> </message> |
1 2 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 42 shows the [Qt Linguist]. Qt can be downloaded from the following URL:
When the translation is finished, switch the iRIC language from Preferences dialog, restart iRIC, and check whether the translation is complete. Figure 43 shows an example of [Grid Creation] dialog after completing transtaion of dictionary.
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. 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.
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 shown on that dialog.
Figure 44 shows an example of the [Select Grid Creating Algorithm] dialog.
About definition files (XML)¶
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).
Structure¶
Structures of solver definition files, grid generating program definition files are described in this section.
Solver definition file¶
Structure of solver definition files for a solver that uses only one calculation grids is shown in Figure 45, and that for a solver that uses multiple types of calculation grids is shown in Figure 46, 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 25. In this example, boundary condition definition is dropped, because that is not required. Please pay attention that the following point is different:
- 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 25, a new pre-processor in Figure 47 is shown.
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> |
Examples¶
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 7, but the grammers are the same. Refer to Structure for the whole structure of each file.
Item | Target file | Definition position |
---|---|---|
Calculation condition | Solver definition file | Under CalculationCondition element |
Grid generating condition | Grid generating program definition file | Under GridGeneratingCondition element |
The types of items available, are shown in Table 8. 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 to know more about iRIClib.
The examples only show the sample codes for loading, so please refer to Creating a solver, Creating a grid generating program to see examples of whole programs.
Type | Description | Definition |
---|---|---|
String | Input string value | Specify "string" for valueType |
File name (For reading) | Input file name for reading. Users can select only files that already exist. | Specify "filename" for valueType |
File name (For writing) | Input file name for writing. Users can select any file name, including those does not exists. | Specify "filename_all" for valueType |
Folder name | Input folder name. | Specify "foldername" for valueType |
Integer | Input arbitrary integer value. | Specify "integer" for valueType |
Integer (Choice) | Select integer value from choices. | Specify "Integer" for valueType, and define choises with Enumeration elements |
Real number | Input arbitrary real number value. | Specify "real" for valueType |
Functional | Input pairs of (X, Y) values. | Specify "functional" for valueType and define variable and value with a Parameter element and a Value element. |
Functional (with multiple values) | Input trinity of (X, Y1, Y2) values. | Specify "functional" for valueType and define one Parameter element and two Value elements. |
CGNS file name | Input CGNS file name for reading. Users can select only files that already e3xists. | Specify "cgns_filename" for valueType |
Calculation result in CGNS file | Select the name of calculatioin result | Specify "”result_gridNodeReal"” etc. for valueType” |
String¶
1 2 3 | <Item name="sampleitem" caption="Sample Item"> <Definition valueType="string" /> </Item> |
1 2 3 4 | integer:: ier character(200):: sampleitem call cg_iric_read_string_f("sampleitem", sampleitem, ier) |
1 2 3 4 | integer:: ier character(200):: sampleitem call cg_iric_read_bc_string_f("inflow", 1, "sampleitem", sampleitem, ier) |
File name (for reading)¶
1 2 3 | <Item name="flowdatafile" caption="Flow data file"> <Definition valueType="filename" default="flow.dat" /> </Item> |
1 2 3 4 | integer:: ier character(200):: flowdatafile call cg_iric_read_string_f("flowdatafile", flowdatafile, ier) |
1 2 3 4 | integer:: ier character(200):: flowdatafile call cg_iric_read_bc_string_f("inflow", 1, "flowdatafile", flowdatafile, ier) |
File name (for writing)¶
1 2 3 | <Item name="flowdatafile" caption="Flow data file"> <Definition valueType="filename_all" default="flow.dat" /> </Item> |
1 2 3 4 | integer:: ier character(200):: flowdatafile call cg_iric_read_string_f("flowdatafile", flowdatafile, ier) |
1 2 3 4 | integer:: ier character(200):: flowdatafile call cg_iric_read_bc_string_f("inflow", 1, "flowdatafile", flowdatafile, ier) |
Folder name¶
1 2 3 | <Item name="flowdatafolder" caption="Flow data folder"> <Definition valueType="foldername" /> </Item> |
1 2 3 4 | integer:: ier character(200):: flowdatafolder call cg_iric_read_string_f("flowdatafolder", flowdatafolder, ier) |
1 2 3 4 | integer:: ier character(200):: flowdatafolder call cg_iric_read_bc_string_f("inflow", 1, "flowdatafolder", flowdatafolder, ier) |
Integer¶
1 2 3 | <Item name="numsteps" caption="The Number of steps to calculate"> <Definition valueType="integer" default="20" min="1" max="200" /> </Item> |
1 2 3 | integer:: ier, numsteps call cg_iric_read_integer_f("numsteps", numsteps, ier) |
1 2 3 | integer:: ier, numsteps call cg_iric_read_bc_integer_f("inflow", 1, "numsteps", numsteps, ier) |
Integer (Choice)¶
1 2 3 4 5 6 | <Item name="flowtype" caption="Flow type"> <Definition valueType="integer" default="0"> <Enumeration value="0" caption="Static Flow"/> <Enumeration value="1" caption="Dynamic Flow"/> </Definition> </Item> |
1 2 3 | integer:: ier, flowtype call cg_iric_read_integer_f("flowtype", flowtype, ier) |
1 2 3 | integer:: ier, flowtype call cg_iric_read_bc_integer_f("inflow", 1, "flowtype", flowtype, ier) |
Real number¶
1 2 3 | <Item name="g" caption="Gravity [m/s2]"> <Definition valueType="real" default="9.8" /> </Item> |
1 2 3 4 | integer:: ier double precision:: g call cg_iric_read_real_f("g", g, ier) |
1 2 3 4 | integer:: ier double precision:: g call cg_iric_read_bc_real_f("inflow", 1, "g", g, ier) |
Functional¶
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> |
1 2 3 4 5 6 7 8 9 10 | integer:: ier, discharge_size double precision, dimension(:), allocatable:: discharge_time, discharge_value ! Read size call cg_iric_read_functionalsize_f("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_functional_f("discharge", discharge_time, discharge_value, ier) |
1 2 3 4 5 6 7 8 9 10 | integer:: ier, discharge_size double precision, dimension(:), allocatable:: discharge_time, discharge_value ! 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)¶
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> |
1 2 3 4 5 6 7 8 9 10 11 12 13 | integer:: ier, discharge_size double precision, dimension(:), allocatable:: time_value double precision, dimension(:), allocatable:: discharge_value, elevation_value ! 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) |
1 2 3 4 5 6 7 8 9 10 11 12 13 | integer:: ier, discharge_size double precision, dimension(:), allocatable:: time_value double precision, dimension(:), allocatable:: discharge_value, elevation_value ! 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.
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> |
1 2 3 4 5 | integer:: ier character(200):: cgnsName, resultName call cg_iric_read_string_f("input_file", cgnsName, ier) call cg_iric_read_string_f("result_to_read", resultName, ier) |
1 2 3 4 5 | integer:: ier character(200):: cgnsName, resultName 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) |
Example of condition to activate calculation conditions etc.¶
Examples of conditions to activate calculation conditions, grid generating conditions, and boundary conditions are shown 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 > 3¶
1 2 3 4 | <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> |
Example of dialog layout definition¶
Simple layout¶
Simple layout (that only uses Item elements) example definition is shown in List 56, and the corresponding dialog is shown in Figure 59.
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 57, and the corresponsing dialog is shown in Figure 60.
GroupBox elements can be used to define groups of items.
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 45 46 47 48 | <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"/> </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> |
Free layout¶
Free layout example, that uses GridLayout element, is shown in List 58, and the corresponsing dialog is shown in Figure 61.
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 these elements freely.
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 | <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"> <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> |
Elements reference¶
BoundaryCondition¶
BoundaryCondition element contains boundary condition information.
Example¶
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> |
CalculationCondition¶
CalculationCondition element contains calculation condition information.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 | <CalculationCondition> <Tab name="basic" caption="Basic Setting"> (abbr.) </Tab> <Tab name="time" caption="Calculation Time Setting"> (abbr.) </Tab> </CalculationCondition> |
Attributes¶
No attribute can be defined.
Condition¶
Condition element contains information of a condition that must be met when a certain input item of calculation conditions become active.
Example¶
1 | <Condition conditionType="isEqual" target="type" value="1" /> |
1 2 3 4 | <Condition conditionType="and"> <Condition conditionType="isEqual" target="type" value="1" /> <Condition conditionType="isEqual" target="inflow" value="0" /> </Condition> |
Refer to ??? for other examples.
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
conditionType | Refer to the table below | Yes | Type of condition |
target | String | Depends | Name of the calculation condition to be compared with. Needs to be sconditionType Needs to be specified only if the conditionType value is none of "and", "or", "not". |
value | String | Depends | Value to be compared with. Needs to be sconditionType Needs to be specified only if the conditionType value is none of "and", "or", "not". |
Value | Meaning |
---|---|
isEqual | is equal to |
isGreaterEqual | is greater than or equal to |
isGreaterThan | is greater than |
isLessEqual | is less than or equal to |
isLessThan | is less than |
and | and |
or | or |
not | not |
Definition (when used under CalculationCondition element or BoundaryCondition element)¶
Definition element contains definition information of calculation conditions or grid attributes or boundary conditions.
Example¶
1 | <Definition valueType="integer" default="1" /> |
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 for examples of Condition element definition.
Attributes¶
Name | Value | Required | Description | |
---|---|---|---|---|
valueType | Refer to the table below | Yes | Value type | |
default | String | Default value | ||
noSort | true or false | When value “true” is specified | the table on the dialog is not sorted by Param value. |
Value | Meaning |
---|---|
integer | Integer |
real | Real number |
string | String |
functional | Functional type |
filename | File name |
filename_all | filename; even a file that currently does not exist can be specified |
foldername | Folder name |
result_gridNodeInteger | Select integer value calculation result defined at grid nodes |
result_gridNodeReal | Select real value calculation result defined at grid nodes |
result_gridCellInteger | Select integer value calculation result defined at grid cells |
result_gridCellReal | Select real value calculation result defined at grid cells |
result_gridEdgeIInteger | Select integer value calculation result defined at I-direction edges |
result_gridEdgeIReal | Select real value calculation result defined at I-direction edges |
result_gridEdgeJInteger | Select integer value calculation result defined at J-direction edges |
result_gridEdgeJReal | Select real value calculation result defined at J-direction edges |
result_baseIterativeInteger | Select integer value calculation result defined globally |
result_baseIterativeReal | Select real value calculation result defined globally |
Child elements¶
Name | Required | Description |
---|---|---|
Enumeration | It should be specified when solver developers wants to limit the selection of the value. It can be specified only when valueType is integer or real. | |
Condition | The condition that must be met when the element become active. | |
Param | value for horizontal axis. It can be specified only when valueType is functional. | |
Value | value for vertical axis. It can be specified only when valueType is functional. |
Dimension¶
Dimension element contains information that defines a dimension of an attributes to be defined for an input grid.
Example¶
1 | <Dimension name="Time" caption="Time" valueType="integer" /> |
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
name | String | Yes | Name of element |
caption | String | Yes | String to be displayed in the [Pre-processor] |
valueType | Refer to table below | Yes | Value type |
Value | Meaning |
---|---|
integer | Integer |
real | Real number |
Child elements¶
No child element can be defined.
Enumeration¶
Enumeration element contains information that defines an input option for the input item of calculation conditions or grid generating condition.
Example¶
1 | <Enumeration value="0" caption="Standard" /> |
Refer to Integer (Choice) for examples of Enumeration element definitions.
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
value | String | Yes | A string representing a value that corresponds to caption |
caption | String | Yes | String to be displayed. |
Child elements¶
No child elements can be defined.
ErrorCode¶
ErrorCodes element contains a list of error codes.
Examples¶
1 | <ErrorCode value="1" caption="Grid is data do not exist" /> |
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
value | Integer | Yes | Error code |
caption | String | Yes | String to be displayed |
Child elements¶
No child elements can be specified
ErrorCodes¶
ErrorCodes element contains a list of error codes.
Example¶
1 2 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.
GridGeneratingCondition¶
GridGeneratingCondition element contains information that defines a grid generating condition.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 | <GridGeneratingCondition> <Tab name="basic" caption="Basic Setting"> (abbr.) </Tab> <Tab name="time" caption="Calculation Time Setting"> (abbr.) </Tab> </GridGeneratingCondition> |
Attributes¶
No attributes can be defined.
GridGeneratorDefinition¶
GridGeneratorDefinition element contains definition information of the grid generating program.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <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"> (Abbr.) </Tab> </GridGeneratingCondition> </GridGeneratorDefinition> |
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
name | String | Yes | Identification name of the grid generator (in alphanumeric characters only) |
caption | String | Yes | Name of the grid generator (any characters can be used) |
version | String | Yes | Version number, in a form such as "1.0" or "1.3.2" |
copyright | String | Yes | Name of copyright owner; basically in English |
release | String | Yes | Date of release, in a form such as "2010.01.01" |
homepage | String | Yes | URL of the web page that provides information on the grid generator |
executable | String | Yes | Filename of the executable program. (ex. GridGen.exe) |
gridtype | Refer to table below | Yes | Grid type |
Value | Meaning |
---|---|
structured2d | two-dimensional structured grid |
unstructured2d | two-dimensional unstructured grid |
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.
Example¶
Refer to Free layout for an example of GridLayout element definition.
Attributes¶
No attributes can be defined.
GridType¶
GridType element contains a list of definition information of input grids.
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
gridtype | Refer to the table below | Yes | Grid type |
multiple | true or false | true if two or more grids can be used |
Value | Meaning |
---|---|
1d | one-dimensional grid |
1.5d | one-and-half dimensional grid |
1.5d_withcrosssection | one-and-half dimensional grid having cross-sectional info |
structured2d | two-dimensional structured grid |
unstructured2d | two-dimensional unstructured grid |
GridTypes¶
GridTypes element contains a list of definition information of input grids types.
Attributes¶
No attributes can be defined.
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.
Example¶
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 for an example of GroupBox element definition.
HBoxLayout¶
HBoxLayout element contains information that defines layout to arrange elements horizontally in the calculation condition input dialog or grid generating condition input dialog.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 | <HBoxLayout> <Item name="stime" caption="Start Time"> (abbr.) </Item> <Item name="etime" caption="End Time"> (abbr.) </Item> </HBoxLayout> |
Attributes¶
No attributes can be defined.
Item¶
Item element contains information that defines an input item of calculation conditions, grid generating condtions, attributes of the input grid, or .boundary conditions.
Example¶
1 2 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 for examples of Item element definitions.
Label¶
Label element contains information that defines a label to be displayed in the calculation condition input dialog or grid creating condition input dialog.
Example¶
1 | <Label caption="Start Time" /> |
Refer to Free layout for Label element definition example.
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
caption | String | String to be displayed on dialog |
Child elements¶
No child elements can be defined.
Param¶
Param element contains information that defines an argument of functional type calculation conditions or grid creating conditions.
Example¶
1 | <Param caption="Time" valueType="real" /> |
Refer to Functional for Param element definition example.
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
caption | String | Yes | String to be displayed on dialog |
valueType | Refer to table below | Yes | Data type |
axislog | true or false | true when you want to make the horizontal axis log |
Child elements¶
No child elements can be defined.
SolverDefinition¶
SolverDefinition element contains definition information of the solver.
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <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> (abbr.) </CalculationCondition> <GridRelatedCondition> (abbr.) </GridRelatedCondition> </SolverDefinition> |
Attributes¶
Name | Value | Required | Description | |
---|---|---|---|---|
name | String | Yes | Identification name of the solver (in alphanumeric characters only) | |
caption | String | Yes | Name of the solver (any characters can be used) | |
version | String | Yes | Version number, in a form such as "1.0", "1.3.2" | |
copyright | String | Yes | Name of copyright owner; basically in English | |
release | String | Yes | Date of release, in a form such as "2010.01.01" | |
homepage | String | Yes | URL of the web page that provides information on the solver | |
executable | String | Yes | Filename of the executable program. (e.g. | Solver.exe) |
iterationtype | Refer to table below | Yes | Unit of outputting result | |
gridtype | Refer to table below | Yes | Grid type | |
multiple | true or false | true if two or more grids can be used |
Value | Meaning |
---|---|
time | Results are output by time |
iteration | Results are output by iteration |
Value | Meaning |
---|---|
1d | one-dimensional grid |
1.5d | one-and-half dimensional grid |
1.5d_withcrosssection | one-and-half dimensional grid having cross-sectional info |
structured2d | two-dimensional structured grid |
unstructured2d | two-dimensional unstructured grid |
When solver developers want to update solvers, version attribute should be changed. Refer to Notes on solver version up for notes on solver version up.
Child elements¶
Name | Required | Description |
---|---|---|
CalculationCondition | Yes | Calculation condition |
GridRelatedCondition | This should be defined only when a single type of input grid is used. | |
GridTypes | This should be defined only when two or more types of input grids are used. |
Tab¶
Tab element contains the information that defines a page of the calculation condition input dialog.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 | <Tab caption="Basic Setting"> <Item name="stime" caption="Start Time"> (abbr.) </Item> <Item name="etime" caption="End Time"> (abbr.) </Item> </Tab> |
Value¶
Value element contains information that defines a value of functional type calculation conditions or grid creating conditions.
Example¶
1 | <value caption="Discharge" valueType="real" /> |
Refer to Functional, for Value element definition example.
Attributes¶
Name | Value | Required | Description |
---|---|---|---|
caption | String | Yes | String to be displayed on dialog |
valueType | Refer to table below | Yes | Data type |
name | String | Identification name (in alphanumeric characters only). It is required only when the condition has multiple values. | |
axis | Refer to table below | Specify on which side to show Y-axis. | |
axislog | true or false | true when you want to make the vertical axis log | |
axisreverse | true or false | true when you want to reverse the vertical axis | |
span | true or false | true when you want to define values at spans | |
step | true or false | true when you want to show the chart as bar chart | |
hide | true or false | true when you want to hide the data from chart |
Value | Meaning |
---|---|
integer | Integer |
real | Real number |
Value | Meaning |
---|---|
left | Use Y-axis on left side |
right | Use Y-axis on right side |
Child elements¶
No child elements can be defined.
VBoxLayout¶
VBoxLayout element contains information that defines layout to arrange elements vertically in the calculation condition input dialog or grid generating condition input dialog.
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 | <VBoxLayout> <Item name="stime" caption="Start Time"> (abbr.) </Item> <Item name="etime" caption="End Time"> (abbr.) </Item> </VBoxLayout> |
Attributes¶
No attributes can be defined.
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 string that 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 55.
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 | Condition to increment | Exmaple |
---|---|---|
Major number | When you changed a big modification so that the grid, calculation condition you created with older version will not be compatible to the new solver. | 2.1 –> 3.0 |
Minor number | 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 new conditions, and that will cause no problem. | 2.1 –> 2.2 |
Fix number | When you fixed bugs or changed inner algorithm. No modification is made to the interface (i. e. grid and calculation condition) is made. | 2.1 –> 2.1.1 |
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 62 shows the examples of compatibility with different solver version numbers.
The basic policy is shown in Table 55, 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 independent of solver names.
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.
Defining Elements¶
Element start tag is described with “<” and “>”.
Element end tag is described with “</” and “>”.
List 82 shows an example of Item element definition.
<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 83 shows an example of a definition of Item element with two “Subitem” child elements and “name” attribute.
<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 84 and List 85 are processed as the same data by XML parsers.
<Item name="sample">
</Item>
<Item name="sample" />
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 86, List 87, List 88 are processed as the same data by XML parsers.
<Item name="sample">
<SubItem>
</SubItem>
</Item>
<Item
name="sample"
>
<SubItem></SubItem>
</Item>
<Item name="sample"><SubItem></SubItem></Item>
iRIClib¶
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 ). 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 abbreviated description of input-output processing which is frequently used by solvers that work together with iRIC. With these subroutines, 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. In case 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.
Languages supported by iRIClib¶
iRIClib is supported for the following languages:
- FORTRAN
- C/C++
- Python
In this manual examples are described with FORTRAN mainly.
In this section, how to use iRIClib from FORTRAN, C/C++, and Python are briefly explained.
Please note that arguments and returned values depends on the language. Please refer to the subsections for each functions in Reference about the format to use the functions from each languages.
FORTRAN¶
Call iRIClib functions after including the header, like shown in List 90.
1 2 3 | include 'iriclib_f.h' call cg_iric_init_f(fid, ier) |
How to read this chapter¶
In this chapter, first Overview explains what kinds of information input/output iRIC assumes a solver to perform, and what subroutines are available for each kind of processing. First, read Section to understand the general concept of iRIClib.
Since Overview gives only an outline of subroutines, see Reference for detailed information, such as lists of arguments for those subroutines.
Overview¶
This section provides an overview of iRIClib.
Processes of the program and iRIClib subroutines¶
The I/O processings in solvers and grid generating programs are shown in Table 56 and Table 57 .
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 |
Process |
---|
Opens a CGNS file |
Initializes iRIClib |
Reads grid generating condition |
Outputs error code |
Outputs grid |
Closes CGNS File |
Opening a CGNS file¶
Open a CGNS file, read it in and make it into a writable state. The subroutine is defined in cgnslib.
Subroutine | Remarks |
---|---|
cg_open_f | Opens a CGNS file |
Initializing iRIClib¶
Prepares the CGNS file that has been opened for use by iRIClib. After the CGNS file is opened, this should be executed.
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”.
Subroutine | Remarks |
---|---|
cg_iric_init_f | Initialize the internal variables that are used for reading and modifying the opened CGNS file. |
cg_iric_initread_f | Initialize the internal variables that are used for reading the opened CGNS file. |
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.
Subroutine | Remarks |
---|---|
iric_initoption_f | Set up solver option |
Reading calculation conditions¶
Reads calculation conditions from the CGNS file.
Subroutine | Remarks |
---|---|
cg_iric_read_integer_f | Reads an integer calculation-condition value |
cg_iric_read_real_f | Reads a double-precision real calculation-condition value |
cg_iric_read_realsingle_f | Reads a single-precision real calculation-condition value |
cg_iric_read_string_f | Reads a string calculation-condition value |
cg_iric_read_functionalsize_f | Checks the size of a functional-type calculation condition |
cg_iric_read_functional_f | Reads functional calculation condition data in double-precision real type |
cg_iric_read_functional_realsingle_f | Reads functional calculation condition data in single-precision real type |
cg_iric_read_functionalwithname_f | 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 93.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | program Sample1 implicit none include 'cgnslib_f.h' integer:: fin, ier, i_flow ! Open CGNS file call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" call cg_iric_read_integer_f('i_flow', i_flow, ier) print *, i_flow; ! Close CGNS file call 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 94.
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 | program Sample2 implicit none include 'cgnslib_f.h' integer:: fin, ier, discharge_size, i double precision, dimension(:), allocatable:: discharge_time, discharge_value ! Array for storing discharge time and discharge value ! Open CGNS file call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! (Output) if (ier ==0) then print *, 'discharge: discharge_size=', discharge_size do i = 1, min(discharge_size, 5) print *, ' i,time,value:', i, discharge_time(i), discharge_value(i) end do end if ! Deallocate memory that has been allocated deallocate(discharge_time, discharge_value) ! Close CGNS file call cg_close_f(fin, ier) stop end program Sample2 |
Refer to Examples of calculation conditions, boundary conditions, and grid generating condition for examples of codes to load calculation conditions (or grid generating conditions).
Reading calculation grid¶
Reads a calculation grid from the CGNS file. iRIClib offers subroutines for reading structured grids only.
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 two-dimensional structured grids and three-dimensional structured grids.
An example description for reading a two-dimensional structured grid is shown in List 95.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | program Sample3 implicit none include 'cgnslib_f.h' integer:: fin, ier, discharge_size, i, j integer:: isize, jsize 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 ! Open CGNS file call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) 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 do end do ! 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 do end do ! 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 do end do ! Read the number of times for Rain call cg_iric_read_grid_functionaltimesize_f('Rain', rain_timesize); ! Allocate memory for time values of Rain allocate(rain_time(rain_timesize)) ! 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 do end do ! Deallocate memory that has been allocated deallocate(grid_x, grid_y, elevation, obstacle, rain_time, rain) ! Close CGNS file call cg_close_f(fin, ier) stop end program Sample3 |
Processing for a three-dimensional grid can be described in the same manner.
Reading boundary conditions¶
Reads boundary conditions from CGNS file.
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 96 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. Please refer to 6.4.48 for detail.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | program Sample8 implicit none include 'cgnslib_f.h' 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:: condindices integer, dimension(:), allocatable:: intparam double precision, dimension(:), allocatable:: realparam character(len=200), dimension(:), allocatable:: stringparam character(len=200):: tmpstr integer, dimension(:), allocatable:: func_size double precision, dimension(:,:), allocatable:: func_param; double precision, dimension(:,:), allocatable:: func_value; ! Opens CGNS file call cg_open_f('bctest.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initializes iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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 ! Reads the number of grid node indices where boundary condition is assigned, and the size of functional-type condition. indexlenmax = 0 funcsizemax = 0 do condid = 1, condcount call cg_iric_read_bc_indicessize_f('inflow', condid, condindexlen(condid), ier) if (indexlenmax < condindexlen(condid)) then indexlenmax = condindexlen(condid) end if call cg_iric_read_bc_functionalsize_f('inflow', condid, 'funcparam', func_size(condid), ier); if (funcsizemax < func_size(condid)) then funcsizemax = func_size(condid) end if end do ! 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, condcount call cg_iric_read_bc_indices_f('inflow', condid, condindices(condid:condid,:,:), ier) 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 ! Displays the boundary condition loaded. do condid = 1, condcount do indexid = 1, condindexlen(condid) print *, 'condindices ', condindices(condid:condid,:,indexid:indexid) end do print *, '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 ! Closes CGNS file call cg_close_f(fin, ier) stop end program Sample8 |
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:
- Reads the number of geographic data, the file name of geographic data etc. from CGNS file.
- Open geographic data file and read data from that.
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 file |
iric_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 97 shows an example of reading polygon. List 98 shows an example of reading river survey data.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | program TestPolygon implicit none include 'cgnslib_f.h' include 'iriclib_f.h' integer:: fin, ier integer:: icount, istatus integer:: geoid integer:: elevation_geo_count character(len=1000):: filename integer:: geotype integer:: polygonid double precision:: polygon_value integer:: region_pointcount double precision, dimension(:), allocatable:: region_pointx double precision, dimension(:), allocatable:: region_pointy integer:: hole_id integer:: hole_count integer:: hole_pointcount double precision, dimension(:), allocatable:: hole_pointx double precision, dimension(:), allocatable:: hole_pointy ! Opens CGNS file call cg_open_f("test.cgn", CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! Initializes iRIClib call cg_iric_init_f(fin, ier) ! Reads the number or geographic data call cg_iric_read_geo_count_f("Elevation", elevation_geo_count, ier) do geoid = 1, elevation_geo_count call cg_iric_read_geo_filename_f('Elevation', geoid, & filename, geotype, ier) if (geotype .eq. iRIC_GEO_POLYGON) then call 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_count do hole_id = 1, hole_count print *, 'hole ', hole_id call iric_geo_polygon_read_holepointcount_f(polygonid, hole_id, hole_pointcount, ier) print *, 'hole pointcount: ', hole_pointcount allocate(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 do call iric_geo_polygon_close_f(polygonid, ier) end if end do ! Closes CGNS file call cg_close_f(fin, ier) stop end program TestPolygon |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | program TestRiverSurvey implicit none include 'cgnslib_f.h' include 'iriclib_f.h' integer:: fin, ier integer:: icount, istatus integer:: geoid integer:: elevation_geo_count character(len=1000):: filename integer:: geotype integer:: rsid integer:: xsec_count integer:: xsec_id character(len=20):: xsec_name double precision:: xsec_x double precision:: xsec_y integer:: xsec_set integer:: xsec_index double precision:: xsec_leftshift integer:: xsec_altid integer:: xsec_altcount double precision, dimension(:), allocatable:: xsec_altpos double precision, dimension(:), allocatable:: xsec_altheight integer, dimension(:), allocatable:: xsec_altactive double precision:: xsec_wse ! Opens CGNS file call cg_open_f("test.cgn", CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! Initializes iRIClib call cg_iric_init_f(fin, ier) ! Reads the number or geographic data call cg_iric_read_geo_count_f("Elevation", elevation_geo_count, ier) do geoid = 1, elevation_geo_count call cg_iric_read_geo_filename_f('Elevation', geoid, & filename, geotype, ier) if (geotype .eq. iRIC_GEO_RIVERSURVEY) then call iric_geo_riversurvey_open_f(filename, rsid, ier) call iric_geo_riversurvey_read_count_f(rsid, xsec_count, ier) do xsec_id = 1, xsec_count call iric_geo_riversurvey_read_name_f(rsid, xsec_id, xsec_name, ier) print *, 'xsec ', xsec_name call 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_leftshift call iric_geo_riversurvey_read_altitudecount_f(rsid, xsec_id, xsec_altcount, ier) print *, 'altitude count: ', xsec_altcount allocate(xsec_altpos(xsec_altcount)) allocate(xsec_altheight(xsec_altcount)) allocate(xsec_altactive(xsec_altcount)) call iric_geo_riversurvey_read_altitudes_f( & rsid, xsec_id, xsec_altpos, xsec_altheight, xsec_altactive, ier) do xsec_altid = 1, xsec_altcount print *, 'Altitude ', xsec_altid, ': ', & xsec_altpos(xsec_altid:xsec_altid), ', ', & xsec_altheight(xsec_altid:xsec_altid), ', ', & xsec_altactive(xsec_altid:xsec_altid) end do deallocate(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 do call iric_geo_riversurvey_close_f(rsid, ier) end if end do ! Closes CGNS file call cg_close_f(fin, ier) stop end program TestRiverSurvey |
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 a particular 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 the grid shape modified after starting calculation, use the subroutines described in Outputting calculation grids (only in the case of a moving grid).
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 99 shows an example of the procedure of reading a two-dimensional grid, dividing it to generate a three-dimensional grid, and then outputting the resulting grid.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | program Sample7 implicit none include 'cgnslib_f.h' 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 ! Open CGNS file. call cg_open_f('test3d.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib. call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! 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. 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 do end do end do ! Output the generated 3D grid call cg_iric_writegridcoord3d_f(isize, jsize, ksize, grid3d_x, grid3d_y, grid3d_z, ier) ! Output the initial state information time = 0 convergence = 0.1 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) 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) If (time > 100) exit end do ! Close CGNS file. call cg_close_f(fin, ier) stop end program Sample7 |
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.
Subroutine | Remarks |
---|---|
cg_iric_write_sol_time_f | Outputs time |
cg_iric_write_sol_iteration_f | Outputs iteration count |
List 100 shows an example of source code to output timestamp information.
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 | program Sample4 implicit none include 'cgnslib_f.h' integer:: fin, ier, i double precision:: time ! Open CGNS file. call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib. call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! Output the initial state information. time = 0 call cg_iric_write_sol_time_f(time, ier) ! (Here, output initial calculation grid or calculation results.) 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 ! Close CGNS file. call cg_close_f(fin, ier) stop end program Sample4 |
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).
The subroutines described in this section should be used for outputting a calculation grid only when the grid shape is changed in the course of calculation. When outputting a grid in the following cases, use the subroutines described in Outputting calculation grids.
- 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
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 101 shows an example of outputting a two-dimensional structured grid after starting calculation.
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 | program Sample5 implicit none include 'cgnslib_f.h' integer:: fin, ier, isize, jsize double precision:: time double precision, dimension(:,:), allocatable:: grid_x, grid_y ! Open CGNS file. call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib. call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! Output the initial state information. time = 0 call cg_iric_write_sol_time_f(time, ier) ! Output the grid. call cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, ier) 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 ! Close CGNS file call cg_close_f(fin, ier) stop end program Sample5 |
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
- 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 68 and Table 69.
Please refer to One value for each time step to Value defined at polygons or polylines for detailed procedure to output each types.
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 |
Subroutine | Remarks |
---|---|
cg_iric_write_sol_time_f | Outputs time |
cg_iric_write_sol_iteration_f | Outputs iteration count |
Note
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 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 in your 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.
One value for each time step¶
When you output one value for each time step, please use the functions in Table 70.
List 102 shows an example of the process to output value for each time step.
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 |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 | program SampleProgram implicit none include 'cgnslib_f.h' integer:: fin, ier, isize, jsize integer:: canceled integer:: locked double precision:: time double precision:: convergence double precision, dimension(:,:), allocatable::grid_x, grid_y character(len=20):: condFile condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! 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) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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) if (time > 1000) exit end do ! Close CGNS file call 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 71.
List 103 shows an example of the process to output value 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 |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | program SampleProgram implicit none include 'cgnslib_f.h' 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 condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! 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) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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) if (time > 1000) exit end do ! Close CGNS file call 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 72.
List 104 shows an example of the process to output value 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 each grid cell |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | program SampleProgram implicit none include 'cgnslib_f.h' 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 condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! 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) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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) if (time > 1000) exit end do ! Close CGNS file call 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 73.
List 105 shows an example of the process to output value defined at grid edges.
Subroutine | Remarks |
---|---|
cg_iric_write_sol_iface_integer_f | Outputs integer-type calculation results, having a value for each grid edge at i-direction |
cg_iric_write_sol_iface_real_f | Outputs double-precision real-type calculation results, having a value for each grid edge at i-direction |
cg_iric_write_sol_jface_integer_f | Outputs integer-type calculation results, having a value for each grid edge at j-direction |
cg_iric_write_sol_jface_real_f | Outputs double-precision real-type calculation results, having a value for each grid edge at j-direction |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | program SampleProgram implicit none include 'cgnslib_f.h' 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 condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! 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) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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) if (time > 1000) exit end do ! Close CGNS file call 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 74.
List 106 shows an example of the process to output value defined at grid nodes.
Note
These functions are deprecated
When you want to output value defined at particles, we recommend that you use functions described at Value defined at particles (groups supported). 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.
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_f | Outputs 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 each particle. |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | program SampleProgram implicit none include 'cgnslib_f.h' 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 condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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)) ! Read the grid into memory call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier) ! 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) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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) if (time > 1000) exit end do ! Close CGNS file call 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 75.
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 107 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.
Subroutine | Remarks |
---|---|
cg_iric_write_sol_particlegroup_groupbegin_f | Start 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_f | Outputs 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 for each particle. |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | program SampleProgram implicit none include 'cgnslib_f.h' 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:: i integer:: status = 1 character(len=20):: condFile condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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)) ! Read the grid into memory call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) ! Output the initial state information. time = 0 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 do call cg_iric_write_sol_particlegroup_groupend_f(ier) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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 do call cg_iric_write_sol_particlegroup_groupend_f(ier) if (time > 1000) exit end do ! Close CGNS file call 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 76.
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 108 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.
Subroutine | Remarks |
---|---|
cg_iric_write_sol_polydata_groupbegin_f | Start 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_f | Outputs 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 a polygon or polyline |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | program SampleProgram implicit none include 'cgnslib_f.h' 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:: i integer:: status = 1 character(len=20):: condFile condFile = 'test.cgn' ! Open CGNS file call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initialize iRIClib call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 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) ! Output the initial state information. time = 0 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 do call cg_iric_write_sol_polydata_groupend_f(ier) do time = time + 10.0 ! (Perform calculation here) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 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 do call cg_iric_write_sol_polydata_groupend_f(ier) if (time > 1000) exit end do ! Close CGNS file call cg_close_f(fin, ier) stop end program SampleProgram |
Reading calculation result¶
Read calculation result from CGNS files.
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 for each 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 for each grid cell |
List 109 shows an example of reading caluculation result from CGNS file, and output to standard output.
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 | program SampleX implicit none include 'cgnslib_f.h' integer:: fin, ier, isize, jsize, solid, solcount, iter, i, j double precision, dimension(:,:), allocatable::grid_x, grid_y, result_real ! Opening CGNS file call cg_open_f('test.cgn', CG_MODE_READ, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! Initializing internal variables call cg_iric_initread_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! Reads grid size call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! Allocate memory for reading calculation result allocate(grid_x(isize,jsize), grid_y(isize,jsize)) allocate(result_real(isize, jsize)) ! Reads calculation result, and output to standard output. call cg_iric_read_sol_count_f(solcount, ier) do solid = 1, solcount call 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) 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), ')' end do end do end do ! Closing CGNS file call 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).
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 80.
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.
FORTRAN | C/C++ | Python |
---|---|---|
integer | int (int* for output) | int |
double precision | double (double* for output) | float |
real | float (float* for output) | – |
character(*) | char* | str |
integer, dimension(:), allocatable | int* | numpy.ndarray(dtype=int32) |
double precision, dimension(:), allocatable | double* | numpy.ndarray(dtype=float64) |
real, dimension(:), allocatable | float* | – |
List of subroutines¶
The table below shows a list of subroutines and their classifications.
Classification | Name | Description | Multi |
---|---|---|---|
Opening a CGNS file | cg_open_f | Opens a CGNS file | X |
Initializing iRIClib | cg_iric_init_f | Initializes the CGNS file for reading and writing | X |
Initializing iRIClib | cg_iric_initread_f | Initializes the CGNS file for reading | X |
Setting up options | cg_initoption_f | Set up solver option | X |
Reading the calculation conditions | cg_iric_read_integer_f | Gets the value of an integer variable | O |
Reading the calculation conditions | cg_iric_read_real_f | Gets the value of a real (double-precision) variable | O |
Reading the calculation conditions | cg_iric_read_realsingle_f | Gets the value of a real (single-precision) variable | O |
Reading the calculation conditions | cg_iric_read_string_f | Gets the value of a string-type variable | O |
Reading the calculation conditions | cg_iric_read_functionalsize_f | Gets the size of a functional-type variable | O |
Reading the calculation conditions | cg_iric_read_functional_f | Gets the value of a functional-type double-precision variable | O |
Reading the calculation conditions | cg_iric_read_functional_realsingle_f | Gets the value of a functional-type single-precision variable | O |
Reading the calculation conditions | cg_iric_read_functionalwithname_f | Gets the value of a functional-type variable (with multiple values) | O |
Reading a calculation grid | cg_iric_gotogridcoord2d_f | Makes preparations for reading a grid | O |
Reading a calculation grid | cg_iric_gotogridcoord3d_f | Makes preparations for reading a grid | O |
Reading a calculation grid | cg_iric_getgridcoord2d_f | Reads the x and y coordinates of a grid | O |
Reading a calculation grid | cg_iric_getgridcoord3d_f | Reads the x, y and z coordinates of a grid | O |
Reading a calculation grid | cg_iric_read_grid_integer_node_f | Reads the integer attribute values defined for grid nodes | O |
Reading a calculation grid | cg_iric_read_grid_real_node_f | Reads double-precision attribute values defined for grid nodes | O |
Reading a calculation grid | cg_iric_read_grid_integer_cell_f | Reads the integer attribute values defined for cells | O |
Reading a calculation grid | cg_iric_read_grid_real_cell_f | Reads the double-precision attribute values defined for cells | O |
Reading a calculation grid | cg_iric_read_complex_count_f | Reads the number of groups of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_integer_f | Reads the integer attribute values of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_real_f | Reads the double precision attribute values of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_realsingle_f | Reads the single precision attribute values of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_string_f | Reads the string attribute values of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_functionalsize_f | Checks the size of a functional-type attribute of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_functional_f | Reads functional attribute data of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_complex_functionalwithname_f | Reads functional attribute of complex type grid attribute (with multiple values) | O |
Reading a calculation grid | cg_iric_read_complex_functional_realsingle_f | Reads functional attribute data of complex type grid attribute | O |
Reading a calculation grid | cg_iric_read_grid_complex_node_f | Reads the complex attribute values defined for grid nodes | O |
Reading a calculation grid | cg_iric_read_grid_complex_cell_f | Reads the complex attribute values defined for grid cells | O |
Reading a calculation grid | cg_iric_read_grid_functionaltimesize_f | Reads the number of values of dimension "Time" for functional grid attribute | O |
Reading a calculation grid | cg_iric_read_grid_functionaltime_f | Reads the values of dimension "Time" for functional grid attribute | O |
Reading a calculation grid | cg_iric_read_grid_functionaldimensionsize_f | Reads the number of values of dimension for functional grid attribute | O |
Reading a calculation grid | cg_iric_read_grid_functionaldimension_integer_f | Reads the values of integer dimension for functional grid attribute | O |
Reading a calculation grid | cg_iric_read_grid_functionaldimension_real_f | Reads the values of double-precision dimension for functional grid attribute | O |
Reading a calculation grid | cg_iric_read_grid_functional_integer_node_f | Reads the values of functional integer grid attribute with dimension "Time" definied at grid nodes. | O |
Reading a calculation grid | cg_iric_read_grid_functional_real_node_f | Reads the values of functional double-precision grid attribute with dimension "Time" definied at grid nodes. | O |
Reading a calculation grid | cg_iric_read_grid_functional_integer_cell_f | Reads the values of functional integer grid attribute with dimension "Time" definied at grid cells. | O |
Reading a calculation grid | cg_iric_read_grid_functional_real_cell_f | Reads the values of functional double-precision grid attribute with dimension "Time" definied at grid cells. | O |
Reading boundary conditions | cg_iric_read_bc_count_f | Reads the number of boundary conditions | O |
Reading boundary conditions | cg_iric_read_bc_indicessize_f | Reads the number of elements (nodes or cells) where boundary conditions are assigned. | O |
Reading boundary conditions | cg_iric_read_bc_indices_f | Reads the list of indices of elements (nodes or cells) where boundary conditions are assigned. | O |
Reading boundary conditions | cg_iric_read_bc_integer_f | Gets the value of an integer boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_real_f | Gets the value of an real (double-precision) boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_realsingle_f | Gets the value of an real (single-precision) boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_string_f | Gets the value of an string-type boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_functionalsize_f | Gets the size of an functional-type boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_functional_f | Gets the value of an functional-type double-precision boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_functional_realsingle_f | Gets the value of an functional-type single-precision boundary condition | O |
Reading boundary conditions | cg_iric_read_bc_functionalwithname_f | Gets the value of a functional-type boundary condition (with multiple values) | O |
Reading geographic data | cg_iric_read_geo_count_f | Reads the number of geographic data | O |
Reading geographic data | cg_iric_read_geo_filename_f | Reads the file name and data type of geographic data | O |
Reading geographic data | iric_geo_polygon_open_f | Opens the geographic data file that contains polygon data | X |
Reading geographic data | iric_geo_polygon_read_integervalue_f | Reads the value of polygon data as integer | X |
Reading geographic data | iric_geo_polygon_read_realvalue_f | Reads the value of polygon datas double precision real | X |
Reading geographic data | iric_geo_polygon_read_pointcount_f | Reads the number of polygon vertices | X |
Reading geographic data | iric_geo_polygon_read_points_f | Reads the coorinates of polygon vertices | X |
Reading geographic data | iric_geo_polygon_read_holecount_f | Reads the number of holes in the polygon | X |
Reading geographic data | iric_geo_polygon_read_holepointcount_f | Reads the number of vertices of hole polygon | X |
Reading geographic data | iric_geo_polygon_read_holepoints_f | Reads the coordinates of hole polygon vertices | X |
Reading geographic data | iric_geo_polygon_close_f | Closes the geographic data file | X |
Reading geographic data | iric_geo_riversurvey_open_f | Opens the geographic data file that contains river survey data | X |
Reading geographic data | iric_geo_riversurvey_read_count_f | Reads the number of the crosssections in river survey data | X |
Reading geographic data | iric_geo_riversurvey_read_position_f | Reads the coordinates of the crosssection center point | X |
Reading geographic data | iric_geo_riversurvey_read_direction_f | Reads the direction of the crosssection as normalized vector | X |
Reading geographic data | iric_geo_riversurvey_read_name_f | Reads the name of the crosssection as string | X |
Reading geographic data | iric_geo_riversurvey_read_realname_f | Reads the name of the crosssection as real number | X |
Reading geographic data | iric_geo_riversurvey_read_leftshift_f | Reads the shift offset value of the crosssection | X |
Reading geographic data | iric_geo_riversurvey_read_altitudecount_f | Reads the number of altitude data of the crosssection | X |
Reading geographic data | iric_geo_riversurvey_read_altitudes_f | Reads the altitude data of the crosssection | X |
Reading geographic data | iric_geo_riversurvey_read_fixedpointl_f | Reads the data of left bank extension line of the crosssection | X |
Reading geographic data | iric_geo_riversurvey_read_fixedpointr_f | Reads the data of right bank extension line of the crosssection | X |
Reading geographic data | iric_geo_riversurvey_read_watersurfaceelevation_f | Reads the water elevation at the crosssection | X |
Reading geographic data | iric_geo_riversurvey_close_f | Closes the geographic data file | X |
Outputting a calculation grid | cg_iric_writegridcoord1d_f | Outputs a one-dimensional structured grid | O |
Outputting a calculation grid | cg_iric_writegridcoord2d_f | Outputs a two-dimensional structured grid | O |
Outputting a calculation grid | cg_iric_writegridcoord3d_f | Outputs a three-dimensional structured grid | O |
Outputting a calculation grid | cg_iric_write_grid_integer_node_f | Outputs a grid attributed defined at grid nodes with integer values. | O |
Outputting a calculation grid | cg_iric_write_grid_real_node_f | Outputs a grid attributed defined at grid nodes with real number (double-precision) values. | O |
Outputting a calculation grid | cg_iric_write_grid_integer_cell_f | Outputs a grid attributed defined at grid cells with integer values. | O |
Outputting a calculation grid | cg_iric_write_grid_real_cell_f | Outputs a grid attributed defined at grid cells with real number (double-precision) values. | O |
Outputting time (or iteration count) information | cg_iric_write_sol_time_f | Outputs time | O |
Outputting time (or iteration count) information | cg_iric_write_sol_iteration_f | Outputs the iteration count | O |
Outputting calculation results | cg_iric_write_sol_gridcoord2d_f | Outputs a two-dimensional structured grid | O |
Outputting calculation results | cg_iric_write_sol_gridcoord3d_f | Outputs a three-dimensional structured grid | O |
Outputting calculation results | cg_iric_write_sol_baseiterative_integer_f | Outputs integer-type calculation results | O |
Outputting calculation results | cg_iric_write_sol_baseiterative_real_f | Outputs double-precision real-type calculation results | O |
Outputting calculation results | cg_iric_write_sol_baseiterative_string_f | Outputs string-type calculation results | O |
Outputting calculation results | cg_iric_write_sol_integer_f | Outputs integer-type calculation results, having a value for each grid node | O |
Outputting calculation results | cg_iric_write_sol_real_f | Outputs double-precision real-type calculation results, having a value for each grid node | O |
Outputting calculation results | cg_iric_write_sol_cell_integer_f | Outputs integer-type calculation results, having a value for each grid cell | O |
Outputting calculation results | cg_iric_write_sol_cell_real_f | Outputs double-precision real-type calculation results, having a value for each grid cell | O |
Outputting calculation results | cg_iric_write_sol_iface_integer_f | Outputs integer-type calculation results, having a value for each grid edge at i-direction | O |
Outputting calculation results | cg_iric_write_sol_iface_real_f | Outputs double-precision real-type calculation results, having a value for each grid edge at i-direction | O |
Outputting calculation results | cg_iric_write_sol_jface_integer_f | Outputs integer-type calculation results, having a value for each grid edge at j-direction | O |
Outputting calculation results | cg_iric_write_sol_jface_real_f | Outputs double-precision real-type calculation results, having a value for each grid edge at j-direction | O |
Outputting calculation results (particles) | cg_iric_write_sol_particle_pos2d_f | Outputs particle positions (two-dimensions) | O |
Outputting calculation results (particles) | cg_iric_write_sol_particle_pos3d_f | Outputs particle positions (three-dimensions) | O |
Outputting calculation results (particles) | cg_iric_write_sol_particle_integer_f | Outputs integer-type calculation results, having a value for each particle | O |
Outputting calculation results (particles) | cg_iric_write_sol_particle_real_f | Outputs double-precision real-type calculation results, having a value for each particle | O |
Outputting calculation results (particles) | cg_iric_write_sol_particlegroup_groupbegin_f | Start outputting calculation result defined as particles | O |
Outputting calculation results (particles) | cg_iric_write_sol_particlegroup_groupend_f | Finish outputting calculation result defined as particles | O |
Outputting calculation results (particles) | cg_iric_write_sol_particlegroup_pos2d_f | Outputs particle positions (two-dimensions) | O |
Outputting calculation results (particles) | cg_iric_write_sol_particlegroup_pos3d_f | Outputs particle positions (three-dimensions) | O |
Outputting calculation results (particles) | cg_iric_write_sol_particlegroup_integer_f | Outputs integer-type calculation results, having a value for each particle | O |
Outputting calculation results (particles) | cg_iric_write_sol_particlegroup_real_f | Outputs double-precision real-type calculation results, having a value for each particle | O |
Outputting calculation results (polygons, polylines) | cg_iric_write_sol_polydata_groupbegin_f | Start outputting calculation result defined as polygons or polylines | O |
Outputting calculation results (polygons, polylines) | cg_iric_write_sol_polydata_groupend_f | Finish outputting calculation result defined as polygons or polylines | O |
Outputting calculation results (polygons, polylines) | cg_iric_write_sol_polydata_polygon_f | Output calculation result defined as polygon | O |
Outputting calculation results (polygons, polylines) | cg_iric_write_sol_polydata_polyline_f | Output calculation result defined as polyline | O |
Outputting calculation results (polygons, polylines) | cg_iric_write_sol_polydata_integer_f | Outputs integer-type calculation results, having a value for a polygon or polyline | O |
Outputting calculation results (polygons, polylines) | cg_iric_write_sol_polydata_real_f | Outputs double-precision real-type calculation results, having a value for a polygon or polyline | O |
Functions to call befor and after outputting calculation results | iric_check_cancel_f | Checks whether user canceled solver execution | X |
Functions to call befor and after outputting calculation results | iric_check_lock_f | Checks whether the CGNS file is locked by GUI | X |
Functions to call befor and after outputting calculation results | iric_write_sol_start_f | Inform the GUI that the solver started outputting result | X |
Functions to call befor and after outputting calculation results | iric_write_sol_end_f | Inform the GUI that the solver finished outputting result | X |
Functions to call befor and after outputting calculation results | cg_iric_flush_f | Flush calculation result into CGNS file | X |
Reading calculation results | cg_iric_read_sol_count_f | Reads the number of calculation results | O |
Reading calculation results | cg_iric_read_sol_time_f | Reads the time value | O |
Reading calculation results | cg_iric_read_sol_iteration_f | Reads the loop iteration value | O |
Reading calculation results | cg_iric_read_sol_baseiterative_integer_f | Reads the integer-type calculation result value | O |
Reading calculation results | cg_iric_read_sol_baseiterative_real_f | Reads the double-precision real-type calculation result value | O |
Reading calculation results | cg_iric_read_sol_baseiterative_string_f | Reads the string-type calculation result value | O |
Reading calculation results | cg_iric_read_sol_gridcoord2d_f | Reads the 2D structured grid (for moving grid calculation) | O |
Reading calculation results | cg_iric_read_sol_gridcoord3d_f | Reads the 3D structured grid (for moving grid calculation) | O |
Reading calculation results | cg_iric_read_sol_integer_f | Reads the integer-type calculation result, having a value for each grid node | O |
Reading calculation results | cg_iric_read_sol_real_f | Reads the double-precision real-type calculation result, having a value for each grid node | O |
Reading calculation results | cg_iric_read_sol_cell_integer_f | Reads the integer-type calculation result, having a value for each grid cell | O |
Reading calculation results | cg_iric_read_sol_cell_real_f | Reads the double-precision real-type calculation result, having a value for each grid cell | O |
Reading calculation results | cg_iric_read_sol_iface_integer_f | Reads the integer-type calculation result, having a value for each grid edge at i-direction | O |
Reading calculation results | 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 | O |
Reading calculation results | cg_iric_read_sol_jface_integer_f | Reads the integer-type calculation result, having a value for each grid edge at j-direction | O |
Reading calculation results | 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 | O |
Outputting error codes | cg_iric_write_errorcode_f | Outputs error code | O |
Closing the CGNS file | cg_close_f | Closes a CGNS file | X |
The functions with “O” value for column “Multi” has functions that are used for the same purpose and used when handling multiple CGNS files. The “Multi” version of the functions end with “_mul_f” instead of “_f”, and the first argument is file ID.
For example, the functions used for reading integer-type calculation result are as follows:
- Function used when handling single CGNS file
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 82.
Item | For Single CGNS file | For Multiple CGNS file |
---|---|---|
Name | Ends with “_f” | Ends with “_mul_f” |
Arguments | See the following sections | The first argument is File ID (integer) |
Target CGNS file | File that is identified by the File ID that was specified as the argument of “cg_iric_init_f” or “cg_iric_initread_f” | File that is identified by the File ID that is specified as the first argument. |
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)
cg_iric_init_f¶
- Initializes the internal variables that are used for reading and
Format (FORTRAN)¶
call cg_iric_init_f(fid, ier)
Format (C/C++)¶
ier = cg_iRIC_Init(fid);
Format (Python)¶
cg_iRIC_Init(fid)
cg_iric_initread_f¶
- Initializes the internal variables that are used for reading CGNS
Format (FORTRAN)¶
call cg_iric_initread_f(fid, ier)
Format (C/C++)¶
ier = cg_iRIC_InitRead(fid);
Format (Python)¶
cg_iRIC_InitRead(fid)
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)
cg_iric_read_integer_f¶
- Reads the value of a integer-type variable from the CGNS file.
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)
cg_iric_read_real_f¶
- Reads the value of a double-precision real-type variable from the
Format (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)
cg_iric_read_realsingle_f¶
- Reads the value of a single-precision real-type variable from the
Format (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.
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)
Format (C/C++)¶
ier = cg_iRIC_Read_String(label, strvalue);
Format (Python)¶
strvalue = cg_iRIC_Read_String(label)
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.
cg_iric_read_functional_f¶
- Reads the value of a functional-type double-precision real variable
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¶
Variable name | Type | I/O | Description |
---|---|---|---|
label | character(*) | I | Name of the variable defined in the solver definition file |
x | double precision , dimension(:), allocatable | O | Array of x values |
y | double precision, dimension(:), allocatable | O | Array of y values |
ier | integer | O | Error code. 0 means success. |
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.
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
label | character(*) | I | Name of the variable defined in the solver definition file |
x | real , dimension(:), allocatable | O | Array of x values |
y | real, dimension(:), allocatable | O | Array of y values |
ier | integer | O | Error code. 0 means success. |
cg_iric_read_functionalwithname_f¶
- Reads the value of a functional-type real variable from the CGNS
Format (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¶
Variable name | Type | I/O | Description |
---|---|---|---|
label | character(*) | I | Name of the variable defined in the solver definition file |
name | character(*) | I | Name of the variable value name defined in the solver definition file |
data | real , dimension(:), allocatable | O | Array of values |
ier | integer | O | Error code. 0 means success. |
cg_iric_gotogridcoord2d_f¶
- Makes preparations for reading a two-dimensional structured grid.
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()
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()
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()
cg_iric_getgridcoord3d_f¶
- Subroutine to reads a three-dimensional structured grid
Format (FORTRAN)¶
call cg_iric_getgridcoord3d_f(x, y, z, ier)
Format (C/C++)¶
ier = cg_iRIC_GetGridCoord3d(x, y, z);
Format (Python)¶
x, y, z = cg_iRIC_GetGridCoord3d()
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
x | double precision, dimension(:), allocatable | O | x coordinate value of a grid node |
y | double precision, dimension(:), allocatable | O | y coordinate value of a grid node |
z | double precision, dimension(:), allocatable | O | z coordinate value of a grid node |
ier | integer | O | Error code. 0 means success. |
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)
cg_iric_read_grid_real_node_f¶
- Reads the double-precision real-type attribute values defined for
Format (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)
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)
cg_iric_read_grid_real_cell_f¶
- Reads the double-precision real-type attribute values defined for
Format (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)
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)
Format (C/C++)¶
ier = cg_iRIC_Read_Complex_Count(type, &num);
Format (Python)¶
num = cg_iRIC_Read_Complex_Count(type)
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)
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)
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.
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)
cg_iric_read_complex_functionalsize_f¶
- Checks the size of a functional-type attribute of complex type grid
Format (FORTRAN)¶
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.
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)
cg_iric_read_complex_functionalwithname_f¶
- Reads functional attribute of complex type grid attribute (with
Format (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¶
Variable name | Type | I/O | Description |
---|---|---|---|
type | character(*) | I | Attribute name |
num | integer | I | Group number |
name | character(*) | I | Condition name |
paramname | character(*) | I | Value name |
data | double precision, dimension(:), allocatable | O | Value array |
ier | integer | O | Error code. 0 means success. |
cg_iric_read_complex_functional_realsingle_f¶
- Reads functional attribute data of complex type grid attribute
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¶
Variable name | Type | I/O | Description |
---|---|---|---|
type | character(*) | I | Attribute name |
num | integer | I | Group number |
name | character(*) | I | Condition name |
x | real, dimension(:), allocatable | O | x value array |
y | real, dimension(:), allocatable | O | y value array |
ier | integer | O | Error code. 0 means success. |
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)
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)
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)
Format (C/C++)¶
ier = cg_iRIC_Read_Grid_FunctionalTimeSize(label, &count);
Format (Python)¶
This function does not exists for Python.
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)
cg_iric_read_grid_functionaldimensionsize_f¶
- Reads the number of values of dimension for functional grid attribute
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.
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)
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)
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)
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)
cg_iric_read_grid_functional_real_node_f¶
- Reads the values of functional double-precision grid attribute with
Format (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 | Type | I/O | Description |
---|---|---|---|
label | character(*) | I | Attribute name |
dimid | integer | I | ID of “Time” (1 to the number of Time) |
values | double precision, dimension(:), allocatable | O | Attribute value |
ier | integer | O | Error code. 0 means success. |
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)
cg_iric_read_grid_functional_real_cell_f¶
- Reads the values of functional double-precision grid attribute with
Format (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)
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
label | character(*) | I | Attribute name |
dimid | integer | I | ID of “Time” (1 to the number of Time) |
values | double precision, dimension(:), allocatable | O | Attribute value |
ier | integer | O | Error code. 0 means success. |
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)
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)
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 | I/O | Description |
---|---|---|---|
type | character(*) | I | The type name of boundary condition you want to know the indices size |
num | integer | O | The boundary condition ID number |
size | integer | O | The number of elements (nodes or cells) where the boundary condition is set. |
ier | integer | O | Error code. 0 means success. |
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 | I/O | Description |
---|---|---|---|
type | character(*) | I | The type name of boundary condition you want to know the indices size |
num | integer | O | The boundary condition ID number |
ier | integer | O | Error code. 0 means success. |
Note¶
Values returned to indices depends on the position where boundary condition is defined, like shown in Table 127.
Please note that when the boundary condition is defined at nodes or cells, it outputs two values for each element, and when defined at edges, it outputs four values for each element.
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
|
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)
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
type | character(*) | I | Name of boundary condition |
num | integer | I | Boundary condition number |
label | character(*) | I | Name of the boundary condition variable defined in the solver definition file |
intvalue | integer | O | Integer read from the CGSN file |
ier | integer | O | Error code. 0 means success. |
cg_iric_read_bc_real_f¶
- Reads the value of a double-precision real-type variable from the
Format (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 | I/O | Description |
---|---|---|---|
type | character(*) | I | Name of boundary condition |
num | integer | I | Boundary condition number |
label | character(*) | I | Name of the variable defined in the solver definition file |
realvalue | double precision | O | Real number read from the CGSN file |
ier | integer | O | Error code. 0 means success. |
cg_iric_read_bc_realsingle_f¶
- Reads the value of a single-precision real-type variable from the
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_f
file: cg_iric_read_bc_realsingle_f_args.csv header-rows: 1
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 | I/O | Description |
---|---|---|---|
type | character(*) | I | Name of boundary condition |
num | integer | I | Boundary condition number |
label | character(*) | I | Name of the variable defined in the solver definition file |
strvalue | character(*) | O | Character string read from the CGSN file |
ier | integer | O | Error code. 0 means success. |
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_f
file: cg_iric_read_bc_functionalsize_f_args.csv header-rows: 1
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)
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
type | character(*) | I | Name of boundary condition |
num | integer | I | Boundary condition number |
label | character(*) | I | Name of the variable defined in the solver definition file |
x | double precision, dimension(:), allocatable | O | Array of x values |
y | double precision, dimension(:), allocatable | O | Array of y values |
ier | integer | O | Error code. 0 means success. |
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_f
file: cg_iric_read_bc_functional_realsingle_f_args.csv header-rows: 1
cg_iric_read_bc_functionalwithname_f¶
- Reads the value of a functional-type real variable from the CGNS
Format (FORTRAN)¶
call cg_iric_read_bc_functionalwithname_f(type, num, label, name, data, ier)
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¶
Variable name | Type | I/O | Description |
---|---|---|---|
type | character(*) | I | Name of boundary condition |
num | integer | I | Boundary condition number |
label | character(*) | I | Name of the variable defined in the solver definition file |
name | character(*) | I | Name of the variable value name defined in the solver definition file |
data | real , dimension(:), allocatable | O | Array of values |
ier | integer | O | Error code. 0 means success. |
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.
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.
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)
Format (C/C++)¶
ier = iRIC_Geo_Polygon_Open(filename, &pid);
Format (Python)¶
This function does not exists for Python.
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.
iric_geo_polygon_read_realvalue_f¶
- Reads the value of polygon datas double precision real
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.
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.
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 | Type | I/O | Description |
---|---|---|---|
pid | integer | I | Polygon ID |
x | double precision , dimension(:), allocatable | O | X coordinates of polygon vertices |
y | double precision , dimension(:), allocatable | O | Y coordinates of polygon vertices |
ier | integer | O | Error code. 0 means success. |
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);
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.
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.
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
pid | integer | I | Polygon ID |
holeid | integer | I | Hole ID |
x | double precision , dimension(:), allocatable | O | X coordinates of hole polygon vertices |
y | double precision , dimension(:), allocatable | O | Y coordinates of hole polygon vertices |
ier | integer | O | Error code. 0 means success. |
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.
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)
Format (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Open(filename, rid);
Format (Python)¶
This function does not exists for Python.
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.
iric_geo_riversurvey_read_position_f¶
- Reads the coordinates of the crosssection center point
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¶
Variable name | Type | I/O | Description |
---|---|---|---|
rid | integer | I | River Survey Data ID |
pointid | integer | I | Crosssection ID |
x | double precision | O | X coordinate of the center point |
y | double precision | O | Y coordinate of the center point |
ier | integer | O | Error code. 0 means success. |
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.
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
rid | integer | I | River Survey Data ID |
pointid | integer | I | Crosssection ID |
vx | double precision | O | X component of the normalized direction vector |
vx | double precision | O | Y component of the normalized direction vector |
ier | integer | O | Error code. 0 means success. |
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.
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)
Format (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_RealName(rid, pointid, &realname);
Format (Python)¶
This function does not exists for Python.
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.
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.
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.
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
rid | integer | I | River Survey Data ID |
pointid | pointid | I | Crosssection ID |
position | double precision , dimension(:), allocatable | O | Altitude position (less than 0: left bank side, grater than 0: right bank side) |
height | double precision , dimension(:), allocatable | O | Altitude height (elevation) |
active | integer, dimension(:), allocatable | O | Altitude data active/inactive (1: active, 0: inactive) |
ier | integer | O | Error code. 0 means success. |
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 name | Type | I/O | Description |
---|---|---|---|
rid | integer | I | River Survey Data ID |
pointid | integer | I | Crosssection ID |
set | integer | O | If defined, the value is 1 |
directionx | double precision | O | X component of normalized direction vector |
direction | double precision | O | Y component of normalized direction vector |
index | integer | O | The ID of the altitude data where the left bank extension line starts |
ier | integer | O | Error code. 0 means success. |
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 name | Type | I/O | Description |
---|---|---|---|
rid | integer | I | River Survey Data ID |
pointid | integer | I | Crosssection ID |
set | integer | O | If defined, the value is 1 |
directionx | double precision | O | X component of normalized direction vector |
direction | double precision | O | Y component of normalized direction vector |
index | integer | O | The ID of the altitude data where the right bank extension line starts |
ier | integer | O | Error code. 0 means success. |
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);
Format (Python)¶
This function does not exists for Python.
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
rid | integer | I | River Survey Data ID |
pointid | integer | I | Crosssection ID |
set | integer | O | If defined the value is 1 |
value | double precision | O | Water surface elevation |
ier | integer | O | Error code. 0 means success. |
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.
cg_iric_writegridcoord1d_f¶
- Outputs a one-dimensional structured grid.
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)
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)
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
nx | integer | I | Number of grid nodes in the i direction |
ny | integer | I | Number of grid nodes in the j direction |
x | double precision, dimension(:,:), allocatable | I | x coordinate value of a grid node |
y | double precision, dimension(:,:), allocatable | I | y coordinate value of a grid node |
ier | integer | O | Error code. 0 means success. |
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 | Type | I/O | Description |
---|---|---|---|
nx | integer | I | Number of grid nodes in the i direction |
ny | integer | I | Number of grid nodes in the j direction |
nz | integer | I | Number of grid nodes in the k direction |
x | double precision, dimension(:), allocatable | I | x coordinate value of a grid node |
y | double precision, dimension(:), allocatable | I | y coordinate value of a grid node |
z | double precision, dimension(:), allocatable | I | z coordinate value of a grid node |
ier | integer | O | Error code. 0 means success. |
cg_iric_write_grid_integer_node_f¶
- Outputs grid attribute values defined at grid nodes with integer
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)
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)
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)
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)
Format (C/C++)¶
ier = cg_iRIC_Write_Grid_Real_Cell(label, values);
Format (Python)¶
cg_iRIC_Write_Grid_Real_Cell(label, values)
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)
cg_iric_write_sol_iteration_f¶
- Outputs iteration count.
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)
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)
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 | Type | I/O | Description |
---|---|---|---|
x | double precision, dimension(:), allocatable | I | x coordinate. |
y | double precision, dimension(:), allocatable | I | y coordinate. |
z | double precision, dimension(:), allocatable | I | z coordinate |
ier | integer | O | Error code. 0 means success. |
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)
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)
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)
Format (C/C++)¶
ier = cg_iRIC_Write_Sol_BaseIterative_String(label, val);
Format (Python)¶
cg_iRIC_Write_Sol_BaseIterative_String(label, val)
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 | Type | I/O | Description |
---|---|---|---|
label | character* | I | Name of the value to be output |
val | integer, dimension(:,:), allocatable | I | Value to be output In the case of a 3D grid, the type should be integer, dimension(:,:,:), allocatable. |
ier | integer | O | Error code. 0 means success. |
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 | Type | I/O | Description |
---|---|---|---|
label | character* | I | Name of the value to be output. |
val | double precision, dimension(:,:), allocatable | I | Value to be output In the case of a 3D grid, the type should be double precision, dimension(:,:,:), allocatable. |
ier | integer | O | Error code. 0 means success. |
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)
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
label | character* | I | Name of the value to be output |
val | integer, dimension(:,:), allocatable | I | Value to be output In the case of a 3D grid, the type should be integer, dimension(:,:,:), allocatable. |
ier | integer | O | Error code. 0 means success. |
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 | Type | I/O | Description |
---|---|---|---|
label | character* | I | Name of the value to be output. |
val | double precision, dimension(:,:), allocatable | I | Value to be output In the case of a 3D grid, the type should be double precision, dimension(:,:,:), allocatable. |
ier | integer | O | Error code. 0 means success. |
cg_iric_write_sol_iface_integer_f¶
- Outputs integer-type calculation results, giving a value for each grid edge at i-direction.
Format (FORTRAN)¶
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)
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)
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)
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)
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 | Type | I/O | Description |
---|---|---|---|
count | integer | I | The number of particles |
x | double precision, dimension(:), allocatable | I | x coordinate. |
y | double precision, dimension(:), allocatable | I | y coordinate. |
ier | integer | O | Error code. 0 means success. |
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)
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 | Type | I/O | Description |
---|---|---|---|
count | integer | I | The number of particles |
x | double precision, dimension(:), allocatable | I | x coordinate. |
y | double precision, dimension(:), allocatable | I | y coordinate. |
z | double precision, dimension(:), allocatable | I | z coordinate. |
ier | integer | O | Error code. 0 means success. |
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)
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)
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)
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()
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);
Format (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_Pos2d(x, y)
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)
cg_iric_write_sol_particlegroup_integer_f¶
- Outputs integer-type calculation results, giving a value for each particle.
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)
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)
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)
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++)¶
ier = cg_iRIC_Write_Sol_PolyData_GroupEnd();
Format (Python)¶
cg_iRIC_Write_Sol_PolyData_GroupEnd()
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 name | Type | I/O | Description |
---|---|---|---|
numpoints | integer | I | The number of points in the polygon |
x | double precision, dimension(:), allocatable | I | x coordinate. |
y | double precision, dimension(:), allocatable | I | y coordinate. |
ier | integer | O | Error code. 0 means success. |
cg_iric_write_sol_polydata_polyline_f¶
- Output calculation result defined as polyline.
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 name | Type | I/O | Description |
---|---|---|---|
numpoints | integer | I | The number of points in the polyline |
x | double precision, dimension(:), allocatable | I | x coordinate. |
y | double precision, dimension(:), allocatable | I | y coordinate. |
ier | integer | O | Error code. 0 means success. |
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)
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)
iric_check_cancel_f¶
- Checks whether user canceled solver execution
Format (FORTRAN)¶
call iric_check_cancel_f(canceled)
Format (C/C++)¶
iRIC_Check_Cancel(&canceled);
Format (Python)¶
canceled = iRIC_Check_Cancel()
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.
iric_write_sol_start_f¶
- Inform the GUI that the solver started outputting result
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.
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.
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)
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()
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)
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++)¶
ier = cg_iRIC_Read_Sol_Iteration(step, &iteration);
Format (Python)¶
iteration = cg_iRIC_Read_Sol_Iteration(step)
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)
cg_iric_read_sol_baseiterative_real_f¶
- Reads the double-precision real-type calculation result value
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)
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)
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)
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)
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 | Type | I/O | Description |
---|---|---|---|
step | integer | I | Result Step Number |
x | double precision, dimension(:), allocatable | O | Xcoordinates |
y | double precision, dimension(:), allocatable | O | Y coordinates |
z | double precision, dimension(:), allocatable | O | Z coordinates |
ier | integer | O | Error code. 0 means success. |
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)
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 | Type | I/O | Description |
---|---|---|---|
step | integer | I | Result Step Number |
label | character(*) | I | Name |
val | double precision, dimension(:,:), allocatable | O | Value (In case of 3D grid, double precision, dimension(:,:,:), allocatable) |
ier | integer | O | Error code. 0 means success. |
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)
Arguments¶
Variable name | Type | I/O | Description |
---|---|---|---|
step | integer | I | Result Step Number |
label | character(*) | I | Name |
val | integer, dimension(:,:),allocatable | O | Value (In case of 3D grid, integer, dimension(:,:,:), allocatable) |
ier | integer | O | Error code. 0 means success. |
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 | Type | I/O | Description |
---|---|---|---|
step | integer | I | Result Step Number |
label | character(*) | I | Name |
val | double precision, dimension(:,:), allocatable | O | Value (In case of 3D grid, double precision, dimension(:,:,:), allocatable) |
ier | integer | O | Error code. 0 means success. |
cg_iric_read_sol_iface_integer_f¶
- Reads the integer-type calculation result, having a value for each grid edge at i-direction.
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)
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)
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)
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)
Format (C/C++)¶
ier = cg_iRIC_Read_Sol_JFace_Real(step, label, val);
Format (Python)¶
val = cg_iRIC_Read_Sol_JFace_Real(step, label)
Other Informations¶
Handling command line arguments in Fortran programs¶
When iRIC launches solvers (or grid generating programs), the name of calculation data file (or grid generating data file) is passed as an argument. So, solvers (or grid generating programs) have to process the file name and opens that file.
In FORTRAN, the functions prepared for handling arguments are different by compilers. In this section, functions for handling arguments are explained for Intel Fortran Complier and GNU Fortran compiler.
Intel Fortran Compiler¶
Obtain the number of command line arguments using nargs(), and obtain the argument value using getarg().
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 ) then call getarg(1, condFile, istatus) else write(*,*) "Input File not specified." stop endif |
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.
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 ) then call getarg(0, str1) ! The file name of the executable. call getarg(1, condfile) ! The first argument else write(*,*) "Input File not specified." stop endif |
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 218 shows the files prepared for each compiler.
For header file, “libcgns_f.h”, “iriclib_f.h” can be used for all compilers commonly.
Compiler | iRIClib library | cgnslib 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 (like path settings) are already finished.
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.
GNU Fortran¶
Put 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.f
g++ -o solver.exe -lgfortran solver.o cgnsdll.lib iriclib.lib
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.
Grid attributes¶
Table 219 shows the special names defined for grid attributes.
Name | Description |
---|---|
Elevation | 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 112. You can change caption attribute value to an arbitrary value.
<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 will automatically load “Elevation” value.
List 113 shows an example of code written in Fortran.
cg_iric_write_grid_real_node_f("Elevation", elevation, ier);
Calculation results¶
Table 220 shows the special names defined for calculation results. Specify these names as arguments of subroutines defined in iRIClib.
List 114 shows an example of solver source code that outputs all special calculation result.
Name | Description | Required |
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)”. | Yes |
WaterSurfaceElevation | Outputs water surface elevation (unit: meter). Output the value as real number calculation result. You can add unit in the tail, like “WaterSurfaceElevation(m)”. | |
IBC | 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. |
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)
Information on CGNS file and CGNS library¶
General concept of CGNS file format¶
CGNS, which stands for CFG General Notation System, refers to a general-purpose file format for storing data for use 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 of elements 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.
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 software tool published as free software.
Installing HDFView¶
First, install HDFView. The installer of HDFView can be downloaded from
https://www.hdfgroup.org/downloads/index.html
From the HDF web page, click the “Current Release” link in Figure 63. You will be taken to download page. On this screen, 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 file as open target.
An example of the HDFView screen after opening a CGNS file is shown in Figure 65.
In the left side of the screen, the tree structure of the CGNS file contents is shown. When you double click on the item in the tree structure, The data contained in that node is displayed in the main region.
Reference URLs¶
For information on CGNS files and CGNS libraries, refer to the URLs in Table 221 .
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 |
Registering file to Repository for iRIC installer build¶
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.
Procedure¶
Solver developer can register the files through the procedure below:
- Install Subversion client software (needed only for the first time)
- Get the folder from server (checkout)
- Copy new files
- 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:
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.
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 the procedure 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 66 is shown. Setup the setting to fit your environment, and click on [OK] button.
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.
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 right-clicking menu:
SVN Checkout
Then, the dialog in Figure 67 is shown.
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 68 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 67, please check again that 「リポジトリのURL」and 「チェックアウト先のディレクトリ」are set up correctly, and then click on [OK].
Then the dialog like Figure 69 is shown, and it starts downloading files from the server.
When downloading files finishes, explorer looks like in Figure 70. You’ll notice that the files checked out from the server is shown with check mark icon.
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 71 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 the version number is the same.
The version number you have to update is stored as version attribute of SolverDefinition element in definition.xml.
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 72 is shown.
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 73 will be shown. Please input the Username and Password, and click on [OK].
Please contact the adninistrator of iRIC, to know the username and password.
To 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.