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