Class gt4_historyauto
In: gt4_historyauto.f90

gtool4 netCDF データの入出力インターフェース (大規模モデル用)

Interface of Input/Output of gtool4 netCDF data (For large models)

Note that Japanese and English are described in parallel.

gt4_historyauto モジュールは gt4_history モジュールの応用版であり, 出力変数が 10 を超えるような大規模な数値モデルを想定した, データ出力のための簡便なインターフェースを 提供します. このモジュールは以下のような特徴を持ちます.

  • 複数のファイルへの出力を行う場合, gt4_history モジュールではファイルごとに gt4_history#HistoryCreate を何度も 呼び出す必要がありましたが, このモジュールでは HistoryAutoCreate をモデル内で一度呼び出すだけで済みます.
  • 個別の変数について, 出力ファイルや出力間隔を手軽に変更可能です. 実際には, HistoryAutoAddVariable の引数もしくは, NAMELIST#gt4_historyauto_nml によって変更することが可能です.
  • gt4_history#GT_HISTORY 構造体を直接使用することなく 出力を行うことが可能となっています.

"gt4_historyauto" module is an application of "gt4_history" module, and provides data output easy-to-use interfaces for large numerical models that output 10 or more variables. This module has following features.

Procedures list

HistoryAutoCreate :初期化
HistoryAutoAddVariable :変数追加
HistoryAutoPut :データ出力
HistoryAutoProgress :時刻進行
HistoryAutoClose :終了処理
HistoryAutoPutAxis :座標データ追加
HistoryAutoAddWeight :座標重み追加
HistoryAutoAddAttr :属性追加
——————— :———————
HistoryAutoCreate :Initialization
HistoryAutoAddVariable :Addition of variables
HistoryAutoPut :Output of data
HistoryAutoProgress :Progression of time
HistoryAutoClose :Termination
HistoryAutoPutAxis :Addition of data of axes
HistoryAutoAddWeight :Addition of weights of axes
HistoryAutoAddAttr :Addition of attributes

NAMELIST

NAMELIST#gt4_historyauto_nml

Acknowledgment

Methods

AXES_WEIGHT   AverageReduceDouble1   AverageReduceDouble2   AverageReduceDouble3   AverageReduceDouble4   AverageReduceDouble5   AverageReduceDouble6   AverageReduceDouble7   AverageReduceInt1   AverageReduceInt2   AverageReduceInt3   AverageReduceInt4   AverageReduceInt5   AverageReduceInt6   AverageReduceInt7   AverageReduceReal1   AverageReduceReal2   AverageReduceReal3   AverageReduceReal4   AverageReduceReal5   AverageReduceReal6   AverageReduceReal7   GT_HISTORY_AXIS_DATA   GT_HISTORY_DUMMY   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttr   HistoryAutoAddAttrChar0   HistoryAutoAddAttrDouble0   HistoryAutoAddAttrDouble1   HistoryAutoAddAttrInt0   HistoryAutoAddAttrInt1   HistoryAutoAddAttrLogical0   HistoryAutoAddAttrReal0   HistoryAutoAddAttrReal1   HistoryAutoAddVariable   HistoryAutoAddVariable1   HistoryAutoAddWeight   HistoryAutoAddWeight   HistoryAutoAddWeight   HistoryAutoAddWeightDouble   HistoryAutoAddWeightInt   HistoryAutoAddWeightReal   HistoryAutoClose   HistoryAutoClose1   HistoryAutoCreate   HistoryAutoCreate1   HistoryAutoProgress   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPut   HistoryAutoPutAxis   HistoryAutoPutAxis   HistoryAutoPutAxis   HistoryAutoPutAxisDouble   HistoryAutoPutAxisInt   HistoryAutoPutAxisReal   HistoryAutoPutDouble0   HistoryAutoPutDouble1   HistoryAutoPutDouble2   HistoryAutoPutDouble3   HistoryAutoPutDouble4   HistoryAutoPutDouble5   HistoryAutoPutDouble6   HistoryAutoPutDouble7   HistoryAutoPutInt0   HistoryAutoPutInt1   HistoryAutoPutInt2   HistoryAutoPutInt3   HistoryAutoPutInt4   HistoryAutoPutInt5   HistoryAutoPutInt6   HistoryAutoPutInt7   HistoryAutoPutReal0   HistoryAutoPutReal1   HistoryAutoPutReal2   HistoryAutoPutReal3   HistoryAutoPutReal4   HistoryAutoPutReal5   HistoryAutoPutReal6   HistoryAutoPutReal7   HstFileCreate   HstVarsOutputCheck   MAX_DIMS_DEPENDED_BY_VAR   Nstep   SLICE_INFO   SPACE_AVR_INFO   all_output_save   conventions_save   current_difftime   data_axes   data_weights   delta_difftime   deltime_value_vars   gt_version_save   gthst_axes   gthst_history_vars   gthst_vars   gthst_weights   gthstnml   initialized   institution_save   intstep_vars   max_remainder_range   newfile_intstep_vars   numdims   numvars   numwgts   once_progressed   origin_value_vars   originstep_vars   output_timing_vars   output_valid_vars   rank_save   slice_vars   source_save   space_avr_vars   start_difftime   sub_sname   tavr_vars   terminusstep_vars   time_unit_bycreate   title_save   varname_vars   version   weight_vars   wgtsuf  

Included Modules

gt4_history gt4_history_nmlinfo netcdf_f77 dc_date_types dc_types dc_trace dc_error dc_string dc_present dc_date dc_message dc_iounit

Public Instance methods

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
: 変数の名前.

ここで指定するものは, HistoryAutoCreatedims , または HistoryAutoAddWeightvarname で既に指定されてい なければなりません.

Name of a variable.

This must be specified with dims in HistoryAutoCreate, or varname in "HistoryAutoAddWeight".

attrname :character(*), intent(in)
: 属性の名前. Name of an attribute.
value :character(*), intent(in)
: 属性の値. Value of an attribute.

座標変数および座標重み変数に属性を付加します. このサブルーチンを用いる前に, HistoryAutoCreate による初期設定が 必要です.

  • 座標変数については, HistoryAutoCreate の "dims" に与えられた もののみ指定可能です.
  • 座標重み変数については, HistoryAutoAddWeight で与えられた もののみ指定可能です.
  • HistoryAutoAddAttr は複数のサブルーチンの総称名です. value にはいくつかの型を与えることが可能です. 下記のサブルーチンを参照ください.

Add attributes axes or weights of axes. Initialization by "HistoryAutoCreate" is needed before use of this subroutine.

