FF508 ポスト処理関数-データ入出力
 
 ◆ 概要 ◆

FieldView固有の機能へのアクセスを提供するポスト処理関数について説明します。ここでは、ポスト処理関数のうち、データ入出力を行う関数について説明します。
※関数の入力引数としてリストされたテーブルの値は、必ずしも必要ではありません。ほとんどの場合、入力にフィールドが指定されていない場合、そのフィールドのデフォルト値が使用されます。

 ◆ 詳細 ◆
 

データ入出力

read_dataset(data_input_table)
この関数はデータセットの読み込みに使用します。PLOT-3D、FV-UNS(FV-UNS分割フォーマットとFV-UNS統合フォーマットフォーマットの両方)および他の多くの商用ソルバーから出力されたフォーマットをサポートしています。いくつかの例を以下に示します。入力引数はテーブルdata_input_tableです。

データセット全体の読み込みが成功した場合、dataset_info_tableを返します。それ以外の場合は、nilとエラーを説明する文字列を返します。dataset_info_table書式の記述については、print_dataset_table(dataset_info_table)を参照してください。

data_input_table形式は読み込むファイル形式に依存します。

data_formatフィールドはユーザー定義のリーダーをサポートします。ユーザーはリーダーのタイプ(統合または分割)に従って入力テーブルを作成する必要があります。data_formatの値は登録されたリーダー名(つまり、File → Data Inputメニューに表示される名前)と一致していなければなりません。リーダー名では、大文字と小文字が区別され、スペースも使用できます(例えば、“My Reader”など)。FVXの値は末尾のスペースを持つべきではありません。そのため、FieldViewはユーザー定義のリーダーが登録されるときに、その名前の末尾にスペースがあれば削除します。

次にダイレクトリーダーとFV-UNSを含む統合フォーマット(グリッドと結果を含む単一ファイル)の場合のdata_input_tableについて説明します。ダイレクトリーダーはAcuSolve、CGNS、FLOW-3D、FLUENT、GENERIC、LS-DYNA、OpenFOAM、SC/Tetra、scSTREAM、STL、VTK、XDBのデータを読み込むことができます。これらの詳細については、リファレンスマニュアルの第1章を参照してください。

data_formatフィールドは、FV-UNS統合フォーマットとFV-UNS分割フォーマットの両方とも“unstructured”と指定しますが、input_parametersサブテーブルの構造は両者で異なります。

File → Data Inputメニューには、FV-UNSファイルに加えてFV-UNSファイルを出力する商用ソルバーが並んでいます。これらの商用ソルバーにはAcusim、ANSYS-CFX、CFD++、COBALT、FLUENT、STAR-CD、STAR-CCM+が含まれます。data_formatフィールドにこれらのソルバーを明示的に指定してもdata_input_tableは機能します。あるいはdata_formatフィールドに簡単に“unstructured”と指定しても機能します。

data_input_table
統合フォーマット(グリッドと結果を含む単一ファイル)
入力フィールド データ型 コメント デフォルト値
data_format string “unstructured”,
“acusolve_direct”,
“acusolve_unstructured”,
“ansys-cfx_unstructured”,
“cfd++_unstructured”,
“cgns_structured”, “cgns_unstructured”,
“cgns_unstructured/hybrid”,
“cobalt_unstructured”,
“flow-3d animation”, “flow-3d restart”,
“fluent_direct”, “fluent_unstructured”,
“generic_unstructured”,
“lsdyna”, “lsdyna_d3plot”,
"openfoam",
“sc_stream”, “sc_tetra”,
“starccm_unstructured”,
“starcd_unstructured”,
“stl”,
“vtk_structured”,
“vtk_unstructured/hybrid”,
"xdb_import"
n/a
server_config string 拡張子.srvを除いたサーバーコンフィグファイル名  
server_append string “on” または “off” “off”
input_parameters table   n/a
name string 入力データファイル名 n/a
options table   n/a
input_mode string “replace” または “append” “replace”
transient string “on” または “off” “off”
boundary_only string “on” または “off” “off”
grid_processing string “less”, “more” または “balanced” “balanced”
initial_time_step string または number ‘first’, ‘last’, または <整数>
data_formatが“acusolve_direct”、“flow-3d animation”、“flow-3d restart”または“openfoam”以外では無視されます。 initial_solution_timeおよび/またはinitial_time_indexが存在する場合、こちらが優先します。
‘first’
initial_solution_time string または number ‘first’, ‘last’, または <整数>
data_formatが“acusolve_direct”、“flow-3d animation”、“flow-3d restart”または“openfoam”以外では無視されます。 initial_time_indexが存在する場合は優先され、initial_time_stepが存在する場合は無視されます。
‘first’
initial_time_index string または number ‘first’, ‘last’, または <整数>
data_formatが“acusolve_direct”、“flow-3d animation”、“flow-3d restart”または“openfoam”以外では無視されます。 initial_time_stepまたはinitial_solution_timeが存在する場合は無視されます。データ読み込み時にタイムステップとソリューションタイムの実際の値が分からない場合は、このフィールドを使用します。
‘first’
read_as_steady_state string “on” または “off”
data_formatが"acusolve_direct"、"flow-3d animation"、"flow-3d restart"または"openfoam"以外では無視されます。
“off”
extended_variables string “on” または “off”
data_formatが“acusolve_direct”以外の場合は無視されます。
“off”
duplicate_boundaries string “on” または “off”
data_formatが“acusolve_direct”以外の場合は無視されます。 注:FieldView 15.1は、古いバージョンと比較して重複すう境界に対するデフォルトのFVX動作に変更があり、導入されました。
“off”

