iRIC Software Developer's Manual¶
このマニュアルについて¶
このマニュアルでは、以下のユーザに必要な情報を解説します。
- iRIC 上で動作するソルバーの開発者
- iRIC 上で動作する格子生成プログラムの開発者
ソルバー開発者の方は、まずは ソルバーの開発手順 を読んで、ソルバー開発の流れについて理解してください。 その後、必要に応じて 定義ファイル (XML) について、 iRIClibについて、 その他の情報 を参照してください。
格子生成プログラム開発者の方は、まずは 格子生成プログラムの開発手順 を読んで格子生成プログラム開発の流れについて理解してください。 その後、必要に応じて 定義ファイル (XML) について、 iRIClibについて、 その他の情報 を参照してください。
ソルバーの開発手順¶
開発環境の準備¶
iRIC ソルバの開発環境を準備します。
- C/C++ で開発するには、Microsoft Visual C/C++ 2013 以降を使用してください。
- FORTRAN で開発するには、Intel Fortran 2015 以降を利用してください。
ソルバをビルドする際には、 cgnslib と iriclib をリンクする必要があります。
必要なヘッダファイルとライブラリは、 iRIC GUI に同梱されています。標準的な場所にインストールした場合、 ファイルは以下にあります。
C:\Users\(userid)\iRIC\guis\prepost\sdk
概要¶
ソルバーは、格子、計算条件などに基づいて河川シミュレーションを実行し、計算結果を出力するプログラムです。
iRIC 上で動作するソルバーを開発するには、表 1 に示すようなファイルを作成、配置する必要があります。
表 1 に示したファイルは iRIC インストール先の下の "solvers" フォルダの下に 自分が開発するソルバー専用のフォルダを作成し、その下に配置します。
ファイル名 | 説明 |
---|---|
definition.xml | ソルバー定義ファイル。英語で記述する。 |
solver.exe (例) | ソルバーの実行モジュール。ファイル名はソルバー開発者が任意に選べる。 |
translation_ja_JP.ts など | ソルバー定義ファイルの辞書ファイル。 |
README | ソルバーの説明ファイル |
LICENSE | ソルバーのライセンス情報ファイル |
各ファイルの概要は以下の通りです。
definition.xml¶
ソルバーに関する以下の情報を定義するファイルです。
- 基本情報
- 計算条件
- 格子属性
iRICはソルバー定義ファイルを読み込むことで、そのソルバーに必要な計算条件、格子を作成するための インターフェースを提供し、そのソルバー用の計算データファイルを生成します。ソルバー定義ファイルは、 すべて英語で記述します。
ソルバー¶
河川シミュレーションを実行するプログラムです。iRICで作成した計算条件と格子を読みこんで計算を行い、 結果を出力します。
計算条件、格子、結果の入出力には、iRICが生成する計算データファイルを使用します。ただし、 計算データファイルで入出力を行えないデータについては、任意の外部ファイルを入出力に使うこともできます。
FORTRAN, Python, C言語、C++言語のいずれかの言語で開発します。この章では、 FORTRAN で開発する例を説明します。
translation_ja_JP.ts など¶
ソルバー定義ファイルで用いられている文字列のうち、ダイアログ上などに表示される文字列を翻訳して 表示するための辞書ファイルです。日本語 (translation_ja_JP.ts)、韓国語 (translation_ka_KR.ts) など言語ごとに別ファイルとして作成します。
README¶
ソルバーに関する説明を記述するテキストファイルです。iRIC で新しいプロジェクトを開始する時にソルバー を選択する画面で、説明欄に表示されます。
フォルダの作成¶
iRIC のインストールフォルダ の下にある "solvers" フォルダの下に、開発するソルバーのための専用のフォルダを作成します。 今回は、 "example" というフォルダを作成します。
ソルバー定義ファイルの作成¶
ソルバー定義ファイルを作成します。
ソルバー定義ファイルは、ソルバーに関する 表 2 に示す情報を定義します。
項目 | 説明 | 必須 |
---|---|---|
基本情報 | ソルバーの名前、開発者、リリース日など | ○ |
計算条件 | ソルバーの実行に必要な計算条件 | ○ |
格子属性 | 計算格子の格子点もしくは格子セルに与える属性 | ○ |
境界条件 | 計算格子の格子点もしくは格子セルに与える境界条件 |
ソルバー定義ファイルは、マークアップ言語の一種であるXML言語で記述します。 XML言語の基礎については XML の基礎 を参照してください。
この節では、ソルバー定義ファイルを、表 2 に示した順で作成していきます。
基本情報の作成¶
ソルバーの基本情報を作成します。 リスト 1 に示すような ファイルを作り、 フォルダの作成 で作成した "example" フォルダ の下に "definition.xml" の名前で保存します。
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> |
この時点では、ソルバー定義ファイルの構造は 図 2 に示すようになっています。
正しくソルバー定義ファイルが作成できているか確認します。
iRIC を起動します。 図 3 に示すダイアログが表示されますので、「新しいプロジェクト」ボタンを押します。 図 4 に示すダイアログが表示されますので、 ソルバーのリストに "Sample Solver" があるか確認します。あったらそれをクリックし、 右側に先ほど指定した属性が正しく表示されるか確認します。
なお、このダイアログでは、以下の属性については表示されません。
- name
- executable
- iterationtype
- gridtype
なお、ここで記述する name 属性と version 属性については、ソルバーのバージョンアップの際に 気をつける必要があります。バージョンアップの際の注意点については ソルバーのバージョンアップ時の注意点 を参照してください。
計算条件の定義¶
計算条件を定義します。計算条件は、ソルバー定義ファイルの CalculationCondition 要素で定義します。 基本情報の作成 で作成したソルバー定義ファイルに追記し、 リスト 2 に示すようなファイルにし、保存します。追記した部分を強調して示しました。
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> |
この時点では、ソルバー定義ファイルの構造は 図 5 に示すようになっています。
正しくソルバー定義ファイルが作成できているか確認します。
iRIC を起動します。図 3 に示すダイアログが表示されますので、「新しいプロジェクト」ボタンを押して、ソルバーの リストから "Sample Solver" をクリックし、 "OK" ボタンを押します。 図 6 に示すダイアログが表示されますが、 "OK" ボタンを押して進みます。
プリプロセッサが表示されますので、以下の操作を行います。
メニュー: --> 計算条件(C) --> 設定(S)
すると、 図 7 に示すダイアログが表示されます。 リスト 2 で追記した 内容に従って表示されているのが分かります。
グループを増やして、さらに計算条件を追加します。Basic Settings の Tab要素 のすぐ下に、 "Water Surface Elevation" というグループを追加して保存します。追記した ソルバー定義ファイルの抜粋を、 リスト 3 に示します。追記した部分を強調して示しました。
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 | (前略) </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> |
この時点では、ソルバー定義ファイルの構造は 図 8 に示すようになっています。
正しくソルバー定義ファイルが作成できているか確認します。先ほどと同じ手順で ダイアログを表示します。
"Water Surface Elevation" というグループがリストに表示されているのが分かります。 また、 "Constant Value" は、 "Type" で "Constant" を選択している時のみ、 "Time Dependent Value" は、 "Type" で "Time Dependent" を選択している時のみ有効です。
ダイアログの表示例を 図 9 に示します。
計算条件の定義についてまとめると、以下の通りです。
- 計算条件のグループは Tab要素で、計算条件は Item要素で指定します。
- Definition 要素以下の構造は、計算条件の種類 (例: 整数、実数、整数からの選択、関数型) によって異なります。計算条件の種類ごとの記述方法とダイアログ上での表示については 計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 を参照して下さい。
- 計算条件には、 Condition 要素で依存関係を定義できます。Condition要素では、その計算条件 が有効になる条件を指定します。 Condition 要素の定義方法の例は、 計算条件・境界条件・格子生成条件の有効になる条件の定義例 を参照して下さい。
- この例では、計算条件のダイアログを単純なリスト形式で作成しましたが、 グループボックスを使うなどしてダイアログのレイアウトをカスタマイズすることができます。 ダイアログのレイアウトのカスタマイズ方法については 計算条件・境界条件・格子生成条件のダイアログのレイアウト定義例 を参照して下さい。
格子属性の定義¶
格子属性を定義します。格子属性は、ソルバー定義ファイルの GridRelatedCondition 要素で定義します。 計算条件の定義 で作成したソルバー定義ファイルに追記し、 GridRelatedCondition 要素に リスト 4 に示すように追記し、保存します。追記した部分を強調して示しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | (前略) </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> |
正しくソルバー定義ファイルが作成できているか確認します。
iRIC を起動して、ソルバー "Sample Solver" の新しいプロジェクトを開始します。 すると、 図 10 に示すような画面が 表示されます。さらに、格子を作成したりインポートしたりすると、 図 11 のようになります。
なお、格子の作成やインポートの方法が分からない場合、ユーザマニュアルを参照して下さい。
以下の手順で格子点の属性Elevation を編集すると、 図 12 に 示すダイアログが表示され、実数の値を入力できることが確認できます。
- オブジェクトブラウザで、 "格子" --> "格子点の属性" -> "Elevation" を選択します。
- 描画領域で、マウスクリックで格子点を選択します。
- 右クリックメニューを表示し、 "編集" を選択します。
同様に、格子セルの属性 "Obstacle" を編集すると、 図 13 に示す ダイアログが表示され、 リスト 4 で 指定した選択肢から値を選択できることが確認できます。
格子属性の定義についてまとめると、以下の通りです。
- 格子属性は、Item要素で指定します。
- Item 要素以下の構造は計算条件の Item と基本的には同じですが、
以下の違いがあります。
- 属性を格子点で定義するか、セルで定義するかを position 属性で指定します。
- 文字列、関数型、ファイル名、フォルダ名を指定することはできません。
- 依存関係を指定することはできません。
- Dimension要素を用いて、次元を定義することができます。
格子属性については、iRIC では特別な名前が定義されており、特定の目的で使用される 属性ではその名前を使用する必要があります。特別な格子属性の名前については 特別な格子属性、計算結果の名前について を参照してください。
境界条件の定義¶
境界条件を定義します。境界条件は、ソルバー定義ファイルの BoundaryCondition 要素で定義します。 なお、境界条件の定義は必須ではありません。
格子属性の定義 で作成したソルバー定義ファイルに追記し、 BoundaryCondition 要素を リスト 5 に 示すように追記し、保存します。追記した部分を強調して示しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | (前略) </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> |
正しくソルバー定義ファイルが作成できているか確認します。
iRIC を起動して、ソルバー "Sample Solver" の新しいプロジェクトを開始します。 格子を作成したりインポートしたりすると、 図 14 のようになります。なお、格子の作成やインポートの方法が分からない場合、 ユーザマニュアルを参照して下さい。
右クリックメニューから「新しい Inflow の追加」を選択すると、 図 15 に示すダイアログが表示され、境界条件を定義することが出来ます。
境界条件を定義した後、格子点を選択して右クリックメニューから「追加」を選択することで 流入口にする格子点を設定できます。設定後の画面表示例を 図 16 に示します。
境界条件の定義についてまとめると、以下の通りです。
- 境界条件は、 BoundaryCondition 要素で指定します。
- Item 要素以下の構造は計算条件の Item と基本的には同じです。計算条件と同様、依存性なども定義できます。
ソルバーの作成¶
ソルバーを作成します。この例では、ソルバーは FORTRAN 言語で開発します。
iRIC と連携するソルバーを開発するには、ソルバー定義ファイルに従って iRIC が生成する計算データファイルを、計算条件、格子、結果の入出力に 利用する必要があります。
iRIC が生成する計算データファイルは、CGNS ファイルという形式です。 CGNS ファイルの入出力には、iRIClib というライブラリを使用します。
この節では、 ソルバー定義ファイルの作成 で作成したソルバー定義ファイルに従って iRIC が生成する 計算データファイルを読みこむソルバーを開発する流れを説明します。 このソルバーで行われる入出力処理を 表 3 に示します。
処理の内容 | 必須 |
---|---|
計算データファイルを開く | ○ |
内部変数の初期化 | ○ |
計算条件の読み込み | ○ |
計算格子の読み込み | ○ |
時刻 (もしくはループ回数) の出力 | ○ |
計算結果の出力 | ○ |
計算データファイルを閉じる | ○ |
この節では、ソルバーを以下の手順で開発していきます。
- 骨組みの作成
- 計算データファイルを開く処理、閉じる処理の記述
- 計算条件、計算格子の読み込み処理の記述
- 時刻、計算結果の出力処理の記述
骨組みの作成¶
まずは、ソルバーの骨組みを作成します。 リスト 6 に示すソースコードを作成して、 sample.f90 という名前で保存します。この時点では、ソルバーは何もしていません。
このソースコードをコンパイルします。コンパイル方法は、コンパイラによって異なります。 Intel Fortran Compiler, gfortran でのコンパイル方法を Fortran 言語で iriclib, cgnslib とリンクしてビルドする方法 で解説していますので、参考にしてください。
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 |
コンパイルが成功したら、できた実行プログラムを フォルダの作成 で作成したフォルダにコピーし、 名前を 基本情報の作成 で executable 属性に指定した名前 (この例なら "solver.exe") に変更してください。 またこの時、ソルバーの実行に必要な DLLも同じフォルダにコピーしてください。
iRIC からソルバーが正しく起動できるか確認します。
"Example Solver" をソルバーに用いるプロジェクトを新しく開始し、 以下の操作を行って下さい。
メニュー: 計算(C) --> 実行(R)
ソルバーコンソールが起動され、 図 17 に示すように "Sample Program" という文字列が表示されれば、ソルバーを iRIC から正しく起動できています。
計算データファイルを開く処理、閉じる処理の記述¶
計算データファイルを開く処理、閉じる処理を記述します。
ソルバーは、処理開始時に計算データファイルを開き、終了時に計算データファイルを 閉じる必要があります。
iRIC は引数として計算データファイルのファイル名を渡すため、 そのファイルを開きます。
引数の数と引数を取得するための方法は、コンパイラによって異なります。 Intel Fortran Compiler, gfortran での引数の取得方法を Fortran プログラムでの引数の読み込み処理 で説明していますので、参考にしてください。 ここでは、Intel Fortran Compiler でコンパイルする場合の方法で記述します。
計算データファイルを開く処理と閉じる処理を追記したソースコードを リスト 7 に示します。強調して示したのが追記した部分です。
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 ! 計算データファイルを開く call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! オプションの設定 call iric_initoption_f(IRIC_OPTION_CANCEL, ier) if (ier /=0) STOP "*** Initialize option error***" ! 計算データファイルを閉じる call cg_close_f(fin, ier) stop end program SampleProgram |
骨組みの作成 と同様に、ファイルのコンパイルと、 実行プログラムの配置を行います。
骨組みの作成 と同様の手順で、iRIC からソルバーが正しく起動できるか 確認します。エラーメッセージが表示されずに終了すれば成功です。
この節で追加した関数の詳細については、 CGNS ファイルを開く, 内部変数の初期化, CGNSファイルを閉じる を参照してください。
計算条件、計算格子、境界条件の読み込み処理の記述¶
計算条件、計算格子、境界条件の読み込み処理を記述します。
iRIC は、 ソルバー定義ファイルの作成 で作成したソルバー定義ファイルに従って、 計算条件、格子、格子属性、境界条件を計算データファイルに出力しますので、 ソルバー定義ファイルでの記述に対応するように、計算条件、計算格子、境界条件の 読み込み処理を記述します。
計算条件、計算格子の読み込み処理を追記したソースコードを リスト 8 に示します。強調して示したのが追記した部分です。
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" ! (略) ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! オプションの設定 call iric_initoption_f(IRIC_OPTION_CANCEL, ier) if (ier /=0) STOP "*** Initialize option error***" ! 計算条件の読み込み 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) ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize,jsize), grid_y(isize,jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) ! 格子点で定義された属性 のメモリを確保 allocate(elevation(isize, jsize)) allocate(obstacle(isize - 1, jsize - 1)) ! 属性を読み込む call cg_iric_read_grid_real_node_f("Elevation", elevation, ier) call cg_iric_read_grid_integer_cell_f("Obstacle", obstacle, ier) ! 流入口の数に従って、境界条件を保持するメモリを確保。 allocate(inflow_element_count(inflow_count)) allocate(discharge_type(inflow_count), discharge_constant(inflow_count)) allocate(discharge_variable_size(inflow_count)) ! 流入口に指定された格子点の数と、時間依存の流入量のサイズを調べる inflow_element_max = 0 do inflowid = 1, inflow_count ! 流入口に指定された格子点の数 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 ! 流入口の時間依存の流入量のデータの数 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(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)) ! 境界条件の読み込み do inflowid = 1, inflow_count ! 流入口に指定された格子点 call cg_iric_read_bc_indices_f('inflow', inflowid, inflow_element(inflowid:inflowid,:,:), ier) ! 流入量の種類 (0 = 一定、1 = 時間依存) call cg_iric_read_bc_integer_f('inflow', inflowid, 'Type', discharge_type(inflowid:inflowid), ier) ! 流入量 (一定) call cg_iric_read_bc_real_f('inflow', inflowid, 'ConstantDischarge', discharge_constant(inflowid:inflowid), ier) ! 流入量 (時間依存) call cg_iric_read_bc_functional_f('inflow', inflowid, 'FunctionalDischarge', discharge_variable_time(inflowid:inflowid,:), discharge_variable_value(inflowid:inflowid,:), ier) end do ! 計算データファイルを閉じる call cg_close_f(fin, ier) stop end program SampleProgram |
計算条件などを読み込む関数に渡す引数が、 計算条件の定義, 格子属性の定義 でソルバー定義ファイルに定義した Item 要素の name 属性と一致していることに注目してください。
なお、ソルバー定義ファイルで定義する計算条件、格子、格子属性と、それを読み込むための iRIClib の関数の対応関係については、 計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 を参照してください。
また、計算条件、計算格子、境界条件の読み込みに使う関数の詳細については、 計算条件 (もしくは格子生成条件) の読み込み, 計算格子の読み込み, 境界条件の読み込み を参照してください。
時刻、計算結果の出力処理の記述¶
時刻、計算結果の出力処理を記述します。
時間依存の方程式を解くソルバーの場合、タイムステップの数だけ時刻、 計算結果の出力を繰り返します。
また、時刻、計算結果の出力のたびにユーザがソルバーの実行を中止していないか確認し、 中止していたら実行を中止します。
なお、ソルバーが出力する計算結果についてはソルバー定義ファイルには記述しませんので、 ソルバー定義ファイルとの対応関係を気にせず記述できます。
時刻、計算結果の出力処理を追記したソースコードを リスト 9 に示します。強調して示したのが追記した部分です。
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 | ! (略) 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 ! (略) ! 属性を読み込む 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 ! (ここで計算を実行。格子の形状も変化) 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) ! 格子を出力 call cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, 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_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 ! 計算データファイルを閉じる call cg_close_f(fin, ier) stop end program SampleProgram |
時刻、計算結果の出力に使う関数の詳細については、 時刻 (もしくはループ回数) の出力, 計算結果の出力 を参照してください。 計算実行中に格子形状が変化する場合、 計算格子の出力 (計算開始後の格子) で説明する関数を使用してください。
計算結果については、iRIC では特別な名前が定義されており、 特定の目的で使用される結果ではその名前を使用する必要があります。 特別な計算結果の名前については 計算結果 を参照してください。
ソルバー定義ファイルの辞書ファイルの作成¶
ソルバー定義ファイルで用いられている文字列のうち、 ダイアログ上などに表示される文字列を翻訳して表示するための 辞書ファイルを作成します。
まず、iRIC から、以下のメニューを起動します。 すると、ソルバー定義ファイルの辞書更新ウィザードが表示されます。 ダイアログの表示例を、 図 18 ~ 図 20 に示します。
メニュー: オプション(O) --> 辞書ファイルの作成・更新(C)
辞書ファイルは、ソルバー定義ファイルと同じフォルダに作成されます。 作成された辞書ファイルは、翻訳前の英語のみが含まれています。 辞書ファイルはテキストファイルですので、テキストエディタなどで開いて編集します。 辞書ファイルは、文字コードに UTF-8 を指定して保存してください。
辞書ファイルの編集例を、 リスト 10 、 リスト 11 に示します。 例に示したように、translation 要素の中に翻訳後の文字列を追記してください。
表 2?16 ソルバー定義ファイルの辞書ファイルの一部 (編集前)
1 2 3 4 | <message> <source>Basic Settings</source> <translation></translation> </message> |
1 2 3 4 | <message> <source>Basic Settings</source> <translation>基本設定</translation> </message> |
なお、辞書ファイルは、Qt に付属する Qt Linguist を利用して編集することもできます。Qt Linguist の画面表示例を 図 2?18 に示します。Qt Linguist は、以下の URL からダウンロードできる Qt に含まれています。
翻訳が完了したら、iRICを確認したい言語に切り替えてから iRIC を起動し直し、 正しく翻訳されて表示されるか確認します。翻訳完了後のプリプロセッサ、 計算条件設定ダイアログの表示例をそれぞれ 図 22, 図 23 に示します。
説明ファイルの作成¶
ソルバーの概要などについて説明するファイルを作成します。
README というファイル名のテキストファイルを、 フォルダの作成 で作成したフォルダの下に作成します。文字コードは UTF-8 にします。
説明ファイルは、以下の例のようなファイル名で言語ごとに用意します。 言語ごとの説明ファイルがない場合、 README が使用されます。
- 英語: README
- 日本語: README_ja_JP
"README_" 以降につく文字列は、辞書ファイルの "translation_*****.ts" の "*****" の部分と同じですので、日本語以外の説明ファイルを作る際のファイル名は、 辞書ファイルのファイル名を参考にして決めて下さい。
説明ファイルの内容は、iRIC 上で新規プロジェクトを作成する際のソルバー選択ダイアログで、 説明タブに表示されます。 ファイルを作成したら、iRIC 上で正しく表示されるか確認して下さい。 ダイアログの表示例を、 図 24 に示します。
ライセンス情報ファイルの作成¶
ソルバーの利用ライセンスについて説明するファイルを作成します。
LICENSE というファイル名のテキストファイルを、 フォルダの作成 で作成したフォルダの下に作成します。文字コードは UTF-8 にします。
ライセンス情報ファイルは、以下の例のようなファイル名で言語ごとに用意します。 言語ごとのライセンスファイルがない場合、 LICENSE が使用されます。
- 英語: LICENSE
- 日本語: LICENSE_ja_JP
"LICENSE_" 以降につく文字列は、辞書ファイルの "translation_*****.ts" の "*****" の部分と同じですので、 日本語以外の説明ファイルを作る際のファイル名は、 辞書ファイルのファイル名を参考にして決めて下さい。
ライセンス情報ファイルの内容は、iRIC 上で新規プロジェクトを作成する際の ソルバー選択ダイアログで、ライセンスタブに表示されます。 ファイルを作成したら、iRIC 上で正しく表示されるか確認して下さい。 ダイアログの表示例を、 図 25 に示します。
計算結果分析ソルバーの開発手順¶
概要¶
iRICでは、既存のCGNSファイルの計算結果を読み込み、分析(・加工)することができます。 分析結果は、新たな CGNS ファイルに書き出すことができます。 計算結果分析ソルバーの開発手順は、通常のソルバー開発手順と同様です ( ソルバーの開発手順 参照)。
ここでは、計算結果分析ソルバーをFORTRANで開発する例を説明します。
一つのソルバーで複数の CGNS ファイルを扱う場合、操作対象の CGNS ファイルを 指定するために、 ソルバーの開発手順 で使用した関数とは 別の関数を用います (サブルーチン一覧 参照) 。 複数 CGNS ファイル用の関数は、末尾が "_mul_f" で終わっており、 ファイルIDを第一引数とします。 また、計算結果読み込み用に既存のCGNSを開く際は、 cg_iric_init_f の代わりに cg_iric_initread_f を用いて初期化を行います。
複数のCGNSファイルを扱ったソースコードの例を リスト 12 に示します。
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 | ! (前略) ! ファイルオープン、初期化 call cg_open_f(cgnsfile, CG_MODE_MODIFY, fin1, ier) call cg_iric_init_f(fin1, ier) ! (略) ! 計算条件の読み込み等 call cg_iric_read_functionalsize_mul_f(fin1, 'func', param_func_size, ier) ! (略) !ファイルオープン、初期化(計算結果読み込み用) call cg_open_f(param_inputfile, CG_MODE_READ, fin2, ier) call cg_iric_initread_f(fin2, ier) ! (略) ! 計算結果の読み込み等 call cg_iric_read_sol_count_mul_f(fin2, solcount, ier) ! (略) ! 計算結果の分析等 ! (略) ! 分析結果等の出力 call cg_iric_write_sol_time_mul_f(fin1, t, ier) ! (略) ! ファイルのクローズ call cg_close_f(fin1, ier) call cg_close_f(fin2, ier) ! (後略) |
既存のCGNSの計算結果をもとに、「魚の生息しやすさ」を算出するソルバーのソースコードを リスト 13 に示します。
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 ! Intel Fortran 用の記述。 icount = nargs() if (icount.eq.2) then call getarg(1, cgnsfile, istatus) else write(*,*) "Input File not specified." stop end if ! CGNS ファイルのオープン call cg_open_f(cgnsfile, CG_MODE_MODIFY, fin1, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin1, ier) ! 計算条件を読み込む 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 ! 指定された CGNS ファイルから、格子を読み込む 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) ! 格子を読み込む 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) ! 読み込んだ格子を cgnsfile に出力する call cg_iric_writegridcoord2d_mul_f(fin1, isize, jsize, & grid_x, grid_y, ier) ! 計算結果を読み込んで加工するためのメモリを確保 allocate(target_result(isize, jsize), analysis_result(isize, jsize)) ! 計算結果を処理 call cg_iric_read_sol_count_mul_f(fin2, solcount, ier) do solid = 1, solcount ! 計算結果を読み込み 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 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 ! 処理済みの計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin1, ier) call cg_close_f(fin2, ier) stop end program SampleProgram2 |
格子生成プログラムの開発手順¶
概要¶
格子生成プログラムは、格子生成条件に基づいて、格子を生成するプログラムです。 作成したプログラムは、iRIC 上から格子生成アルゴリズムの1つとして 利用できるようになります。
iRIC 上で動作する格子生成プログラムを開発するには、表 4 に示すようなファイルを作成、配置する必要があります。
表 4 に示したファイルは iRIC インストール先の下の "gridcreators" フォルダの下に自分が開発する格子生成プログラム専用のフォルダを作成し、その下に配置します。
ファイル名 | 説明 |
---|---|
definition.xml | 格子生成プログラム定義ファイル。英語で記述する。 |
generator.exe (例) | 格子生成プログラムの実行モジュール。ファイル名は開発者が任意に選べる。 |
translation_ja_JP.ts など | 格子生成プログラム定義ファイルの辞書ファイル。 |
README | 格子生成プログラムの説明ファイル |
各ファイルの概要は以下の通りです。
definition.xml¶
格子生成プログラムに関する以下の情報を定義するファイルです。
- 基本情報
- 格子生成条件
iRIC は格子生成プログラム定義ファイルを読み込むことで、 格子生成条件を作成するためのインターフェースを提供し、 そのプログラム用の格子生成データファイルを生成します。 また、この格子生成プログラムが生成する格子に現在使っているソルバーが対応している時のみ、 この格子生成プログラムを使えるようにします。
格子生成プログラム定義ファイルは、すべて英語で記述します。
格子生成プログラム¶
格子を生成するプログラムです。iRICで作成した格子生成条件を読みこんで格子を生成し、 生成した格子を出力します。
格子生成条件、格子の入出力には、iRIC が生成する 格子生成データファイルを使用します。
FORTRAN, Python, C言語、C++言語のいずれかの言語で開発します。この章では、 FORTRAN で開発する例を説明します。
translation_ja_JP.ts など¶
格子生成プログラム定義ファイルで用いられている文字列のうち、 ダイアログ上に表示される文字列を翻訳して表示するための辞書ファイルです。 日本語 (translation_ja_JP.ts)、韓国語 (translation_ka_KR.ts) など言語ごとに別ファイルとして作成します。
フォルダの作成¶
iRIC のインストールフォルダ の下にある "gridcreators" フォルダの下に、開発するソルバーのための専用のフォルダを作成します。今回は、"example" というフォルダを作成します。
格子生成プログラム定義ファイルの作成¶
格子生成プログラム定義ファイルを作成します。
格子生成プログラム定義ファイルは、格子生成プログラムに関する 表 5 に示す情報を定義します。
項目 | 説明 | 必須 |
---|---|---|
基本情報 | 格子生成プログラムの名前、開発者、リリース日など | ○ |
格子生成条件 | 格子の生成に必要な格子生成条件 | ○ |
エラーコード | エラー発生時のコードとメッセージの対応表 |
定義ファイルは、マークアップ言語の一種であるXML言語で記述します。 XML言語の基礎については XML の基礎 を参照してください。
この節では、ソルバー定義ファイルを、表 5 に示した順で作成していきます。
基本情報の作成¶
ソルバーの基本情報を作成します。 リスト 14 に示すような ファイルを作り、 フォルダの作成 で作成した "example" フォルダ の下に "definition.xml" の名前で保存します。
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> |
この時点では、格子生成プログラム定義ファイルの構造は 図 27 に示すようになっています。
正しく定義ファイルが作成できているか確認します。
iRIC を起動します。 図 28 に示すダイアログが表示されますので、「新しいプロジェクト」ボタンを押します。 図 29 に示すダイアログが表示されますので、 "Nays2D" を選択して "OK" ボタンを押し、 新しいプロジェクトを開始します。
次に、メニューから以下の操作を行い、格子生成アルゴリズムの選択画面を表示します。
メニュー: 格子(C) --> 格子生成アルゴリズムの選択(S)
格子生成アルゴリズムの選択ダイアログの表示例を 図 30 に示します。 ここに、先ほど作成した定義ファイルで指定した "Sample Grid Creator" が表示されていることを確認します。確認できたら、キャンセルボタンを押します。
格子生成条件の定義¶
計算条件を定義します。計算条件は、ソルバー定義ファイルの CalculationCondition 要素で定義します。 基本情報の作成 で作成した格子生成プログラム定義ファイルに追記し、 リスト 15 に示すようなファイルにし、保存します。追記した部分を強調して示しました。
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> |
この時点では、格子生成プログラム定義ファイルの構造は 図 31 に示すようになっています。
正しく格子生成プログラム定義ファイルが作成できているか確認します。
iRIC を起動し、 基本情報の作成 と同じ手順で 格子生成アルゴリズム選択画面を表示します。 "Sample Grid Creator" を選択し、 "OK" ボタンを押します。
すると、 図 32 に示すダイアログが 表示されます。 リスト 15 で追記した内容に従って、 "Grid Size" というグループが追加されているのが分かります。 確認できたら、 "キャンセル" ボタンを押します。
グループを増やして、さらに格子生成条件を追加します。 "Grid Size" の Tab要素 のすぐ下に、 "Elevation Output" というグループを 追加して保存します。追記した定義ファイルの抜粋を、 リスト 16 に示します。 追記した部分を強調して示しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | (前略) </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> |
この時点では、定義ファイルの構造は 図 33 に示す通りです。
正しくソルバー定義ファイルが作成できているか確認します。 先ほどと同じ手順でダイアログを表示します。
"Elevation Output" というグループがリストに表示され、 このグループには2つの項目が表示されているのが分かります。 また、 "Value" は、 "Output" で "Enabled" を選択している時のみ有効です。 ダイアログの表示例を 図 34 に示します。
格子生成条件の定義についてまとめると、以下の通りです。
- 格子生成条件のグループは Tab 要素で、格子生成条件は Item 要素でそれぞれ指定します。
- Definition 要素以下の構造は、計算条件の種類 (例: 整数、実数、整数からの選択、関数型) によって異なります。格子生成条件の種類ごとの記述方法と、ダイアログ上での表示については 計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 を参照して下さい。
- 格子生成条件には、 Condition 要素で依存関係を定義できます。 Condition 要素では、 その格子生成条件が有効になる条件を指定します。 Condition 要素の定義方法の詳細は、 計算条件・境界条件・格子生成条件の有効になる条件の定義例 を参照して下さい。
- この例では、格子生成条件のダイアログを単純なリスト形式で作成しましたが、 グループボックスを使うなどしてダイアログのレイアウトをカスタマイズすることができます。 ダイアログのレイアウトのカスタマイズ方法については 計算条件・境界条件・格子生成条件のダイアログのレイアウト定義例 を参照して下さい。
エラーコードの定義¶
格子生成プログラムで発生するエラーのコードと、対応するメッセージを定義します。 エラーコードは、定義ファイルの ErrorCode 要素で定義します。 格子生成条件の定義 で作成した格子生成プログラム定義ファイル に追記し、 リスト 17 に示すような ファイルにし、保存します。追記した部分を強調して示しました。
1 2 3 4 5 6 7 8 | (前略) </Item> </Tab> </GridGeneratingCondition> <ErrorCodes> <ErrorCode value="1" caption="IMax * JMax must be smaller than 100,000." /> </ErrorCodes> </GridGeneratorDefinition> |
この時点では、定義ファイルの構造は 図 35 に示すようになっています。 なお、エラーコードの定義は必須ではありません。
エラーコードの定義が正しく行えているかの確認は、 格子生成プログラムを作成するまで行えません。 エラーコードの定義の確認については エラー処理の記述 で行います。
格子生成プログラムの作成¶
格子生成プログラムを作成します。この例では、格子生成プログラムは FORTRAN 言語で開発します。
iRIC と連携する格子生成プログラムを開発するには、 格子生成プログラム定義ファイルに従って iRIC が生成する格子生成データファイルを、 格子生成条件、格子の入出力に利用する必要があります。
iRIC が生成する格子生成データファイルは、CGNS ファイルという形式です。CGNS ファイルの入出力には、iRIClib というライブラリを使用します。
この節では、格子生成プログラム定義ファイルの作成 で作成した定義ファイルに従ってiRIC が生成する格子生成データファイルを読みこんで、 格子を生成するプログラムを開発する流れを説明します。
この格子生成プログラムで行われる入出力処理を 表 6 に示します。
処理の内容 |
---|
格子生成データファイルを開く |
内部変数の初期化 |
格子生成条件の読み込み |
格子の出力 |
格子生成データファイルを閉じる |
この節では、格子生成プログラムを以下の手順で作成します。
- 骨組みの作成
- 格子生成データファイルを開く処理、閉じる処理の記述
- 格子の出力処理の記述
- 格子生成条件の読み込み処理の記述
- エラー処理の記述
骨組みの作成¶
格子生成プログラムの骨組みを作成します。 リスト 18 に示すソースコードを作成して、 "sample.f90" という名前で保存します。この時点では、このプログラムは何もしていません。
このソースコードをコンパイルします。コンパイル方法は、コンパイラによって異なります。 gfortran, Intel Fortran Compiler でのコンパイル方法を Intel Fortran Compiler (Windows) で解説していますので、参考にしてください。
1 2 3 4 | program SampleProgram implicit none include 'cgnslib_f.h' end program SampleProgram |
コンパイルが成功することを確認してください。
格子生成データファイルを開く処理、閉じる処理の記述¶
格子生成データファイルを開く処理、閉じる処理を記述します。
格子計算プログラムは、処理開始時に 格子生成データファイルを開き、終了時に閉じる必要があります。iRIC は引数として格子生成データファイルのファイル名を渡すため、 そのファイル名を開きます。
引数の数と引数を取得するための方法は、コンパイラによって異なります。 Intel Fortran compiler, gfortran での引数の取得方法を Fortran プログラムでの引数の読み込み処理 で説明していますので、参考にしてください。 ここでは、Intel Fortran compiler でコンパイルする場合の方法で記述します。
処理を追記したソースコードを リスト 19 に示します。追記した部分を強調して示します。
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 ! 格子生成データファイルを開く call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! 内部変数の初期化。戻り値は 1 になるが問題ない。 call cg_iric_init_f(fin, ier) ! 格子生成データファイルを閉じる call cg_close_f(fin, ier) end program SampleProgram |
骨組みの作成 と同様に、ファイルのコンパイルを行います。 問題なくコンパイルが成功することを確認してください。
この節で追加した関数の詳細については、CGNS ファイルを開く, 内部変数の初期化, CGNSファイルを閉じる を参照してください。
格子の出力処理の記述¶
格子の出力処理を記述します。
まずは、iRIC との連携が正しく行えることを確認するため、 単純な格子を生成して出力する処理を記述します。
格子を出力する処理を追記したソースコードを リスト 20 に示します。追記した部分を強調して示します。
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 ! 格子生成データファイルを開く call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! 内部変数の初期化。戻り値は 1 になるが問題ない。 call cg_iric_init_f(fin, ier) imax = 10 jmax = 10 ! 格子生成用のメモリを確保 allocate(grid_x(imax,jmax), grid_y(imax,jmax) ! 格子を生成 do i = 1, imax do j = 1, jmax grid_x(i, j) = i grid_y(i, j) = j end do end do ! 格子を出力 cg_iric_writegridcoord2d_f(imax, jmax, grid_x, grid_y, ier) ! 格子生成データファイルを閉じる call cg_close_f(fin, ier) end program SampleProgram |
コンパイルしたら、できた実行プログラムを フォルダの作成 で作成したフォルダにコピーし、名前を 基本情報の作成 で executable 属性に指定した名前 (この例なら "generator.exe" ) に変更してください。またこの時、格子生成プログラムの実行に必要な DLLなども同じフォルダにコピーしてください。
この段階で、iRIC から格子生成プログラムが正しく起動できるか確認します。
ソルバーに "Nays2DH" を指定して、新しいプロジェクトを開始し、 基本情報の作成 で行ったのと同じ操作で 格子生成アルゴリズムに "Sample Grid Creator" を選択し、格子生成ダイアログを表示します。表示されるダイアログを 図 36 に示します。
"格子生成" ボタンを押します。すると、格子生成プログラムが 10 x 10 の 格子を生成し、それがiRIC 上に読み込まれるのが確認できます。 "格子生成" ボタンを押した後のプリプロセッサの表示画面を 図 37 に示します。
なお、この節で追加した格子出力用の関数の詳細については、 計算格子の出力 を参照してください。ただし、 計算格子の出力 では3次元格子の出力用関数についても 解説していますが、格子生成プログラムで利用できるのは、2次元格子の出力用関数だけです。
格子生成条件の読み込み処理の記述¶
格子生成条件の読み込み処理を記述します。
iRIC は、 格子生成プログラム定義ファイルの作成 で作成した 定義ファイルに従って格子生成条件を格子生成データファイルに出力しますので、 それに対応するように格子生成条件の読み込み処理を記述します。
格子生成条件の読み込み処理を追記したソースコードを リスト 21 に示します。追記した部分を太字で示します。格子生成条件を読み込む関数に 渡す引数が、 格子生成条件の定義 で定義ファイルに記述したItem 要素の name 属性と一致していることに 注目してください。
コンパイルしたら、 格子の出力処理の記述 の時と同様の手順で格子を生成し、指定した通りの格子生成条件で 格子が生成することを確認してください。
定義ファイルで定義する格子生成条件と、それを読み込むための iRIClib の関数の対応関係については、計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 を参照してください。格子生成条件の読み込みに使う関数の詳細については、 計算条件 (もしくは格子生成条件) の読み込み を参照してください。
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 ! 格子生成データファイルを開く call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! 内部変数の初期化。戻り値は 1 になるが問題ない。 call cg_iric_init_f(fin, ier) ! 格子生成条件の読み込み ! 簡潔に記述するため、エラー処理は行っていない 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(grid_x(imax,jmax), grid_y(imax,jmax) allocate(elevation(imax,jmax)) ! 格子を生成 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 ! 格子を出力 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 ! 格子生成データファイルを閉じる call cg_close_f(fin, ier) end program SampleProgram |
エラー処理の記述¶
格子生成条件に問題があった場合のエラー処理を記述します。
エラー処理を追記したソースコードを リスト 22 に示します。太字で示したのが追記した部分です。追記した部分により、格子の格子点数が 100000 を超えるような imax, jmax を指定した時は、エラーが発生するようにしました。
コンパイルしたら、 格子の出力処理の記述 の時と同様の手順で格子を生成し、imax x jmax が 100000より大きくなる条件の時には、 図 38 に示すようなダイアログが表示されることを確認してください。例えば、 IMax, JMax にそれぞれ 10000 を指定してみてください。
エラー処理に使う関数の詳細については エラーコードの出力 を参照してください。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ! (前略) ! 格子生成条件の読み込み ! 簡潔に記述するため、エラー処理は行っていない 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) ! エラー処理 if (imax * jmax > 100000 ) then ! 100000 より大きい格子は生成できない call cg_iric_write_errorcode(1, ier) cg_close_f(fin, ier) stop endif ! 格子生成用のメモリを確保 allocate(grid_x(imax,jmax), grid_y(imax,jmax) allocate(elevation(imax,jmax)) ! (後略) |
格子生成プログラム定義ファイルの辞書ファイルの作成¶
格子生成プログラム定義ファイルで用いられている文字列のうち、 ダイアログ上に表示される文字列を翻訳して表示するための 辞書ファイルを作成します。
まず、iRIC から、以下のメニューを起動します。 すると、格子生成プログラム定義ファイルの辞書更新ウィザードが表示されます。 ダイアログの表示例を、図 39 ~ 図 41 に示します。
メニュー: オプション(O) --> 辞書ファイルの作成・更新(C)
辞書ファイルは、格子生成プログラムソルバー定義ファイルと 同じフォルダに作成されます。 作成された辞書ファイルは、翻訳前の英語のみが含まれています。 辞書ファイルはテキストファイルですので、 テキストエディタなどで開いて編集します。辞書ファイルは、 UTF-8 で保存してください。
辞書ファイルの編集例を、 リスト 23、 リスト 24 に示します。例に示したように、translation 要素の中に翻訳後の文字列を追記してください。
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> |
なお、辞書ファイルは、Qt に付属する Qt Linguist を利用して編集することもできます。Qt Linguist の画面表示例を 図 42 に示します。Qt Linguist は、以下の URL からダウンロードできる Qt に含まれています。
翻訳が完了したら、iRICを確認したい言語に切り替えてから iRIC を起動し直し、正しく翻訳されて表示されるか確認します。 翻訳完了後の格子生成条件設定ダイアログの表示例を 図 43 に示します。
説明ファイルの作成¶
格子生成プログラムの概要について説明するファイルを作成します。
README というファイル名のテキストファイルを、 フォルダの作成 で作成したフォルダ の下に作成します。文字コードは UTF-8 にします。
なお、説明ファイルは、以下の例のようなファイル名で言語ごとに用意します。 言語ごとの説明ファイルがない場合、 README が使用されます。
- 英語: README
- 日本語: README_ja_JP
"README_" 以降につく文字列は、辞書ファイルの "translation_*****.ts" の "*****" の部分と同じですので、日本語以外の説明ファイルを作る際のファイル名は、 辞書ファイルのファイル名を参考にして決めて下さい。
説明ファイルの内容は、格子生成アルゴリズム選択ダイアログで、 説明欄に表示されます。ファイルを作成したら、 iRIC 上で正しく表示されるか確認して下さい。ダイアログの表示例を、 図 44 に示します。
定義ファイル (XML) について¶
概要¶
iRIC は、ソルバー定義ファイル、格子生成プログラム定義ファイルを 読み込むことで、そのソルバー、格子生成プログラムが必要な入力情報を 作成するためのインターフェースを提供します。
構造¶
ソルバー定義ファイル、格子生成プログラム定義ファイルの構造を示します。
ソルバー定義ファイル¶
計算格子を1つ利用するソルバーでのソルバー定義ファイルの構造を 図 45 に、 複数利用するソルバーでのソルバー定義ファイルの構造を 図 46 にそれぞれ示します。
複数の格子を利用するソルバーの場合、ソルバー定義ファイルでは GridType 要素を使って、それぞれの格子の構造、格子属性、境界条件を定義します。
複数の格子を利用するソルバーのソルバー定義ファイルの例を、 リスト 25 に示します。この例では、境界条件は省略されています。 以下の点が、1つの格子を利用する場合と異なっていることに注意して下さい。
- 格子の構造 (gridtype 属性) は、SolverDefinition 要素でなく、 GridType 要素で定義されている。
リスト 25 に示した ソルバー定義ファイルのソルバーを選択して iRIC で新しいプロジェクトを開始した場合、 図 47 に示すようなプリプロセッサが表示されます。
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> <!-- ここで、計算条件を定義。--> </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> |
定義例¶
計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例¶
ソルバー定義ファイルでの計算条件、格子生成プログラムでの格子生成条件の 項目の定義例を示します。定義する位置は 表 7 に示すように異なりますが、同じ文法で定義できます。各対象ファイルの構造は 構造 を参照してください。
項目 | 対象ファイル | 定義する位置 |
---|---|---|
計算条件 | ソルバー定義ファイル | CalculationCondition 要素の下 |
格子生成条件 | 格子生成プログラム定義ファイル | GridGeneratingCondition 要素の下 |
定義できる項目の種類を、 表 8 に示します。この節では、以下を示します。
- 定義例
- iRIC の計算条件編集ダイアログ上での表示例
- ソルバー (もしくは格子生成プログラム) で値を読み込むための処理の記述例
ソルバー (もしくは格子生成プログラム) で値を読み込むための 処理の記述例では、iRIClib の関数を使用しています。iRIClib の詳細は、 iRIClibについて を参照して下さい。
記述例は読み込みに関連する部分のみですので、プログラム全体の例は ソルバーの作成, 格子生成プログラムの作成 を参照してください。
種類 | 説明 | 定義方法 |
---|---|---|
文字列 | 文字列の値を入力。 | valueType に "string" を指定 |
ファイル名 (読み込み用) | 読み込み用のファイル名を入力。既に存在するファイルしか選択できない。 | valueType に "filename" を指定 |
ファイル名 (書き込み用) | 書き込み用のファイル名を入力。存在しないファイルの名前も指定できる。 | valueType に "filename_all" を指定 |
フォルダ名 | フォルダ名を入力。 | valueType に "foldername" を指定 |
整数 | 任意の整数値を入力。 | valueType に "integer" を指定 |
整数 (選択式) | あらかじめ用意した選択肢の中から整数値を選択。 | valueType に "integer" を指定し、Enumeration 要素で選択肢を定義 |
実数 | 任意の実数値を入力。 | valueType に "real" を指定 |
関数型 | (X, Y) の組を複数入力。 | valueType に "functional" を指定し、Parameter 要素、 Value 要素で変数と値を定義 |
関数型 (複数の値) | (X, Y1, Y2) の組を複数入力。 | valueType に "functional" を指定し、Parameter 要素を1つと Value 要素を2つ定義 |
CGNSファイル名 | 読み込み用のCGNSファイル名を入力。既に存在するファイルしか選択できない。 | valueType に "cgns_filename" を指定 |
CGNSファイル内の計算結果 | 計算結果の名前を選択 | valueType に "result_gridNodeReal" などを指定 |
文字列¶
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) |
ファイル名 (読み込み用)¶
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) |
ファイル名 (書き込み用)¶
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) |
フォルダ名¶
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) |
整数¶
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) |
整数 (選択式)¶
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) |
実数¶
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) |
関数型¶
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 ! サイズを調べる call cg_iric_read_functionalsize_f("discharge", discharge_size, ier) ! メモリを確保 allocate(discharge_time(discharge_size)) allocate(discharge_value(discharge_size)) ! 確保したメモリに値を読み込む 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 ! サイズを調べる call cg_iric_read_bc_functionalsize_f("inflow", 1, "discharge", discharge_size, ier) ! メモリを確保 allocate(discharge_time(discharge_size)) allocate(discharge_value(discharge_size)) ! 確保したメモリに値を読み込む call cg_iric_read_bc_functional_f("inflow", 1, "discharge", discharge_time, discharge_value, ier) |
関数型 (複数の値)¶
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 ! サイズを調べる call cg_iric_read_functionalsize_f("discharge", discharge_size, ier) ! メモリを確保 allocate(time_value(discharge_size)) allocate(discharge_value(discharge_size), elevation_value(discharge_size)) ! 確保したメモリに値を読み込む 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 ! サイズを調べる call cg_iric_read_bc_functionalsize_f("discharge", discharge_size, ier) ! メモリを確保 allocate(time_value(discharge_size)) allocate(discharge_value(discharge_size), elevation_value(discharge_size)) ! 確保したメモリに値を読み込む 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ファイル名 など¶
CGNSファイル名と、CGNSファイル内の計算結果は組み合わせて使用します。
CGNSファイル名の入力欄は、 valueType に cgns_filename を指定することで作成できます。
CGNSファイル内の計算結果は、 valueType に result_gridNodeReal などを指定し、 cgnsFile に CGNSファイル名の入力欄に指定した name を指定することで作成できます。
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) |
計算条件・境界条件・格子生成条件の有効になる条件の定義例¶
計算条件、格子生成条件、境界条件に関する有効になる条件の定義例を示します。 ここで示すように、type が "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> |
計算条件・境界条件・格子生成条件のダイアログのレイアウト定義例¶
単純なレイアウト¶
Item 要素 のみを使って定義した単純なレイアウトの例を リスト 56 に、 ダイアログでの表示例を 図 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> |
グループボックスを利用したレイアウト¶
グループボックスを利用したレイアウトの例を リスト 57 に、ダイアログでの表示例を 図 60 にそれぞれ示します。
GroupBox 要素に Item 要素を入れることで、グループに分けて項目を表示できます。
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> |
自由なレイアウト¶
GridLayout要素を利用することで、自由なレイアウトを実現した例を リスト 58 に、ダイアログでの表示例を 図 61 にそれぞれ示します。
GridLayout (表形式のレイアウト), HBoxLayout (水平に並べるレイアウト), VBoxLayout(垂直に並べるレイアウト) を使うことで、自由に要素を配置できます。 また、これらのレイアウトの中では Item では caption 属性は指定せず、 Label 要素でラベルを表示します。
GridLayout, HBoxLayout, VBoxLayout は入れ子にできます。 また、その中で GroupBox を利用することもできます。
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> |
要素のリファレンス¶
BoundaryCondition¶
境界条件の情報を保持します。
例¶
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¶
計算条件の情報を保持します。
例¶
1 2 3 4 5 6 7 8 9 10 11 12 | <CalculationCondition> <Tab name="basic" caption="Basic Setting"> (略) </Tab> <Tab name="time" caption="Calculation Time Setting"> (略) </Tab> </CalculationCondition> |
属性¶
定義できる属性はありません。
Condition¶
計算条件 (もしくは格子生成条件) での入力項目が有効になる場合の 条件の情報を保持します。
例¶
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> |
例は ????? も参照して下さい。
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
conditionType | 下の表を参照 | ○ | 条件の種類 |
target | 文字列 | △ | 比較対象の計算条件の名前。 conditionType が and, or, not の場合に指定する。 |
value | 文字列 | △ | 比較対象の値。 conditionType が and, or, not の場合に指定する。 |
値 | 意味 |
---|---|
isEqual | 等しい |
isGreaterEqual | 等しいか大きい |
isGreaterThan | 大きい |
isLessEqual | 等しいか小さい |
isLessThan | 小さい |
and | and |
or | or |
not | not |
Definition (計算条件・境界条件・格子生成条件の定義)¶
計算条件・境界条件・格子生成条件の定義情報を保持します。
例¶
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> |
例は 計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 も参照して下さい。
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
valueType | 下の表を参照 | ○ | 値の種類 |
default | 文字列 | デフォルト値 | |
noSort | true もしくは false | テーブルを Param の値でソートしたくない場合は true を指定 | |
cgnsFile | 文字列 | 参照先のCGNSファイルの名前 |
値 | 意味 |
---|---|
integer | 整数 |
real | 実数 |
string | 文字列 |
functional | 関数型 |
filename | ファイル名 |
filename_all | ファイル名。存在しないファイルも選択可能 |
cgns_filename | CGNSファイル名 |
foldername | フォルダ名 |
result_gridNodeInteger | 格子点で定義された整数の計算結果の選択 |
result_gridNodeReal | 格子点で定義された実数の計算結果の選択 |
result_gridCellInteger | 格子セルで定義された整数の計算結果の選択 |
result_gridCellReal | 格子セルで定義された実数の計算結果の選択 |
result_gridEdgeIInteger | I方向のエッジ定義された整数の計算結果の選択 |
result_gridEdgeIReal | I方向のエッジで定義された実数の計算結果の選択 |
result_gridEdgeJInteger | J方向のエッジ定義された整数の計算結果の選択 |
result_gridEdgeJReal | J方向のエッジで定義された実数の計算結果の選択 |
result_baseIterativeInteger | グローバルな整数の計算結果の選択 |
result_baseIterativeReal | グローバルな実数の計算結果の選択 |
Definition (格子属性の定義)¶
計算格子の属性の定義情報を保持します。
Dimension¶
計算格子属性の次元の定義情報を保持します。
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
name | 文字列 | ○ | 要素名 |
caption | 文字列 | ○ | 名前 (プリプロセッサ上に表示される) |
valueType | 下の表を参照 | ○ | 値の種類 |
値 | 意味 |
---|---|
integer | 整数 |
real | 実数 |
子要素¶
定義できる子要素はありません。
Enumeration¶
計算条件 (もしくは格子生成条件) の項目の選択肢の定義情報を保持します。
例¶
1 | <Enumeration value="0" caption="Standard" /> |
Enumeration を使って計算条件を定義した例は 整数 (選択式) を参照して下さい。
子要素¶
定義できる子要素はありません。
ErrorCodes¶
エラーコードのリストを保持します。
例¶
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> |
属性¶
定義できる属性はありません。
GridGeneratingCondition¶
格子生成条件の情報を保持します。
例¶
1 2 3 4 5 6 7 8 9 10 11 12 | <GridGeneratingCondition> <Tab name="basic" caption="Basic Setting"> (略) </Tab> <Tab name="time" caption="Calculation Time Setting"> (略) </Tab> </GridGeneratingCondition> |
属性¶
定義できる属性はありません。
GridGeneratorDefinition¶
格子生成プログラムの定義情報を保持します。
例¶
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"> (略) </Tab> </GridGeneratingCondition> </GridGeneratorDefinition> |
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
name | 文字列 | ○ | 格子生成プログラムの識別名 (英数字のみ) |
caption | 文字列 | ○ | 格子生成プログラムの名前 (任意の文字を利用可能) |
version | 文字列 | ○ | バージョン番号。\"1.0\", \"1.3.2\" などの型式で |
copyright | 文字列 | ○ | 著作権者の名前。基本的に英語で記述 |
release | 文字列 | ○ | リリース日。\"2010.01.01\" などの型式で |
homepage | 文字列 | ○ | 格子生成プログラム情報を示す Web ページの URL |
executable | 文字列 | ○ | 実行プログラムのファイル名 (例: GridGen.exe) |
gridtype | 下の表を参照 | ○ | 生成する格子の種類 |
値 | 意味 |
---|---|
structured2d | 2次元構造格子 |
unstructured2d | 2次元非構造格子 |
GridType¶
入力格子の定義情報を保持します。
GroupBox¶
計算条件 (もしくは格子生成条件) の入力ダイアログに表示するグループボックスの定義情報を保持します。
HBoxLayout¶
計算条件 (もしくは格子生成条件) の入力ダイアログに表示する水平に並べるレイアウトの定義情報を保持します。
例¶
1 2 3 4 5 6 7 8 9 10 11 12 | <HBoxLayout> <Item name="stime" caption="Start Time"> (略) </Item> <Item name="etime" caption="End Time"> (略) </Item> </HBoxLayout> |
属性¶
定義できる属性はありません。
Item¶
計算条件 (もしくは格子生成条件) の入力項目、計算格子の属性、境界条件の定義情報を保持します。
例¶
1 2 3 | <Item name="stime" caption="Start Time"> <Definition valueType="real" default="0" /> </Item> |
定義例は 計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 も参照して下さい。
Param¶
計算条件 (もしくは格子生成条件) の入力ダイアログに表示するラベルの定義情報を保持します。
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
caption | 文字列 | ○ | 表示する文字列 |
valueType | 下の表を参照 | ○ | データ型 |
axislog | true or false | 横軸を対数軸にするなら true |
子要素¶
定義できる子要素はありません。
SolverDefinition¶
ソルバーの定義情報を保持します。
例¶
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> (略) </CalculationCondition> <GridRelatedCondition> (略) </GridRelatedCondition> </SolverDefinition> |
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
name | 文字列 | ○ | ソルバーの識別名 (英数字のみ) |
caption | 文字列 | ○ | ソルバーの名前 (任意の文字を利用可能) |
version | 文字列 | ○ | バージョン番号。\"1.0\", \"1.3.2\" などの型式で |
copyright | 文字列 | ○ | 著作権者の名前。基本的に英語で記述 |
release | 文字列 | ○ | リリース日。\"2010.01.01\" などの型式で |
homepage | 文字列 | ○ | ソルバー情報を示す Web ページの URL |
executable | 文字列 | ○ | 実行プログラムのファイル名 (例: GridGen.exe) |
iterationtype | 下の表を参照 | ○ | 計算結果出力の単位 |
gridtype | 下の表を参照 | ○ | 生成する格子の種類 |
multiple | true or false | 複数の格子を生成できるなら true |
値 | 意味 |
---|---|
time | 時間ごとの結果を出力 |
iteration | イテレーションごとの結果を出力。 |
値 | 意味 |
---|---|
1d | 1次元格子 |
1.5d | 1.5次元格子 |
1.5d_withcrosssection | 横断データを持つ1.5次元格子 |
structured2d | 2次元構造格子 |
unstructured2d | 2次元非構造格子 |
ソルバーのバージョンアップを行う時は、 version 属性を変更します。 ソルバーのバージョンアップ時の注意点については、 ソルバーのバージョンアップ時の注意点 を参照して下さい。
Tab¶
計算条件 (もしくは格子生成条件) 設定ダイアログの、ページの定義情報を保持します。
Value¶
関数型の計算条件 (もしくは格子生成条件) 、格子属性、境界条件の値の定義情報を保持します。
属性¶
名前 | 値 | 必須 | 説明 |
---|---|---|---|
caption | 文字列 | ○ | 表示する文字列 |
valueType | 下の表を参照 | ○ | データ型 |
name | 文字列 | 識別名 (英数字のみ)。複数の値を持つ関数型条件の場合のみ指定する。 | |
axis | 下の表を参照 | 設定ダイアログでのY軸 | |
axislog | true or false | 縦軸を対数軸にするなら true | |
axisreverse | true or false | Y軸を上下逆転するなら true | |
span | true or false | 値を区間ごとに定義するなら true | |
step | true or false | グラフを棒グラフとして表示するなら true | |
hide | true or false | 設定ダイアログのグラフに表示しない場合は true |
値 | 意味 |
---|---|
integer | 整数 |
real | 実数 |
値 | 意味 |
---|---|
left | 左側のY軸を利用 |
right | 右側のY軸を利用 |
子要素¶
定義できる子要素はありません。
ソルバーのバージョンアップ時の注意点¶
ソルバーをバージョンアップする際は、ソルバーそのものを改変するとともに、ソルバー定義ファイルを更新する必要があります。 ソルバー定義ファイルを更新する際の注意点について、以下に示します。
- SolverDefinition 要素の name 属性は編集しないでください。 name 属性が異なると、iRIC は別のソルバーとみなし、過去のソルバー用に作成したプロジェクトファイルは 読み込めなくなります。
- SolverDefinition 要素の caption属性を変更してください。caption 属性は、ソルバーの名前とバージョンの情報を保持する任意の文字列ですので、例えば "Sample Solver 1.0"、"Sample Solver 3.2 Beta", "Sample Solver 3.0 RC1" など任意の形式でバージョンを記述できます。下で示す version 属性とは独立に設定できます。
- SolverDefinition 要素の version 属性を、 表 55 のポリシーに従って変更して下さい。
なお、バージョン番号は、例えば "3.1.4" などのように、 "." で区切られた番号から 構成されます。先頭から順に "メジャー番号"、 "マイナー番号"、 "修正番号" と呼びます。 修正番号は省略可能です。
更新する要素 | 更新する条件 | 例 |
---|---|---|
メジャー番号 | 入力する格子・計算条件が過去のものと全く互換性のなくなる、大きな変更を行った場合 | 2.1 --> 3.0 |
マイナー番号 | 入力する格子・計算条件に項目を追加したが、入力されなかった場合はデフォルト値で実行すれば問題ない変更を行った場合 | 2.1 --> 2.2 |
修正番号 | 入力する格子・計算条件には全く変更がなく、内部のアルゴリズムの変更やバグの修正のみを行った場合 | 2.1 --> 2.1.1 |
なお、バージョン番号が異なるプロジェクトファイルの互換性については、iRIC では以下のように扱われます。
- メジャー番号が異なるソルバーのプロジェクトファイルは、互換性がない。
- マイナー番号が異なるだけのソルバーのプロジェクトファイルは、より古いものであれば互換性がある。
- 修正番号が異なるだけのソルバーのプロジェクトファイルは、常に互換性がある。
ソルバーとプロジェクトファイルのバージョン番号と、互換性の例を 図 62 に示します。
バージョン番号の増やし方の基本方針は 表 55 で示したとおりですが、最終的には、プロジェクトファイルの互換性を考慮して ソルバー開発者の方がご判断ください。
また、同一のソルバーの異なるバージョンを、同じ環境に混在させたい場合は、 solvers フォルダの下に、異なる名前でフォルダを作成し、その中にそれぞれ異なる バージョンのソルバーを配置することができます。 フォルダの名前は、ソルバーの名前とは独立につけることができます。
XML の基礎¶
この節では、iRIC でソルバー定義ファイル、格子生成プログラム定義ファイルに 用いられているXMLという言語の基礎について説明します。
要素の書き方¶
要素の開始は、要素名を "<" と ">" で囲って記述します。
要素の終了は、要素名を "</" と ">" で囲って記述します。
Item 要素の記述例を リスト 82 に示します。
<Item>
</Item>
要素は、以下を持つことができます。
- 子要素
- 属性
要素は、同じ名前の子要素を複数持つことができます。 一方、属性は同じ名前の属性は1つしか持てません。 子要素 SubItem と、属性 name を持つ Item 要素の記述例を リスト 83 に示します。
<Item name="sample">
<SubItem>
</SubItem>
<SubItem>
</SubItem>
</Item>
また、子要素を持たない要素は "<要素名 />" という形式で記述できます。例えば、 リスト 84, リスト 85 の要素は、読み込まれると同じデータとして処理されます。
<Item name="sample">
</Item>
<Item name="sample" />
タブ、スペース、改行について¶
XML では、タブ、スペース、改行は無視されますので、XML を読みやすくするために自由に追加できます。ただし、 属性の値の中のスペースなどは無視されません。
リスト 86, リスト 87, リスト 88 の要素は、 読み込まれるとすべて同じデータとして処理されます。
<Item name="sample">
<SubItem>
</SubItem>
</Item>
<Item
name="sample"
>
<SubItem></SubItem>
</Item>
<Item name="sample"><SubItem></SubItem></Item>
iRIClibについて¶
iRIClib とは¶
iRIClib は、ソルバー、格子生成プログラムをiRICと連携させるためのライブラリです。
iRIC は、ソルバー、格子生成プログラムとの情報の入出力に使う計算データファイル、 格子生成データファイルに CGNS ファイルを利用しています。 CGNS ファイルの入出力関数群は cgnslib というライブラリとしてオープンソースで公開されています (CGNS ファイル、 CGNSライブラリに関する情報 参照)。 しかし、 cgnslib を直接利用して必要な入出力を記述すると、煩雑な処理を 記述する必要があります。
そこで、iRIC プロジェクトでは iRIC に対応するソルバーでよく利用する入出力処理を 簡便に記述するためのラッパー関数を提供するライブラリとして、iRIClib を用意しています。 単一の構造格子を用いて計算を行うソルバーと、格子生成プログラムの入出力処理は、 iRIClibで用意された関数を利用することで簡単に記述できます。
なお、複数の格子や非構造格子を使うソルバーなどで必要な関数は iRIClib では提供されません。そのようなソルバーでは、cgnslib で用意された関数を直接利用する必要があります。
この文書では、iRIClibを構成する関数群と利用例及びコンパイル方法について説明します。
利用可能な言語¶
iRIClib は、以下の言語から利用することができます。
- FORTRAN
- C/C++
- Python
マニュアルでは、FORTRAN から利用する場合の例を主に記載しています。
ここでは、FORTRAN, C/C++, Python から iRIClib を利用する方法の概要について 説明します。
なお、関数を呼び出す際の引数などは、言語によって異なります。言語ごとの関数の呼び出し方法については、 リファレンス の各関数の解説を参照してください。
FORTRAN¶
リスト 90 に示すように、ヘッダファイルを読み込んだ上で、 iRIClib の関数を呼び出します。
1 2 3 | include 'iriclib_f.h' call cg_iric_init_f(fid, ier) |
この章の読み方¶
概要 で、iRIC がソルバー、格子生成プログラムについて想定している入出力処理と、 その処理のために用意している関数についてを説明します。
まずは、概要 を読んで iRIClib の概要についてご理解ください。 概要を理解したら、関数の引数のリストなどの詳細な情報は リファレンス を参照してください。
概要¶
この節では、iRIClibの概要について説明します。
プログラムの処理とiRIClibの関数¶
ソルバー、格子生成プログラムで必要な入出力処理を 表 56 、 表 57 に示します。
処理内容 |
---|
CGNS ファイルを開く |
内部変数の初期化 |
オプションの設定 |
計算条件の読み込み |
計算格子の読み込み |
境界条件の読み込み |
地形データの読み込み (必要な場合のみ) |
計算格子の出力 (格子の生成、再分割を行う場合のみ) |
時刻 (もしくはループ回数) の出力 |
計算格子の出力 (移動格子の場合のみ) |
計算結果の出力 |
CGNSファイルを閉じる |
処理内容 |
---|
CGNS ファイルを開く |
内部変数の初期化 |
格子生成条件の読み込み |
エラーコードの出力 |
格子の出力 |
CGNSファイルを閉じる |
CGNS ファイルを開く¶
CGNSファイルを開き、読み込み、書き込みができる状態にします。この関数は cgnslib で定義された関数です。
関数 | 備考 |
---|---|
cg_open_f | CGNSファイルを開く。 |
内部変数の初期化¶
開いた CGNS ファイルを、 iRIClib から利用するための準備をします。 CGNS ファイルを開いた後、いずれかを必ず実行します。
書き込みを行う場合には CG_MODE_MODIFYモードでCGNSファイルを開き、 cg_iric_init_fにより初期化します。
読み込み専用の場合には、CG_MODE_READモードでCGNSファイルを開き、 cg_iric_initread_fにより初期化します。
関数 | 備考 |
---|---|
cg_iric_init_f | 指定したファイルを読み込み・書き込み用にiRIClibから利用するため、内部変数を初期化し、ファイルを初期化する |
cg_iric_initread_f | 指定したファイルを読み込み専用でiRIClibから利用するため、内部変数を初期化する |
オプションの設定¶
ソルバーのオプションの設定を行います。 現在指定できるオプションを、以下に示します。
- IRIC_OPTION_CANCEL: iric_check_cancel_f を利用してキャンセルを検知します。
関数 | 備考 |
---|---|
iric_initoption_f | ソルバーのオプションを設定する |
計算条件 (もしくは格子生成条件) の読み込み¶
CGNSファイルから、計算条件 (もしくは格子生成条件) を読み込みます。
関数 | 備考 |
---|---|
cg_iric_read_integer_f | 整数の条件を読み込む |
cg_iric_read_real_f | 倍精度実数の条件を読み込む |
cg_iric_read_realsingle_f | 単精度実数の条件を読み込む |
cg_iric_read_string_f | 文字列の条件を読み込む |
cg_iric_read_functionalsize_f | 関数型の条件のサイズを調べる |
cg_iric_read_functional_f | 倍精度実数の関数型の条件を読み込む |
cg_iric_read_functional_realsingle_f | 単精度実数の関数型の条件を読み込む |
cg_iric_read_functionalwithname_f | 値を複数持つ倍精度実数の関数型の条件を読み込む |
関数型以外の条件については、一つの関数で一つの条件を読み込むことができます。 整数の計算条件を読み込む処理の例を リスト 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 ! CGNS ファイルのオープン call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 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; ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample1 |
一方、関数型の計算条件では、cg_iric_read_functionalsize_f, cg_iric_read_functional_f の 二つの関数を利用する必要があります。関数型の計算条件を読み込む処理の例を リスト 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 ! discharge の時刻と値を保持する配列 ! CGNS ファイルのオープン call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! まず、関数型の入力条件のサイズを調べる call cg_iric_read_functionalsize_f('discharge', discharge_size, ier) ! メモリを確保 allocate(discharge_time(discharge_size), discharge_value(discharge_size)) ! 確保したメモリに値を読み込む call cg_iric_read_functional_f('discharge', discharge_time, discharge_value, ier) ! (出力) 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 ! allocate で確保したメモリを開放 deallocate(discharge_time, discharge_value) ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample2 |
計算条件 (もしくは 格子生成条件) の種類別の読み込み処理の記述例については、 計算条件・境界条件・格子生成条件の項目の定義と読み込み処理の例 を参照してください。
計算格子の読み込み¶
CGNSファイルから、計算格子を読み込みます。iRIClib では、構造格子の読み込みの関数のみ提供します。
関数 | 備考 |
---|---|
cg_iric_gotogridcoord2d_f | 2次元構造格子を読み込む準備をする |
cg_iric_getgridcoord2d_f | 2次元構造格子を読み込む |
cg_iric_gotogridcoord3d_f | 3次元構造格子を読み込む準備をする |
cg_iric_getgridcoord3d_f | 3次元構造格子を読み込む |
cg_iric_read_grid_integer_node_f | 格子点で定義された整数の属性を読み込む |
cg_iric_read_grid_real_node_f | 格子点で定義された倍精度実数の属性を読み込む |
cg_iric_read_grid_integer_cell_f | セルで定義された整数の属性を読み込む |
cg_iric_read_grid_real_cell_f | セルで定義された倍精度実数の属性を読み込む |
cg_iric_read_complex_count_f | 複合型の属性のグループの数を読み込む |
cg_iric_read_complex_integer_f | 複合型の属性の整数の条件を読み込む |
cg_iric_read_complex_real_f | 複合型の属性の倍精度実数の条件を読み込む |
cg_iric_read_complex_realsingle_f | 複合型の属性の単精度実数の条件を読み込む |
cg_iric_read_complex_string_f | 複合型の属性の文字列の条件を読み込む |
cg_iric_read_complex_functionalsize_f | 複合型の属性の関数型の条件のサイズを調べる |
cg_iric_read_complex_functional_f | 複合型の属性の倍精度実数の関数型の条件を読み込む |
cg_iric_read_complex_functionalwithname_f | 複合型の属性の単精度実数の関数型の条件を読み込む |
cg_iric_read_complex_functional_realsingle_f | 複合型の属性の値を複数持つ倍精度実数の関数型の条件を読み込む |
cg_iric_read_grid_complex_node_f | 格子点で定義された複合型の属性を読み込む |
cg_iric_read_grid_complex_cell_f | セルで定義された複合型の属性を読み込む |
cg_iric_read_grid_functionaltimesize_f | 次元「時刻」(Time) を持つ格子属性の、時刻の数を調べる |
cg_iric_read_grid_functionaltime_f | 次元「時刻」(Time)の値を読み込む |
cg_iric_read_grid_functionaldimensionsize_f | 次元の数を調べる |
cg_iric_read_grid_functionaldimension_integer_f | 整数の次元の値を読み込む |
cg_iric_read_grid_functionaldimension_real_f | 倍精度実数の次元の値を読み込む |
cg_iric_read_grid_functional_integer_node_f | 次元「時刻」を持つ、格子点で定義された整数の属性を読み込む |
cg_iric_read_grid_functional_real_node_f | 次元「時刻」を持つ、格子点で定義された倍精度実数の属性を読み込む |
cg_iric_read_grid_functional_integer_cell_f | 次元「時刻」を持つ、セルで定義された整数の属性を読み込む |
cg_iric_read_grid_functional_real_cell_f | 次元「時刻」を持つ、セルで定義された倍精度実数の属性を読み込む |
cg_iric_read_grid_integer_node_f など属性読み込み用の関数は、 2次元構造格子、3次元構造格子で共通で利用することができます。 2次元構造格子を読み込む処理の記述例を リスト 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 84 | 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 ! CGNS ファイルのオープン call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize,jsize), grid_y(isize,jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) if (ier /=0) STOP "*** No grid data ***" ! (出力) 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 ! 格子点で定義された属性 elevation のメモリを確保 allocate(elevation(isize, jsize)) ! 属性を読み込む 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 ! セルで定義された属性 obstacle のメモリを確保。セルの属性なのでサイズは (isize-1) * (jsize-1) allocate(obstacle(isize-1, jsize-1)) ! 属性を読み込む 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 ! Rain の時刻の数を読み込む call cg_iric_read_grid_functionaltimesize_f('Rain', rain_timesize); ! Rain の時刻を読み込むメモリを確保。 allocate(rain_time(rain_timesize)) ! セルで定義された属性 rain のメモリを確保。セルの属性なのでサイズは (isize-1) * (jsize-1) allocate(rain(isize-1, jsize-1)) ! 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 ! allocate で確保したメモリを開放 deallocate(grid_x, grid_y, elevation, obstacle, rain_time, rain) ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample3 |
3次元の格子の場合も同様の処理になります。
境界条件の読み込み¶
CGNSファイルから、境界条件を読み込みます。
関数 | 備考 |
---|---|
cg_iric_read_bc_count_f | 境界条件の数を取得する |
cg_iric_read_bc_indicessize_f | 境界条件の設定された要素 (格子点もしくはセル) の数を取得する |
cg_iric_read_bc_indices_f | 境界条件の設定された要素 (格子点もしくはセル) のインデックスの配列を取得する |
cg_iric_read_bc_integer_f | 整数型境界条件の値を取得する |
cg_iric_read_bc_real_f | 実数(倍精度)境界条件の値を取得する |
cg_iric_read_bc_realsingle_f | 実数(単精度)境界条件の値を取得する |
cg_iric_read_bc_string_f | 文字列型境界条件の値を取得する |
cg_iric_read_bc_functionalsize_f | 関数型境界条件のサイズを取得する |
cg_iric_read_bc_functional_f | 倍精度実数の関数型境界条件の値を取得する |
cg_iric_read_bc_functionalwithname_f | 単精度実数の関数型境界条件の値を取得する |
同じ種類の境界条件を、1つの格子に複数定義することができます。 例えば、流入口を一つの格子に複数定義し、流入量をそれぞれ独立に与えることができます。
境界条件を読み込む処理の記述例を リスト 96 に示します。 この例では、流入口 (Inflow) の数を cg_iric_read_bc_count_f で調べ、 必要なメモリを確保してから境界条件の設定情報を読み込んでいます。 なお、GUIで指定した境界条件の名前は cg_iric_read_bc_string_f で読み込めます。
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; ! CGNS ファイルのオープン call cg_open_f('bctest.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 流入口の数を取得する call cg_iric_read_bc_count_f('inflow', condcount) ! 流入口の数に従って、パラメータの保存用のメモリを確保する。 allocate(condindexlen(condcount), intparam(condcount), realparam(condcount)) allocate(stringparam(condcount), func_size(condcount)) print *, 'condcount ', condcount ! 境界条件が設定された格子点の数と、関数型の境界条件の最大サイズを調べる 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 ! 格子点のインデックス格納用の配列と、関数型境界条件の格納用変数のメモリを確保 allocate(condindices(condcount, 2, indexlenmax)) allocate(func_param(condcount, funcsizemax), func_value(condcount, funcsizemax)) ! インデックスと、境界条件 を読み込み 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 ! 読み込まれた境界条件を表示 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample8 |
地形データの読み込み¶
プロジェクトでインポートして格子生成に利用した地形データを読み込みます。 ソルバーで、河川測量データやポリゴンを直接読み込んで解析に使用したい場合に行います。 地形データを読み込む場合の手順は、以下の通りになります。
- CGNS ファイルから、プロジェクトで使用した地形データのファイル名などを読み込みます。
- 地形データファイルを開き、地形データを読み込みます。
関数 | 備考 |
---|---|
cg_iric_read_geo_count_f | 地形データの数を返す |
cg_iric_read_geo_filename_f | 地形データのファイル名と種類を返す |
iric_geo_polygon_open_f | ポリゴンファイルを開く |
iric_geo_polygon_read_integervalue_f | ポリゴンの値を整数で返す |
iric_geo_polygon_read_realvalue_f | ポリゴンの値を実数で返す |
iric_geo_polygon_read_pointcount_f | ポリゴンの頂点の数を返す |
iric_geo_polygon_read_points_f | ポリゴンの頂点の座標を返す |
iric_geo_polygon_read_holecount_f | ポリゴンに開いた穴の数を返す |
iric_geo_polygon_read_holepointcount_f | ポリゴンの穴の頂点の数を返す |
iric_geo_polygon_read_holepoints_f | ポリゴンの穴の頂点の座標を返す |
iric_geo_polygon_close_f | ポリゴンファイルを閉じる |
iric_geo_riversurvey_open_f | 河川測量データを開く |
iric_geo_riversurvey_read_count_f | 河川横断線の数を返す |
iric_geo_riversurvey_read_position_f | 横断線の中心点の座標を返す |
iric_geo_riversurvey_read_direction_f | 横断線の向きを返す |
iric_geo_riversurvey_read_name_f | 横断線の名前を文字列として返す |
iric_geo_riversurvey_read_realname_f | 横断線の名前を実数値として返す |
iric_geo_riversurvey_read_leftshift_f | 横断線の標高データのシフト量を返す |
iric_geo_riversurvey_read_altitudecount_f | 横断線の標高データの数を返す |
iric_geo_riversurvey_read_altitudes_f | 横断線の標高データを返す |
iric_geo_riversurvey_read_fixedpointl_f | 横断線の左岸延長線のデータを返す |
iric_geo_riversurvey_read_fixedpointr_f | 横断線の右岸延長線のデータを返す |
iric_geo_riversurvey_read_watersurfaceelevation_f | 横断線での水面標高のデータを返す |
iric_geo_riversurvey_close_f | 河川測量データを閉じる |
地形データのうち、ポリゴンを読み込む処理の記述例を リスト 97 に、 河川測量データを読み込む処理の記述例を リスト 98 にそれぞれ示します。
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 ! 計算データファイルを開く call cg_open_f("test.cgn", CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! iRIClib の初期化 call cg_iric_init_f(fin, ier) ! 地形データの数を取得 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 ! 計算データファイルを閉じる 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 ! 計算データファイルを開く call cg_open_f("test.cgn", CG_MODE_MODIFY, fin, ier) if (ier /=0) stop "*** Open error of CGNS file ***" ! iRIClib の初期化 call cg_iric_init_f(fin, ier) ! 地形データの数を取得 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 ! 計算データファイルを閉じる call cg_close_f(fin, ier) stop end program TestRiverSurvey |
計算格子の出力¶
CGNSファイルに、計算格子を出力します。
ソルバーでは、ソルバーで計算に用いる格子を生成する場合や、 2次元格子から3次元格子を生成する場合に行います。
格子生成プログラムでは必ず行います。
ここで示す関数は、ソルバーでは計算開始時の格子を出力するために使用します。 計算中に格子形状が変化する場合の格子の出力には、計算格子の出力 (計算開始後の格子) に示す関数を使用して下さい。
関数 | 備考 |
---|---|
cg_iric_writegridcoord1d_f | 1次元構造格子を出力する |
cg_iric_writegridcoord2d_f | 2次元構造格子を出力する |
cg_iric_writegridcoord3d_f | 3次元構造格子を出力する |
cg_iric_write_grid_real_node_f | 格子点で定義された整数の属性を出力する |
cg_iric_write_grid_integer_node_f | 格子点で定義された倍精度実数の属性を出力する |
cg_iric_write_grid_real_cell_f | セルで定義された整数の属性を出力する |
cg_iric_write_grid_integer_cell_f | セルで定義された倍精度実数の属性を出力する |
2次元格子を読み込み、それを分割して生成した3次元格子を 出力する処理の記述例を リスト 99 に示します。
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 ! CGNS ファイルのオープン call cg_open_f('test3d.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize,jsize), grid_y(isize,jsize), elevation(isize,jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) call cg_iric_read_grid_real_node_f('Elevation', elevation, ier) ! 読み込んだ2次元格子を元に、3次元格子を生成。 ! 3次元格子は Z方向に、深さ 5 で、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 ! 生成した3次元格子を出力 call cg_iric_writegridcoord3d_f(isize, jsize, ksize, grid3d_x, grid3d_y, grid3d_z, ier) ! 初期状態の情報を出力 time = 0 convergence = 0.1 call cg_iric_write_sol_time_f(time, ier) ! 格子を出力 call cg_iric_write_sol_gridcoord3d_f(grid3d_x, grid3d_y, grid3d_z, ier) ! 計算結果を出力 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 ! (ここで計算を実行。格子の形状も変化) call cg_iric_write_sol_time_f(time, ier) ! 格子を出力 call cg_iric_write_sol_gridcoord3d_f(grid3d_x, grid3d_y, grid3d_z, ier) ! 計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample7 |
時刻 (もしくはループ回数) の出力¶
CGNSファイルに、時刻もしくはループ回数を出力します。
その時刻での計算格子の出力や計算結果の出力を行うより前に、必ず実行してください。
また、時刻とループ回数を両方出力することはできません。必ずいずれかのみ出力してください。
関数 | 備考 |
---|---|
cg_iric_write_sol_time_f | 時刻を出力する |
cg_iric_write_sol_iteration_f | ループ回数を出力する |
時刻を出力する処理の例を リスト 100 に示します。
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 ! CGNS ファイルのオープン call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 初期状態の情報を出力 time = 0 call cg_iric_write_sol_time_f(time, ier) ! (ここで、初期の計算格子や計算結果を出力) do time = time + 10.0 ! (ここで計算を実行) call cg_iric_write_sol_time_f(time, ier) ! (ここで、計算格子や計算結果を出力) If (time > 1000) exit end do ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample4 |
計算格子の出力 (計算開始後の格子)¶
CGNSファイルに、計算開始後の計算格子を出力します。計算中に格子形状が 変化するソルバーでのみ行います。
特定の時間での計算格子を出力する前に、必ず 時刻 (もしくはループ回数) の出力 で示した時刻 (もしくはループ回数) の出力を行ってください。
以下に示す場合の格子の出力については、計算格子の出力 で示した関数を利用してください。
- ソルバーで新たに格子を生成した
- ソルバーで格子を再分割するなどして、次元や格子点数が異なる格子を生成した
- 格子生成プログラム内で格子を生成した
関数 | 備考 |
---|---|
cg_iric_write_sol_gridcoord2d_f | 2次元構造格子を出力する |
cg_iric_write_sol_gridcoord3d_f | 3次元構造格子を出力する |
2次元構造格子を出力する処理の例を リスト 101 に示します。
表 6 11 2次元構造格子を出力する処理の記述例
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 ! CGNS ファイルのオープン call cg_open_f('test.cgn', CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize,jsize), grid_y(isize,jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) ! 初期状態の情報を出力 time = 0 call cg_iric_write_sol_time_f(time, ier) ! 格子を出力 call cg_iric_write_sol_gridcoord2d_f (grid_x, grid_y, ier) do time = time + 10.0 ! (ここで計算を実行) 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program Sample5 |
計算結果の出力¶
CGNSファイルに、計算結果を出力します。
iRIClib で出力できる計算結果は、大きく以下に分類されます。
- 1つのタイムステップで1つ値を持つ計算結果
- 格子点ごとに値を持つ計算結果
- 格子セルごとに値を持つ計算結果
- 格子辺ごとに値を持つ計算結果
- 粒子の座標ごとに値を持つ計算結果
- 粒子の座標ごとに値を持つ計算結果 (複数グループ可)
- ポリゴンもしくは折れ線ごとに値を持つ計算結果
どの種類の計算結果を出力する場合も、 表 68 と 表 69 に示す関数は必ず使用します。
計算結果の分類ごとの固有の関数は、 1つのタイムステップで1つ値を持つ計算結果 ~ ポリゴンもしくは折れ線ごとに値を持つ計算結果 をそれぞれ参照してください。
関数 | 備考 |
---|---|
iric_check_cancel_f | ユーザがソルバーの実行をキャンセルしたか確認する |
iric_check_lock_f | CGNSファイルが GUI によってロックされているか確認する |
iric_write_sol_start_f | 計算結果の出力開始をGUIに通知する |
iric_write_sol_end_f | 計算結果の出力終了をGUIに通知する |
cg_iric_flush_f | 計算結果の出力をファイルに書き込む |
関数 | 備考 |
---|---|
cg_iric_write_sol_time_f | 時刻を出力する |
cg_iric_write_sol_iteration_f | ループ回数を出力する |
注釈
ベクトル量とスカラー量
iRIClib では、ベクトル量の計算結果とスカラー量の計算結果は、 同じ関数を使って出力を行います。
ベクトル量の計算結果を出力する場合は、 "VelocityX", "VelocityY" などの名前で各成分を出力してください。
スカラー量の計算結果の出力で、名前の最後に "X", "Y", "Z" を使った場合、 GUI で正しく読み込まれず可視化できませんのでご注意下さい。 小文字の "x", "y", "z" は問題なく使用できます。
注釈
計算結果で使用する特別な名前
計算結果について、iRIC では特別な名前が定義されており、 特定の目的で使用される結果ではその名前を使用する必要があります。 特別な計算結果の名前については 計算結果 を参照してください。
注釈
格子点・格子セル・格子エッジ
格子に関係する計算結果は、格子点で出力する方法、格子セルで出力する 方法、格子エッジで出力する方法があります。
基本的には、ソルバにおいて変数がどこで定義されているかによって、どの方法で 計算結果を出力するかを選択してください。
ただし、ベクトル量については格子点で出力してください。格子セル・格子エッジで ベクトル量を出力しても、矢印、流線、パーティクルの描画はできません。
1つのタイムステップで1つ値を持つ計算結果¶
1つのタイムステップで1つ値を持つ計算結果を出力する場合、 表 70 に示す関数を 使用します。
出力するプログラムの例は、リスト 102 を参照してください。
関数 | 備考 |
---|---|
cg_iric_write_sol_baseiterative_integer_f | 整数の計算結果を出力する |
cg_iric_write_sol_baseiterative_real_f | 倍精度実数の計算結果を出力する |
cg_iric_write_sol_baseiterative_string_f | 文字列の計算結果を出力する |
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 | 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' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize,jsize), grid_y(isize,jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier) ! 初期状態の情報を出力 time = 0 convergence = 0.1 call cg_iric_write_sol_time_f(time, ier) call cg_iric_write_sol_baseiterative_real_f('Convergence', convergence, ier) do time = time + 10.0 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
格子点ごとに値を持つ計算結果¶
格子点ごとに値を持つ計算結果を出力する場合、 表 71 に示す関数を 使用します。
出力するプログラムの例は、リスト 103 を参照してください。
関数 | 備考 |
---|---|
cg_iric_write_sol_integer_f | 整数の格子点ごとに値を持つ計算結果を出力する |
cg_iric_write_sol_real_f | 倍精度実数の格子点ごとに値を持つ計算結果を出力する |
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 | 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' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize, jsize), grid_y(isize, jsize)) ! 計算結果を保持するメモリも確保 allocate(velocity_x(isize, jsize), velocity_y(isize, jsize), depth(isize, jsize), wetflag(isize, jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier) ! 初期状態の情報を出力 time = 0 convergence = 0.1 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 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
格子セルごとに値を持つ計算結果¶
格子セルごとに値を持つ計算結果を出力する場合、 表 72 に示す関数を 使用します。
出力するプログラムの例は、リスト 104 を参照してください。
関数 | 備考 |
---|---|
cg_iric_write_sol_cell_integer_f | 整数の格子セルごとに値を持つ計算結果を出力する |
cg_iric_write_sol_real_f | 倍精度実数の格子セルごとに値を持つ計算結果を出力する |
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:: depth integer, dimension(:,:), allocatable:: wetflag character(len=20):: condFile condFile = 'test.cgn' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize, jsize), grid_y(isize, jsize)) ! 計算結果を保持するメモリも確保 allocate(depth(isize - 1, jsize - 1), wetflag(isize - 1, jsize - 1)) ! 格子を読み込む call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier) ! 初期状態の情報を出力 time = 0 convergence = 0.1 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) do time = time + 10.0 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
格子エッジごとに値を持つ計算結果¶
格子エッジごとに値を持つ計算結果を出力する場合、 表 73 に示す関数を 使用します。
出力するプログラムの例は、リスト 105 を参照してください。
関数 | 備考 |
---|---|
cg_iric_write_sol_iface_integer_f | 整数のI方向の格子エッジごとに値を持つ計算結果を出力する |
cg_iric_write_sol_iface_real_f | 倍精度実数のI方向の格子エッジごとに値を持つ計算結果を出力する |
cg_iric_write_sol_jface_integer_f | 整数のJ方向の格子エッジごとに値を持つ計算結果を出力する |
cg_iric_write_sol_jface_real_f | 倍精度実数のJ方向の格子エッジごとに値を持つ計算結果を出力する |
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 | 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' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize, jsize), grid_y(isize, jsize)) ! 計算結果を保持するメモリも確保 allocate(fluxi(isize, jsize - 1), fluxj(isize - 1, jsize)) ! 格子を読み込む call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier) ! 初期状態の情報を出力 time = 0 convergence = 0.1 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) do time = time + 10.0 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
粒子の座標ごとに値を持つ計算結果¶
粒子の座標ごとに値を持つ計算結果を出力する場合、 表 74 に示す関数を 使用します。
出力するプログラムの例は、リスト 106 を参照してください。
注釈
ここで示す関数群は現在は非推奨です
粒子の座標ごとに値を持つ計算結果を出力する場合は、 粒子の座標ごとに値を持つ計算結果 (複数グループ可) に示す関数を使用する ことをおすすめします。そちらに示した関数を使用すれば、複数のグループの 粒子を出力でき、グループごとに色の設定や粒子のサイズを変えて可視化することができます。
関数 | 備考 |
---|---|
cg_iric_write_sol_particle_pos2d_f | 粒子の位置を出力する (2次元) |
cg_iric_write_sol_particle_pos3d_f | 粒子の位置を出力する (3次元) |
cg_iric_write_sol_particle_integer_f | 整数の粒子ごとに値を持つ計算結果を出力する |
cg_iric_write_sol_particle_real_f | 倍精度実数の粒子ごとに値を持つ計算結果を出力する |
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' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize, jsize), grid_y(isize, jsize)) ! 計算結果を保持するメモリを確保 allocate(particle_x(numparticles), particle_y(numparticles)) allocate(velocity_x(numparticles), velocity_y(numparticles), temperature(numparticles)) ! 格子を読み込む call cg_iric_getgridcoord2d_f (grid_x, grid_y, ier) ! 初期状態の情報を出力 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 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
粒子の座標ごとに値を持つ計算結果 (複数グループ可)¶
粒子の座標ごとに値を持つ計算結果を出力する場合、 表 75 に示す関数を 使用します。
ここで示す関数を使うと、複数のグループの粒子を出力することができます。 各グループの出力の最初と最後で、 cg_iric_write_sol_particlegroup_groupbegin_f と cg_iric_write_sol_particlegroup_groupend_f を呼び出してください。
出力するプログラムの例は、リスト 107 を参照してください。
注釈
粒子の座標ごとに値を持つ計算結果 で示した関数とは異なり、 ここで示す関数では、一度の関数呼び出しでは粒子一つ分のデータを出力します。
関数 | 備考 |
---|---|
cg_iric_write_sol_particlegroup_groupbegin_f | 粒子の計算結果の出力を開始する |
cg_iric_write_sol_particlegroup_groupend_f | 粒子の計算結果の出力を終了する |
cg_iric_write_sol_particlegroup_pos2d_f | 粒子の位置を出力する (2次元) |
cg_iric_write_sol_particlegroup_pos3d_f | 粒子の位置を出力する (3次元) |
cg_iric_write_sol_particlegroup_integer_f | 整数の粒子ごとに値を持つ計算結果を出力する |
cg_iric_write_sol_particlegroup_real_f | 倍精度実数の粒子ごとに値を持つ計算結果を出力する |
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' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize, jsize), grid_y(isize, jsize)) ! 計算結果を保持するメモリを確保。 allocate(particle_x(numparticles), particle_y(numparticles)) allocate(velocity_x(numparticles), velocity_y(numparticles), temperature(numparticles)) ! 格子を読み込む call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) ! 初期状態の情報を出力 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 ! (ここで particle_x, particle_x, velocity_x, velocity_y, temperature に適切な値を設定) 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 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! (ここで particle_x, particle_x, velocity_x, velocity_y, temperature に適切な値を設定) 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
ポリゴンもしくは折れ線ごとに値を持つ計算結果¶
ポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する場合、 表 76 に示す関数を 使用します。
ポリゴンもしくは折れ線では、複数のグループを出力することができます。 各グループの出力の最初と最後で、 cg_iric_write_sol_polydata_groupbegin_f と cg_iric_write_sol_polydata_groupend_f を呼び出してください。
出力するプログラムの例は、リスト 108 を参照してください。
注釈
粒子の座標ごとに値を持つ計算結果を出力する関数では、 一度の関数の呼び出して全ての粒子の座標や値を出力しますが、 ポリゴンもしくは折れ線ごとに値を持つ計算結果では、一度の関数呼び出しでは ポリゴンもしくは折れ線一つ分のデータを出力します。
注釈
ポリゴンもしくは折れ線ごとに値を持つ計算結果は、2次元にのみ対応しています。
注釈
一つのグループの中にポリゴンと折れ線を混在させることもできます。
注釈
ポリゴンもしくは折れ線では、計算結果の値はスカラー量にのみ対応しています。
関数 | 備考 |
---|---|
cg_iric_write_sol_polydata_groupbegin_f | ポリゴンもしくは折れ線で定義された計算結果の出力を開始する |
cg_iric_write_sol_polydata_groupend_f | ポリゴンもしくは折れ線で定義された計算結果の出力を終了する |
cg_iric_write_sol_polydata_polygon_f | 計算結果としてポリゴンの形状を出力する |
cg_iric_write_sol_polydata_polyline_f | 計算結果として折れ線の形状を出力する |
cg_iric_write_sol_polydata_integer_f | 整数のポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する |
cg_iric_write_sol_polydata_real_f | 倍精度実数のポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する |
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 | 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' ! CGNS ファイルのオープン call cg_open_f(condFile, CG_MODE_MODIFY, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_init_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 格子を読み込むためのメモリを確保 allocate(grid_x(isize, jsize), grid_y(isize, jsize)) ! 計算結果を保持するメモリを確保。一つのポリゴンの点数は5点 allocate(polydata_x(numpoints), polydata_y(numpoints)) ! 格子を読み込む call cg_iric_getgridcoord2d_f(grid_x, grid_y, ier) ! 初期状態の情報を出力 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 ! (ここで 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 ! (ここで計算を実行) call iric_check_cancel_f(canceled) if (canceled == 1) exit ! 計算結果を出力 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 ! (ここで 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleProgram |
既存の計算結果の読み込み¶
既存のCGNSファイルに格納されている計算結果を読み込みます。
関数 | 備考 |
---|---|
cg_iric_read_sol_count_f | 計算結果の数を取得する |
cg_iric_read_sol_time_f | 計算結果の時刻の値を取得する |
cg_iric_read_sol_iteration_f | 計算結果のループ回数の値を取得する |
cg_iric_read_sol_baseiterative_integer_f | 整数の計算結果の値を取得する |
cg_iric_read_sol_baseiterative_real_f | 倍精度実数の計算結果の値を取得する |
cg_iric_read_sol_gridcoord2d_f | 計算結果の2次元構造格子を取得する |
cg_iric_read_sol_gridcoord3d_f | 計算結果の3次元構造格子を取得する |
cg_iric_read_sol_integer_f | 整数の格子点ごとに値を持つ計算結果の値を取得する |
cg_iric_read_sol_real_f | 倍精度実数の格子点ごとに値を持つ計算結果の値を取得する |
cg_iric_read_sol_cell_integer_f | 整数の格子セルごとに値を持つ計算結果の値を取得する |
cg_iric_read_sol_cell_real_f | 倍精度実数の格子セルごとに値を持つ計算結果の値を取得する |
既存のCGNSファイルを読み込み、格納されている計算結果を標準出力に 出力する処理の例を リスト 109 に示します。
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 ! CGNS ファイルのオープン call cg_open_f('test.cgn', CG_MODE_READ, fin, ier) if (ier /=0) STOP "*** Open error of CGNS file ***" ! 内部変数の初期化 call cg_iric_initread_f(fin, ier) if (ier /=0) STOP "*** Initialize error of CGNS file ***" ! 格子のサイズを調べる call cg_iric_gotogridcoord2d_f(isize, jsize, ier) ! 計算結果を読み込むためのメモリを確保 allocate(grid_x(isize,jsize), grid_y(isize,jsize)) allocate(result_real(isize, jsize)) ! 計算結果を読み込み出力 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 ! CGNS ファイルのクローズ call cg_close_f(fin, ier) stop end program SampleX |
なお、計算結果読み込みの関数を用いて、既存のCGNSファイルの計算結果を 分析・加工することができます(計算結果分析ソルバーの開発手順 参照)。
リファレンス¶
リファレンスでは、各関数の機能、呼び出す際の形式、引数について解説します。
リファレンスの各関数のページでは、引数の型は FORTRAN の場合について解説しています。 C/C++, Python から呼び出す際の引数の型については、表 80 を参照して 読み替えてください。
Python では、エラーコードを格納する ier は出力されず、エラーが発生した場合は 例外が発生します。エラー処理を行う場合は、try, except を利用してください。
FORTRAN | C/C++ | Python |
---|---|---|
integer | int (出力の場合 int*) | int |
double precision | double (出力の場合 double*) | float |
real | float (出力の場合 float*) | (なし) |
character(*) | char* | str |
integer, dimension(:), allocatable | int* | numpy.ndarray(dtype=int32) |
double precision, dimension(:), allocatable | double* | numpy.ndarray(dtype=float64) |
real, dimension(:), allocatable | float* | (なし) |
サブルーチン一覧¶
サブルーチンとその分類の一覧を 表 81 に示します。
分類 | 名前 | 機能 | 複数版 |
---|---|---|---|
CGNSファイルを開く | cg_open_f | CGNS ファイルを開く | × |
内部変数の初期化 | cg_iric_init_f | 指定したファイルを読み込み・書き込み用にiRIClibから利用するため、内部変数を初期化し、ファイルを初期化する | × |
内部変数の初期化 | cg_iric_initread_f | 指定したファイルを読み込み専用でiRIClibから利用するため、内部変数を初期化する | × |
オプションの設定 | cg_initoption_f | ソルバーのオプションを設定する | × |
計算条件、格子生成条件の読み込み | cg_iric_read_integer_f | 整数型変数の値を取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_real_f | 実数(倍精度)変数の値を取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_realsingle_f | 実数(単精度)変数の値を取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_string_f | 文字列型変数の値を取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_functionalsize_f | 関数型変数のサイズを取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_functional_f | 倍精度実数の関数型変数の値を取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_functional_realsingle_f | 単精度実数の関数型変数の値を取得する | ○ |
計算条件、格子生成条件の読み込み | cg_iric_read_functionalwithname_f | 複数の値を持つ倍精度実数の関数型変数の値を取得する | ○ |
計算格子の読み込み | cg_iric_gotogridcoord2d_f | 格子を読み込む準備をする | ○ |
計算格子の読み込み | cg_iric_gotogridcoord3d_f | 格子を読み込む準備をする | ○ |
計算格子の読み込み | cg_iric_getgridcoord2d_f | 格子のX, Y 座標を読み込む | ○ |
計算格子の読み込み | cg_iric_getgridcoord3d_f | 格子のX, Y, Z 座標を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_integer_node_f | 格子点で定義された整数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_real_node_f | 格子点で定義された倍精度実数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_integer_cell_f | セルで定義された整数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_real_cell_f | セルで定義された倍精度実数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_count_f | 複合型の属性のグループの数を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_integer_f | 複合型の属性の整数の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_real_f | 複合型の属性の倍精度実数の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_realsingle_f | 複合型の属性の単精度実数の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_string_f | 複合型の属性の文字列の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_functionalsize_f | 複合型の属性の関数型の条件のサイズを調べる | ○ |
計算格子の読み込み | cg_iric_read_complex_functional_f | 複合型の属性の倍精度実数の関数型の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_functionalwithname_f | 複合型の属性の単精度実数の関数型の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_complex_functional_realsingle_f | 複合型の属性の値を複数持つ倍精度実数の関数型の条件を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_complex_node_f | 格子点で定義された複合型の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_complex_cell_f | セルで定義された複合型の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functionaltimesize_f | 次元「時刻」(Time) を持つ格子属性の、時刻の数を調べる | ○ |
計算格子の読み込み | cg_iric_read_grid_functionaltime_f | 次元「時刻」(Time)の値を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functionaldimensionsize_f | 次元の数を調べる | ○ |
計算格子の読み込み | cg_iric_read_grid_functionaldimension_integer_f | 整数の次元の値を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functionaldimension_real_f | 倍精度実数の次元の値を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functional_integer_node_f | 次元「時刻」を持つ、格子点で定義された整数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functional_real_node_f | 次元「時刻」を持つ、格子点で定義された倍精度実数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functional_integer_cell_f | 次元「時刻」を持つ、セルで定義された整数の属性を読み込む | ○ |
計算格子の読み込み | cg_iric_read_grid_functional_real_cell_f | 次元「時刻」を持つ、セルで定義された倍精度実数の属性を読み込む | ○ |
境界条件の読み込み | cg_iric_read_bc_count_f | 境界条件の数を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_indicessize_f | 境界条件の設定された要素 (格子点もしくはセル) の数を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_indices_f | 境界条件の設定された要素 (格子点もしくはセル) のインデックスの配列を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_integer_f | 整数型境界条件の値を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_real_f | 実数(倍精度)境界条件の値を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_realsingle_f | 実数(単精度)境界条件の値を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_string_f | 文字列型境界条件の値を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_functionalsize_f | 関数型境界条件のサイズを取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_functional_f | 倍精度実数の関数型境界条件の値を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_functional_realsingle_f | 単精度実数の関数型境界条件の値を取得する | ○ |
境界条件の読み込み | cg_iric_read_bc_functionalwithname_f | 複数の値を持つ倍精度実数の関数型境界条件の値を取得する | ○ |
地形データの読み込み | cg_iric_read_geo_count_f | 地形データの数を返す | ○ |
地形データの読み込み | cg_iric_read_geo_filename_f | 地形データのファイル名と種類を返す | ○ |
地形データの読み込み | iric_geo_polygon_open_f | ポリゴンファイルを開く | × |
地形データの読み込み | iric_geo_polygon_read_integervalue_f | ポリゴンの値を整数で返す | × |
地形データの読み込み | iric_geo_polygon_read_realvalue_f | ポリゴンの値を実数で返す | × |
地形データの読み込み | iric_geo_polygon_read_pointcount_f | ポリゴンの頂点の数を返す | × |
地形データの読み込み | iric_geo_polygon_read_points_f | ポリゴンの頂点の座標を返す | × |
地形データの読み込み | iric_geo_polygon_read_holecount_f | ポリゴンに開いた穴の数を返す | × |
地形データの読み込み | iric_geo_polygon_read_holepointcount_f | ポリゴンの穴の頂点の数を返す | × |
地形データの読み込み | iric_geo_polygon_read_holepoints_f | ポリゴンの穴の頂点の座標を返す | × |
地形データの読み込み | iric_geo_polygon_close_f | ポリゴンファイルを閉じる | × |
地形データの読み込み | iric_geo_riversurvey_open_f | 河川測量データを開く | × |
地形データの読み込み | iric_geo_riversurvey_read_count_f | 河川横断線の数を返す | × |
地形データの読み込み | iric_geo_riversurvey_read_position_f | 横断線の中心点の座標を返す | × |
地形データの読み込み | iric_geo_riversurvey_read_direction_f | 横断線の向きを返す | × |
地形データの読み込み | iric_geo_riversurvey_read_name_f | 横断線の名前を文字列として返す | × |
地形データの読み込み | iric_geo_riversurvey_read_realname_f | 横断線の名前を実数値として返す | × |
地形データの読み込み | iric_geo_riversurvey_read_leftshift_f | 横断線の標高データのシフト量を返す | × |
地形データの読み込み | iric_geo_riversurvey_read_altitudecount_f | 横断線の標高データの数を返す | × |
地形データの読み込み | iric_geo_riversurvey_read_altitudes_f | 横断線の標高データを返す | × |
地形データの読み込み | iric_geo_riversurvey_read_fixedpointl_f | 横断線の左岸延長線のデータを返す | × |
地形データの読み込み | iric_geo_riversurvey_read_fixedpointr_f | 横断線の右岸延長線のデータを返す | × |
地形データの読み込み | iric_geo_riversurvey_read_watersurfaceelevation_f | 横断線での水面標高のデータを返す | × |
地形データの読み込み | iric_geo_riversurvey_close_f | 河川測量データを閉じる | × |
計算格子の出力 | cg_iric_writegridcoord1d_f | 1次元構造格子を出力する | ○ |
計算格子の出力 | cg_iric_writegridcoord2d_f | 2次元構造格子を出力する | ○ |
計算格子の出力 | cg_iric_writegridcoord3d_f | 3次元構造格子を出力する | ○ |
計算格子の出力 | cg_iric_write_grid_integer_node_f | 格子点で定義された整数の属性を出力する | ○ |
計算格子の出力 | cg_iric_write_grid_real_node_f | 格子点で定義された倍精度実数の属性を出力する | ○ |
計算格子の出力 | cg_iric_write_grid_integer_cell_f | セルで定義された整数の属性を出力する | ○ |
計算格子の出力 | cg_iric_write_grid_real_cell_f | セルで定義された倍精度実数の属性を出力する | ○ |
時刻 (ループ回数) の出力 | cg_iric_write_sol_time_f | 時刻を出力する | ○ |
時刻 (ループ回数) の出力 | cg_iric_write_sol_iteration_f | ループ回数を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_gridcoord2d_f | 2次元構造格子を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_gridcoord3d_f | 3次元構造格子を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_baseiterative_integer_f | 整数の計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_baseiterative_real_f | 倍精度実数の計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_baseiterative_string_f | 文字列の計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_integer_f | 整数の格子点ごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_real_f | 倍精度実数の格子点ごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_cell_integer_f | 整数の格子セルごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_cell_real_f | 倍精度実数の格子セルごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_iface_integer_f | 整数のI方向格子エッジごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_iface_real_f | 倍精度実数のI方向格子エッジごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_jface_integer_f | 整数のJ方向格子エッジごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 | cg_iric_write_sol_jface_real_f | 倍精度実数のJ方向格子エッジごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 (粒子) | cg_iric_write_sol_particle_pos2d_f | 粒子の位置を出力する (2次元) | ○ |
計算結果の出力 (粒子) | cg_iric_write_sol_particle_pos3d_f | 粒子の位置を出力する (3次元) | ○ |
計算結果の出力 (粒子) | cg_iric_write_sol_particle_integer_f | 整数の粒子ごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 (粒子) | cg_iric_write_sol_particle_real_f | 倍精度実数の粒子ごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 (粒子) | cg_iric_write_sol_particlegroup_groupbegin_f | 粒子で定義された計算結果の出力を開始する | |
計算結果の出力 (粒子) | cg_iric_write_sol_particlegroup_groupend_f | 粒子で定義された計算結果の出力を終了する | |
計算結果の出力 (粒子) | cg_iric_write_sol_particlegroup_pos2d_f | 粒子の位置を出力する (2次元) | |
計算結果の出力 (粒子) | cg_iric_write_sol_particlegroup_pos3d_f | 粒子の位置を出力する (3次元) | |
計算結果の出力 (粒子) | cg_iric_write_sol_particlegroup_integer_f | 整数の粒子ごとに値を持つ計算結果を出力する | |
計算結果の出力 (粒子) | cg_iric_write_sol_particlegroup_real_f | 倍精度実数の粒子ごとに値を持つ計算結果を出力する | |
計算結果の出力 (ポリゴン・折れ線) | cg_iric_write_sol_polydata_groupbegin_f | ポリゴンもしくは折れ線で定義された計算結果の出力を開始する | ○ |
計算結果の出力 (ポリゴン・折れ線) | cg_iric_write_sol_polydata_groupend_f | ポリゴンもしくは折れ線で定義された計算結果の出力を終了する | ○ |
計算結果の出力 (ポリゴン・折れ線) | cg_iric_write_sol_polydata_polygon_f | 計算結果としてポリゴンの形状を出力する | ○ |
計算結果の出力 (ポリゴン・折れ線) | cg_iric_write_sol_polydata_polyline_f | 計算結果として折れ線の形状を出力する | ○ |
計算結果の出力 (ポリゴン・折れ線) | cg_iric_write_sol_polydata_integer_f | 整数のポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する | ○ |
計算結果の出力 (ポリゴン・折れ線) | cg_iric_write_sol_polydata_real_f | 倍精度実数のポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する | ○ |
計算結果の出力の前後に利用する関数 | iric_check_cancel_f | ユーザがソルバーの実行をキャンセルしたか確認する | × |
計算結果の出力の前後に利用する関数 | iric_check_lock_f | CGNSファイルが GUI によってロックされているか確認する | × |
計算結果の出力の前後に利用する関数 | iric_write_sol_start_f | 計算結果の出力開始をGUIに通知する | × |
計算結果の出力の前後に利用する関数 | iric_write_sol_end_f | 計算結果の出力終了をGUIに通知する | × |
計算結果の出力の前後に利用する関数 | cg_iric_flush_f | 計算結果の出力をファイルに書き込む | × |
既存の計算結果の読み込み | cg_iric_read_sol_count_f | 計算結果の数を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_time_f | 計算結果の時刻の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_iteration_f | 計算結果のループ回数の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_baseiterative_integer_f | 整数の計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_baseiterative_real_f | 倍精度実数の計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_baseiterative_string_f | 文字列の計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_gridcoord2d_f | 計算結果の2次元構造格子を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_gridcoord3d_f | 計算結果の3次元構造格子を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_integer_f | 整数の格子点ごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_real_f | 倍精度実数の格子点ごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_cell_integer_f | 整数の格子セルごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_cell_real_f | 倍精度実数の格子セルごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_iface_integer_f | 整数のI方向格子エッジごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_iface_real_f | 倍精度実数のI方向格子エッジごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_jface_integer_f | 整数のJ方向格子エッジごとに値を持つ計算結果の値を取得する | ○ |
既存の計算結果の読み込み | cg_iric_read_sol_jface_real_f | 倍精度実数のJ方向格子エッジごとに値を持つ計算結果の値を取得する | ○ |
エラーコードの出力 | cg_iric_write_errorcode_f | エラーコードを出力する | ○ |
CGNSファイルを閉じる | cg_close_f | CGNS ファイルを閉じる | × |
「複数版」欄が「○」となっているサブルーチン (単一CGNSファイル用) には、 ファイルIDを第一引数とする、類似のサブルーチン (複数CGNSファイル用) があります。 名前は、末尾の "_f" を "_mul_f" に変えたものです。
例えば、CGNSファイルから整数型の計算条件・格子生成条件の値を読み込む関数 には、以下のものがあります。
- 単一CGNSファイルを扱うプログラム用
call cg_iric_read_integer_f(label, intvalue, ier)
- 複数CGNSファイルを扱うプログラム用
call cg_iric_read_integer_mul_f(fid, label, intvalue, ier)
単一CGNSファイル用、複数CGNSファイル用の違いを 表 82 に示します。
項目 | 単一CGNSファイル用 | 複数CGNSファイル用 |
---|---|---|
名前 | 末尾が "_f" ("_mul" が付かない) | 末尾が "_mul_f" |
引数 | 次節以降参照 | 第一引数 = ファイルID (integer) |
操作対象ファイル | 最後に cg_iric_init_f またはcg_iric_initread_f で指定したファイル | 第一引数で指定したファイル |
cg_open_f¶
CGNS ファイルを開く。
形式 (FORTRAN)¶
call cg_open_f(filename, mode, fid, ier)
形式 (C/C++)¶
ier = cg_open(filename, mode, fid);
形式 (Python)¶
fid = cg_open(filename, mode)
cg_iric_init_f¶
指定したファイルを読み込み・書き込み用にiRIClibから利用するため、内部変数を初期化し、ファイルを初期化する。
形式 (FORTRAN)¶
call cg_iric_init_f(fid, ier)
形式 (C/C++)¶
ier = cg_iRIC_Init(fid);
形式 (Python)¶
cg_iRIC_Init(fid)
cg_iric_initread_f¶
指定したファイルを読み込み専用でiRIClibから利用するため、内部変数を初期化する。
形式 (FORTRAN)¶
call cg_iric_initread_f(fid, ier)
形式 (C/C++)¶
ier = cg_iRIC_InitRead(fid);
形式 (Python)¶
cg_iRIC_InitRead(fid)
iric_initoption_f¶
ソルバーのオプションを指定する。
形式 (FORTRAN)¶
call iric_initoption_f(optionval, ier)
形式 (C/C++)¶
ier = iRIC_InitOption(optionval);
形式 (Python)¶
iRIC_InitOption(optionval)
cg_iric_read_integer_f¶
CGNSファイルから整数型の計算条件・格子生成条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_integer_f(label, intvalue, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Integer(label, &intvalue);
形式 (Python)¶
intvalue = cg_iRIC_Read_Integer(label)
cg_iric_read_real_f¶
CGNSファイルから倍精度の実数型の計算条件・格子生成条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_real_f(label, realvalue, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Real(label, &realvalue);
形式 (Python)¶
realvalue = cg_iRIC_Read_Real(label)
cg_iric_read_realsingle_f¶
CGNSファイルから単精度の実数型の計算条件・格子生成条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_realsingle_f(label, realvalue, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_RealSingle(label, &realvalue);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_string_f¶
CGNSファイルから文字列型の計算条件・格子生成条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_string_f(label, strvalue, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_String(label, strvalue);
形式 (Python)¶
strvalue = cg_iRIC_Read_String(label)
cg_iric_read_functionalsize_f¶
CGNSファイルから関数型の計算条件・格子生成条件のサイズを読み込む。
形式 (FORTRAN)¶
call cg_iric_read_functionalsize_f(label, size, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_FunctionalSize(label, &size);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_functional_f¶
CGNSファイルから倍精度実数の関数型の計算条件・格子生成条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_functional_f(label, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Functional(label, x, y);
形式 (Python)¶
x, y = cg_iRIC_Read_Functional(label)
cg_iric_read_functional_realsingle_f¶
CGNSファイルから単精度実数の関数型の計算条件・格子生成条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_functional_realsingle_f(label, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Functional_RealSingle(label, x, y);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_functionalwithname_f¶
CGNSファイルから関数型の計算条件・格子生成条件の値を読み込む。変数が1つ、値が複数の関数型の計算条件・格子生成条件の読み込みに利用する。
形式 (FORTRAN)¶
call cg_iric_read_functionalwithname_f(label, name, data, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_FunctionalWithName(label, name, data);
形式 (Python)¶
data = cg_iRIC_Read_FunctionalWithName(label, name)
cg_iric_gotogridcoord2d_f¶
二次元構造格子を読み込む準備を行う。
形式 (FORTRAN)¶
call cg_iric_gotogridcoord2d_f(nx, ny, ier)
形式 (C/C++)¶
ier = cg_iRIC_GotoGridCoord2d(nx, ny);
形式 (Python)¶
nx, ny = cg_iRIC_GotoGridCoord2d()
cg_iric_gotogridcoord3d_f¶
三次元構造格子を読み込む準備を行う。
形式 (FORTRAN)¶
call cg_iric_gotogridcoord3d_f(nx, ny, nz, ier)
形式 (C/C++)¶
ier = cg_iRIC_GotoGridCoord3d(nx, ny, nz);
形式 (Python)¶
nx, ny, nz = cg_iRIC_GotoGridCoord3d()
cg_iric_getgridcoord2d_f¶
二次元構造格子を読み込む。
形式 (FORTRAN)¶
call cg_iric_getgridcoord2d_f(x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_GetGridCoord2d(x, y);
形式 (Python)¶
x, y = cg_iRIC_GetGridCoord2d()
cg_iric_getgridcoord3d_f¶
三次元構造格子を読み込む。
形式 (FORTRAN)¶
call cg_iric_getgridcoord3d_f(x, y, z, ier)
形式 (C/C++)¶
ier = cg_iRIC_GetGridCoord3d(x, y, z);
形式 (Python)¶
x, y, z = cg_iRIC_GetGridCoord3d()
cg_iric_read_grid_integer_node_f¶
構造格子の格子点で定義された整数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_integer_node_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Integer_Node(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Integer_Node(label)
cg_iric_read_grid_real_node_f¶
構造格子の格子点で定義された倍精度実数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_real_node_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Real_Node(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Real_Node(label)
cg_iric_read_grid_integer_cell_f¶
構造格子のセルで定義された整数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_integer_cell_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Integer_Cell(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Integer_Cell(label)
cg_iric_read_grid_real_cell_f¶
構造格子のセルで定義された倍精度実数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_real_cell_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Real_Cell(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Real_Cell(label)
cg_iric_read_complex_count_f¶
複合型格子属性の、グループの数を取得する。
形式 (FORTRAN)¶
call cg_iric_read_complex_count_f(type, num, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_Count(type, &num);
形式 (Python)¶
num = cg_iRIC_Read_Complex_Count(type)
cg_iric_read_complex_integer_f¶
複合型格子属性の、整数型の条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_integer_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_Integer(type, num, name, &value);
形式 (Python)¶
value = cg_iRIC_Read_Complex_Integer(type, num, name)
cg_iric_read_complex_real_f¶
複合型格子属性の、実数(倍精度)型の条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_real_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_Real(type, num, name, &value);
形式 (Python)¶
value = cg_iRIC_Read_Complex_Real(type, num, name)
cg_iric_read_complex_realsingle_f¶
複合型格子属性の、実数(単精度)型の条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_realsingle_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_RealSingle(type, num, name, &value);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_complex_string_f¶
複合型格子属性の、文字列型の条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_string_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_String(type, num, name, value);
形式 (Python)¶
value = cg_iRIC_Read_Complex_String(type, num, name)
cg_iric_read_complex_functionalsize_f¶
複合型格子属性の、関数型の条件の変数のサイズを読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_functionalsize_f(type, num, name, size, ier)
形式 (C/C++)¶
ier = cg_iric_read_complexunctionalsize(type, num, name, &size);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_complex_functional_f¶
複合型格子属性の、倍精度関数型の条件の変数の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_functional_f(type, num, name, x, y, ier)
形式 (C/C++)¶
ier = cg_iric_read_complexunctional(type, num, name, x, y);
形式 (Python)¶
x, y = cg_iric_read_complexunctional(type, num, name)
cg_iric_read_complex_functional_realsingle_f¶
複合型格子属性の、単精度関数型の条件の変数の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_complex_functional_realsingle_f(type, num, name, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_Functional_RealSingle(type, num, name, x, y);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_complex_functionalwithname_f¶
複合型格子属性の、倍精度関数型の条件の変数の値を読み込む。変数が1つ、値が複数の関数型の境界条件の読み込みに利用する。
形式 (FORTRAN)¶
call cg_iric_read_complex_functionalwithname_f(type, num, name, paramname, data, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Complex_FunctionalWithName(type, num, name, paramname, data);
形式 (Python)¶
data = cg_iRIC_Read_Complex_FunctionalWithName(type, num, name, paramname)
cg_iric_read_grid_complex_node_f¶
構造格子の格子点で定義された複合型の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_complex_node_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Complex_Node(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Complex_Node(label)
cg_iric_read_grid_complex_cell_f¶
構造格子のセルで定義された複合型の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_complex_cell_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Complex_Cell(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Complex_Cell(label)
cg_iric_read_grid_functionaltimesize_f¶
次元「時刻」(Time) を持つ格子属性の、時刻の数を調べる。
形式 (FORTRAN)¶
call cg_iric_read_grid_functionaltimesize_f(label, count, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_FunctionalTimeSize(label, &count);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_grid_functionaltime_f¶
次元「時刻」(Time) の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_functionaltime_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_FunctionalTime(label, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_FunctionalTime(label)
cg_iric_read_grid_functionaldimensionsize_f¶
次元の数を調べる。
形式 (FORTRAN)¶
call cg_iric_read_grid_functionaltime_f(label, dimname, count, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_FunctionalTime(label, dimname, &count);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_grid_functionaldimension_integer_f¶
整数の次元の値を読み込む
形式 (FORTRAN)¶
call cg_iric_read_grid_functionaldimension_integer_f(label, dimname, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_FunctionalDimension_Integer(label, dimname, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_FunctionalDimension_Integer(label, dimname)
cg_iric_read_grid_functionaldimension_real_f¶
実数の次元の値を読み込む
形式 (FORTRAN)¶
call cg_iric_read_grid_functionaldimension_real_f(label, dimname, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_FunctionalDimension_Real(label, dimname, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_FunctionalDimension_Real(label, dimname)
cg_iric_read_grid_functional_integer_node_f¶
次元「時刻」を持つ、格子点で定義された整数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_functional_integer_node_f(label, dimid, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Functional_Integer_Node(label, dimid, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Functional_Integer_Node(label, dimid)
cg_iric_read_grid_functional_real_node_f¶
次元「時刻」を持つ、格子点で定義された倍精度実数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_functional_real_node_f(label, dimid, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Functional_Real_Node(label, dimid, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Functional_Real_Node(label, dimid)
cg_iric_read_grid_functional_integer_cell_f¶
次元「時刻」を持つ、セルで定義された整数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_functional_integer_cell_f(label, dimid, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Functional_Integer_Cell(label, dimid, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Functional_Integer_Cell(label, dimid)
cg_iric_read_grid_functional_real_cell_f¶
次元「時刻」を持つ、セルで定義された倍精度実数の属性を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_grid_functional_real_cell_f(label, dimid, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Grid_Functional_Real_Cell(label, dimid, values);
形式 (Python)¶
values = cg_iRIC_Read_Grid_Functional_Real_Cell(label, dimid)
cg_iric_read_bc_count_f¶
境界条件の数を取得する。
形式 (FORTRAN)¶
call cg_iric_read_bc_count_f(type, num)
形式 (C/C++)¶
cg_iRIC_Read_BC_Count(type, &num);
形式 (Python)¶
num = cg_iRIC_Read_BC_Count(type)
cg_iric_read_bc_indicessize_f¶
境界条件が設定された要素 (格子点もしくはセル) の数を取得する。
形式 (FORTRAN)¶
call cg_iric_read_bc_indicessize_f(type, num, size, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_IndicesSize(type, num, &size);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_bc_indices_f¶
境界条件が設定された要素 (格子点もしくはセル)
形式 (FORTRAN)¶
call cg_iric_read_bc_indices_f(type, num, indices, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_Indices(type, num, indices);
形式 (Python)¶
indices = cg_iRIC_Read_BC_Indices(type, num)
引数¶
変数名 | 型 | I/O | 内容 |
---|---|---|---|
type | character(*) | I | 境界条件の識別名 |
num | integer | I | 境界条件の番号 |
indices | integer, dimension(2,:), allocatable | O | 境界条件が設定された要素のインデックスの配列。 |
ier | integer | O | エラーコード。0なら成功 |
備考¶
indices に返される値は、境界条件が設定される位置によって、 表 129 に示すように異なります。 格子点、セルでは、値2つで一つの要素を定義しているのに対し、 辺では値4つで1つの要素を定義している点にご注意下さい。
境界条件を設定された位置 | indicesに返される値 |
---|---|
格子点 (node) | (格子点1のI), (格子点1のJ)
...,
(格子点NのI), (格子点NのJ)
|
セル (cell) | (セル1のI), (セル1のJ)
...,
(セルNのI), (セルNのJ)
|
辺 (edge) | (辺1の開始格子点のI), (辺1の開始格子点のJ),
(辺1の終了格子点のI), (辺1の終了格子点のJ),
...,
(辺Nの開始格子点のI), (辺Nの開始格子点のJ),
(辺Nの終了格子点のI), (辺Nの終了格子点のJ)
|
cg_iric_read_bc_integer_f¶
整数型の境界条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_integer_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_Integer(type, num, name, &value);
形式 (Python)¶
value = cg_iRIC_Read_BC_Integer(type, num, name)
cg_iric_read_bc_real_f¶
実数(倍精度)型の境界条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_real_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_Real(type, num, name, &value);
形式 (Python)¶
value = cg_iRIC_Read_BC_Real(type, num, name)
cg_iric_read_bc_realsingle_f¶
実数(単精度)型の境界条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_realsingle_f(type, num, label, realvalue, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_RealSingle(type, num, label, &realvalue);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_bc_string_f¶
文字列型の境界条件の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_string_f(type, num, name, value, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_String(type, num, name, value);
形式 (Python)¶
value = cg_iRIC_Read_BC_String(type, num, name)
cg_iric_read_bc_functionalsize_f¶
関数型の境界条件の変数のサイズを読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_functionalsize_f(type, num, name, size, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_FunctionalSize(type, num, name, &size);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_bc_functional_f¶
倍精度関数型の境界条件の変数の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_functional_f(type, num, name, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_Functional(type, num, name, x, y);
形式 (Python)¶
x, y = cg_iRIC_Read_BC_Functional(type, num, name)
cg_iric_read_bc_functional_realsingle_f¶
単精度関数型の境界条件の変数の値を読み込む。
形式 (FORTRAN)¶
call cg_iric_read_bc_functional_realsingle_f(type, num, name, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_Functional_RealSingle(type, num, name, x, y);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_bc_functionalwithname_f¶
倍精度関数型の境界条件の変数の値を読み込む。変数が1つ、値が複数の関数型の境界条件の読み込みに利用する。
形式 (FORTRAN)¶
call cg_iric_read_bc_functionalwithname_f(type, num, name, paramname, data, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_BC_FunctionalWithName(type, num, name, paramname, data);
形式 (Python)¶
data = cg_iRIC_Read_BC_FunctionalWithName(type, num, name, paramname)
cg_iric_read_geo_count_f¶
CGNSファイルから地形データの数を読み込みます。
形式 (FORTRAN)¶
call cg_iric_read_geo_count_f(name, geocount, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Geo_Count(name, geocount);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_read_geo_filename_f¶
CGNSファイルから地形データのファイル名と種類を読み込みます。
形式 (FORTRAN)¶
call cg_iric_read_geo_filename_f(name, geoid, geofilename, geotype, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Geo_Filename(name, geoid, geofilename, &geotype);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_open_f¶
ポリゴンファイルを開く。
形式 (FORTRAN)¶
call iric_geo_polygon_open_f(filename, pid, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Open(filename, &pid);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_integervalue_f¶
ポリゴンの値を整数で返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_integervalue_f(pid, intval, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_IntegerValue(pid, &intval);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_realvalue_f¶
ポリゴンの値を実数で返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_realvalue_f(pid, realval, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_RealValue(pid, &realval);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_pointcount_f¶
ポリゴンの頂点の数を返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_pointcount_f(pid, count, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_PointCount(pid, &count);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_points_f¶
ポリゴンの頂点の座標を返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_points_f(pid, x, y, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_Points(pid, x, y);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_holecount_f¶
ポリゴンに開いた穴の数を返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_holecount_f(pid, holecount, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_HoleCount(pid, &holecount);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_holepointcount_f¶
ポリゴンの穴の頂点の数を返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_holepointcount_f(pid, holeid, count, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_HolePointCount(pid, holeid, &count);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_read_holepoints_f¶
ポリゴンの穴の頂点の座標を返す。
形式 (FORTRAN)¶
call iric_geo_polygon_read_holepoints_f(pid, holeid, x, y, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Read_HolePoints(pid, holeid, x, y);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_polygon_close_f¶
ポリゴンファイルを閉じる。
形式 (FORTRAN)¶
call iric_geo_polygon_close_f(pid, ier)
形式 (C/C++)¶
ier = iRIC_Geo_Polygon_Close(pid);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_open_f¶
河川測量データを開く。
形式 (FORTRAN)¶
call iric_geo_riversurvey_open_f(filename, rid, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Open(filename, rid);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_count_f¶
河川横断線の数を返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_count_f(rid, count, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_Count(rid, &count);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_position_f¶
横断線の中心点の座標を返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_position_f(rid, pointid, x, y, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_Position(rid, pointid, &x, &y);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_direction_f¶
横断線の向きを返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_direction_f(rid, pointid, vx, vy, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_Direction(rid, pointid, &vx, &vy);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_name_f¶
横断線の名前を文字列として返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_name_f(rid, pointid, name, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_Name(rid, pointid, name);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_realname_f¶
横断線の名前を実数値として返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_realname_f(rid, pointid, realname, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_RealName(rid, pointid, &realname);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_leftshift_f¶
横断線の標高データのシフト量を返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_leftshift_f(rid, pointid, shift, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_LeftShift(rid, pointid, &shift);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_altitudecount_f¶
横断線の標高データの数を返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_altitudecount_f(rid, pointid, count, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_AltitudeCount(rid, pointid, &count);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_altitudes_f¶
横断線の中心点の座標を返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_altitudes_f(rid, pointid, position, height, active, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_Altitudes(rid, pointid, position, height, active);
形式 (Python)¶
Python にはこの関数は存在しない
引数¶
変数名 | 型 | I/O | 内容 |
---|---|---|---|
rid | integer | I | 河川測量データのID |
pointid | pointid | I | 横断線のID |
position | double precision, dimension(:), allocatable | O | 標高データの位置 (0より小さい = 左岸側, 0 より大きい = 右岸側) |
height | double precision, dimension(:), allocatable | O | 標高データの高さ |
active | integer, dimension(:), allocatable | O | 標高データの有効/無効 (1: 有効, 0: 無効) |
ier | integer | O | エラーコード。0なら成功 |
iric_geo_riversurvey_read_fixedpointl_f¶
横断線の左岸延長線のデータを返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_fixedpointl_f(rid, pointid, set, directionx, directiony, index, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_FixedPointL(rid, pointid, &set, &directionx, &directiony, &index);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_fixedpointr_f¶
横断線の右岸延長線のデータを返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_fixedpointr_f(rid, pointid, set, directionx, directiony, index, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_FixedPointR(rid, pointid, &set, &directionx, &directiony, &index);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_read_watersurfaceelevation_f¶
横断線での水面標高のデータを返す。
形式 (FORTRAN)¶
call iric_geo_riversurvey_read_watersurfaceelevation_f(rid, pointid, set, value, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Read_WaterSurfaceElevation(rid, pointid, set, &value);
形式 (Python)¶
Python にはこの関数は存在しない
iric_geo_riversurvey_close_f¶
河川測量データファイルを閉じる。
形式 (FORTRAN)¶
call iric_geo_riversurvey_close_f(pid, ier)
形式 (C/C++)¶
ier = iRIC_Geo_RiverSurvey_Close(pid);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_writegridcoord1d_f¶
1次元構造格子を出力する。
形式 (FORTRAN)¶
call cg_iric_writegridcoord1d_f(nx, x, ier)
形式 (C/C++)¶
ier = cg_iRIC_WriteGridCoord1d(nx, x);
形式 (Python)¶
cg_iRIC_WriteGridCoord1d(nx, x)
cg_iric_writegridcoord2d_f¶
2次元構造格子を出力する。
形式 (FORTRAN)¶
call cg_iric_writegridcoord2d_f(nx, ny, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_WriteGridCoord2d(nx, ny, x, y);
形式 (Python)¶
cg_iRIC_WriteGridCoord2d(nx, ny, x, y)
cg_iric_writegridcoord3d_f¶
3次元構造格子を出力する。
形式 (FORTRAN)¶
call cg_iric_writegridcoord3d_f(nx, ny, nz, x, y, z, ier)
形式 (C/C++)¶
ier = cg_iRIC_WriteGridCoord3d(nx, ny, nz, x, y, z);
形式 (Python)¶
cg_iRIC_WriteGridCoord3d(nx, ny, nz, x, y, z)
引数¶
変数名 | 型 | I/O | 内容 |
---|---|---|---|
nx | integer | I | i方向格子点数 |
ny | integer | I | j方向格子点数 |
nz | integer | I | k方向格子点数 |
x | double precision, dimension(:), allocatable | I | 格子点のx座標値 |
y | double precision, dimension(:), allocatable | I | 格子点のy座標値 |
z | double precision, dimension(:), allocatable | I | 格子点のz座標値 |
ier | integer | O | エラーコード。0なら成功 |
cg_iric_write_grid_integer_node_f¶
構造格子の格子点で定義された整数の属性を出力する。
形式 (FORTRAN)¶
call cg_iric_write_grid_integer_node_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Grid_Integer_Node(label, values);
形式 (Python)¶
cg_iRIC_Write_Grid_Integer_Node(label, values)
cg_iric_write_grid_real_node_f¶
構造格子の格子点で定義された倍精度実数の属性を出力する。
形式 (FORTRAN)¶
call cg_iric_write_grid_real_node_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Grid_Real_Node(label, values);
形式 (Python)¶
cg_iRIC_Write_Grid_Real_Node(label, values)
cg_iric_write_grid_integer_cell_f¶
構造格子のセルで定義された整数の属性を出力する。
形式 (FORTRAN)¶
call cg_iric_write_grid_integer_cell_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Grid_Integer_Cell(label, values);
形式 (Python)¶
cg_iRIC_Write_Grid_Integer_Cell(label, values)
cg_iric_write_grid_real_cell_f¶
構造格子のセルで定義された倍精度実数の属性を出力する。
形式 (FORTRAN)¶
call cg_iric_write_grid_real_cell_f(label, values, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Grid_Real_Cell(label, values);
形式 (Python)¶
cg_iRIC_Write_Grid_Real_Cell(label, values)
cg_iric_write_sol_time_f¶
時刻を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_time_f(time, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Time(time);
形式 (Python)¶
cg_iRIC_Write_Sol_Time(time)
cg_iric_write_sol_iteration_f¶
ループ回数を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_iteration_f(iteration, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Iteration(iteration);
形式 (Python)¶
cg_iRIC_Write_Sol_Iteration(iteration)
cg_iric_write_sol_gridcoord2d_f¶
2次元構造格子を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_gridcoord2d_f(x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_GridCoord2d(x, y);
形式 (Python)¶
cg_iRIC_Write_Sol_GridCoord2d(x, y)
cg_iric_write_sol_gridcoord3d_f¶
3次元構造格子を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_gridcoord3d_f(x, y, z, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_GridCoord3d(x, y, z);
形式 (Python)¶
cg_iRIC_Write_Sol_GridCoord3d(x, y, z)
cg_iric_write_sol_baseiterative_integer_f¶
整数の計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_baseiterative_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_BaseIterative_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_BaseIterative_Integer(label, val)
cg_iric_write_sol_baseiterative_real_f¶
倍精度実数の計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_baseiterative_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_BaseIterative_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_BaseIterative_Real(label, val)
cg_iric_write_sol_baseiterative_string_f¶
文字列の計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_baseiterative_string_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_BaseIterative_String(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_BaseIterative_String(label, val)
cg_iric_write_sol_integer_f¶
整数の格子点ごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_Integer(label, val)
cg_iric_write_sol_real_f¶
倍精度実数の格子点ごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_Real(label, val)
cg_iric_write_sol_cell_integer_f¶
整数の格子セルごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_cell_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Cell_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_Cell_Integer(label, val)
cg_iric_write_sol_cell_real_f¶
倍精度実数の格子セルごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_cell_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Cell_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_Cell_Real(label, val)
cg_iric_write_sol_iface_integer_f¶
整数のI方向格子エッジごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_iface_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_IFace_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_IFace_Integer(label, val)
cg_iric_write_sol_iface_real_f¶
倍精度実数のI方向格子エッジごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_iface_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_IFace_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_IFace_Real(label, val)
cg_iric_write_sol_jface_integer_f¶
整数のJ方向格子エッジごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_jface_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_JFace_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_JFace_Integer(label, val)
cg_iric_write_sol_jface_real_f¶
倍精度実数のJ方向格子エッジごとに値を持つ計算結果を出力する。
形式 (FORTRAN)¶
call cg_iric_write_sol_jface_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_JFace_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_JFace_Real(label, val)
cg_iric_write_sol_particle_pos2d_f¶
粒子の位置を出力する。 (2次元)
形式 (FORTRAN)¶
call cg_iric_write_sol_particle_pos2d_f(count, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Particle_Pos2d(count, x, y);
形式 (Python)¶
cg_iRIC_Write_Sol_Particle_Pos2d(x, y)
cg_iric_write_sol_particle_pos3d_f¶
粒子の位置を出力する。 (3次元)
形式 (FORTRAN)¶
call cg_iric_write_sol_particle_pos3d_f(count, x, y, z, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Particle_Pos3d(count, x, y, z);
形式 (Python)¶
cg_iRIC_Write_Sol_Particle_Pos3d(x, y, z)
cg_iric_write_sol_particle_integer_f¶
整数の粒子ごとに値を持つ計算結果を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_particle_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Particle_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_Particle_Integer(label, val)
cg_iric_write_sol_particle_real_f¶
倍精度実数の粒子ごとに値を持つ計算結果を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_particle_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_Particle_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_Particle_Real(label, val)
cg_iric_write_sol_particlegroup_groupbegin_f¶
粒子で定義された計算結果の出力を開始する
形式 (FORTRAN)¶
call cg_iric_write_sol_particlegroup_groupbegin_f(name, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(name);
形式 (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(name)
cg_iric_write_sol_particlegroup_groupend_f¶
粒子で定義された計算結果の出力を終了する
形式 (FORTRAN)¶
call cg_iric_write_sol_particlegroup_groupend_f(ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_ParticleGroup_GroupEnd();
形式 (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_GroupEnd()
cg_iric_write_sol_particlegroup_pos2d_f¶
粒子の位置を出力する (2次元)
形式 (FORTRAN)¶
call cg_iric_write_sol_particlegroup_pos2d_f(x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_ParticleGroup_Pos2d(x, y);
形式 (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_Pos2d(x, y)
cg_iric_write_sol_particlegroup_pos3d_f¶
粒子の位置を出力する (3次元)
形式 (FORTRAN)¶
call cg_iric_write_sol_particlegroup_pos3d_f(x, y, z, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_ParticleGroup_Pos3d(x, y, z);
形式 (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_Pos3d(x, y, z)
cg_iric_write_sol_particlegroup_integer_f¶
整数の粒子ごとに値を持つ計算結果を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_particlegroup_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_ParticleGroup_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_Integer(label, val)
cg_iric_write_sol_particlegroup_real_f¶
倍精度実数の粒子ごとに値を持つ計算結果を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_particlegroup_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_ParticleGroup_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_ParticleGroup_Real(label, val)
cg_iric_write_sol_polydata_groupbegin_f¶
ポリゴンもしくは折れ線で定義された計算結果の出力を開始する
形式 (FORTRAN)¶
call cg_iric_write_sol_polydata_groupbegin_f(name, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_PolyData_GroupBegin(name);
形式 (Python)¶
cg_iRIC_Write_Sol_PolyData_GroupBegin(name)
cg_iric_write_sol_polydata_groupend_f¶
ポリゴンもしくは折れ線で定義された計算結果の出力を終了する
形式 (FORTRAN)¶
call cg_iric_write_sol_polydata_groupend_f(ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_PolyData_GroupEnd();
形式 (Python)¶
cg_iRIC_Write_Sol_PolyData_GroupEnd()
cg_iric_write_sol_polydata_polygon_f¶
計算結果としてポリゴンの形状を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_polydata_polygon_f(numpoints, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_PolyData_Polygon(numpoints, x, y);
形式 (Python)¶
cg_iRIC_Write_Sol_PolyData_Polygon(x, y)
cg_iric_write_sol_polydata_polyline_f¶
計算結果として折れ線の形状を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_polydata_polyline_f(numpoints, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_PolyData_Polyline(numpoints, x, y);
形式 (Python)¶
cg_iRIC_Write_Sol_PolyData_Polyline(x, y)
cg_iric_write_sol_polydata_integer_f¶
整数のポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_polydata_integer_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_PolyData_Integer(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_PolyData_Integer(label, val)
cg_iric_write_sol_polydata_real_f¶
倍精度実数のポリゴンもしくは折れ線ごとに値を持つ計算結果を出力する
形式 (FORTRAN)¶
call cg_iric_write_sol_polydata_real_f(label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Write_Sol_PolyData_Real(label, val);
形式 (Python)¶
cg_iRIC_Write_Sol_PolyData_Real(label, val)
iric_check_cancel_f¶
ユーザがソルバーをキャンセルしたか確認する。
形式 (FORTRAN)¶
call iric_check_cancel_f(canceled)
形式 (C/C++)¶
iRIC_Check_Cancel(&canceled);
形式 (Python)¶
canceled = iRIC_Check_Cancel()
iric_check_lock_f¶
CGNSファイルがGUIによってロックされているか確認する。
注釈
この関数は、現在は何もせず、呼び出しは不要。
形式 (FORTRAN)¶
call iric_check_lock_f(filename, locked)
形式 (C/C++)¶
iRIC_Check_Lock(filename, locked);
形式 (Python)¶
Python にはこの関数は存在しない
iric_write_sol_start_f¶
計算結果の出力開始をGUIに通知する。
注釈
この関数は、現在は何もせず、呼び出しは不要。
形式 (FORTRAN)¶
call iric_write_sol_start_f(filename, ier)
形式 (C/C++)¶
ier = iRIC_Write_Sol_Start(filename);
形式 (Python)¶
Python にはこの関数は存在しない
iric_write_sol_end_f¶
計算結果の出力終了をGUIに通知する。
注釈
この関数は、現在は何もせず、呼び出しは不要。
形式 (FORTRAN)¶
call iric_write_sol_end_f(filename, ier)
形式 (C/C++)¶
ier = iRIC_Write_Sol_End(filename);
形式 (Python)¶
Python にはこの関数は存在しない
cg_iric_flush_f¶
計算結果の出力をファイルに書き込む。
形式 (FORTRAN)¶
call cg_iric_flush_f(filename, fin, ier)
形式 (C/C++)¶
ier = cg_iRIC_Flush(filename, fin);
形式 (Python)¶
fin = cg_iRIC_Flush(filename, fin)
cg_iric_read_sol_count_f¶
計算結果の数を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_count_f(count, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Count(&count);
形式 (Python)¶
count = cg_iRIC_Read_Sol_Count()
cg_iric_read_sol_time_f¶
計算結果の時刻の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_time_f(step, time, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Time(step, &time);
形式 (Python)¶
time = cg_iRIC_Read_Sol_Time(step)
cg_iric_read_sol_iteration_f¶
計算結果のループ回数の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_iteration_f(step, iteration, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Iteration(step, &iteration);
形式 (Python)¶
iteration = cg_iRIC_Read_Sol_Iteration(step)
cg_iric_read_sol_baseiterative_integer_f¶
整数の計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_baseiterative_integer_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_BaseIterative_Integer(step, label, &val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_BaseIterative_Integer(step, label)
cg_iric_read_sol_baseiterative_real_f¶
倍精度実数の計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_baseiterative_real_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_BaseIterative_Real(step, label, &val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_BaseIterative_Real(step, label)
cg_iric_read_sol_baseiterative_string_f¶
文字列の計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_baseiterative_string_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_BaseIterative_String(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_BaseIterative_String(step, label)
cg_iric_read_sol_gridcoord2d_f¶
計算結果の2次元構造格子を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_gridcoord2d_f(step, x, y, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_GridCoord2d(step, x, y);
形式 (Python)¶
x, y = cg_iRIC_Read_Sol_GridCoord2d(step)
cg_iric_read_sol_gridcoord3d_f¶
計算結果の3次元構造格子を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_gridcoord3d_f(step, x, y, z, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_GridCoord3d(step, x, y, z);
形式 (Python)¶
x, y, z = cg_iRIC_Read_Sol_GridCoord3d(step)
cg_iric_read_sol_integer_f¶
整数の格子点ごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_integer_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Integer(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_Integer(step, label)
cg_iric_read_sol_real_f¶
倍精度実数の格子点ごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_real_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Real(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_Real(step, label)
cg_iric_read_sol_cell_integer_f¶
整数の格子セルごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_cell_integer_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Cell_Integer(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_Cell_Integer(step, label)
cg_iric_read_sol_cell_real_f¶
倍精度実数の格子セルごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_cell_real_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_Cell_Real(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_Cell_Real(step, label)
cg_iric_read_sol_iface_integer_f¶
整数のJ方向格子エッジごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_iface_integer_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_IFace_Integer(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_IFace_Integer(step, label)
cg_iric_read_sol_iface_real_f¶
倍精度実数のI方向格子エッジごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_iface_real_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_IFace_Real(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_IFace_Real(step, label)
cg_iric_read_sol_jface_integer_f¶
整数のJ方向格子エッジごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_jface_integer_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_JFace_Integer(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_JFace_Integer(step, label)
cg_iric_read_sol_jface_real_f¶
倍精度実数のJ方向格子エッジごとに値を持つ計算結果の値を取得する。
形式 (FORTRAN)¶
call cg_iric_read_sol_jface_real_f(step, label, val, ier)
形式 (C/C++)¶
ier = cg_iRIC_Read_Sol_JFace_Real(step, label, val);
形式 (Python)¶
val = cg_iRIC_Read_Sol_JFace_Real(step, label)
その他の情報¶
Fortran プログラムでの引数の読み込み処理¶
iRICは、ソルバーや格子生成プログラムを起動する時、コマンドライン引数として 計算データファイルもしくは格子生成データファイルの名前を渡すため、 これを読み込む必要があります。
Fortran では、コマンドライン引数を読み込む方法がコンパイラによって異なります。 ここでは、Intel Fortran Compiler と、GNU Fortran (gfortran), G95 での 引数の読み込み処理について説明します。
Intel Fortran Compiler¶
nargs()でコマンドライン引数の個数を取得し、引数がある場合、 getarg() で引数を取得します。
1 2 3 4 5 6 7 | icount = nargs() ! コマンド名が数に含まれるので、引数が1つなら2を返す if ( icount.eq.2 ) then call getarg(1, condFile, istatus) else write(*,*) "Input File not specified." stop endif |
GNU Fortran, G95¶
iargc() でコマンドライン引数の個数を取得し、 引数がある場合、getarg() で引数を取得します。
Intel Fortran Compiler の nargs(), getarg() とは 仕様が異なりますので注意して下さい。
1 2 3 4 5 6 7 8 | icount = iargc() ! コマンド名は数に含まれないので、引数が1つなら1を返す if ( icount.eq.1 ) then call getarg(0, str1) ! 実行プログラムのファイル名 call getarg(1, condfile) ! 引数 else write(*,*) "Input File not specified." stop endif |
Fortran 言語で iriclib, cgnslib とリンクしてビルドする方法¶
iRIC と連携して動作するソルバー、格子生成プログラムをコンパイルするには、 cgnslib, iriclib とリンクする必要があります。 それぞれ、Intel Fortran Compiler と GNU Fortran では異なるライブラリを利用する 必要があります。それぞれで必要なライブラリのファイル名は 表 224 のとおりです。 ヘッダファイルは共通で、 "libcgns_f.h"、 "iriclib_f.h" です。
コンパイラ | iRIClib ライブラリ | cgnslib ライブラリ |
Intel Fortran Compiler | iriclib_x64_ifort.lib | cgnsdll_x64_ifort.lib |
GNU Fortran(gfortran) | iriclib.lib | cgnsdll.lib |
ソースコードのファイルが solver.f の時のコンパイル手順について以下に示します。 ただし、コンパイラの設定 (pathの設定など) は完了しているものとします。
Intel Fortran Compiler (Windows)¶
solver.f, cgnsdll_x64_ifort.lib, iriclib_x64_ifort.lib, cgnslib_f.h, iriclib_f.h を同じフォルダに置き、そこに移動して以下のコマンドを実行することで、 実行ファイル solver.exe が生成されます。
ifort solver.f cgnsdll_x64_ifort.lib iriclib_x64_ifort.lib /MD
コンパイル時には、同時に solver.exe.manifest というファイルも作成されます。 ソルバーをコピーする時はこのファイルも一緒にコピーし、同じフォルダに配置してください。
GNU Fortran¶
solver.f, cgnsdll.lib, iriclib.lib, cgnslib_f.h, iriclib_f.h を 同じフォルダに置き、そこに移動して以下のコマンドを実行することで、 実行ファイル solver.exe が生成されます。
gfortran -c solver.f
g++ -o solver.exe -lgfortran solver.o cgnsdll.lib iriclib.lib
特別な格子属性、計算結果の名前について¶
iRIC では、特別な目的で用いる格子属性、計算結果について、特別な名前を用います。 開発するソルバーで、以下の目的に合致する属性を入出力する場合、ここで示す名前を使ってください。
格子属性¶
入力格子の属性について定義された特別な名前を 表 225 に示します。
名前 | 説明 |
---|---|
Elevation | 格子点の標高 (単位: m) を保持する格子属性です。格子点の、実数の属性として定義します。 |
ソルバーで Elevation を使用する場合は、 GridRelatedCondition 要素の子要素の、 Item 要素の name 属性に指定します。caption 属性は任意に設定できます。 定義例を リスト 112 に示します。
<Item name="Elevation" caption="Elevation">
<Definition position="node" valueType="real" default="max" />
</Item>
一方格子生成プログラムで標高情報を出力する場合、 Elevationという名前を使って出力すれば iRIC で読み込まれます。格子生成プログラムで Elavtion を出力する処理の例を リスト 113 に示します。
cg_iric_write_grid_real_node_f("Elevation", elevation, ier);
計算結果¶
計算結果について定義された特別な名前を 表 226 に示します。 ここで示す名前は、 iRIClib の関数の引数に指定してください。
これらの特別な計算結果を全て出力するソルバーの例を リスト 114 に示します。
名前 | 説明 | 必須 |
Elevation | 河床の標高 (単位: m)。実数の計算結果として出力します。"Elevation(m)" などのように、後ろに単位などの文字列を付加してもかまいません。 | ○ |
WaterSurfaceElevation | 水面の標高 (単位: m)。実数の計算結果として出力します。"WaterSurfaceElevation(m)" などのように、後ろに単位などの文字列を付加してもかまいません。 | |
IBC | 計算結果の有効・無効フラグ。無効な (水がない) 領域では 0、有効な (水がある) 領域では 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)
CGNS ファイル、 CGNSライブラリに関する情報¶
CGNS ファイルフォーマットの概要¶
CGNSは、CFG General Notation System の略で、数値流体力学で用いられるデータを 格納するための汎用ファイルフォーマットです。 OS やCPU の種類が異なるコンピュータの間で、共通して利用することができます。 数値流体力学で用いられる標準的なデータ形式が定義されているほか、 ソルバーごとに独自の要素を追加する拡張性が備わっています。
CGNS ファイルの入出力ライブラリは cgnslib として提供されており、 以下の言語から利用することができます。
- C, C++
- FORTRAN
- Python
元は Boeing 社と NASA が共同で開発しましたが、現在はオープンソースの コミュニティによって機能追加やメンテナンスが行われています。
CGNS ファイルの閲覧方法¶
ここでは、iRIC により作成した CGNS ファイルを HDFView を用いて 閲覧する方法を説明します。HDFView は、フリーソフトとして 公開されているソフトウェアです。
HDFView のインストール¶
まず、HDFViewをインストールします。HDFView のインストーラは、 以下のサイトからダウンロードできます。
https://www.hdfgroup.org/downloads/index.html
HDF のホームページから、「Current Release」の リンクをクリックします。すると、様々なファイルのダウンロード画面に 移動します。ここで、適切な (64 bit or 32 bit) プラットフォームのインストーラをクリックしてダウンロードしてください。 解凍してインストーラを実行することで、 HDFViewがインストールされます。
HDFView を利用したCGNS ファイルの閲覧¶
HDFViewを起動して CGNS ファイルを閲覧します。
まず、スタートメニューから HDFView を起動します。次に、以下のメニューから、 開く CGNS ファイルを選択します。
File --> Open
HDFView では、拡張子 "*.cgn" のファイルはデフォルトでは開く対象に含まれないため、 ファイルのタイプで「すべてのファイル」を指定した上で、CGNSファイルを選択して開いて下さい。 CGNS ファイルを開いた後の HDFView の画面表示例を 図 65 に示します。
画面の左側には、CGNS ファイル内のツリー構造が表示されます。 ツリー構造で、閲覧したい項目を選択すると、画面右側に選択した項目の 内部のデータが表示されます。
リンク集¶
CGNS ファイル及び CGNS ライブラリに関する情報は、 表 227 を参照してください。
項目 | URL |
---|---|
ホームページ | http://cgns.sourceforge.net/ |
関数リファレンス | http://cgns.github.io/CGNS_docs_current/midlevel/index.html |
CGNSファイルの内部構造 | http://cgns.github.io/CGNS_docs_current/sids/index.html |
記述例集 | http://cgns.github.io/CGNS_docs_current/user/examples.html |
iRIC インストーラ作成用リポジトリへの登録¶
はじめに¶
iRIC は、インストーラの作成及びオンラインアップデートのために公開するファイルの管理を、 github というウェブサービスを利用して行っています。
ソルバ開発者は、 github に最新のソルバのファイルを登録することで、以下を行なうことが できます。
- 次回インストーラが作成される際に同梱されるソルバを更新します
- 既に iRIC をインストールしているユーザが、 オプション -> メンテナンス 機能から、 ソルバの更新版をオンラインアップデートで入手するできるようにします
この節では、ソルバ開発者が github に最新のソルバを登録する手順を説明します。
作業の流れ¶
github に最新のソルバを登録するには、以下の流れで作業を行います。
- Subversion のクライアントのインストール (初回のみ)
- サーバからのフォルダの取得 (チェックアウト)
- 新しいファイルのコピー
- 新しいファイルのサーバへの登録 (コミット)
github へのファイルの登録は、 Subversion と git の2つのバージョン管理システム を使って行なうことができますが、ここでは操作の簡単な Subversion を 利用した場合の手順をご説明します。
以下で、詳しい手順を説明します。
Subversion のクライアントのインストール (初回のみ)¶
インストール¶
Subversion に関連した操作を行うためのクライアントをインストールします。 この手順では、Windows 用の Subversion クライアントである TortoiseSVN をインストールします。
以下の URL にアクセスし、 TortoiseSVN のインストーラを入手します。
https://tortoisesvn.net/downloads.html
画面上には、 32bit版 OS用と 64bit版 OS用の2つのダウンロード用ボタンがあります。お使いの環境 に合わせて適切なインストーラをダウンロードして下さい。
日本語でお使いになりたい場合は、画面の少し下にある Language packs を追加でインストールすること で、メニューが日本語になります。"Japanese" という行の "Setup" リンクをクリックして ダウンロードしてください。
インストーラがダウンロードできたら、まずは TortoiseSVN 本体、その後 Language pack の順番で インストールして下さい。
インストールが完了したら、一度 Windows を再起動します。
サーバからのフォルダの取得 (チェックアウト)¶
https://github.com/i-RIC/online_update.git/trunk/dev_src/packages 以下のフォルダのうち、更新したいソルバが含まれているフォルダをチェックアウトします。
例えば、 FaSTMECH なら以下のフォルダをチェックアウトします。
https://github.com/i-RIC/online_update.git/trunk/dev_src/packages/solver.fastmech
以下では、 FaSTMECH のフォルダを取得する際の例を示します。
サーバからのフォルダの取得¶
TortoiseSVN を利用して、サーバからフォルダを取得します。
上記で作成したフォルダをエクスプローラで選択し、右クリックメニューから以下を選択します。
SVN チェックアウト
すると、 図 67 に示すダイアログが表示されます。
「リポジトリのURL」欄に、以下の URL を入力します。
https://github.com/i-RIC/online_update.git/trunk/dev_src/packages
その後、その右にある「...」ボタンを押します。すると、 図 68 に示すダイアログが表示されます。
このダイアログで、自分が更新したいソルバが含まれているフォルダ (今回の例なら "solver.fastmech") を選択し、「OK」ボタンを押します。 すると、「リポジトリのURL」 が更新されます。
図 67 に示すダイアログで、 「リポジトリのURL」「チェックアウト先のディレクトリ」が正しく設定されている ことを確認したら、「OK」ボタンを押します。すると、 図 69 に示すようなダイアログが 表示され、フォルダ内のファイルの取得が始まります。
ファイルの取得が完了すると、エクスプローラでは 図 70 に示すように表示されます。 チェックアウトされたファイルの横には、チェックマークのついたアイコンが表示されます。
新しいファイルのコピー¶
チェックアウトしたフォルダに、インストーラに同梱したいファイルをコピーします。 ファイルをコピーすると、ファイルの横のアイコンが以下のようになります。
- 上書きされたファイルの横には、「!」マークのついたアイコンが表示されます
- 新しくコピーされたファイルの横には、アイコンにマークが表示されません
新しくコピーされたファイルをサーバに送信するには、ファイルを右クリックして、 右クリックメニューから以下を選択します。
TortoiseSVN --> 追加
追加を行うと、ファイルの横に「+」マークが表示されます。
"Fastmech.exe" を上書きし、 "newdll.dll" を追加した後のエクスプローラの表示例を 図 71 に示します。
ご注意
ソルバの更新をする時は、ソルバの実行ファイルなどを更新するだけでなく、 definition.xml に記述されたバージョン番号も更新してください。 これは、バージョン番号が変わっていないと、 iRIC メンテナンスが ファイルが更新されていることを認識できないためです。
バージョン番号は definition.xml の SolverDefinition 要素で、 version という 名前の属性で指定されています。
ご利用にあたって¶
- 本ソフトウェアを利用した成果を用いて論文、報告書、記事等の出版物を作成する場合は、 本ソフトウェアを使用したことを適切な位置に示してください。
- iRICサイトで提供している河川の地形データなどはサンプルデータであり、 実際のものとは異なる場合があります。あくまでもテスト用としてご試用下さい。
- ご感想、ご意見、ご指摘は http://i-ric.org にて受け付けております。