Alias for HistoryAutoAddAttrChar0

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :integer, intent(in)

Alias for HistoryAutoAddAttrInt0

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :logical, intent(in)

Alias for HistoryAutoAddAttrLogical0

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :real(DP), intent(in)

Alias for HistoryAutoAddAttrDouble0

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value :real, intent(in)

Alias for HistoryAutoAddAttrReal0

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :integer, intent(in)

Alias for HistoryAutoAddAttrInt1

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :real(DP), intent(in)

Alias for HistoryAutoAddAttrDouble1

HistoryAutoAddAttr( varname, attrname, value )
Subroutine :
varname :character(*), intent(in)
attrname :character(*), intent(in)
value(:) :real, intent(in)

Alias for HistoryAutoAddAttrReal1

HistoryAutoAddVariable( varname, dims, longname, units, [xtype], [time_units], [time_average], [file], [origin], [terminus], [interval], [slice_start], [slice_end], [slice_stride], [space_average], [newfile_interval] )
Subroutine :
varname :character(*), intent(in)
: 変数名. Variable name
dims(:) :character(*), intent(in)
: 変数が依存する次元の名前. 時間の次元は配列の最後に指定すること.

Names of dependency dimensions of a variable. Dimension of time must be specified to last of an array.

longname :character(*), intent(in)
: 変数の記述的名称.

Descriptive name of a variable

units :character(*), intent(in)
: 変数の単位.

Units of a variable

xtype :character(*), intent(in), optional
: 変数のデータ型

デフォルトは float (単精度実数型) であ る. 有効なのは, double (倍精度実数型), int (整数型) である. 指定しない 場合や, 無効な型を指定した場合には, float (単 精度実数型) となる.

Data types of dimensions specified with "dims".

Default value is "float" (single precision). Other valid values are "double" (double precision), "int" (integer). If no value or invalid value is specified, "float" is applied.

time_units :character(*), intent(in), optional
: 時刻次元の単位. Units of time dimension.
time_average :logical, intent(in), optional
: 出力データを時間平均する場合には .true. を与えます. デフォルトは .false. です.

If output data is averaged, specify ".true.". Default is ".false.".

file :character(*), intent(in), optional
: 出力ファイル名. Output file name.
origin :real, intent(in), optional
: 出力開始時刻.

省略した場合, 自動的に current_time の値が 設定されます.

Start time of output.

If this argument is omitted, a value of "current_time" is specified automatically.

terminus :real, intent(in), optional
: 出力終了時刻.

省略した場合, 数値モデルの実行が終了するまで 出力を行います.

End time of output.

If this argument is omitted, output is continued until a numerical model is finished.

interval :real, intent(in), optional
: 出力時間間隔.

省略した場合, 自動的に delta_time の値が設定されます.

Interval of output time.

If this argument is omitted, a value of "delta_time" is specified automatically.

slice_start(:) :integer, intent(in), optional
: 空間方向の開始点.

省略した場合, 座標データの開始点が設定されます.

Start points of spaces.

If this argument is omitted, start points of dimensions are set.

slice_end(:) :integer, intent(in), optional
: 空間方向の終了点.

省略した場合, 座標データの終了点が設定されます.

End points of spaces.

If this argument is omitted, End points of dimensions are set.

slice_stride(:) :integer, intent(in), optional
: 空間方向の刻み幅.

省略した場合, 1 が設定されます.

Strides of spaces

If this argument is omitted, 1 is set.

space_average(:) :logical, intent(in), optional
: 平均化のフラグ.

.true. が指定される座標に対して平均化を 行います. 省略した場合, .false. が設定されます.

Flag of average.

Axes specified .true. are averaged. If this argument is omitted, .false. is set.

newfile_interval :integer, intent(in), optional
: ファイル分割時間間隔.

省略した場合, 時間方向へのファイル分割を行いません.

Interval of time of separation of a file.

If this argument is omitted, a files is not separated in time direction.

ヒストリデータ出力するための変数登録を行います.

HistoryAutoProgress を呼ぶ前にこのサブルーチンを使用してください.

Register variables for history data output

Use this subroutine before "HistoryAutoProgress" is called.

Alias for HistoryAutoAddVariable1

HistoryAutoAddWeight( dim, weight, [units], [xtype] )
Subroutine :
dim :character(*), intent(in)
: 座標重みを設定する座標の名称.

ただし, ここで指定するもの は, HistoryAutoCreatedims 既に指定されていなければなりません.

Name of axis to which "weight" are set.

Note that this value must be set as "dims" of "HistoryAutoCreate".

weight(:) :integer, intent(in)
: 座標重みデータ.

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, xtype もしくは座標データの型へと 変換されます.

Weight of axis.

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtype" or type of the axis.

units :character(*), intent(in), optional
: 座標重みの単位. 省略した場合には, 座標の単位が 使用されます.

Units of axis weight. If this argument is omitted, unit of the dimension is used.

xtype :character(*), intent(in), optional
: 座標重みのデータ型. 省略した場合には, 座標のデータ型が 使用されます.

Data type of weight of the dimension. If this argument is omitted, data type of the dimension is used.

座標の重みデータを設定します.

Set weights of axes.

Alias for HistoryAutoAddWeightInt

HistoryAutoAddWeight( dim, weight, [units], [xtype] )
Subroutine :
dim :character(*), intent(in)
: 座標重みを設定する座標の名称.

ただし, ここで指定するもの は, HistoryAutoCreatedims 既に指定されていなければなりません.

Name of axis to which "weight" are set.

Note that this value must be set as "dims" of "HistoryAutoCreate".

weight(:) :real(DP), intent(in)
: 座標重みデータ.

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, xtype もしくは座標データの型へと 変換されます.

Weight of axis.

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtype" or type of the axis.

units :character(*), intent(in), optional
: 座標重みの単位. 省略した場合には, 座標の単位が 使用されます.

Units of axis weight. If this argument is omitted, unit of the dimension is used.

xtype :character(*), intent(in), optional
: 座標重みのデータ型. 省略した場合には, 座標のデータ型が 使用されます.

Data type of weight of the dimension. If this argument is omitted, data type of the dimension is used.

座標の重みデータを設定します.

Set weights of axes.

Alias for HistoryAutoAddWeightDouble

HistoryAutoAddWeight( dim, weight, [units], [xtype] )
Subroutine :
dim :character(*), intent(in)
: 座標重みを設定する座標の名称.

ただし, ここで指定するもの は, HistoryAutoCreatedims 既に指定されていなければなりません.

Name of axis to which "weight" are set.

Note that this value must be set as "dims" of "HistoryAutoCreate".