例:

data_input_table = {

  data_format = "unstructured",
  input_parameters = {

    -- combined grid and results file
    name = "combinedfile.uns",

    options = {
      input_mode = "replace",
      transient = "off"
    }
  }
}
read_dataset(data_input_table)

例:

data_input_table = {
  data_format = "lsdyna",
  input_parameters = {

    name = "d3plot"
  } -- input_parameters
}
read_dataset(data_input_table)

FVXはXDBファイルのインポートを完全にサポートします。以下にXDB読み込みのサンプルFVXを示します。

local dataset_1_info_table = read_dataset( {
    data_format = "xdb_import",
    input_parameters = {
        name = "/usr3/xdb/spitfire.xdb",
        options = {
            input_mode = "replace",
            boundary_only = "off"
        } -- options
    } -- input_parameters
} ) -- read_dataset

次に、FV-UNS分割フォーマット、NPARC/WINDおよびWIND USフォーマットを含む、分割フォーマット(グリッドと結果が別ファイル)の場合のdata_input_tableについて説明します。

data_formatフィールドは、FV-UNS統合フォーマットとFV-UNS分割フォーマットの両方とも“unstructured”と指定しますが、input_parametersサブテーブルの構造は両者で異なります。

data_input_table
分割フォーマット(グリッドと結果が別ファイル)
入力フィールド データ型 コメント デフォルト値
data_format string “unstructured”,
“nparc/wind”,
“acusolve_unstructured”,
“ansys-cfx_unstructured”,
“cfd++_unstructured”,
“cobalt_unstructured”,
“fluent_cas/dat_direct”, “fluent_unstructured”,
“starcd_unstructured”,
“starccm_unstructured”,
"wind_structured",
"wind_unstructured"
n/a
server_config string 拡張子.srvを除いたサーバーコンフィグファイル名  
server_append string “on” または “off” “off”
input_parameters table   n/a
grid_file table   n/a
name string FV-UNS、NPARC/WINDのグリッドファイル名 n/a
options table   n/a
input_mode string “replace” または “append” “replace”
transient string “on” または “off” “off”
boundary_only string “on” または “off” “off”
grid_processing string “less”, “more” または “balanced” results_fileのoptionsサブテーブルに存在する場合は無視されます(存在する場合はエラーになりますが、無効な値に設定されます) “balanced”
results_file table   n/a
name string FV-UNS、NPARC/WINDの結果ファイル名 ‘first’
options table   n/a
input_mode string “replace” または “append” “replace”
transient string “on” または “off” “off”

例:

data_input_table = {

  data_format = "unstructured",
  -- data_format = "nparc/wind",
  input_parameters = {   

    -- grid file information
    grid_file = {
      name = "gridfile.uns",
      options = {
        input_mode = "replace",
        transient = "off"
      }
    },-- end grid file information

    -- results file information
    results_file = {
      name = "resultsfile.uns",
      options = {
      input_mode = "replace",
      transient = "off"
      }
    }-- end results file information

  }-- end input parameters

}-- end data_input_table

