gtool_history_types.f90
Go to the documentation of this file.
1 !
2 != gtool_history より提供される構造データ型
3 != Derived types provided from "gtool_history"
4 !
5 ! Authors:: Yasuhiro MORIKAWA, Eizi TOYODA
6 ! Version:: $Id: gtool_history_types.f90,v 1.5 2009-10-10 08:01:52 morikawa Exp $
7 ! Tag Name:: $Name: $
8 ! Copyright:: Copyright (C) GFD Dennou Club, 2000-2009. All rights reserved.
9 ! License:: See COPYRIGHT[link:../../../COPYRIGHT]
10 !
11 
13  !
14  != gtool_history より提供される構造データ型
15  != Derived types provided from "gtool_history"
16  !
17  ! <b>Note that Japanese and English are described in parallel.</b>
18  !
19  ! モジュールの概要や使用方法については, gtool_history
20  ! を参照ください.
21  !
22  ! See "gtool_history" for brief and usage of this module.
23  !
24  !== Derived types
25  !
26  ! GT_HISTORY :: gtool4 データ出力用
27  ! GT_HISTORY_AXIS :: gtool4 データ座標軸情報
28  ! GT_HISTORY_VARINFO :: gtool4 データ変数情報
29  !
30 
31  use dc_types, only: string, token, stderr, dp, sp
33  use gtdata_types, only: gt_variable
34  implicit none
35  private
36 
41 
43  !
44  !== gtool4 netCDF データの出力用構造体
45  !
46  ! この型の変数は HistoryCreate によって初期設定される必要があります。
47  ! 初期設定後、データ出力用の複数のサブルーチンによって利用されます。
48  ! 最終的には HistoryClose によって終了処理してください。
49  !
50  ! この構造体の内部の要素は非公開になっています。
51  ! 問い合わせの際には HistoryInquire を利用してください。
52  !
53  !
54  ! Data entity of this type represents a netCDF dataset
55  ! controlled by gtool5 library.
56  ! It must be initialized by HistoryCreate ,
57  ! then used in many subroutines, and must be finalized by
58  ! HistoryClose .
59  ! Note that the resultant file is undefined if you forget to
60  ! finalize it.
61  !
62  ! Users are recommended to retain the object of this type
63  ! returned by HistoryCreate,
64  ! to use it as the last argument called *history* for
65  ! all following subroutine calls.
66  ! However, it is not mandatory.
67  ! When you are going to write *ONLY* one dataset,
68  ! argument *history* of all subroutine calls can be omitted, and
69  ! the history entity will be internally managed within this module.
70 
71  logical:: initialized = .false.
72  ! 初期設定フラグ.
73  ! Initialization flag
74  integer:: unlimited_index = 0
75  ! 無制限次元の ID.
76  ! ID of unlimited dimension.
77  character(TOKEN):: unlimited_units = ''
78  ! 無制限次元の単位.
79  ! Units of unlimited dimension.
80  integer:: unlimited_units_symbol = unit_symbol_err
81  ! 無制限次元の単位.
82  ! Units of unlimited dimension.
83  type(gt_variable), pointer:: dimvars(:) =>null()
84  ! 次元変数 ID配列.
85  ! it is index of dimvars(:),
86  ! not that of vars(:).
87  logical, pointer:: dim_value_written(:) =>null()
88  ! 各次元が記述済みかどうか
89  real(DP):: origin, interval, newest, oldest
90  ! 単位は HistoryCreate の units 中で無制限次元
91  ! に対応するものになる.
92  logical:: origin_setting = .false.
93  ! 時間の原点が明示的に設定されたか.
94  type(gt_variable), pointer:: vars(:) =>null()
95  ! 変数 ID 配列
96  integer, pointer:: growable_indices(:) =>null()
97  ! 無制限次元の添字
98  ! (無制限次元が無い時は 0)
99  integer, pointer:: count(:) =>null()
100  ! 各配列の無制限次元の配列長
101  integer, pointer:: var_avr_count(:) =>null()
102  ! 各変数の時間平均値出力の際の積算回数.
103  ! -1 の場合は出力データを平均化しない.
104  !
105  ! Number of times of integral
106  ! for time-averaged value output of each variable.
107  ! -1 disables average value output
108  type(gt_history_avrdata), pointer:: var_avr_data(:) =>null()
109  ! 時間平均値を出力するためのデータ一時保管用配列.
110  !
111  ! Array for temporary keeping data for
112  ! time-averaged value output
113  logical, pointer:: var_avr_firstput(:) =>null()
114  ! 一度目の出力を示すフラグ.
115  !
116  ! Flag for first output
117  real(DP), pointer:: var_avr_coefsum(:) =>null()
118  ! 各変数の時間平均値蓄積の際の係数の合計値.
119  !
120  ! Summation of coefficients for integral
121  ! of time-averaged value of each variable
122  real(DP), pointer:: var_avr_baseint(:) =>null()
123  ! 各変数の時間平均値出力のための基本時間間隔.
124  !
125  ! Basic interval of time for output
126  ! of time-averaged value of each variable
127  real(DP), pointer:: var_avr_prevtime(:) =>null()
128  ! 各変数の時間平均値出力のための前回の時刻保管.
129  !
130  ! Store keeping of previous time for output
131  ! of time-averaged value of each variable
132  real(DP):: time_bnds(1:2) = 0.0_dp
133  ! "time_bnds" 変数に出力されるデータ.
134  !
135  ! Data that is to be output in "time_bnds"
136  ! variable
137  integer:: time_bnds_output_count = 0
138  ! "time_bnds" 変数に出力された回数.
139  !
140  ! Number of output in "time_bnds" variable
141  integer:: time_nv_index = 0
142  ! time_nv 次元の ID.
143  ! ID of dimension "time_nv"
144 
145  ! MPI 関連の変数
146  ! Variables for MPI
147  !
148  integer:: mpi_myrank = -1
149  ! MPI におけるノード番号. Node number of MPI
150  integer:: mpi_nprocs = -1
151  ! MPI における全ノード数. Number of all nodes of MPI
152  logical:: mpi_gather = .false.
153  ! ファイルを統合して出力するフラグ.
154  ! Flag for integration of files
155  logical:: mpi_split = .false.
156  ! ファイルを分割して出力するフラグ.
157  ! Flag for split of files
158  type(gt_history_mpifileinfo), pointer:: mpi_fileinfo =>null()
159  ! ファイルに関する情報
160  ! Information about file
161  type(gt_history_mpiaxisdata), pointer:: mpi_dimdata_all(:) =>null()
162  ! 全体の軸データを保管するための配列.
163  ! Array for keeping data of axes in whole area.
164  type(gt_history_mpiaxisdata), pointer:: mpi_dimdata_each(:) =>null()
165  ! 個々のノードでの軸データを保管するための配列.
166  ! Array for keeping data of axes on each node.
167  type(gt_history_mpiaxisinfo), pointer:: mpi_gthr_info(:) =>null()
168  ! データを一箇所に集約する際に必要な情報.
169  ! Information for integration of data.
170  type(gt_history_varinfo), pointer:: mpi_varinfo(:) =>null()
171  ! 変数情報.
172  ! Information of variables
173  type(gt_history_mpivarindex), pointer:: mpi_vars_index(:) =>null()
174  ! 各変数の配列添字情報.
175  ! Indexes of array of each variable
176  end type gt_history
177 
179  !
180  ! 時間方向の平均値を出力するためのデータ一時保管用配列.
181  !
182  ! Array for temporary keeping data for time average value output.
183  !
184  real(DP), pointer:: a_dataavr(:) =>null()
185  integer:: length
186  end type gt_history_avrdata
187 
188  type(gt_history), save, target:: default ! history が未指定の場合に使用
189 
191  !
192  !== 座標軸情報を格納する構造体
193  !
194  ! この型の変数は HistoryAxisCreate, HistoryAxisCopy, HistoryInquire
195  ! によって初期設定される必要があります。
196  ! 初期設定後、HistoryCreate の *axes* に与えます。
197  !
198  ! 問い合わせは HistoryAxisInquire によって行います。
199  ! 属性の付加は HistoryAxisAddAttr によって行います。
200  ! 初期化は HistoryAxisClear によって行います。
201  !
202  ! This type may be used as a argument *axes* of HistoryCreate
203  ! to define features of axes of a history dataset.
204  ! Typically, a constant array of this type will be used for
205  ! fixed specification.
206  !
207  character(TOKEN) :: name = "" ! 次元変数名
208  integer :: length = 0 ! 次元長 (配列サイズ)
209  character(STRING):: longname = "" ! 次元変数の記述的名称
210  character(STRING):: units = "" ! 次元変数の単位
211  character(TOKEN) :: xtype = "" ! 次元変数の型
212  type(gt_history_attr), pointer:: attrs(:) =>null() ! 属性情報群
213  end type gt_history_axis
214 
215 
217  !
218  !== 変数情報を格納する構造体
219  !
220  ! この型の変数は HistoryVarinfoCreate, HistoryVarinfoCopy,
221  ! HistoryInquire
222  ! によって初期設定される必要があります。
223  ! 初期設定後、HistoryAddVariable の *varinfo* に与えます。
224  !
225  ! 問い合わせは HistoryVarinfoInquire によって行います。
226  ! 属性の付加は HistoryVarinfoAddAttr によって行います。
227  ! 初期化は HistoryVarinfoClear によって行います。
228  !
229  ! This type may be used as a argument *varinfo* of
230  ! HistoryAddVariable
231  ! to define features of variable of a history dataset.
232  !
233  character(TOKEN) :: name = "" ! 変数名
234  character(TOKEN), pointer :: dims(:) =>null() ! 依存する次元
235  character(STRING) :: longname = "" ! 変数の記述的名称
236  character(STRING) :: units = "" ! 変数の単位
237  character(TOKEN) :: xtype = "" ! 変数の型
238  type(gt_history_attr), pointer:: attrs(:) =>null() ! 属性情報群
239  logical:: time_average = .false. ! 時間平均
240  logical:: initialized = .false.
241  ! 初期設定フラグ.
242  ! Initialization flag
243  end type gt_history_varinfo
244 
246  !
247  ! 変数の属性情報の構造体. 外部参照はさせず, GT_HISTORY_VARINFO
248  ! および GT_HISTORY_AXIS に内包されて利用されることを
249  ! 想定している. 直接的にこの構造体を変数にとる
250  ! サブルーチンは gtool_history_internal モジュール内の
251  ! gtool_history_internal#append_attrs および
252  ! gtool_history_internal#copy_attrs .
253  !
254  character(TOKEN) :: attrname ! 属性の名前
255  character(TOKEN) :: attrtype ! 属性の値の型
256  logical :: array = .false. ! 属性の値が配列かどうか
257  character(STRING) :: charvalue ! 属性の値 (文字型変数)
258  integer :: intvalue ! 属性の値 (整数型変数)
259  real(SP) :: realvalue ! 属性の値 (単精度実数型変数)
260  real(DP) :: doublevalue ! 属性の値 (倍精度実数型変数)
261  logical :: logicalvalue ! 属性の値 (論理型変数)
262  integer, pointer :: intarray(:) =>null() ! 属性の値 (整数型配列)
263  real(SP), pointer :: realarray(:) =>null() ! 属性の値 (単精度実数型配列)
264  real(DP), pointer :: doublearray(:) =>null() ! 属性の値 (倍精度実数型配列)
265  end type gt_history_attr
266 
268  !
269  ! MPI 使用時に, ファイルに書き出す基本情報.
270  ! (各ノード上のデータを統合して一つのファイルに出力する際に使用)
271  !
272  ! Basic information output to a file when MPI is used.
273  ! (This is used when data on each node is integrated and output to one file )
274  !
275  logical:: already_output = .false.
276  type(gt_history_axis), pointer:: axes(:) =>null()
277  logical:: overwrite
278  character(STRING):: file
279  character(STRING):: title
280  character(STRING):: source
281  character(STRING):: institution
282  character(STRING):: conventions
283  character(TOKEN):: gt_version
284  logical:: gtver_add
285  logical:: quiet
286  character(STRING):: nc_history
287  end type gt_history_mpifileinfo
288 
290  !
291  ! MPI 使用時に, 軸データを保管するための配列.
292  !
293  ! Array for keeping data of axes when MPI is used.
294  !
295  real(DP), pointer:: a_axis(:) =>null()
296  integer:: length = -1
297  type(gt_history_attr), pointer:: attrs(:) =>null()
298  ! 座標の属性 (HistoryCreate2 が呼ばれた場合に使用)
299  ! Attributes of axes (this is used when HistoryCreate2 is used)
300  end type gt_history_mpiaxisdata
301 
303  !
304  ! MPI 使用時に, データを一箇所に集約する際に必要な情報.
305  !
306  ! Information for integration of data when MPI is used.
307  !
308  integer, pointer:: index_all(:,:) =>null()
309  integer, pointer:: length(:) =>null()
310  end type gt_history_mpiaxisinfo
311 
313  !
314  ! MPI 使用時に, データを一箇所に集約する際に必要な情報.
315  !
316  ! Information for integration of data when MPI is used.
317  !
318  integer, pointer:: each2all(:,:) =>null()
319  integer, pointer:: allcount(:) =>null()
320  integer:: allcount_all = 0
321  end type gt_history_mpivarindex
322 
323 end module gtool_history_types
integer, parameter, public unit_symbol_err
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition: dc_types.f90:109
integer, parameter, public stderr
標準エラー出力の装置番号
Definition: dc_types.f90:103
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
種別型パラメタを提供します。
Definition: dc_types.f90:49
integer, parameter, public sp
単精度実数型変数
Definition: dc_types.f90:73
type(gt_history), target, save default
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118