weight(:) :real, intent(in)
: 座標重みデータ.

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, xtype もしくは座標データの型へと 変換されます.

Weight of axis.

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtype" or type of the axis.

units :character(*), intent(in), optional
: 座標重みの単位. 省略した場合には, 座標の単位が 使用されます.

Units of axis weight. If this argument is omitted, unit of the dimension is used.

xtype :character(*), intent(in), optional
: 座標重みのデータ型. 省略した場合には, 座標のデータ型が 使用されます.

Data type of weight of the dimension. If this argument is omitted, data type of the dimension is used.

座標の重みデータを設定します.

Set weights of axes.

Alias for HistoryAutoAddWeightReal

HistoryAutoClose( )
Subroutine :

HistoryAutoCreate で始まったデータ出力の終了処理を行います. プログラムを終了する前に必ずこのサブルーチンを呼んでください.

Terminates data output with "HistoryAutoCreate". Call this subroutine certainly before a progrem is finished.

Alias for HistoryAutoClose1

HistoryAutoCreate( title, source, institution, dims, dimsizes, longnames, units, [xtypes], [conventions], [gt_version], [all_output], [file_prefix], [namelist_filename], [current_time], [delta_time], [interval], [origin], [terminus], [slice_start], [slice_end], [slice_stride], [space_average], [time_average], [newfile_interval], [rank] )
Subroutine :
title :character(*), intent(in)
: データ全体の表題. Title of entire data
source :character(*), intent(in)
: データを作成する際の手段. Source of data file
institution :character(*), intent(in)
: ファイルを最終的に変更した組織/個人. Institution or person that changes files for the last time
dims(:) :character(*), intent(in)
: 次元の名前.

配列の大きさに制限はありません. 個々の次元の文字数は dc_types#TOKEN まで. 配列内の文字数は 全て同じでなければなりません. 足りない文字分は空白で 補ってください.

Names of dimensions.

Length of array is unlimited. Limits of numbers of characters of each dimensions are "dc_types#TOKEN". Numbers of characters in this array must be same. Make up a deficit with blanks.

dimsizes(:) :integer, intent(in)
: dims で指定したそれぞれの次元大きさ.

配列の大きさは dims の大きさと等しい 必要があります. ‘0’ (数字のゼロ) を指定 するとその次元は 無制限次元 (unlimited dimension) となります. (gt4_history では時間の次元に対して無制限次元を 用いることを想定しています). ただし, 1 つの NetCDF ファイル (バージョン 3) は最大で 1 つの無制限次元しか持てないので, 2 ヶ所以上に ‘0’ を指定しないでください. その場合, 正しく gtool4 データが出力されません.

Lengths of dimensions specified with "dims".

Length of this array must be same as length of "dim". If ‘0’ (zero) is specified, the dimension is treated as unlimited dimension. (In "gt4_history", unlimited dimension is expected to be used as time). Note that one NetCDF file (version 3) can not have two or more unlimited dimensions, so that do not specify ‘0’ to two or more places. In that case, gtoo4 data is not output currently

longnames(:) :character(*), intent(in)
: dims で指定したそれぞれの次元の名前.

配列の大きさは dims の大きさ と等しい必要があります. 文字数 は dc_types#STRING まで. 配列内の文字数は 全て同じでなければなりません. 足りない文字分は空白で補います.

Names of dimensions specified with "dims".

Length of this array must be same as length of "dim". Limits of numbers of characters are "dc_types#STRING". Numbers of characters in this array must be same. Make up a deficit with blanks.

units(:) :character(*), intent(in)
: dims で指定したそれぞれの次元の単位.

配列の大きさは dims の大きさ と等しい必要があります. 文字数 は dc_types#STRING まで. 配列内の文字数は 全て同じでなければなりません. 足りない文字分は空白で補います.

Units of dimensions specified with "dims".

Length of this array must be same as length of "dim". Limits of numbers of characters are "dc_types#STRING". Numbers of characters in this array must be same. Make up a deficit with blanks.

xtypes(:) :character(*), intent(in), optional
: dims で指定したそれぞれの 次元のデータ型.

デフォルトは float (単精度実数型) です. 有効なのは, double (倍精度実数型), int (整数型) です. 指定しない 場合や, 無効な型を指定した場合には, float となります. なお, 配列の大きさ は dims の大きさと等しい必要が あります. 配列内の文字数は全て 同じでなければなりません. 足りない文字分は空白で補います.

Data types of dimensions specified with "dims".

Default value is "float" (single precision). Other valid values are "double" (double precision), "int" (integer). If no value or invalid value is specified, "float" is applied. Length of this array must be same as length of "dim". Numbers of characters in this array must be same. Make up a deficit with blanks.

conventions :character(*), intent(in), optional
: 出力するファイルの netCDF 規約

省略した場合, もしくは空文字を与えた場合, 出力する netCDF 規約の Conventions 属性に値 gtool4_netCDF_Conventions が自動的に与えられます.

NetCDF conventions of output file.

If this argument is omitted or, blanks are given, gtool4_netCDF_Conventions is given to attribute "Conventions" of an output file automatically.

gt_version :character(*), intent(in), optional
: gtool4 netCDF 規約のバージョン

省略した場合, gt_version 属性に 規約の最新版のバージョンナンバー gtool4_netCDF_version が与えられます. (ただし, 引数 conventions に gtool4_netCDF_Conventions 以外が与えられる場合は gt_version 属性を作成しません).

Version of gtool4 netCDF Conventions.

If this argument is omitted, latest version number of gtool4 netCDF Conventions is given to attribute "gt_version" of an output file (However, gtool4_netCDF_Conventions is not given to an argument "conventions", attribute "gt_version" is not created).

all_output :logical, intent(in), optional
: 登録変数を全て出力するためのフラグ.

.true. を指定すると, HistoryAutoAddVariable で登録された 変数が全て出力されるようになります.

namelist_filename が指定される場合 には, デフォルトは .false. となります. この場合には, namelist_filename に指定された NAMELIST ファイルから読み込まれる NAMELIST#gt4_historyauto_nml で指定された変数のみ出力されます.

namelist_filename が指定されない場合 には, .true. となります.

Flag for output all registered variables.

When .true. is specified, all variables registered by "HistoryAutoAddVariable" are output.

If namelist_filename is specified, default value becomes .false. . In this case, only variables specified in "NAMELIST#gt4_historyauto_nml" loaded from a NAMELIST file namelist_filename.

If namelist_filename is not specified, this value becomes .true. .