read_dataset(data_input_table)

次に、PLOT3DとOVERFLOW-2フォーマットのdata_input_tableは以下の通りです。

data_input_table
PLOT3Dフォーマット / OVERFLOW-2フォーマット
入力フィールド データ型 コメント デフォルト値
data_format string “plot3d” または “overflow-2”
注: "plot3d"と"overflow-2"を使用して同じデータを読み取ると、FieldViewに異なるデータテーブルと異なる関数名が表示されます。
n/a
server_config string 拡張子.srvを除いたサーバーコンフィグファイル名  
server_append string “on” または “off” “off”
input_parameters table   n/a
auto_detect string “on” または “off” “off”
xyz_file table    
name string 入力xyzデータファイル名  
options table plot3d_or_overflow-2_options  
grid_point_increment number   “1”
q_file table    
name string 入力qファイル名  
options table plot3d_or_overflow-2_options  
function_file table    
name string 入力ファンクションファイル名  
options table plot3d_or_overflow-2_options  
names_filename string オプション  
plot3d_or_overflow-2_options
data_input_table中のテーブルフィールドinput_parametersのoptionsフィールドの指定です。
入力フィールド データ型 コメント デフォルト値
format string “binary”, “formatted”, “unformatted” または “dp_unformatted” n/a
input_mode string “append” または “replace” “replace”
coord string 座標系の次元: “2d” or “3d” “3d”
multi_grid string “on” または “off” “off”
iblanks string “on” または “off” “off”
transient string “on” または “off” “off”
grid_processing string “less”, “more” または “balanced”
q_fileまたはfunction_fileのoptionsサブテーブルに存在する場合は無視されます(存在する場合はエラーになりますが、無効な値に設定されます)
“balanced”

例:

--set data file options
plot3d_or_overflow-2_options = {
  format= "binary",-- default: binary
  --format= "dp_unformatted",--double precision unformatted
  input_mode= "replace",-- default: replace
  coords= "3d",-- default: 3d
  multi_grid= "on",-- default: off
  iblanks= "on",-- default: off
  transient= "off",-- default: off
}

--prepare argument data_input_table
data_input_table = {

  data_format = "plot3d",
  input_parameters = {

    --xyz file information
    xyz_file = {
    name = "impeller3_xyz",
    grid_point_increment = 1,
    options = plot3d_or_overflow-2_options,     },

    --q file information
    q_file = {
    name = "impeller3_abs.q",
    options = plot3d_or_overflow-2_options,
    },

  }, --end input_parameters table

} --end data_input_table

--call function to read dataset
read_dataset(data_input_table)

例:

p3ddata= {
  data_format = "plot3d",
    input_parameters = {
      xyz_file = {
      name = "x.1100",
      options = {
        format="unformatted",
        multi_grid = “on”,
        iblanks = "on",
      } -- options
      },--xyz file
      q_file = {
      name = "q.1100",
      options = {
        format="unformatted",
        multi_grid = "on",
        iblanks = "on",
      } -- options
      },--q file
    }--input_parameters
}-- p3ddata
read_dataset(p3ddata)

次にOVERFLOW-2データセット読み込みの例を示します。

--Set data file options
plot3d_or_overflow-2_options = {
  format = "unformatted",
  input_mode = "replace",
  coords = "3d",
  multi_grid = "off",
  iblanks = "on",
  transient = "off",
}

--Prepare argument data_input_table
data_input_table = {
  data_format = "overflow-2",

  input_parameters = {
    --xyz file information
    xyz_file = {
      name = "grid.in",
      grid_point_increment = 1,
      options = plot3d_or_overflow-2_options,
    },

    --q file information
    q_file = {
    name = "q.gaminf",
    options = plot3d_or_overflow-2_options,
    },

  }, --end input_parameters table

} --end data_input_table

--Call function to read dataset
read_dataset(data_input_table)

最後に、データセットサンプリングツールを使用して作成されたデータセットを読み込むためのdata_input_tableについて説明します(Help → Working with FieldViewより、データセットサンプリングの項をご参照ください)。

data_input_table
Append Sampled Data
入力フィールド データ型 コメント デフォルト値
data_format string “append_sampled_data” n/a
server_config string 拡張子.srvを除いたサーバーコンフィグファイル名  
server_append string “on” または “off” “off”
input_parameters table   n/a
name string 入力データファイル名 n/a