file_prefix :character(*), intent(in), optional
: ヒストリデータのファイル名の接頭詞. Prefixes of history data filenames
namelist_filename :character(*), intent(in), optional
: NAMELIST ファイルの名称.

省略した場合, もしくは空白文字を与えた場合, NAMELIST ファイルは読み込みません.

Name of NAMELIST file.

If this argument is omitted, or blanks are specified, no NAMELIST file is loaded.

current_time :real, intent(in), optional
: 数値モデル内の現在時刻 (単位: 秒).

省略した場合, 自動的にゼロが設定されます.

Current time in a numerical model (unit: seconds).

If this argument is omitted, zero is set automatically.

delta_time :real, intent(in), optional
: 数値モデル内のタイムステップ (単位: 秒).

省略した場合, 自動的に 1.0 が設定されます.

Time step in a numerical model (unit: seconds).

If this argument is omitted, 1.0 is set automatically.

interval :real, intent(in), optional
: 出力時間間隔.

省略した場合, 自動的に delta_time の値が設定されます.

Interval of output time.

If this argument is omitted, a value of "delta_time" is specified automatically.

origin :real, intent(in), optional
: 出力開始時刻.

省略した場合, 自動的に current_time の値が 設定されます.

Start time of output.

If this argument is omitted, a value of "current_time" is specified automatically.

terminus :real, intent(in), optional
: 出力終了時刻.

省略した場合, 数値モデルの実行が終了するまで 出力を行います.

End time of output.

If this argument is omitted, output is continued until a numerical model is finished.

slice_start(:) :integer, intent(in), optional
: 空間方向の開始点.

省略した場合, 座標データの開始点が設定されます.

Start points of spaces.

If this argument is omitted, start points of dimensions are set.

slice_end(:) :integer, intent(in), optional
: 空間方向の終了点.

省略した場合, 座標データの終了点が設定されます.

End points of spaces.

If this argument is omitted, End points of dimensions are set.

slice_stride(:) :integer, intent(in), optional
: 空間方向の刻み幅.

省略した場合, 1 が設定されます.

Strides of spaces

If this argument is omitted, 1 is set.

space_average(:) :logical, intent(in), optional
: 平均化のフラグ.

.true. が指定される座標に対して平均化を 行います. 省略した場合, .false. が設定されます.

Flag of average.

Axes specified .true. are averaged. If this argument is omitted, .false. is set.

time_average :logical, intent(in), optional
: 出力データの時間平均フラグ. デフォルトは .false. Flag for time average of output data Default value is .false.
newfile_interval :integer, intent(in), optional
: ファイル分割時間間隔.

省略した場合, 時間方向へのファイル分割を行いません.

Interval of time of separation of a file.

If this argument is omitted, a files is not separated in time direction.

rank :character(*), intent(in), optional
: ランクの名称.

Name of a rank.

複数のヒストリデータ出力を行うための初期化を行います.

この HistoryAutoCreate には, モデル内で出力する 変数が依存する座標や座標重みなどを全てを設定してください.

all_output に .true. を与えた場合や, namelist_filename を与えない (空文字を与える) 場合には, HistoryAutoAddVariable で登録される全ての変数が出力されます. 一方で namelist_filename に NAMELIST ファイル名を与える場合には, その NAMELIST ファイルから出力のオンオフや, 出力ファイル名, 出力間隔などを変更可能です. 変更可能な項目に関しては NAMELIST#gt4_historyauto_nml を参照して下さい.

interval, origin, terminus, slice_start, slice_end, slice_stride, space_average, time_average, newfile_interval などの設定はデフォルト値として使用されます. これらの設定値は HistoryAutoAddVariable および NAMELIST#gt4_historyauto_nml で上書きされます. (優先度が高いのは NAMELIST#gt4_historyauto_nml , HistoryAutoAddVariable の引数, HistoryAutoCreate の引数 の順です).

Initialization for multiple history data output

Set all axes and their weights depended by variables output from numerical models to this "HistoryAutoCreate".

All variables registered by "HistoryAutoAddVariable" are output if .true. is given to "all_output" or "namelist_filename" is not given (or blanks are given) On the other hand, if a filename of NAMELIST file is given to "namelist_filename", on/off of output, output filename and output interval, etc. can be changed from the NAMELIST file. For available items, see "NAMELIST#gt4_historyauto_nml".

Settings about "interval", "origin", "terminus", "slice_start", "slice_end", "slice_stride", "space_average", "time_average", "newfile_interval" etc. are used as default values. Their set values are overwritten by "HistoryAutoAddVariable" or "NAMELIST#gt4_historyauto_nml". ("NAMELIST#gt4_historyauto_nml" is high priority, arguments of "HistoryAutoAddVariable" are medium, arguments of "HistoryAutoCreate" are low).

This procedure input/output NAMELIST#gt4_historyauto_nml .

Alias for HistoryAutoCreate1

Subroutine :

時刻を進めます.

時刻は HistoryAutoCreate の delta_time で指定された分 (省略した場合は 1.0) だけ進みます.

HistoryAutoAddVariable はサブルーチンを呼ぶ前に, 使用してください.

一度目に呼んだ際には, 以下の事を行います.

  • NAMELIST から読み込んだ値に無効なものが存在したかどうかをチェック
  • HistoryAutoAddVariable で登録した変数群を印字

Progress time.

Time is progressed to the extent that specified with "delta_time" of "HistoryAutoCreate" (1.0 when omitting "delta_time").

Use "HistoryAutoAddVariable" before this subroutine is called.

When this subroutine called at first, following things are done.

[Source]

  subroutine HistoryAutoProgress
    !
    ! 時刻を進めます. 
    ! 
    ! 時刻は HistoryAutoCreate の delta_time で指定された分
    ! (省略した場合は 1.0) だけ進みます. 
    !
    ! HistoryAutoAddVariable はサブルーチンを呼ぶ前に, 
    ! 使用してください. 
    !
    ! 一度目に呼んだ際には, 以下の事を行います. 
    ! 
    ! * NAMELIST から読み込んだ値に無効なものが存在したかどうかをチェック
    ! * HistoryAutoAddVariable で登録した変数群を印字
    !
    !
    ! Progress time. 
    !
    ! Time is progressed to the extent that specified with
    ! "delta_time" of "HistoryAutoCreate" (1.0 when omitting
    ! "delta_time").
    !
    ! Use "HistoryAutoAddVariable" before this subroutine is called. 
    !
    ! When this subroutine called at first, following things are done.
    ! 
    ! * Check that invalid values are loaded from NAMELIST or not. 
    ! * Print registered variables by "HistoryAutoAddVariable"
    !
    use dc_trace, only: BeginSub, EndSub
    use dc_error, only: StoreError, DC_NOERR, HST_EBADVARNAME, DC_ENOTINIT
    use dc_message, only: MessageNotify
    use dc_date, only: operator(*), operator(+)
    use dc_string, only: JoinChar
    use gt4_history, only: HistoryVarinfoInquire
    use gt4_history_nmlinfo, only: HstNmlInfoAllNameValid

    implicit none
    logical:: allvar_invalid
                              ! 無効な変数名のチェックフラグ. 
                              ! Check flag of invalid variable names. 

    integer, parameter:: names_limit = 100
    character(names_limit):: names_invalid
                              ! 無効な変数名. 
                              ! Invalid variable names. 

    character(STRING):: name, units, longname, var_info_str
    character(TOKEN), pointer:: dims(:) =>null()
    integer:: stat, i
    character(STRING):: cause_c
    character(*), parameter:: subname = "HistoryAutoProgress"
  continue
    call BeginSub(subname)
    stat = DC_NOERR
    cause_c = ""

    ! 初期設定チェック
    ! Check initialization
    !
    if ( .not. initialized ) then
      stat = DC_ENOTINIT
      cause_c = 'gt4_historyauto'
      goto 999
    end if

    ! 無効な変数名のチェック (初回のみ)
    ! Check invalid variable names (at only first time)
    !
    if ( Nstep == 0 ) then
      call HstNmlInfoAllNameValid( gthstnml = gthstnml, invalid = allvar_invalid, names = names_invalid ) ! (out)

      if ( len_trim(names_invalid) > (names_limit - 5)  ) then
        names_invalid = names_invalid(1:names_limit - 5) // ' ....'
      end if

      if ( allvar_invalid ) then
        stat = HST_EBADVARNAME
        cause_c = names_invalid
        call MessageNotify( 'W', subname, 'names "%c" from NAMELIST "gt4_historyauto_nml" are invalid.', c1 = trim(names_invalid) )
        goto 999
      end if

    end if

    ! 登録された変数の印字 (初回のみ)
    ! Print registered variables (at only first time)
    !
    if ( Nstep == 0 ) then
      call MessageNotify( 'M', sub_sname, '-------------------------------------------' )
      call MessageNotify( 'M', sub_sname, '----- Registered variables for output -----' )
      call MessageNotify( 'M', sub_sname, '-------------------------------------------' )

      do i = 1, numvars
        call HistoryVarinfoInquire( varinfo = gthst_vars(i), name = name, dims = dims, longname = longname, units = units )               ! (out) optional

        var_info_str = trim( longname ) // ' [' // trim( units ) // '] {' // trim( JoinChar( dims, ',' ) ) // '}'
        deallocate( dims )

        call MessageNotify( 'M', sub_sname, '  %c  (%c)', c1 = trim(name), c2 = trim(var_info_str) )

      end do
      call MessageNotify( 'M', sub_sname, '-----' )
    end if

    ! 時刻を進める
    ! Progress time
    !
    Nstep = Nstep + 1
    current_difftime = start_difftime + delta_difftime * Nstep

    if ( .not. once_progressed ) once_progressed = .true.

    ! 出力タイミングのチェックとファイルの作成
    ! Check output timing and create files
    !
    call HstVarsOutputCheck

999 continue
    call StoreError(stat, subname, cause_c = cause_c)
    call EndSub(subname, 'stat=%d', i = (/stat/) )
  end subroutine HistoryAutoProgress
HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
: 変数の名前.

ただし, ここで指定するものは, HistoryAutoAddVariablevarname で既に指定されてい なければなりません.

Name of a variable.

This must be specified varname in "HistoryAutoAddVariable".

array(:) :real(DP), intent(in), target
: 出力データ.

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, HistoryAutoAddVariablextypes で指定した データ型へ変換されます.

Output data.

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtype" specified in "HistoryAutoAddVariable"

err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

データの出力を行います. このサブルーチンを用いる前に, "HistoryAutoCreate" による初期設定が必要です.

varnameHistoryAutoAddVariable で指定されている必要があります.

HistoryAutoPut は複数のサブルーチンの総称名です. array には 0 〜 7 次元のデータを与えることが可能です. (下記のサブルーチンを参照ください). また, 整数, 単精度実数, 倍精度実数を与えることが可能です. ただし, 0 次元のデータを与える際の引数キーワードは value を用いてください.

Output data. Initialization by "HistoryAutoCreate" is needed before use of this subroutine.

"varname" must be specified by "HistoryAutoAddVariable".

"HistoryAutoPut" is a generic name of multiple subroutines. Then 0 — 7 dimensional data can be given to "array". (See bellow subroutines). And, integer, sinble or double precision can be given. However, if 0 dimensional data is given, use "value" as a keyword argument.

Alias for HistoryAutoPutDouble1

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt1

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal1

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt2

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:) :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble2

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal2

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt3

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:) :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble3

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal3

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt4

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:) :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble4

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal4

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt5

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:) :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble5

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal5

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:,:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt6

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:,:) :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble6

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:,:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal6

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:,:,:) :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt7

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:,:,:) :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble7

HistoryAutoPut( varname, array, [err] )
Subroutine :
varname :character(*), intent(in)
array(:,:,:,:,:,:,:) :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal7

HistoryAutoPut( varname, value, [err] )
Subroutine :
varname :character(*), intent(in)
value :integer, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutInt0

HistoryAutoPut( varname, value, [err] )
Subroutine :
varname :character(*), intent(in)
value :real(DP), intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutDouble0

HistoryAutoPut( varname, value, [err] )
Subroutine :
varname :character(*), intent(in)
value :real, intent(in), target
err :logical, intent(out), optional
: 例外処理用フラグ. デフォルトでは, この手続き内でエラーが 生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Exception handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

Alias for HistoryAutoPutReal0

HistoryAutoPutAxis( dim, array )
Subroutine :
dim :character(*), intent(in)
: 座標の名称.

ただし, ここで指定するもの は, HistoryAutoCreatedims 既に指定されていなければなりません.

Name of axis.

Note that this value must be set as "dims" of "HistoryAutoCreate".

array(:) :integer, intent(in)
: 座標データ

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, HistoryAutoCreatextypes で指定した データ型へ変換されます.

Data of axis

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtypes" specified in "HistoryAutoCreate"

座標データを設定します.

Set data of an axis.

Alias for HistoryAutoPutAxisInt

HistoryAutoPutAxis( dim, array )
Subroutine :
dim :character(*), intent(in)
: 座標の名称.