サンプリングされたデータセットを追加できるようにするには、元となるグリッドターゲットをまずFieldViewで読み込む必要があります。これを説明する簡単な例を以下に示します。

grid_target_table = read_dataset( {
  data_format = "unstructured",
  input_parameters = {
    name = "./catheter_mod.fv",
    options = {
      input_mode = "replace",
      boundary_only = "off"
    } -- options
  } -- input_parameters
} ) -- read_dataset

sampled_dataset_table = read_dataset( {
  data_format = "append_sampled_data",
  input_parameters = {
    name = "./base_to_mod_sampled.uns"
  } -- input_parameters
} ) -- read_dataset

print_dataset_table(dataset_info_table)
read_dataset()関数が返すdataset_info_tableのテキスト出力をするための関数です。stdoutにデータセットの内容が出力されます。

dataset_info_table
このテーブルは、関数read_dataset()の出力です。ファイルから読み込んだデータセットの情報を表します。データセットの読み込みが完全に成功した場合、ステータスフィールドはnilになります。それ以外の場合は、操作の失敗を詳細に示すテーブルになります。 成功した場合、テーブルの内容詳細はread_dataset関数への入力テーブルに依存します。 テーブルの読み込みに失敗した場合、このテーブルは返されません。
入力フィールド データ型 コメント デフォルト値
data_format string   n/a
server_config string 拡張子.srvを除いたサーバーコンフィグファイル名  
server_append string “on” または “off” “off”
Id number データセット番号  
grid_file string    
results_file string 存在する場合と存在しない場合があります  
function_file string 存在する場合と存在しない場合があります  
names_file string 存在する場合と存在しない場合があります  
Cylindrical string id >0の場合、“yes” または “no” n/a
machine_axis string cylindrical=“yes”の場合、“X” または “Z”  
Transient string id >0の場合、“yes” または “no” n/a
cur_time_step number transient=“yes”の場合 n/a
has_solution_times string transient=“yes”の場合、“yes” または “no” n/a
cur_solution_time number transient=“yes”かつhas_solution_time=“yes”の場合 n/a
Rmin number cylindrical=“yes”の場合  
Rmax number cylindrical=“yes”の場合  
Tmin number cylindrical=“yes”の場合  
Tmax number cylindrical=“yes”の場合  
Xmin number cylindrical=“no” または machine_axis=“X”の場合  
Xmax number cylindrical=“no” または machine_axis=“X”の場合  
Ymin number cylindrical=“no”の場合  
Ymax number cylindrical=“no”の場合  
Zmin number cylindrical=“no” または machine_axis=“Z”の場合  
Zmax number cylindrical=“no” または machine_axis=“Z”の場合  
num_grids number データセット内のグリッドの総数  
grid_info table グリッド情報を持つテーブルのテーブル。エントリ数はnum_gridsに依存します。  
structured number “yes” または “no”  
num_nodes number    
num_cells number structured=“yes”の場合  
num_elements number structured=“yes”の場合  
imax number    
jmax number    
kmax number    
q_fsmach number data_format=“plot3d”の場合  
q_alpha number data_format=“plot3d”の場合  
q_re number data_format=“plot3d”の場合  
q_time number data_format=“plot3d”の場合  
wind_gamma number data_format=“nparc/wind”の場合  
wind_pinf number data_format=“nparc/wind”の場合  
wind_tinf number data_format=“nparc/wind”の場合  
wind_rgas number data_format=“nparc/wind”の場合  
num_regions number データセット内のリージョンの総数  
region_info table リージョン情報を持つテーブルのテーブル。エントリ数はnum_regionsに依存します。  
name string リージョン名  
revolutions_per_second number    
blades_per_row number    
period number    
num_grids number    
grid_list table リージョン内のグリッドの表:{, , ...}  

例:

--get dataset table
t = read_dataset(data_input_table)

--call print function with handle "t"
print_dataset_table(t)

・この資料の内容は予告なしに変更されることがあります。
・いかなる場合でも、この資料の内容およびその運用の結果に関しては一切の責任を負いません。
・この資料の一部または全部を無断で使用、作成することはできません。
All rights reserved by Vinas Co., Ltd.
sales@vinas.com