ただし, ここで指定するもの は, HistoryAutoCreatedims 既に指定されていなければなりません.

Name of axis.

Note that this value must be set as "dims" of "HistoryAutoCreate".

array(:) :real(DP), intent(in)
: 座標データ

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, HistoryAutoCreatextypes で指定した データ型へ変換されます.

Data of axis

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtypes" specified in "HistoryAutoCreate"

座標データを設定します.

Set data of an axis.

Alias for HistoryAutoPutAxisDouble

HistoryAutoPutAxis( dim, array )
Subroutine :
dim :character(*), intent(in)
: 座標の名称.

ただし, ここで指定するもの は, HistoryAutoCreatedims 既に指定されていなければなりません.

Name of axis.

Note that this value must be set as "dims" of "HistoryAutoCreate".

array(:) :real, intent(in)
: 座標データ

データ型は整数, 単精度実数型, 倍精度実数型のどれでもかまいません. ただし, ファイルへ出力される際には, HistoryAutoCreatextypes で指定した データ型へ変換されます.

Data of axis

Integer, single or double precision are acceptable as data type. Note that when this is output to a file, data type is converted into "xtypes" specified in "HistoryAutoCreate"

座標データを設定します.

Set data of an axis.

Alias for HistoryAutoPutAxisReal

Private Instance methods

AXES_WEIGHT
Derived Type :
wgt1(:) =>null() :real(DP), pointer
wgt2(:) =>null() :real(DP), pointer
wgt3(:) =>null() :real(DP), pointer
wgt4(:) =>null() :real(DP), pointer
wgt5(:) =>null() :real(DP), pointer
wgt6(:) =>null() :real(DP), pointer
wgt7(:) =>null() :real(DP), pointer

座標重み情報管理用の構造型 Derived type for information of axes weight

Subroutine :
array(:) :real(DP), intent(in), target
space_average(1) :logical, intent(in)
weight1(:) :real(DP), intent(in)
array_avr(:) :real(DP), pointer
: (out)

space_average で .true. に指定された次元に対して, array を平均化して array_avr に返します. 平均化には重み weight1 〜 weight7 が用いられます. array_avr の配列の次元そのものは減りません. その代わり, 平均化された次元の配列のサイズは 1 になります.

[Source]

  subroutine AverageReduceDouble1( array, space_average, weight1, array_avr )
    !
    ! space_average で .true. に指定された次元に対して, 
    ! array を平均化して array_avr に返します. 
    ! 平均化には重み weight1 〜 weight7 が用いられます. 
    ! array_avr の配列の次元そのものは減りません. その代わり, 
    ! 平均化された次元の配列のサイズは 1 になります. 
    !
    implicit none
    real(DP), intent(in), target:: array(:)
    logical, intent(in):: space_average(1)
                        real(DP), intent(in):: weight1(:)
                    
    real(DP), pointer:: array_avr(:) ! (out)

    real(DP), pointer:: array_avr_work(:)

                        real(DP), pointer:: array_avr_work1(:)
                    

    integer:: array_shape(1)
    integer:: i, dim_size
    real(DP):: weight_sum
  continue

    array_shape = shape( array )
    array_avr_work => array

                    
                      
                        
    if ( space_average(1) ) then
      dim_size = array_shape(1)
      array_shape(1) = 1
      allocate( array_avr_work1( array_shape(1) ) )
      array_avr_work1 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work1(1) = array_avr_work1(1) + array_avr_work(i) * weight1(i)
        weight_sum = weight_sum + weight1(i)
      end do
      array_avr_work1 = array_avr_work1 / weight_sum
      array_avr_work  => array_avr_work1
    end if

                        
                      

                    


      allocate( array_avr( array_shape(1) ) )

      array_avr = array_avr_work

      nullify( array_avr_work )

                          if ( associated( array_avr_work1 ) ) deallocate( array_avr_work1 )
                    

  end subroutine AverageReduceDouble1
Subroutine :
array(:,:) :real(DP), intent(in), target
space_average(2) :logical, intent(in)
weight1(:) :real(DP), intent(in)
weight2(:) :real(DP), intent(in)
array_avr(:,:) :real(DP), pointer
: (out)

space_average で .true. に指定された次元に対して, array を平均化して array_avr に返します. 平均化には重み weight1 〜 weight7 が用いられます. array_avr の配列の次元そのものは減りません. その代わり, 平均化された次元の配列のサイズは 1 になります.

[Source]

  subroutine AverageReduceDouble2( array, space_average, weight1, weight2, array_avr )
    !
    ! space_average で .true. に指定された次元に対して, 
    ! array を平均化して array_avr に返します. 
    ! 平均化には重み weight1 〜 weight7 が用いられます. 
    ! array_avr の配列の次元そのものは減りません. その代わり, 
    ! 平均化された次元の配列のサイズは 1 になります. 
    !
    implicit none
    real(DP), intent(in), target:: array(:,:)
    logical, intent(in):: space_average(2)
                        real(DP), intent(in):: weight1(:)
                    
    real(DP), intent(in):: weight2(:)
                    
    real(DP), pointer:: array_avr(:,:) ! (out)

    real(DP), pointer:: array_avr_work(:,:)

                        real(DP), pointer:: array_avr_work1(:,:)
                    
    real(DP), pointer:: array_avr_work2(:,:)
                    

    integer:: array_shape(2)
    integer:: i, dim_size
    real(DP):: weight_sum
  continue

    array_shape = shape( array )
    array_avr_work => array

                    
                      
                        
    if ( space_average(1) ) then
      dim_size = array_shape(1)
      array_shape(1) = 1
      allocate( array_avr_work1( array_shape(1) , array_shape(2) ) )
      array_avr_work1 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work1(1,:) = array_avr_work1(1,:) + array_avr_work(i,:) * weight1(i)
        weight_sum = weight_sum + weight1(i)
      end do
      array_avr_work1 = array_avr_work1 / weight_sum
      array_avr_work  => array_avr_work1
    end if

                        

    if ( space_average(2) ) then
      dim_size = array_shape(2)
      array_shape(2) = 1
      allocate( array_avr_work2( array_shape(1) , array_shape(2) ) )
      array_avr_work2 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work2(:,1) = array_avr_work2(:,1) + array_avr_work(:,i) * weight2(i)
        weight_sum = weight_sum + weight2(i)
      end do
      array_avr_work2 = array_avr_work2 / weight_sum
      array_avr_work  => array_avr_work2
    end if

                        
                      

                    


      allocate( array_avr( array_shape(1) , array_shape(2) ) )

      array_avr = array_avr_work

      nullify( array_avr_work )

                          if ( associated( array_avr_work1 ) ) deallocate( array_avr_work1 )
                    
      if ( associated( array_avr_work2 ) ) deallocate( array_avr_work2 )
                    

  end subroutine AverageReduceDouble2
Subroutine :
array(:,:,:) :real(DP), intent(in), target
space_average(3) :logical, intent(in)
weight1(:) :real(DP), intent(in)
weight2(:) :real(DP), intent(in)
weight3(:) :real(DP), intent(in)
array_avr(:,:,:) :real(DP), pointer
: (out)

space_average で .true. に指定された次元に対して, array を平均化して array_avr に返します. 平均化には重み weight1 〜 weight7 が用いられます. array_avr の配列の次元そのものは減りません. その代わり, 平均化された次元の配列のサイズは 1 になります.

[Source]

  subroutine AverageReduceDouble3( array, space_average, weight1, weight2, weight3, array_avr )
    !
    ! space_average で .true. に指定された次元に対して, 
    ! array を平均化して array_avr に返します. 
    ! 平均化には重み weight1 〜 weight7 が用いられます. 
    ! array_avr の配列の次元そのものは減りません. その代わり, 
    ! 平均化された次元の配列のサイズは 1 になります. 
    !
    implicit none
    real(DP), intent(in), target:: array(:,:,:)
    logical, intent(in):: space_average(3)
                        real(DP), intent(in):: weight1(:)
                    
    real(DP), intent(in):: weight2(:)
                    
    real(DP), intent(in):: weight3(:)
                    
    real(DP), pointer:: array_avr(:,:,:) ! (out)

    real(DP), pointer:: array_avr_work(:,:,:)

                        real(DP), pointer:: array_avr_work1(:,:,:)
                    
    real(DP), pointer:: array_avr_work2(:,:,:)
                    
    real(DP), pointer:: array_avr_work3(:,:,:)
                    

    integer:: array_shape(3)
    integer:: i, dim_size
    real(DP):: weight_sum
  continue

    array_shape = shape( array )
    array_avr_work => array

                    
                      
                        
    if ( space_average(1) ) then
      dim_size = array_shape(1)
      array_shape(1) = 1
      allocate( array_avr_work1( array_shape(1) , array_shape(2) , array_shape(3) ) )
      array_avr_work1 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work1(1,:,:) = array_avr_work1(1,:,:) + array_avr_work(i,:,:) * weight1(i)
        weight_sum = weight_sum + weight1(i)
      end do
      array_avr_work1 = array_avr_work1 / weight_sum
      array_avr_work  => array_avr_work1
    end if

                        

    if ( space_average(2) ) then
      dim_size = array_shape(2)
      array_shape(2) = 1
      allocate( array_avr_work2( array_shape(1) , array_shape(2) , array_shape(3) ) )
      array_avr_work2 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work2(:,1,:) = array_avr_work2(:,1,:) + array_avr_work(:,i,:) * weight2(i)
        weight_sum = weight_sum + weight2(i)
      end do
      array_avr_work2 = array_avr_work2 / weight_sum
      array_avr_work  => array_avr_work2
    end if

                        

    if ( space_average(3) ) then
      dim_size = array_shape(3)
      array_shape(3) = 1
      allocate( array_avr_work3( array_shape(1) , array_shape(2) , array_shape(3) ) )
      array_avr_work3 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work3(:,:,1) = array_avr_work3(:,:,1) + array_avr_work(:,:,i) * weight3(i)
        weight_sum = weight_sum + weight3(i)
      end do
      array_avr_work3 = array_avr_work3 / weight_sum
      array_avr_work  => array_avr_work3
    end if

                        
                      

                    


      allocate( array_avr( array_shape(1) , array_shape(2) , array_shape(3) ) )

      array_avr = array_avr_work

      nullify( array_avr_work )

                          if ( associated( array_avr_work1 ) ) deallocate( array_avr_work1 )
                    
      if ( associated( array_avr_work2 ) ) deallocate( array_avr_work2 )
                    
      if ( associated( array_avr_work3 ) ) deallocate( array_avr_work3 )
                    

  end subroutine AverageReduceDouble3
Subroutine :
array(:,:,:,:) :real(DP), intent(in), target
space_average(4) :logical, intent(in)
weight1(:) :real(DP), intent(in)
weight2(:) :real(DP), intent(in)
weight3(:) :real(DP), intent(in)
weight4(:) :real(DP), intent(in)
array_avr(:,:,:,:) :real(DP), pointer
: (out)

space_average で .true. に指定された次元に対して, array を平均化して array_avr に返します. 平均化には重み weight1 〜 weight7 が用いられます. array_avr の配列の次元そのものは減りません. その代わり, 平均化された次元の配列のサイズは 1 になります.

[Source]

  subroutine AverageReduceDouble4( array, space_average, weight1, weight2, weight3, weight4, array_avr )
    !
    ! space_average で .true. に指定された次元に対して, 
    ! array を平均化して array_avr に返します. 
    ! 平均化には重み weight1 〜 weight7 が用いられます. 
    ! array_avr の配列の次元そのものは減りません. その代わり, 
    ! 平均化された次元の配列のサイズは 1 になります. 
    !
    implicit none
    real(DP), intent(in), target:: array(:,:,:,:)
    logical, intent(in):: space_average(4)
                        real(DP), intent(in):: weight1(:)
                    
    real(DP), intent(in):: weight2(:)
                    
    real(DP), intent(in):: weight3(:)
                    
    real(DP), intent(in):: weight4(:)
                    
    real(DP), pointer:: array_avr(:,:,:,:) ! (out)

    real(DP), pointer:: array_avr_work(:,:,:,:)

                        real(DP), pointer:: array_avr_work1(:,:,:,:)
                    
    real(DP), pointer:: array_avr_work2(:,:,:,:)
                    
    real(DP), pointer:: array_avr_work3(:,:,:,:)
                    
    real(DP), pointer:: array_avr_work4(:,:,:,:)
                    

    integer:: array_shape(4)
    integer:: i, dim_size
    real(DP):: weight_sum
  continue

    array_shape = shape( array )
    array_avr_work => array

                    
                      
                        
    if ( space_average(1) ) then
      dim_size = array_shape(1)
      array_shape(1) = 1
      allocate( array_avr_work1( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) ) )
      array_avr_work1 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work1(1,:,:,:) = array_avr_work1(1,:,:,:) + array_avr_work(i,:,:,:) * weight1(i)
        weight_sum = weight_sum + weight1(i)
      end do
      array_avr_work1 = array_avr_work1 / weight_sum
      array_avr_work  => array_avr_work1
    end if

                        

    if ( space_average(2) ) then
      dim_size = array_shape(2)
      array_shape(2) = 1
      allocate( array_avr_work2( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) ) )
      array_avr_work2 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work2(:,1,:,:) = array_avr_work2(:,1,:,:) + array_avr_work(:,i,:,:) * weight2(i)
        weight_sum = weight_sum + weight2(i)
      end do
      array_avr_work2 = array_avr_work2 / weight_sum
      array_avr_work  => array_avr_work2
    end if

                        

    if ( space_average(3) ) then
      dim_size = array_shape(3)
      array_shape(3) = 1
      allocate( array_avr_work3( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) ) )
      array_avr_work3 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work3(:,:,1,:) = array_avr_work3(:,:,1,:) + array_avr_work(:,:,i,:) * weight3(i)
        weight_sum = weight_sum + weight3(i)
      end do
      array_avr_work3 = array_avr_work3 / weight_sum
      array_avr_work  => array_avr_work3
    end if

                        

    if ( space_average(4) ) then
      dim_size = array_shape(4)
      array_shape(4) = 1
      allocate( array_avr_work4( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) ) )
      array_avr_work4 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work4(:,:,:,1) = array_avr_work4(:,:,:,1) + array_avr_work(:,:,:,i) * weight4(i)
        weight_sum = weight_sum + weight4(i)
      end do
      array_avr_work4 = array_avr_work4 / weight_sum
      array_avr_work  => array_avr_work4
    end if

                        
                      

                    


      allocate( array_avr( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) ) )

      array_avr = array_avr_work

      nullify( array_avr_work )

                          if ( associated( array_avr_work1 ) ) deallocate( array_avr_work1 )
                    
      if ( associated( array_avr_work2 ) ) deallocate( array_avr_work2 )
                    
      if ( associated( array_avr_work3 ) ) deallocate( array_avr_work3 )
                    
      if ( associated( array_avr_work4 ) ) deallocate( array_avr_work4 )
                    

  end subroutine AverageReduceDouble4
Subroutine :
array(:,:,:,:,:) :real(DP), intent(in), target
space_average(5) :logical, intent(in)
weight1(:) :real(DP), intent(in)
weight2(:) :real(DP), intent(in)
weight3(:) :real(DP), intent(in)
weight4(:) :real(DP), intent(in)
weight5(:) :real(DP), intent(in)
array_avr(:,:,:,:,:) :real(DP), pointer
: (out)

space_average で .true. に指定された次元に対して, array を平均化して array_avr に返します. 平均化には重み weight1 〜 weight7 が用いられます. array_avr の配列の次元そのものは減りません. その代わり, 平均化された次元の配列のサイズは 1 になります.

[Source]

  subroutine AverageReduceDouble5( array, space_average, weight1, weight2, weight3, weight4, weight5, array_avr )
    !
    ! space_average で .true. に指定された次元に対して, 
    ! array を平均化して array_avr に返します. 
    ! 平均化には重み weight1 〜 weight7 が用いられます. 
    ! array_avr の配列の次元そのものは減りません. その代わり, 
    ! 平均化された次元の配列のサイズは 1 になります. 
    !
    implicit none
    real(DP), intent(in), target:: array(:,:,:,:,:)
    logical, intent(in):: space_average(5)
                        real(DP), intent(in):: weight1(:)
                    
    real(DP), intent(in):: weight2(:)
                    
    real(DP), intent(in):: weight3(:)
                    
    real(DP), intent(in):: weight4(:)
                    
    real(DP), intent(in):: weight5(:)
                    
    real(DP), pointer:: array_avr(:,:,:,:,:) ! (out)

    real(DP), pointer:: array_avr_work(:,:,:,:,:)

                        real(DP), pointer:: array_avr_work1(:,:,:,:,:)
                    
    real(DP), pointer:: array_avr_work2(:,:,:,:,:)
                    
    real(DP), pointer:: array_avr_work3(:,:,:,:,:)
                    
    real(DP), pointer:: array_avr_work4(:,:,:,:,:)
                    
    real(DP), pointer:: array_avr_work5(:,:,:,:,:)
                    

    integer:: array_shape(5)
    integer:: i, dim_size
    real(DP):: weight_sum
  continue

    array_shape = shape( array )
    array_avr_work => array

                    
                      
                        
    if ( space_average(1) ) then
      dim_size = array_shape(1)
      array_shape(1) = 1
      allocate( array_avr_work1( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) , array_shape(5) ) )
      array_avr_work1 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work1(1,:,:,:,:) = array_avr_work1(1,:,:,:,:) + array_avr_work(i,:,:,:,:) * weight1(i)
        weight_sum = weight_sum + weight1(i)
      end do
      array_avr_work1 = array_avr_work1 / weight_sum
      array_avr_work  => array_avr_work1
    end if

                        

    if ( space_average(2) ) then
      dim_size = array_shape(2)
      array_shape(2) = 1
      allocate( array_avr_work2( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) , array_shape(5) ) )
      array_avr_work2 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work2(:,1,:,:,:) = array_avr_work2(:,1,:,:,:) + array_avr_work(:,i,:,:,:) * weight2(i)
        weight_sum = weight_sum + weight2(i)
      end do
      array_avr_work2 = array_avr_work2 / weight_sum
      array_avr_work  => array_avr_work2
    end if

                        

    if ( space_average(3) ) then
      dim_size = array_shape(3)
      array_shape(3) = 1
      allocate( array_avr_work3( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) , array_shape(5) ) )
      array_avr_work3 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work3(:,:,1,:,:) = array_avr_work3(:,:,1,:,:) + array_avr_work(:,:,i,:,:) * weight3(i)
        weight_sum = weight_sum + weight3(i)
      end do
      array_avr_work3 = array_avr_work3 / weight_sum
      array_avr_work  => array_avr_work3
    end if

                        

    if ( space_average(4) ) then
      dim_size = array_shape(4)
      array_shape(4) = 1
      allocate( array_avr_work4( array_shape(1) , array_shape(2) , array_shape(3) , array_shape(4) , array_shape(5) ) )
      array_avr_work4 = 0.0_DP
      weight_sum = 0.0_DP
      do i = 1, dim_size
        array_avr_work4(:,:,:,1,:) = array_avr_work4(:,:,:,1,:) + array_avr_work(:,:,:,i,:) * weight4(i)
        weight_sum = weight_sum + weight4(i)
      end do
      array_avr_work4 = array_avr_work4 / weight_sum
      array_avr_work  => array_avr_work4
    end if