gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
historyautoput.f90
Go to the documentation of this file.
1!--
2! *** Caution!! ***
3!
4! This file is generated from "historyautoput.rb2f90" by Ruby 3.3.8.
5! Please do not edit this file directly.
6!
7! [JAPANESE]
8!
9! ※※※ 注意!!! ※※※
10!
11! このファイルは "historyautoput.rb2f90" から Ruby 3.3.8
12! によって自動生成されたファイルです.
13! このファイルを直接編集しませんようお願い致します.
14!
15!
16!++
30
110 & time, varname, value, & ! (in)
111 & err & ! (out) optional
112 & )
113 !
114 !
115 ! データの出力を行います.
116 ! このサブルーチンを用いる前に, "HistoryAutoCreate"
117 ! による初期設定が必要です.
118 !
119 ! *varname* は HistoryAutoAddVariable で指定されている必要があります.
120 !
121 ! *HistoryAutoPut* は複数のサブルーチンの総称名です. *array* には
122 ! 0 〜 7 次元のデータを与えることが可能です.
123 ! (以下の同名のサブルーチンを参照ください).
124 ! また, 整数, 単精度実数, 倍精度実数を与えることが可能です.
125 ! ただし, 0 次元のデータを与える際の引数キーワードは
126 ! *value* を用いてください.
127 !
128 ! Output data.
129 ! Initialization by "HistoryAutoCreate" is needed
130 ! before use of this subroutine.
131 !
132 ! "varname" must be specified by "HistoryAutoAddVariable".
133 !
134 ! "HistoryAutoPut" is a generic name of multiple subroutines.
135 ! Then 0 -- 7 dimensional data can be given to "array".
136 ! (See bellow subroutines with the same name).
137 ! And, integer, sinble or double precision can be given.
138 ! However, if 0 dimensional data is given, use "value" as a
139 ! keyword argument.
140 !
141 !
142 ! * 時間平均について
143 !
144 ! 時間平均については HistoryAutoAddVariable を参照ください。
145 !
146 ! * About time average
147 !
148 ! See "HistoryAutoAddVariable" for details of time average
149 !
150 !
151
152 !
153
167 use gtool_history, only: gt_history, historyput, historyinitialized, &
168 & historyaddvariable, historyinquire, historyvarinfoinquire, &
170 use dc_string, only: tochar
171 use dc_message, only: messagenotify
172 use dc_trace, only: beginsub, endsub
173 use dc_error, only: storeerror, dc_noerr, &
175 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
176 use dc_date_generic, only: operator(-), operator(+), &
177 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
180 use dc_types, only: dp, string
181 implicit none
182 real(DP), intent(in):: time
183 real(DP), parameter:: time_eps = epsilon(1.0_dp)
184 ! データの時刻.
185 ! Time of data
186
187 character(*), intent(in):: varname
188 ! 変数の名前.
189 !
190 ! ただし, ここで指定するものは,
191 ! HistoryAutoAddVariable の
192 ! *varname* で既に指定されてい
193 ! なければなりません.
194 !
195 ! Name of a variable.
196 !
197 ! This must be specified
198 ! *varname* in "HistoryAutoAddVariable".
199
200 real(DP), intent(in), target:: value
201 ! 出力データ.
202 !
203 ! データ型は整数, 単精度実数型,
204 ! 倍精度実数型のどれでもかまいません.
205 ! ただし, ファイルへ出力される際には,
206 ! HistoryAutoAddVariable の *xtypes* で指定した
207 ! データ型へ変換されます.
208 !
209 ! Output data.
210 !
211 ! Integer, single or double precision are
212 ! acceptable as data type.
213 ! Note that when this is output to a file,
214 ! data type is converted into "xtype"
215 ! specified in "HistoryAutoAddVariable"
216 !
217
218 logical, intent(out), optional:: err
219 ! 例外処理用フラグ.
220 ! デフォルトでは, この手続き内でエラーが
221 ! 生じた場合, プログラムは強制終了します.
222 ! 引数 *err* が与えられる場合,
223 ! プログラムは強制終了せず, 代わりに
224 ! *err* に .true. が代入されます.
225 !
226 ! Exception handling flag.
227 ! By default, when error occur in
228 ! this procedure, the program aborts.
229 ! If this *err* argument is given,
230 ! .true. is substituted to *err* and
231 ! the program does not abort.
232
233
234 type(gt_history), pointer:: gthist =>null()
235 ! gtool_history モジュール用構造体.
236 ! Derived type for "gtool_history" module
237
238
239 real(DP):: settime
240 integer:: stat, i
241 integer:: vnum
242 character(STRING):: cause_c
243 integer, save:: svnum = 1, svtstep
244 character(*), parameter:: subname = "HistoryAutoPutDouble0"
245 continue
246 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
247 stat = dc_noerr
248 cause_c = ""
249
250 ! 初期設定チェック
251 ! Check initialization
252 !
253 if ( .not. initialized ) then
254 stat = dc_enotinit
255 cause_c = 'gtool_historyauto'
256 goto 999
257 end if
258
259 ! 時刻に関するエラー処理
260 ! Error handling for time
261 !
262 if ( time < zero_time ) then
263 cause_c = tochar( time )
264 call messagenotify( 'W', subname, &
265 & '"time=<%c>" must be positive value (varname=<%c>).', &
266 & c1 = trim( cause_c ), c2 = trim( varname ) )
267 stat = dc_enegative
268 cause_c = 'time'
269 goto 999
270 end if
271
272 ! 変数 ID のサーチ
273 ! Search variable ID
274 !
275 varsearch: do
276 do i = svnum, numvars
277 if ( trim( varname_vars(i) ) == trim(varname) ) then
278 vnum = i
279 exit varsearch
280 end if
281 end do
282 do i = 1, svnum - 1
283 if ( trim( varname_vars(i) ) == trim(varname) ) then
284 vnum = i
285 exit varsearch
286 end if
287 end do
288
289 stat = hst_ebadvarname
290 cause_c = varname
291 goto 999
292 end do varsearch
293
294 svnum = vnum
295
296 ! 定義モードからデータモードへ
297 ! Transit from define mode to data mode
298 !
299 if ( hstnmlinfodefinemode( gthstnml ) ) then
300 call hstnmlinfoenddefine( gthstnml ) ! (inout)
301 end if
302
303 ! 出力タイミングのチェックとファイルの作成
304 ! Check output timing and create files
305 !
306 call hstvarsoutputcheck( &
307 & time = time, & ! (in)
308 & stime_index = svtstep ) ! (out)
309
310 ! ファイルのオープン・クローズ・再オープン
311 ! Open, close, reopen files
312 !
313 if ( create_timing_vars(vnum, svtstep) &
314 & .and. .not. histaddvar_vars(vnum) ) then
315 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
316 & varname_vars(vnum), time ) ! (in)
317 histaddvar_vars(vnum) = .true.
318 if ( flag_output_prev_vars(vnum) ) then
319 prev_outtime_vars(vnum) = time
320 else
321 flag_output_prev_vars(vnum) = .true.
322 if ( origin_time_vars(vnum) > zero_time ) then
324 else
325 prev_outtime_vars(vnum) = time
326 end if
327 end if
328 end if
329
330 if ( close_timing_vars(vnum, svtstep) ) then
331 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
332 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
333 end if
334 end if
335
336 if ( renew_timing_vars(vnum, svtstep) ) then
337 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
338 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
339 end if
340 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
341 & varname_vars(vnum), time ) ! (in)
342 newfile_createtime_vars(vnum) = time
343 prev_outtime_vars(vnum) = time
344 end if
345
346 ! 出力が有効かどうかを確認する
347 ! Confirm whether the output is effective
348 !
349 if ( .not. output_timing_vars(vnum, svtstep) &
350 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
351
352 goto 999
353 end if
354
355 ! GT_HISTORY 変数の取得
356 ! Get "GT_HISTORY" variable
357 !
358 gthist => gthst_history_vars(vnum) % gthist
359
360
361 ! 空間切り出し
362 ! Slice of spaces
363 !
364 ! array only
365
366
367
368 ! 空間平均
369 ! Spatial average
370 !
371 ! array only
372
373
374 ! 単位に応じて時刻を変換
375 ! Convert time according to units
376 !
377 if ( output_timing_vars(vnum, svtstep) &
378 & .or. output_timing_avr_vars(vnum, svtstep) ) then
379
380 settime = &
381 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
382 end if
383
384 ! 時刻設定
385 ! Set time
386 !
387 if ( output_timing_vars(vnum, svtstep) ) then
388 call historysettime( &
389 & history = gthist, & ! (in) optional
390 & timed = settime ) ! (in) optional
391 end if
392
393 ! 出力
394 ! OutPut
395 !
396 if ( output_timing_avr_vars(vnum, svtstep) ) then
397 call historyput( &
398 & varname, & ! (in)
399 & (/value/), & ! (in)
400
401 & timed = settime, & ! (in) optional
402 & time_average_store = &
403 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
404 & history = gthist ) ! (inout) optional
405 else
406 call historyput( &
407 & varname, & ! (in)
408 & (/value/), & ! (in)
409
410 & history = gthist ) ! (inout) optional
411 end if
412
413 ! 最後に出力した時刻を保存
414 ! Save last time of output
415 !
416 if ( output_timing_vars(vnum, svtstep) ) then
417 if ( .not. create_timing_vars(vnum, svtstep) .and. &
418 & .not. renew_timing_vars(vnum, svtstep) ) then
419
420 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
421 & time_eps * max(1.0_dp, abs(time), &
422 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
423 prev_outtime_vars(vnum) = time
424 else
425 prev_outtime_vars(vnum) = &
427 end if
428 end if
429 end if
430
431 ! 結合解除
432 ! Release associations
433 !
434 nullify( gthist )
435
436
437999 continue
438 call storeerror(stat, subname, cause_c = cause_c, err = err)
439 call endsub(subname)
440 end subroutine historyautoputdouble0
441
442
522 & time, varname, array, & ! (in)
523 & err & ! (out) optional
524 & )
525 !
526
527 !
528
543 use gtool_history, only: gt_history, historyput, historyinitialized, &
544 & historyaddvariable, historyinquire, historyvarinfoinquire, &
546 use dc_string, only: tochar
547 use dc_message, only: messagenotify
548 use dc_trace, only: beginsub, endsub
549 use dc_error, only: storeerror, dc_noerr, &
551 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
552 use dc_date_generic, only: operator(-), operator(+), &
553 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
556 use dc_types, only: dp, string
557 implicit none
558 real(DP), intent(in):: time
559 real(DP), parameter:: time_eps = epsilon(1.0_dp)
560
561 character(*), intent(in):: varname
562
563 real(DP), intent(in), target:: array(:)
564
565 logical, intent(out), optional:: err
566
567
568 type(gt_history), pointer:: gthist =>null()
569 ! gtool_history モジュール用構造体.
570 ! Derived type for "gtool_history" module
571
572 real(DP), pointer:: array_slice(:) =>null()
573 type(slice_info), pointer:: sv =>null()
574 real(DP), pointer:: array_avr(:) =>null()
575
576 real(DP):: settime
577 integer:: stat, i
578 integer:: vnum
579 character(STRING):: cause_c
580 integer, save:: svnum = 1, svtstep
581 character(*), parameter:: subname = "HistoryAutoPutDouble1"
582 continue
583 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
584 stat = dc_noerr
585 cause_c = ""
586
587 ! 初期設定チェック
588 ! Check initialization
589 !
590 if ( .not. initialized ) then
591 stat = dc_enotinit
592 cause_c = 'gtool_historyauto'
593 goto 999
594 end if
595
596 ! 時刻に関するエラー処理
597 ! Error handling for time
598 !
599 if ( time < zero_time ) then
600 cause_c = tochar( time )
601 call messagenotify( 'W', subname, &
602 & '"time=<%c>" must be positive value (varname=<%c>).', &
603 & c1 = trim( cause_c ), c2 = trim( varname ) )
604 stat = dc_enegative
605 cause_c = 'time'
606 goto 999
607 end if
608
609 ! 変数 ID のサーチ
610 ! Search variable ID
611 !
612 varsearch: do
613 do i = svnum, numvars
614 if ( trim( varname_vars(i) ) == trim(varname) ) then
615 vnum = i
616 exit varsearch
617 end if
618 end do
619 do i = 1, svnum - 1
620 if ( trim( varname_vars(i) ) == trim(varname) ) then
621 vnum = i
622 exit varsearch
623 end if
624 end do
625
626 stat = hst_ebadvarname
627 cause_c = varname
628 goto 999
629 end do varsearch
630
631 svnum = vnum
632
633 ! 定義モードからデータモードへ
634 ! Transit from define mode to data mode
635 !
636 if ( hstnmlinfodefinemode( gthstnml ) ) then
637 call hstnmlinfoenddefine( gthstnml ) ! (inout)
638 end if
639
640 ! 出力タイミングのチェックとファイルの作成
641 ! Check output timing and create files
642 !
643 call hstvarsoutputcheck( &
644 & time = time, & ! (in)
645 & stime_index = svtstep ) ! (out)
646
647 ! ファイルのオープン・クローズ・再オープン
648 ! Open, close, reopen files
649 !
650 if ( create_timing_vars(vnum, svtstep) &
651 & .and. .not. histaddvar_vars(vnum) ) then
652 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
653 & varname_vars(vnum), time ) ! (in)
654 histaddvar_vars(vnum) = .true.
655 if ( flag_output_prev_vars(vnum) ) then
656 prev_outtime_vars(vnum) = time
657 else
658 flag_output_prev_vars(vnum) = .true.
659 if ( origin_time_vars(vnum) > zero_time ) then
661 else
662 prev_outtime_vars(vnum) = time
663 end if
664 end if
665 end if
666
667 if ( close_timing_vars(vnum, svtstep) ) then
668 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
669 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
670 end if
671 end if
672
673 if ( renew_timing_vars(vnum, svtstep) ) then
674 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
675 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
676 end if
677 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
678 & varname_vars(vnum), time ) ! (in)
679 newfile_createtime_vars(vnum) = time
680 prev_outtime_vars(vnum) = time
681 end if
682
683 ! 出力が有効かどうかを確認する
684 ! Confirm whether the output is effective
685 !
686 if ( .not. output_timing_vars(vnum, svtstep) &
687 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
688
689 goto 999
690 end if
691
692 ! GT_HISTORY 変数の取得
693 ! Get "GT_HISTORY" variable
694 !
695 gthist => gthst_history_vars(vnum) % gthist
696
697
698 ! 空間切り出し
699 ! Slice of spaces
700 !
701 sv => slice_vars(vnum)
702
703 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
704
705
706 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
707
708 & )
709
710
711
712 ! 空間平均
713 ! Spatial average
714 !
715 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
716 array_avr => array_slice
717 else
718 call averagereduce( &
719 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
720 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
721
722 & array_avr ) ! (out)
723 end if
724
725 ! 座標重みを取得 ; Get weights of axes
726
727
728
729 ! 単位に応じて時刻を変換
730 ! Convert time according to units
731 !
732 if ( output_timing_vars(vnum, svtstep) &
733 & .or. output_timing_avr_vars(vnum, svtstep) ) then
734
735 settime = &
736 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
737 end if
738
739 ! 時刻設定
740 ! Set time
741 !
742 if ( output_timing_vars(vnum, svtstep) ) then
743 call historysettime( &
744 & history = gthist, & ! (in) optional
745 & timed = settime ) ! (in) optional
746 end if
747
748 ! 出力
749 ! OutPut
750 !
751 if ( output_timing_avr_vars(vnum, svtstep) ) then
752 call historyput( &
753 & varname, & ! (in)
754 & array_avr, & ! (in)
755
756 & timed = settime, & ! (in) optional
757 & time_average_store = &
758 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
759 & history = gthist ) ! (inout) optional
760 else
761 call historyput( &
762 & varname, & ! (in)
763 & array_avr, & ! (in)
764
765 & history = gthist ) ! (inout) optional
766 end if
767
768 ! 最後に出力した時刻を保存
769 ! Save last time of output
770 !
771 if ( output_timing_vars(vnum, svtstep) ) then
772 if ( .not. create_timing_vars(vnum, svtstep) .and. &
773 & .not. renew_timing_vars(vnum, svtstep) ) then
774
775 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
776 & time_eps * max(1.0_dp, abs(time), &
777 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
778 prev_outtime_vars(vnum) = time
779 else
780 prev_outtime_vars(vnum) = &
782 end if
783 end if
784 end if
785
786 ! 結合解除
787 ! Release associations
788 !
789 nullify( gthist )
790 nullify( array_avr, array_slice )
791
792
793999 continue
794 call storeerror(stat, subname, cause_c = cause_c, err = err)
795 call endsub(subname)
796 end subroutine historyautoputdouble1
797
798
878 & time, varname, array, & ! (in)
879 & err & ! (out) optional
880 & )
881 !
882
883 !
884
899 use gtool_history, only: gt_history, historyput, historyinitialized, &
900 & historyaddvariable, historyinquire, historyvarinfoinquire, &
902 use dc_string, only: tochar
903 use dc_message, only: messagenotify
904 use dc_trace, only: beginsub, endsub
905 use dc_error, only: storeerror, dc_noerr, &
907 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
908 use dc_date_generic, only: operator(-), operator(+), &
909 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
912 use dc_types, only: dp, string
913 implicit none
914 real(DP), intent(in):: time
915 real(DP), parameter:: time_eps = epsilon(1.0_dp)
916
917 character(*), intent(in):: varname
918
919 real(DP), intent(in), target:: array(:,:)
920
921 logical, intent(out), optional:: err
922
923
924 type(gt_history), pointer:: gthist =>null()
925 ! gtool_history モジュール用構造体.
926 ! Derived type for "gtool_history" module
927
928 real(DP), pointer:: array_slice(:,:) =>null()
929 type(slice_info), pointer:: sv =>null()
930 real(DP), pointer:: array_avr(:,:) =>null()
931
932 real(DP):: settime
933 integer:: stat, i
934 integer:: vnum
935 character(STRING):: cause_c
936 integer, save:: svnum = 1, svtstep
937 character(*), parameter:: subname = "HistoryAutoPutDouble2"
938 continue
939 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
940 stat = dc_noerr
941 cause_c = ""
942
943 ! 初期設定チェック
944 ! Check initialization
945 !
946 if ( .not. initialized ) then
947 stat = dc_enotinit
948 cause_c = 'gtool_historyauto'
949 goto 999
950 end if
951
952 ! 時刻に関するエラー処理
953 ! Error handling for time
954 !
955 if ( time < zero_time ) then
956 cause_c = tochar( time )
957 call messagenotify( 'W', subname, &
958 & '"time=<%c>" must be positive value (varname=<%c>).', &
959 & c1 = trim( cause_c ), c2 = trim( varname ) )
960 stat = dc_enegative
961 cause_c = 'time'
962 goto 999
963 end if
964
965 ! 変数 ID のサーチ
966 ! Search variable ID
967 !
968 varsearch: do
969 do i = svnum, numvars
970 if ( trim( varname_vars(i) ) == trim(varname) ) then
971 vnum = i
972 exit varsearch
973 end if
974 end do
975 do i = 1, svnum - 1
976 if ( trim( varname_vars(i) ) == trim(varname) ) then
977 vnum = i
978 exit varsearch
979 end if
980 end do
981
982 stat = hst_ebadvarname
983 cause_c = varname
984 goto 999
985 end do varsearch
986
987 svnum = vnum
988
989 ! 定義モードからデータモードへ
990 ! Transit from define mode to data mode
991 !
992 if ( hstnmlinfodefinemode( gthstnml ) ) then
993 call hstnmlinfoenddefine( gthstnml ) ! (inout)
994 end if
995
996 ! 出力タイミングのチェックとファイルの作成
997 ! Check output timing and create files
998 !
999 call hstvarsoutputcheck( &
1000 & time = time, & ! (in)
1001 & stime_index = svtstep ) ! (out)
1002
1003 ! ファイルのオープン・クローズ・再オープン
1004 ! Open, close, reopen files
1005 !
1006 if ( create_timing_vars(vnum, svtstep) &
1007 & .and. .not. histaddvar_vars(vnum) ) then
1008 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
1009 & varname_vars(vnum), time ) ! (in)
1010 histaddvar_vars(vnum) = .true.
1011 if ( flag_output_prev_vars(vnum) ) then
1012 prev_outtime_vars(vnum) = time
1013 else
1014 flag_output_prev_vars(vnum) = .true.
1015 if ( origin_time_vars(vnum) > zero_time ) then
1017 else
1018 prev_outtime_vars(vnum) = time
1019 end if
1020 end if
1021 end if
1022
1023 if ( close_timing_vars(vnum, svtstep) ) then
1024 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
1025 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
1026 end if
1027 end if
1028
1029 if ( renew_timing_vars(vnum, svtstep) ) then
1030 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
1031 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
1032 end if
1033 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
1034 & varname_vars(vnum), time ) ! (in)
1035 newfile_createtime_vars(vnum) = time
1036 prev_outtime_vars(vnum) = time
1037 end if
1038
1039 ! 出力が有効かどうかを確認する
1040 ! Confirm whether the output is effective
1041 !
1042 if ( .not. output_timing_vars(vnum, svtstep) &
1043 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
1044
1045 goto 999
1046 end if
1047
1048 ! GT_HISTORY 変数の取得
1049 ! Get "GT_HISTORY" variable
1050 !
1051 gthist => gthst_history_vars(vnum) % gthist
1052
1053
1054 ! 空間切り出し
1055 ! Slice of spaces
1056 !
1057 sv => slice_vars(vnum)
1058
1059 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
1060
1061!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
1062
1063
1064 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
1065 & , sv%st(2):sv%ed(2):sv%sd(2) &
1066
1067 & )
1068
1069
1070
1071 ! 空間平均
1072 ! Spatial average
1073 !
1074 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
1075 array_avr => array_slice
1076 else
1077 call averagereduce( &
1078 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
1079 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
1080
1081 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
1082
1083 & array_avr ) ! (out)
1084 end if
1085
1086 ! 座標重みを取得 ; Get weights of axes
1087
1088
1089
1090 ! 単位に応じて時刻を変換
1091 ! Convert time according to units
1092 !
1093 if ( output_timing_vars(vnum, svtstep) &
1094 & .or. output_timing_avr_vars(vnum, svtstep) ) then
1095
1096 settime = &
1097 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
1098 end if
1099
1100 ! 時刻設定
1101 ! Set time
1102 !
1103 if ( output_timing_vars(vnum, svtstep) ) then
1104 call historysettime( &
1105 & history = gthist, & ! (in) optional
1106 & timed = settime ) ! (in) optional
1107 end if
1108
1109 ! 出力
1110 ! OutPut
1111 !
1112 if ( output_timing_avr_vars(vnum, svtstep) ) then
1113 call historyput( &
1114 & varname, & ! (in)
1115 & array_avr, & ! (in)
1116
1117 & timed = settime, & ! (in) optional
1118 & time_average_store = &
1119 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
1120 & history = gthist ) ! (inout) optional
1121 else
1122 call historyput( &
1123 & varname, & ! (in)
1124 & array_avr, & ! (in)
1125
1126 & history = gthist ) ! (inout) optional
1127 end if
1128
1129 ! 最後に出力した時刻を保存
1130 ! Save last time of output
1131 !
1132 if ( output_timing_vars(vnum, svtstep) ) then
1133 if ( .not. create_timing_vars(vnum, svtstep) .and. &
1134 & .not. renew_timing_vars(vnum, svtstep) ) then
1135
1136 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
1137 & time_eps * max(1.0_dp, abs(time), &
1138 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
1139 prev_outtime_vars(vnum) = time
1140 else
1141 prev_outtime_vars(vnum) = &
1143 end if
1144 end if
1145 end if
1146
1147 ! 結合解除
1148 ! Release associations
1149 !
1150 nullify( gthist )
1151 nullify( array_avr, array_slice )
1152
1153
1154999 continue
1155 call storeerror(stat, subname, cause_c = cause_c, err = err)
1156 call endsub(subname)
1157 end subroutine historyautoputdouble2
1158
1159
1239 & time, varname, array, & ! (in)
1240 & err & ! (out) optional
1241 & )
1242 !
1243
1244 !
1245
1260 use gtool_history, only: gt_history, historyput, historyinitialized, &
1261 & historyaddvariable, historyinquire, historyvarinfoinquire, &
1263 use dc_string, only: tochar
1264 use dc_message, only: messagenotify
1265 use dc_trace, only: beginsub, endsub
1266 use dc_error, only: storeerror, dc_noerr, &
1268 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
1269 use dc_date_generic, only: operator(-), operator(+), &
1270 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
1273 use dc_types, only: dp, string
1274 implicit none
1275 real(DP), intent(in):: time
1276 real(DP), parameter:: time_eps = epsilon(1.0_dp)
1277
1278 character(*), intent(in):: varname
1279
1280 real(DP), intent(in), target:: array(:,:,:)
1281
1282 logical, intent(out), optional:: err
1283
1284
1285 type(gt_history), pointer:: gthist =>null()
1286 ! gtool_history モジュール用構造体.
1287 ! Derived type for "gtool_history" module
1288
1289 real(DP), pointer:: array_slice(:,:,:) =>null()
1290 type(slice_info), pointer:: sv =>null()
1291 real(DP), pointer:: array_avr(:,:,:) =>null()
1292
1293 real(DP):: settime
1294 integer:: stat, i
1295 integer:: vnum
1296 character(STRING):: cause_c
1297 integer, save:: svnum = 1, svtstep
1298 character(*), parameter:: subname = "HistoryAutoPutDouble3"
1299 continue
1300 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
1301 stat = dc_noerr
1302 cause_c = ""
1303
1304 ! 初期設定チェック
1305 ! Check initialization
1306 !
1307 if ( .not. initialized ) then
1308 stat = dc_enotinit
1309 cause_c = 'gtool_historyauto'
1310 goto 999
1311 end if
1312
1313 ! 時刻に関するエラー処理
1314 ! Error handling for time
1315 !
1316 if ( time < zero_time ) then
1317 cause_c = tochar( time )
1318 call messagenotify( 'W', subname, &
1319 & '"time=<%c>" must be positive value (varname=<%c>).', &
1320 & c1 = trim( cause_c ), c2 = trim( varname ) )
1321 stat = dc_enegative
1322 cause_c = 'time'
1323 goto 999
1324 end if
1325
1326 ! 変数 ID のサーチ
1327 ! Search variable ID
1328 !
1329 varsearch: do
1330 do i = svnum, numvars
1331 if ( trim( varname_vars(i) ) == trim(varname) ) then
1332 vnum = i
1333 exit varsearch
1334 end if
1335 end do
1336 do i = 1, svnum - 1
1337 if ( trim( varname_vars(i) ) == trim(varname) ) then
1338 vnum = i
1339 exit varsearch
1340 end if
1341 end do
1342
1343 stat = hst_ebadvarname
1344 cause_c = varname
1345 goto 999
1346 end do varsearch
1347
1348 svnum = vnum
1349
1350 ! 定義モードからデータモードへ
1351 ! Transit from define mode to data mode
1352 !
1353 if ( hstnmlinfodefinemode( gthstnml ) ) then
1354 call hstnmlinfoenddefine( gthstnml ) ! (inout)
1355 end if
1356
1357 ! 出力タイミングのチェックとファイルの作成
1358 ! Check output timing and create files
1359 !
1360 call hstvarsoutputcheck( &
1361 & time = time, & ! (in)
1362 & stime_index = svtstep ) ! (out)
1363
1364 ! ファイルのオープン・クローズ・再オープン
1365 ! Open, close, reopen files
1366 !
1367 if ( create_timing_vars(vnum, svtstep) &
1368 & .and. .not. histaddvar_vars(vnum) ) then
1369 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
1370 & varname_vars(vnum), time ) ! (in)
1371 histaddvar_vars(vnum) = .true.
1372 if ( flag_output_prev_vars(vnum) ) then
1373 prev_outtime_vars(vnum) = time
1374 else
1375 flag_output_prev_vars(vnum) = .true.
1376 if ( origin_time_vars(vnum) > zero_time ) then
1378 else
1379 prev_outtime_vars(vnum) = time
1380 end if
1381 end if
1382 end if
1383
1384 if ( close_timing_vars(vnum, svtstep) ) then
1385 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
1386 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
1387 end if
1388 end if
1389
1390 if ( renew_timing_vars(vnum, svtstep) ) then
1391 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
1392 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
1393 end if
1394 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
1395 & varname_vars(vnum), time ) ! (in)
1396 newfile_createtime_vars(vnum) = time
1397 prev_outtime_vars(vnum) = time
1398 end if
1399
1400 ! 出力が有効かどうかを確認する
1401 ! Confirm whether the output is effective
1402 !
1403 if ( .not. output_timing_vars(vnum, svtstep) &
1404 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
1405
1406 goto 999
1407 end if
1408
1409 ! GT_HISTORY 変数の取得
1410 ! Get "GT_HISTORY" variable
1411 !
1412 gthist => gthst_history_vars(vnum) % gthist
1413
1414
1415 ! 空間切り出し
1416 ! Slice of spaces
1417 !
1418 sv => slice_vars(vnum)
1419
1420 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
1421
1422!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
1423
1424!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
1425
1426
1427 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
1428 & , sv%st(2):sv%ed(2):sv%sd(2) &
1429
1430 & , sv%st(3):sv%ed(3):sv%sd(3) &
1431
1432 & )
1433
1434
1435
1436 ! 空間平均
1437 ! Spatial average
1438 !
1439 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
1440 array_avr => array_slice
1441 else
1442 call averagereduce( &
1443 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
1444 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
1445
1446 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
1447
1448 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
1449
1450 & array_avr ) ! (out)
1451 end if
1452
1453 ! 座標重みを取得 ; Get weights of axes
1454
1455
1456
1457 ! 単位に応じて時刻を変換
1458 ! Convert time according to units
1459 !
1460 if ( output_timing_vars(vnum, svtstep) &
1461 & .or. output_timing_avr_vars(vnum, svtstep) ) then
1462
1463 settime = &
1464 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
1465 end if
1466
1467 ! 時刻設定
1468 ! Set time
1469 !
1470 if ( output_timing_vars(vnum, svtstep) ) then
1471 call historysettime( &
1472 & history = gthist, & ! (in) optional
1473 & timed = settime ) ! (in) optional
1474 end if
1475
1476 ! 出力
1477 ! OutPut
1478 !
1479 if ( output_timing_avr_vars(vnum, svtstep) ) then
1480 call historyput( &
1481 & varname, & ! (in)
1482 & array_avr, & ! (in)
1483
1484 & timed = settime, & ! (in) optional
1485 & time_average_store = &
1486 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
1487 & history = gthist ) ! (inout) optional
1488 else
1489 call historyput( &
1490 & varname, & ! (in)
1491 & array_avr, & ! (in)
1492
1493 & history = gthist ) ! (inout) optional
1494 end if
1495
1496 ! 最後に出力した時刻を保存
1497 ! Save last time of output
1498 !
1499 if ( output_timing_vars(vnum, svtstep) ) then
1500 if ( .not. create_timing_vars(vnum, svtstep) .and. &
1501 & .not. renew_timing_vars(vnum, svtstep) ) then
1502
1503 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
1504 & time_eps * max(1.0_dp, abs(time), &
1505 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
1506 prev_outtime_vars(vnum) = time
1507 else
1508 prev_outtime_vars(vnum) = &
1510 end if
1511 end if
1512 end if
1513
1514 ! 結合解除
1515 ! Release associations
1516 !
1517 nullify( gthist )
1518 nullify( array_avr, array_slice )
1519
1520
1521999 continue
1522 call storeerror(stat, subname, cause_c = cause_c, err = err)
1523 call endsub(subname)
1524 end subroutine historyautoputdouble3
1525
1526
1606 & time, varname, array, & ! (in)
1607 & err & ! (out) optional
1608 & )
1609 !
1610
1611 !
1612
1627 use gtool_history, only: gt_history, historyput, historyinitialized, &
1628 & historyaddvariable, historyinquire, historyvarinfoinquire, &
1630 use dc_string, only: tochar
1631 use dc_message, only: messagenotify
1632 use dc_trace, only: beginsub, endsub
1633 use dc_error, only: storeerror, dc_noerr, &
1635 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
1636 use dc_date_generic, only: operator(-), operator(+), &
1637 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
1640 use dc_types, only: dp, string
1641 implicit none
1642 real(DP), intent(in):: time
1643 real(DP), parameter:: time_eps = epsilon(1.0_dp)
1644
1645 character(*), intent(in):: varname
1646
1647 real(DP), intent(in), target:: array(:,:,:,:)
1648
1649 logical, intent(out), optional:: err
1650
1651
1652 type(gt_history), pointer:: gthist =>null()
1653 ! gtool_history モジュール用構造体.
1654 ! Derived type for "gtool_history" module
1655
1656 real(DP), pointer:: array_slice(:,:,:,:) =>null()
1657 type(slice_info), pointer:: sv =>null()
1658 real(DP), pointer:: array_avr(:,:,:,:) =>null()
1659
1660 real(DP):: settime
1661 integer:: stat, i
1662 integer:: vnum
1663 character(STRING):: cause_c
1664 integer, save:: svnum = 1, svtstep
1665 character(*), parameter:: subname = "HistoryAutoPutDouble4"
1666 continue
1667 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
1668 stat = dc_noerr
1669 cause_c = ""
1670
1671 ! 初期設定チェック
1672 ! Check initialization
1673 !
1674 if ( .not. initialized ) then
1675 stat = dc_enotinit
1676 cause_c = 'gtool_historyauto'
1677 goto 999
1678 end if
1679
1680 ! 時刻に関するエラー処理
1681 ! Error handling for time
1682 !
1683 if ( time < zero_time ) then
1684 cause_c = tochar( time )
1685 call messagenotify( 'W', subname, &
1686 & '"time=<%c>" must be positive value (varname=<%c>).', &
1687 & c1 = trim( cause_c ), c2 = trim( varname ) )
1688 stat = dc_enegative
1689 cause_c = 'time'
1690 goto 999
1691 end if
1692
1693 ! 変数 ID のサーチ
1694 ! Search variable ID
1695 !
1696 varsearch: do
1697 do i = svnum, numvars
1698 if ( trim( varname_vars(i) ) == trim(varname) ) then
1699 vnum = i
1700 exit varsearch
1701 end if
1702 end do
1703 do i = 1, svnum - 1
1704 if ( trim( varname_vars(i) ) == trim(varname) ) then
1705 vnum = i
1706 exit varsearch
1707 end if
1708 end do
1709
1710 stat = hst_ebadvarname
1711 cause_c = varname
1712 goto 999
1713 end do varsearch
1714
1715 svnum = vnum
1716
1717 ! 定義モードからデータモードへ
1718 ! Transit from define mode to data mode
1719 !
1720 if ( hstnmlinfodefinemode( gthstnml ) ) then
1721 call hstnmlinfoenddefine( gthstnml ) ! (inout)
1722 end if
1723
1724 ! 出力タイミングのチェックとファイルの作成
1725 ! Check output timing and create files
1726 !
1727 call hstvarsoutputcheck( &
1728 & time = time, & ! (in)
1729 & stime_index = svtstep ) ! (out)
1730
1731 ! ファイルのオープン・クローズ・再オープン
1732 ! Open, close, reopen files
1733 !
1734 if ( create_timing_vars(vnum, svtstep) &
1735 & .and. .not. histaddvar_vars(vnum) ) then
1736 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
1737 & varname_vars(vnum), time ) ! (in)
1738 histaddvar_vars(vnum) = .true.
1739 if ( flag_output_prev_vars(vnum) ) then
1740 prev_outtime_vars(vnum) = time
1741 else
1742 flag_output_prev_vars(vnum) = .true.
1743 if ( origin_time_vars(vnum) > zero_time ) then
1745 else
1746 prev_outtime_vars(vnum) = time
1747 end if
1748 end if
1749 end if
1750
1751 if ( close_timing_vars(vnum, svtstep) ) then
1752 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
1753 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
1754 end if
1755 end if
1756
1757 if ( renew_timing_vars(vnum, svtstep) ) then
1758 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
1759 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
1760 end if
1761 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
1762 & varname_vars(vnum), time ) ! (in)
1763 newfile_createtime_vars(vnum) = time
1764 prev_outtime_vars(vnum) = time
1765 end if
1766
1767 ! 出力が有効かどうかを確認する
1768 ! Confirm whether the output is effective
1769 !
1770 if ( .not. output_timing_vars(vnum, svtstep) &
1771 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
1772
1773 goto 999
1774 end if
1775
1776 ! GT_HISTORY 変数の取得
1777 ! Get "GT_HISTORY" variable
1778 !
1779 gthist => gthst_history_vars(vnum) % gthist
1780
1781
1782 ! 空間切り出し
1783 ! Slice of spaces
1784 !
1785 sv => slice_vars(vnum)
1786
1787 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
1788
1789!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
1790
1791!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
1792
1793!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
1794
1795
1796 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
1797 & , sv%st(2):sv%ed(2):sv%sd(2) &
1798
1799 & , sv%st(3):sv%ed(3):sv%sd(3) &
1800
1801 & , sv%st(4):sv%ed(4):sv%sd(4) &
1802
1803 & )
1804
1805
1806
1807 ! 空間平均
1808 ! Spatial average
1809 !
1810 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
1811 array_avr => array_slice
1812 else
1813 call averagereduce( &
1814 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
1815 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
1816
1817 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
1818
1819 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
1820
1821 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
1822
1823 & array_avr ) ! (out)
1824 end if
1825
1826 ! 座標重みを取得 ; Get weights of axes
1827
1828
1829
1830 ! 単位に応じて時刻を変換
1831 ! Convert time according to units
1832 !
1833 if ( output_timing_vars(vnum, svtstep) &
1834 & .or. output_timing_avr_vars(vnum, svtstep) ) then
1835
1836 settime = &
1837 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
1838 end if
1839
1840 ! 時刻設定
1841 ! Set time
1842 !
1843 if ( output_timing_vars(vnum, svtstep) ) then
1844 call historysettime( &
1845 & history = gthist, & ! (in) optional
1846 & timed = settime ) ! (in) optional
1847 end if
1848
1849 ! 出力
1850 ! OutPut
1851 !
1852 if ( output_timing_avr_vars(vnum, svtstep) ) then
1853 call historyput( &
1854 & varname, & ! (in)
1855 & array_avr, & ! (in)
1856
1857 & timed = settime, & ! (in) optional
1858 & time_average_store = &
1859 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
1860 & history = gthist ) ! (inout) optional
1861 else
1862 call historyput( &
1863 & varname, & ! (in)
1864 & array_avr, & ! (in)
1865
1866 & history = gthist ) ! (inout) optional
1867 end if
1868
1869 ! 最後に出力した時刻を保存
1870 ! Save last time of output
1871 !
1872 if ( output_timing_vars(vnum, svtstep) ) then
1873 if ( .not. create_timing_vars(vnum, svtstep) .and. &
1874 & .not. renew_timing_vars(vnum, svtstep) ) then
1875
1876 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
1877 & time_eps * max(1.0_dp, abs(time), &
1878 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
1879 prev_outtime_vars(vnum) = time
1880 else
1881 prev_outtime_vars(vnum) = &
1883 end if
1884 end if
1885 end if
1886
1887 ! 結合解除
1888 ! Release associations
1889 !
1890 nullify( gthist )
1891 nullify( array_avr, array_slice )
1892
1893
1894999 continue
1895 call storeerror(stat, subname, cause_c = cause_c, err = err)
1896 call endsub(subname)
1897 end subroutine historyautoputdouble4
1898
1899
1979 & time, varname, array, & ! (in)
1980 & err & ! (out) optional
1981 & )
1982 !
1983
1984 !
1985
2000 use gtool_history, only: gt_history, historyput, historyinitialized, &
2001 & historyaddvariable, historyinquire, historyvarinfoinquire, &
2003 use dc_string, only: tochar
2004 use dc_message, only: messagenotify
2005 use dc_trace, only: beginsub, endsub
2006 use dc_error, only: storeerror, dc_noerr, &
2008 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
2009 use dc_date_generic, only: operator(-), operator(+), &
2010 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
2013 use dc_types, only: dp, string
2014 implicit none
2015 real(DP), intent(in):: time
2016 real(DP), parameter:: time_eps = epsilon(1.0_dp)
2017
2018 character(*), intent(in):: varname
2019
2020 real(DP), intent(in), target:: array(:,:,:,:,:)
2021
2022 logical, intent(out), optional:: err
2023
2024
2025 type(gt_history), pointer:: gthist =>null()
2026 ! gtool_history モジュール用構造体.
2027 ! Derived type for "gtool_history" module
2028
2029 real(DP), pointer:: array_slice(:,:,:,:,:) =>null()
2030 type(slice_info), pointer:: sv =>null()
2031 real(DP), pointer:: array_avr(:,:,:,:,:) =>null()
2032
2033 real(DP):: settime
2034 integer:: stat, i
2035 integer:: vnum
2036 character(STRING):: cause_c
2037 integer, save:: svnum = 1, svtstep
2038 character(*), parameter:: subname = "HistoryAutoPutDouble5"
2039 continue
2040 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
2041 stat = dc_noerr
2042 cause_c = ""
2043
2044 ! 初期設定チェック
2045 ! Check initialization
2046 !
2047 if ( .not. initialized ) then
2048 stat = dc_enotinit
2049 cause_c = 'gtool_historyauto'
2050 goto 999
2051 end if
2052
2053 ! 時刻に関するエラー処理
2054 ! Error handling for time
2055 !
2056 if ( time < zero_time ) then
2057 cause_c = tochar( time )
2058 call messagenotify( 'W', subname, &
2059 & '"time=<%c>" must be positive value (varname=<%c>).', &
2060 & c1 = trim( cause_c ), c2 = trim( varname ) )
2061 stat = dc_enegative
2062 cause_c = 'time'
2063 goto 999
2064 end if
2065
2066 ! 変数 ID のサーチ
2067 ! Search variable ID
2068 !
2069 varsearch: do
2070 do i = svnum, numvars
2071 if ( trim( varname_vars(i) ) == trim(varname) ) then
2072 vnum = i
2073 exit varsearch
2074 end if
2075 end do
2076 do i = 1, svnum - 1
2077 if ( trim( varname_vars(i) ) == trim(varname) ) then
2078 vnum = i
2079 exit varsearch
2080 end if
2081 end do
2082
2083 stat = hst_ebadvarname
2084 cause_c = varname
2085 goto 999
2086 end do varsearch
2087
2088 svnum = vnum
2089
2090 ! 定義モードからデータモードへ
2091 ! Transit from define mode to data mode
2092 !
2093 if ( hstnmlinfodefinemode( gthstnml ) ) then
2094 call hstnmlinfoenddefine( gthstnml ) ! (inout)
2095 end if
2096
2097 ! 出力タイミングのチェックとファイルの作成
2098 ! Check output timing and create files
2099 !
2100 call hstvarsoutputcheck( &
2101 & time = time, & ! (in)
2102 & stime_index = svtstep ) ! (out)
2103
2104 ! ファイルのオープン・クローズ・再オープン
2105 ! Open, close, reopen files
2106 !
2107 if ( create_timing_vars(vnum, svtstep) &
2108 & .and. .not. histaddvar_vars(vnum) ) then
2109 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
2110 & varname_vars(vnum), time ) ! (in)
2111 histaddvar_vars(vnum) = .true.
2112 if ( flag_output_prev_vars(vnum) ) then
2113 prev_outtime_vars(vnum) = time
2114 else
2115 flag_output_prev_vars(vnum) = .true.
2116 if ( origin_time_vars(vnum) > zero_time ) then
2118 else
2119 prev_outtime_vars(vnum) = time
2120 end if
2121 end if
2122 end if
2123
2124 if ( close_timing_vars(vnum, svtstep) ) then
2125 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
2126 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
2127 end if
2128 end if
2129
2130 if ( renew_timing_vars(vnum, svtstep) ) then
2131 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
2132 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
2133 end if
2134 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
2135 & varname_vars(vnum), time ) ! (in)
2136 newfile_createtime_vars(vnum) = time
2137 prev_outtime_vars(vnum) = time
2138 end if
2139
2140 ! 出力が有効かどうかを確認する
2141 ! Confirm whether the output is effective
2142 !
2143 if ( .not. output_timing_vars(vnum, svtstep) &
2144 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
2145
2146 goto 999
2147 end if
2148
2149 ! GT_HISTORY 変数の取得
2150 ! Get "GT_HISTORY" variable
2151 !
2152 gthist => gthst_history_vars(vnum) % gthist
2153
2154
2155 ! 空間切り出し
2156 ! Slice of spaces
2157 !
2158 sv => slice_vars(vnum)
2159
2160 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
2161
2162!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
2163
2164!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
2165
2166!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
2167
2168!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
2169
2170
2171 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
2172 & , sv%st(2):sv%ed(2):sv%sd(2) &
2173
2174 & , sv%st(3):sv%ed(3):sv%sd(3) &
2175
2176 & , sv%st(4):sv%ed(4):sv%sd(4) &
2177
2178 & , sv%st(5):sv%ed(5):sv%sd(5) &
2179
2180 & )
2181
2182
2183
2184 ! 空間平均
2185 ! Spatial average
2186 !
2187 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
2188 array_avr => array_slice
2189 else
2190 call averagereduce( &
2191 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
2192 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
2193
2194 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
2195
2196 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
2197
2198 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
2199
2200 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
2201
2202 & array_avr ) ! (out)
2203 end if
2204
2205 ! 座標重みを取得 ; Get weights of axes
2206
2207
2208
2209 ! 単位に応じて時刻を変換
2210 ! Convert time according to units
2211 !
2212 if ( output_timing_vars(vnum, svtstep) &
2213 & .or. output_timing_avr_vars(vnum, svtstep) ) then
2214
2215 settime = &
2216 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
2217 end if
2218
2219 ! 時刻設定
2220 ! Set time
2221 !
2222 if ( output_timing_vars(vnum, svtstep) ) then
2223 call historysettime( &
2224 & history = gthist, & ! (in) optional
2225 & timed = settime ) ! (in) optional
2226 end if
2227
2228 ! 出力
2229 ! OutPut
2230 !
2231 if ( output_timing_avr_vars(vnum, svtstep) ) then
2232 call historyput( &
2233 & varname, & ! (in)
2234 & array_avr, & ! (in)
2235
2236 & timed = settime, & ! (in) optional
2237 & time_average_store = &
2238 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
2239 & history = gthist ) ! (inout) optional
2240 else
2241 call historyput( &
2242 & varname, & ! (in)
2243 & array_avr, & ! (in)
2244
2245 & history = gthist ) ! (inout) optional
2246 end if
2247
2248 ! 最後に出力した時刻を保存
2249 ! Save last time of output
2250 !
2251 if ( output_timing_vars(vnum, svtstep) ) then
2252 if ( .not. create_timing_vars(vnum, svtstep) .and. &
2253 & .not. renew_timing_vars(vnum, svtstep) ) then
2254
2255 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
2256 & time_eps * max(1.0_dp, abs(time), &
2257 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
2258 prev_outtime_vars(vnum) = time
2259 else
2260 prev_outtime_vars(vnum) = &
2262 end if
2263 end if
2264 end if
2265
2266 ! 結合解除
2267 ! Release associations
2268 !
2269 nullify( gthist )
2270 nullify( array_avr, array_slice )
2271
2272
2273999 continue
2274 call storeerror(stat, subname, cause_c = cause_c, err = err)
2275 call endsub(subname)
2276 end subroutine historyautoputdouble5
2277
2278
2358 & time, varname, array, & ! (in)
2359 & err & ! (out) optional
2360 & )
2361 !
2362
2363 !
2364
2379 use gtool_history, only: gt_history, historyput, historyinitialized, &
2380 & historyaddvariable, historyinquire, historyvarinfoinquire, &
2382 use dc_string, only: tochar
2383 use dc_message, only: messagenotify
2384 use dc_trace, only: beginsub, endsub
2385 use dc_error, only: storeerror, dc_noerr, &
2387 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
2388 use dc_date_generic, only: operator(-), operator(+), &
2389 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
2392 use dc_types, only: dp, string
2393 implicit none
2394 real(DP), intent(in):: time
2395 real(DP), parameter:: time_eps = epsilon(1.0_dp)
2396
2397 character(*), intent(in):: varname
2398
2399 real(DP), intent(in), target:: array(:,:,:,:,:,:)
2400
2401 logical, intent(out), optional:: err
2402
2403
2404 type(gt_history), pointer:: gthist =>null()
2405 ! gtool_history モジュール用構造体.
2406 ! Derived type for "gtool_history" module
2407
2408 real(DP), pointer:: array_slice(:,:,:,:,:,:) =>null()
2409 type(slice_info), pointer:: sv =>null()
2410 real(DP), pointer:: array_avr(:,:,:,:,:,:) =>null()
2411
2412 real(DP):: settime
2413 integer:: stat, i
2414 integer:: vnum
2415 character(STRING):: cause_c
2416 integer, save:: svnum = 1, svtstep
2417 character(*), parameter:: subname = "HistoryAutoPutDouble6"
2418 continue
2419 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
2420 stat = dc_noerr
2421 cause_c = ""
2422
2423 ! 初期設定チェック
2424 ! Check initialization
2425 !
2426 if ( .not. initialized ) then
2427 stat = dc_enotinit
2428 cause_c = 'gtool_historyauto'
2429 goto 999
2430 end if
2431
2432 ! 時刻に関するエラー処理
2433 ! Error handling for time
2434 !
2435 if ( time < zero_time ) then
2436 cause_c = tochar( time )
2437 call messagenotify( 'W', subname, &
2438 & '"time=<%c>" must be positive value (varname=<%c>).', &
2439 & c1 = trim( cause_c ), c2 = trim( varname ) )
2440 stat = dc_enegative
2441 cause_c = 'time'
2442 goto 999
2443 end if
2444
2445 ! 変数 ID のサーチ
2446 ! Search variable ID
2447 !
2448 varsearch: do
2449 do i = svnum, numvars
2450 if ( trim( varname_vars(i) ) == trim(varname) ) then
2451 vnum = i
2452 exit varsearch
2453 end if
2454 end do
2455 do i = 1, svnum - 1
2456 if ( trim( varname_vars(i) ) == trim(varname) ) then
2457 vnum = i
2458 exit varsearch
2459 end if
2460 end do
2461
2462 stat = hst_ebadvarname
2463 cause_c = varname
2464 goto 999
2465 end do varsearch
2466
2467 svnum = vnum
2468
2469 ! 定義モードからデータモードへ
2470 ! Transit from define mode to data mode
2471 !
2472 if ( hstnmlinfodefinemode( gthstnml ) ) then
2473 call hstnmlinfoenddefine( gthstnml ) ! (inout)
2474 end if
2475
2476 ! 出力タイミングのチェックとファイルの作成
2477 ! Check output timing and create files
2478 !
2479 call hstvarsoutputcheck( &
2480 & time = time, & ! (in)
2481 & stime_index = svtstep ) ! (out)
2482
2483 ! ファイルのオープン・クローズ・再オープン
2484 ! Open, close, reopen files
2485 !
2486 if ( create_timing_vars(vnum, svtstep) &
2487 & .and. .not. histaddvar_vars(vnum) ) then
2488 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
2489 & varname_vars(vnum), time ) ! (in)
2490 histaddvar_vars(vnum) = .true.
2491 if ( flag_output_prev_vars(vnum) ) then
2492 prev_outtime_vars(vnum) = time
2493 else
2494 flag_output_prev_vars(vnum) = .true.
2495 if ( origin_time_vars(vnum) > zero_time ) then
2497 else
2498 prev_outtime_vars(vnum) = time
2499 end if
2500 end if
2501 end if
2502
2503 if ( close_timing_vars(vnum, svtstep) ) then
2504 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
2505 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
2506 end if
2507 end if
2508
2509 if ( renew_timing_vars(vnum, svtstep) ) then
2510 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
2511 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
2512 end if
2513 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
2514 & varname_vars(vnum), time ) ! (in)
2515 newfile_createtime_vars(vnum) = time
2516 prev_outtime_vars(vnum) = time
2517 end if
2518
2519 ! 出力が有効かどうかを確認する
2520 ! Confirm whether the output is effective
2521 !
2522 if ( .not. output_timing_vars(vnum, svtstep) &
2523 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
2524
2525 goto 999
2526 end if
2527
2528 ! GT_HISTORY 変数の取得
2529 ! Get "GT_HISTORY" variable
2530 !
2531 gthist => gthst_history_vars(vnum) % gthist
2532
2533
2534 ! 空間切り出し
2535 ! Slice of spaces
2536 !
2537 sv => slice_vars(vnum)
2538
2539 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
2540
2541!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
2542
2543!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
2544
2545!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
2546
2547!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
2548
2549!!$ write(*,*) ' sv%st(6), sv%ed(6), sv%sd(6)=', sv%st(6), sv%ed(6), sv%sd(6)
2550
2551
2552 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
2553 & , sv%st(2):sv%ed(2):sv%sd(2) &
2554
2555 & , sv%st(3):sv%ed(3):sv%sd(3) &
2556
2557 & , sv%st(4):sv%ed(4):sv%sd(4) &
2558
2559 & , sv%st(5):sv%ed(5):sv%sd(5) &
2560
2561 & , sv%st(6):sv%ed(6):sv%sd(6) &
2562
2563 & )
2564
2565
2566
2567 ! 空間平均
2568 ! Spatial average
2569 !
2570 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
2571 array_avr => array_slice
2572 else
2573 call averagereduce( &
2574 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
2575 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
2576
2577 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
2578
2579 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
2580
2581 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
2582
2583 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
2584
2585 & weight_vars(vnum) % wgt6( sv%st(6):sv%ed(6):sv%sd(6) ) , & ! (in)
2586
2587 & array_avr ) ! (out)
2588 end if
2589
2590 ! 座標重みを取得 ; Get weights of axes
2591
2592
2593
2594 ! 単位に応じて時刻を変換
2595 ! Convert time according to units
2596 !
2597 if ( output_timing_vars(vnum, svtstep) &
2598 & .or. output_timing_avr_vars(vnum, svtstep) ) then
2599
2600 settime = &
2601 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
2602 end if
2603
2604 ! 時刻設定
2605 ! Set time
2606 !
2607 if ( output_timing_vars(vnum, svtstep) ) then
2608 call historysettime( &
2609 & history = gthist, & ! (in) optional
2610 & timed = settime ) ! (in) optional
2611 end if
2612
2613 ! 出力
2614 ! OutPut
2615 !
2616 if ( output_timing_avr_vars(vnum, svtstep) ) then
2617 call historyput( &
2618 & varname, & ! (in)
2619 & array_avr, & ! (in)
2620
2621 & timed = settime, & ! (in) optional
2622 & time_average_store = &
2623 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
2624 & history = gthist ) ! (inout) optional
2625 else
2626 call historyput( &
2627 & varname, & ! (in)
2628 & array_avr, & ! (in)
2629
2630 & history = gthist ) ! (inout) optional
2631 end if
2632
2633 ! 最後に出力した時刻を保存
2634 ! Save last time of output
2635 !
2636 if ( output_timing_vars(vnum, svtstep) ) then
2637 if ( .not. create_timing_vars(vnum, svtstep) .and. &
2638 & .not. renew_timing_vars(vnum, svtstep) ) then
2639
2640 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
2641 & time_eps * max(1.0_dp, abs(time), &
2642 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
2643 prev_outtime_vars(vnum) = time
2644 else
2645 prev_outtime_vars(vnum) = &
2647 end if
2648 end if
2649 end if
2650
2651 ! 結合解除
2652 ! Release associations
2653 !
2654 nullify( gthist )
2655 nullify( array_avr, array_slice )
2656
2657
2658999 continue
2659 call storeerror(stat, subname, cause_c = cause_c, err = err)
2660 call endsub(subname)
2661 end subroutine historyautoputdouble6
2662
2663
2743 & time, varname, array, & ! (in)
2744 & err & ! (out) optional
2745 & )
2746 !
2747
2748 !
2749
2764 use gtool_history, only: gt_history, historyput, historyinitialized, &
2765 & historyaddvariable, historyinquire, historyvarinfoinquire, &
2767 use dc_string, only: tochar
2768 use dc_message, only: messagenotify
2769 use dc_trace, only: beginsub, endsub
2770 use dc_error, only: storeerror, dc_noerr, &
2772 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
2773 use dc_date_generic, only: operator(-), operator(+), &
2774 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
2777 use dc_types, only: dp, string
2778 implicit none
2779 real(DP), intent(in):: time
2780 real(DP), parameter:: time_eps = epsilon(1.0_dp)
2781
2782 character(*), intent(in):: varname
2783
2784 real(DP), intent(in), target:: array(:,:,:,:,:,:,:)
2785
2786 logical, intent(out), optional:: err
2787
2788
2789 type(gt_history), pointer:: gthist =>null()
2790 ! gtool_history モジュール用構造体.
2791 ! Derived type for "gtool_history" module
2792
2793 real(DP), pointer:: array_slice(:,:,:,:,:,:,:) =>null()
2794 type(slice_info), pointer:: sv =>null()
2795 real(DP), pointer:: array_avr(:,:,:,:,:,:,:) =>null()
2796
2797 real(DP):: settime
2798 integer:: stat, i
2799 integer:: vnum
2800 character(STRING):: cause_c
2801 integer, save:: svnum = 1, svtstep
2802 character(*), parameter:: subname = "HistoryAutoPutDouble7"
2803 continue
2804 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
2805 stat = dc_noerr
2806 cause_c = ""
2807
2808 ! 初期設定チェック
2809 ! Check initialization
2810 !
2811 if ( .not. initialized ) then
2812 stat = dc_enotinit
2813 cause_c = 'gtool_historyauto'
2814 goto 999
2815 end if
2816
2817 ! 時刻に関するエラー処理
2818 ! Error handling for time
2819 !
2820 if ( time < zero_time ) then
2821 cause_c = tochar( time )
2822 call messagenotify( 'W', subname, &
2823 & '"time=<%c>" must be positive value (varname=<%c>).', &
2824 & c1 = trim( cause_c ), c2 = trim( varname ) )
2825 stat = dc_enegative
2826 cause_c = 'time'
2827 goto 999
2828 end if
2829
2830 ! 変数 ID のサーチ
2831 ! Search variable ID
2832 !
2833 varsearch: do
2834 do i = svnum, numvars
2835 if ( trim( varname_vars(i) ) == trim(varname) ) then
2836 vnum = i
2837 exit varsearch
2838 end if
2839 end do
2840 do i = 1, svnum - 1
2841 if ( trim( varname_vars(i) ) == trim(varname) ) then
2842 vnum = i
2843 exit varsearch
2844 end if
2845 end do
2846
2847 stat = hst_ebadvarname
2848 cause_c = varname
2849 goto 999
2850 end do varsearch
2851
2852 svnum = vnum
2853
2854 ! 定義モードからデータモードへ
2855 ! Transit from define mode to data mode
2856 !
2857 if ( hstnmlinfodefinemode( gthstnml ) ) then
2858 call hstnmlinfoenddefine( gthstnml ) ! (inout)
2859 end if
2860
2861 ! 出力タイミングのチェックとファイルの作成
2862 ! Check output timing and create files
2863 !
2864 call hstvarsoutputcheck( &
2865 & time = time, & ! (in)
2866 & stime_index = svtstep ) ! (out)
2867
2868 ! ファイルのオープン・クローズ・再オープン
2869 ! Open, close, reopen files
2870 !
2871 if ( create_timing_vars(vnum, svtstep) &
2872 & .and. .not. histaddvar_vars(vnum) ) then
2873 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
2874 & varname_vars(vnum), time ) ! (in)
2875 histaddvar_vars(vnum) = .true.
2876 if ( flag_output_prev_vars(vnum) ) then
2877 prev_outtime_vars(vnum) = time
2878 else
2879 flag_output_prev_vars(vnum) = .true.
2880 if ( origin_time_vars(vnum) > zero_time ) then
2882 else
2883 prev_outtime_vars(vnum) = time
2884 end if
2885 end if
2886 end if
2887
2888 if ( close_timing_vars(vnum, svtstep) ) then
2889 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
2890 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
2891 end if
2892 end if
2893
2894 if ( renew_timing_vars(vnum, svtstep) ) then
2895 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
2896 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
2897 end if
2898 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
2899 & varname_vars(vnum), time ) ! (in)
2900 newfile_createtime_vars(vnum) = time
2901 prev_outtime_vars(vnum) = time
2902 end if
2903
2904 ! 出力が有効かどうかを確認する
2905 ! Confirm whether the output is effective
2906 !
2907 if ( .not. output_timing_vars(vnum, svtstep) &
2908 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
2909
2910 goto 999
2911 end if
2912
2913 ! GT_HISTORY 変数の取得
2914 ! Get "GT_HISTORY" variable
2915 !
2916 gthist => gthst_history_vars(vnum) % gthist
2917
2918
2919 ! 空間切り出し
2920 ! Slice of spaces
2921 !
2922 sv => slice_vars(vnum)
2923
2924 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
2925
2926!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
2927
2928!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
2929
2930!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
2931
2932!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
2933
2934!!$ write(*,*) ' sv%st(6), sv%ed(6), sv%sd(6)=', sv%st(6), sv%ed(6), sv%sd(6)
2935
2936!!$ write(*,*) ' sv%st(7), sv%ed(7), sv%sd(7)=', sv%st(7), sv%ed(7), sv%sd(7)
2937
2938
2939 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
2940 & , sv%st(2):sv%ed(2):sv%sd(2) &
2941
2942 & , sv%st(3):sv%ed(3):sv%sd(3) &
2943
2944 & , sv%st(4):sv%ed(4):sv%sd(4) &
2945
2946 & , sv%st(5):sv%ed(5):sv%sd(5) &
2947
2948 & , sv%st(6):sv%ed(6):sv%sd(6) &
2949
2950 & , sv%st(7):sv%ed(7):sv%sd(7) &
2951
2952 & )
2953
2954
2955
2956 ! 空間平均
2957 ! Spatial average
2958 !
2959 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
2960 array_avr => array_slice
2961 else
2962 call averagereduce( &
2963 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
2964 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
2965
2966 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
2967
2968 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
2969
2970 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
2971
2972 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
2973
2974 & weight_vars(vnum) % wgt6( sv%st(6):sv%ed(6):sv%sd(6) ) , & ! (in)
2975
2976 & weight_vars(vnum) % wgt7( sv%st(7):sv%ed(7):sv%sd(7) ) , & ! (in)
2977
2978 & array_avr ) ! (out)
2979 end if
2980
2981 ! 座標重みを取得 ; Get weights of axes
2982
2983
2984
2985 ! 単位に応じて時刻を変換
2986 ! Convert time according to units
2987 !
2988 if ( output_timing_vars(vnum, svtstep) &
2989 & .or. output_timing_avr_vars(vnum, svtstep) ) then
2990
2991 settime = &
2992 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
2993 end if
2994
2995 ! 時刻設定
2996 ! Set time
2997 !
2998 if ( output_timing_vars(vnum, svtstep) ) then
2999 call historysettime( &
3000 & history = gthist, & ! (in) optional
3001 & timed = settime ) ! (in) optional
3002 end if
3003
3004 ! 出力
3005 ! OutPut
3006 !
3007 if ( output_timing_avr_vars(vnum, svtstep) ) then
3008 call historyput( &
3009 & varname, & ! (in)
3010 & array_avr, & ! (in)
3011
3012 & timed = settime, & ! (in) optional
3013 & time_average_store = &
3014 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
3015 & history = gthist ) ! (inout) optional
3016 else
3017 call historyput( &
3018 & varname, & ! (in)
3019 & array_avr, & ! (in)
3020
3021 & history = gthist ) ! (inout) optional
3022 end if
3023
3024 ! 最後に出力した時刻を保存
3025 ! Save last time of output
3026 !
3027 if ( output_timing_vars(vnum, svtstep) ) then
3028 if ( .not. create_timing_vars(vnum, svtstep) .and. &
3029 & .not. renew_timing_vars(vnum, svtstep) ) then
3030
3031 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
3032 & time_eps * max(1.0_dp, abs(time), &
3033 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
3034 prev_outtime_vars(vnum) = time
3035 else
3036 prev_outtime_vars(vnum) = &
3038 end if
3039 end if
3040 end if
3041
3042 ! 結合解除
3043 ! Release associations
3044 !
3045 nullify( gthist )
3046 nullify( array_avr, array_slice )
3047
3048
3049999 continue
3050 call storeerror(stat, subname, cause_c = cause_c, err = err)
3051 call endsub(subname)
3052 end subroutine historyautoputdouble7
3053
3054
3134 & time, varname, value, & ! (in)
3135 & err & ! (out) optional
3136 & )
3137 !
3138
3139 !
3140
3154 use gtool_history, only: gt_history, historyput, historyinitialized, &
3155 & historyaddvariable, historyinquire, historyvarinfoinquire, &
3157 use dc_string, only: tochar
3158 use dc_message, only: messagenotify
3159 use dc_trace, only: beginsub, endsub
3160 use dc_error, only: storeerror, dc_noerr, &
3162 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
3163 use dc_date_generic, only: operator(-), operator(+), &
3164 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
3167 use dc_types, only: dp, string
3168 implicit none
3169 real(DP), intent(in):: time
3170 real(DP), parameter:: time_eps = epsilon(1.0_dp)
3171
3172 character(*), intent(in):: varname
3173
3174 real, intent(in), target:: value
3175
3176 logical, intent(out), optional:: err
3177
3178
3179 type(gt_history), pointer:: gthist =>null()
3180 ! gtool_history モジュール用構造体.
3181 ! Derived type for "gtool_history" module
3182
3183
3184 real(DP):: settime
3185 integer:: stat, i
3186 integer:: vnum
3187 character(STRING):: cause_c
3188 integer, save:: svnum = 1, svtstep
3189 character(*), parameter:: subname = "HistoryAutoPutReal0"
3190 continue
3191 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
3192 stat = dc_noerr
3193 cause_c = ""
3194
3195 ! 初期設定チェック
3196 ! Check initialization
3197 !
3198 if ( .not. initialized ) then
3199 stat = dc_enotinit
3200 cause_c = 'gtool_historyauto'
3201 goto 999
3202 end if
3203
3204 ! 時刻に関するエラー処理
3205 ! Error handling for time
3206 !
3207 if ( time < zero_time ) then
3208 cause_c = tochar( time )
3209 call messagenotify( 'W', subname, &
3210 & '"time=<%c>" must be positive value (varname=<%c>).', &
3211 & c1 = trim( cause_c ), c2 = trim( varname ) )
3212 stat = dc_enegative
3213 cause_c = 'time'
3214 goto 999
3215 end if
3216
3217 ! 変数 ID のサーチ
3218 ! Search variable ID
3219 !
3220 varsearch: do
3221 do i = svnum, numvars
3222 if ( trim( varname_vars(i) ) == trim(varname) ) then
3223 vnum = i
3224 exit varsearch
3225 end if
3226 end do
3227 do i = 1, svnum - 1
3228 if ( trim( varname_vars(i) ) == trim(varname) ) then
3229 vnum = i
3230 exit varsearch
3231 end if
3232 end do
3233
3234 stat = hst_ebadvarname
3235 cause_c = varname
3236 goto 999
3237 end do varsearch
3238
3239 svnum = vnum
3240
3241 ! 定義モードからデータモードへ
3242 ! Transit from define mode to data mode
3243 !
3244 if ( hstnmlinfodefinemode( gthstnml ) ) then
3245 call hstnmlinfoenddefine( gthstnml ) ! (inout)
3246 end if
3247
3248 ! 出力タイミングのチェックとファイルの作成
3249 ! Check output timing and create files
3250 !
3251 call hstvarsoutputcheck( &
3252 & time = time, & ! (in)
3253 & stime_index = svtstep ) ! (out)
3254
3255 ! ファイルのオープン・クローズ・再オープン
3256 ! Open, close, reopen files
3257 !
3258 if ( create_timing_vars(vnum, svtstep) &
3259 & .and. .not. histaddvar_vars(vnum) ) then
3260 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
3261 & varname_vars(vnum), time ) ! (in)
3262 histaddvar_vars(vnum) = .true.
3263 if ( flag_output_prev_vars(vnum) ) then
3264 prev_outtime_vars(vnum) = time
3265 else
3266 flag_output_prev_vars(vnum) = .true.
3267 if ( origin_time_vars(vnum) > zero_time ) then
3269 else
3270 prev_outtime_vars(vnum) = time
3271 end if
3272 end if
3273 end if
3274
3275 if ( close_timing_vars(vnum, svtstep) ) then
3276 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
3277 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
3278 end if
3279 end if
3280
3281 if ( renew_timing_vars(vnum, svtstep) ) then
3282 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
3283 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
3284 end if
3285 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
3286 & varname_vars(vnum), time ) ! (in)
3287 newfile_createtime_vars(vnum) = time
3288 prev_outtime_vars(vnum) = time
3289 end if
3290
3291 ! 出力が有効かどうかを確認する
3292 ! Confirm whether the output is effective
3293 !
3294 if ( .not. output_timing_vars(vnum, svtstep) &
3295 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
3296
3297 goto 999
3298 end if
3299
3300 ! GT_HISTORY 変数の取得
3301 ! Get "GT_HISTORY" variable
3302 !
3303 gthist => gthst_history_vars(vnum) % gthist
3304
3305
3306 ! 空間切り出し
3307 ! Slice of spaces
3308 !
3309 ! array only
3310
3311
3312
3313 ! 空間平均
3314 ! Spatial average
3315 !
3316 ! array only
3317
3318
3319 ! 単位に応じて時刻を変換
3320 ! Convert time according to units
3321 !
3322 if ( output_timing_vars(vnum, svtstep) &
3323 & .or. output_timing_avr_vars(vnum, svtstep) ) then
3324
3325 settime = &
3326 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
3327 end if
3328
3329 ! 時刻設定
3330 ! Set time
3331 !
3332 if ( output_timing_vars(vnum, svtstep) ) then
3333 call historysettime( &
3334 & history = gthist, & ! (in) optional
3335 & timed = settime ) ! (in) optional
3336 end if
3337
3338 ! 出力
3339 ! OutPut
3340 !
3341 if ( output_timing_avr_vars(vnum, svtstep) ) then
3342 call historyput( &
3343 & varname, & ! (in)
3344 & (/value/), & ! (in)
3345
3346 & timed = settime, & ! (in) optional
3347 & time_average_store = &
3348 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
3349 & history = gthist ) ! (inout) optional
3350 else
3351 call historyput( &
3352 & varname, & ! (in)
3353 & (/value/), & ! (in)
3354
3355 & history = gthist ) ! (inout) optional
3356 end if
3357
3358 ! 最後に出力した時刻を保存
3359 ! Save last time of output
3360 !
3361 if ( output_timing_vars(vnum, svtstep) ) then
3362 if ( .not. create_timing_vars(vnum, svtstep) .and. &
3363 & .not. renew_timing_vars(vnum, svtstep) ) then
3364
3365 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
3366 & time_eps * max(1.0_dp, abs(time), &
3367 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
3368 prev_outtime_vars(vnum) = time
3369 else
3370 prev_outtime_vars(vnum) = &
3372 end if
3373 end if
3374 end if
3375
3376 ! 結合解除
3377 ! Release associations
3378 !
3379 nullify( gthist )
3380
3381
3382999 continue
3383 call storeerror(stat, subname, cause_c = cause_c, err = err)
3384 call endsub(subname)
3385 end subroutine historyautoputreal0
3386
3387
3467 & time, varname, array, & ! (in)
3468 & err & ! (out) optional
3469 & )
3470 !
3471
3472 !
3473
3488 use gtool_history, only: gt_history, historyput, historyinitialized, &
3489 & historyaddvariable, historyinquire, historyvarinfoinquire, &
3491 use dc_string, only: tochar
3492 use dc_message, only: messagenotify
3493 use dc_trace, only: beginsub, endsub
3494 use dc_error, only: storeerror, dc_noerr, &
3496 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
3497 use dc_date_generic, only: operator(-), operator(+), &
3498 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
3501 use dc_types, only: dp, string
3502 implicit none
3503 real(DP), intent(in):: time
3504 real(DP), parameter:: time_eps = epsilon(1.0_dp)
3505
3506 character(*), intent(in):: varname
3507
3508 real, intent(in), target:: array(:)
3509
3510 logical, intent(out), optional:: err
3511
3512
3513 type(gt_history), pointer:: gthist =>null()
3514 ! gtool_history モジュール用構造体.
3515 ! Derived type for "gtool_history" module
3516
3517 real, pointer:: array_slice(:) =>null()
3518 type(slice_info), pointer:: sv =>null()
3519 real, pointer:: array_avr(:) =>null()
3520
3521 real(DP):: settime
3522 integer:: stat, i
3523 integer:: vnum
3524 character(STRING):: cause_c
3525 integer, save:: svnum = 1, svtstep
3526 character(*), parameter:: subname = "HistoryAutoPutReal1"
3527 continue
3528 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
3529 stat = dc_noerr
3530 cause_c = ""
3531
3532 ! 初期設定チェック
3533 ! Check initialization
3534 !
3535 if ( .not. initialized ) then
3536 stat = dc_enotinit
3537 cause_c = 'gtool_historyauto'
3538 goto 999
3539 end if
3540
3541 ! 時刻に関するエラー処理
3542 ! Error handling for time
3543 !
3544 if ( time < zero_time ) then
3545 cause_c = tochar( time )
3546 call messagenotify( 'W', subname, &
3547 & '"time=<%c>" must be positive value (varname=<%c>).', &
3548 & c1 = trim( cause_c ), c2 = trim( varname ) )
3549 stat = dc_enegative
3550 cause_c = 'time'
3551 goto 999
3552 end if
3553
3554 ! 変数 ID のサーチ
3555 ! Search variable ID
3556 !
3557 varsearch: do
3558 do i = svnum, numvars
3559 if ( trim( varname_vars(i) ) == trim(varname) ) then
3560 vnum = i
3561 exit varsearch
3562 end if
3563 end do
3564 do i = 1, svnum - 1
3565 if ( trim( varname_vars(i) ) == trim(varname) ) then
3566 vnum = i
3567 exit varsearch
3568 end if
3569 end do
3570
3571 stat = hst_ebadvarname
3572 cause_c = varname
3573 goto 999
3574 end do varsearch
3575
3576 svnum = vnum
3577
3578 ! 定義モードからデータモードへ
3579 ! Transit from define mode to data mode
3580 !
3581 if ( hstnmlinfodefinemode( gthstnml ) ) then
3582 call hstnmlinfoenddefine( gthstnml ) ! (inout)
3583 end if
3584
3585 ! 出力タイミングのチェックとファイルの作成
3586 ! Check output timing and create files
3587 !
3588 call hstvarsoutputcheck( &
3589 & time = time, & ! (in)
3590 & stime_index = svtstep ) ! (out)
3591
3592 ! ファイルのオープン・クローズ・再オープン
3593 ! Open, close, reopen files
3594 !
3595 if ( create_timing_vars(vnum, svtstep) &
3596 & .and. .not. histaddvar_vars(vnum) ) then
3597 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
3598 & varname_vars(vnum), time ) ! (in)
3599 histaddvar_vars(vnum) = .true.
3600 if ( flag_output_prev_vars(vnum) ) then
3601 prev_outtime_vars(vnum) = time
3602 else
3603 flag_output_prev_vars(vnum) = .true.
3604 if ( origin_time_vars(vnum) > zero_time ) then
3606 else
3607 prev_outtime_vars(vnum) = time
3608 end if
3609 end if
3610 end if
3611
3612 if ( close_timing_vars(vnum, svtstep) ) then
3613 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
3614 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
3615 end if
3616 end if
3617
3618 if ( renew_timing_vars(vnum, svtstep) ) then
3619 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
3620 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
3621 end if
3622 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
3623 & varname_vars(vnum), time ) ! (in)
3624 newfile_createtime_vars(vnum) = time
3625 prev_outtime_vars(vnum) = time
3626 end if
3627
3628 ! 出力が有効かどうかを確認する
3629 ! Confirm whether the output is effective
3630 !
3631 if ( .not. output_timing_vars(vnum, svtstep) &
3632 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
3633
3634 goto 999
3635 end if
3636
3637 ! GT_HISTORY 変数の取得
3638 ! Get "GT_HISTORY" variable
3639 !
3640 gthist => gthst_history_vars(vnum) % gthist
3641
3642
3643 ! 空間切り出し
3644 ! Slice of spaces
3645 !
3646 sv => slice_vars(vnum)
3647
3648 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
3649
3650
3651 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
3652
3653 & )
3654
3655
3656
3657 ! 空間平均
3658 ! Spatial average
3659 !
3660 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
3661 array_avr => array_slice
3662 else
3663 call averagereduce( &
3664 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
3665 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
3666
3667 & array_avr ) ! (out)
3668 end if
3669
3670 ! 座標重みを取得 ; Get weights of axes
3671
3672
3673
3674 ! 単位に応じて時刻を変換
3675 ! Convert time according to units
3676 !
3677 if ( output_timing_vars(vnum, svtstep) &
3678 & .or. output_timing_avr_vars(vnum, svtstep) ) then
3679
3680 settime = &
3681 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
3682 end if
3683
3684 ! 時刻設定
3685 ! Set time
3686 !
3687 if ( output_timing_vars(vnum, svtstep) ) then
3688 call historysettime( &
3689 & history = gthist, & ! (in) optional
3690 & timed = settime ) ! (in) optional
3691 end if
3692
3693 ! 出力
3694 ! OutPut
3695 !
3696 if ( output_timing_avr_vars(vnum, svtstep) ) then
3697 call historyput( &
3698 & varname, & ! (in)
3699 & array_avr, & ! (in)
3700
3701 & timed = settime, & ! (in) optional
3702 & time_average_store = &
3703 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
3704 & history = gthist ) ! (inout) optional
3705 else
3706 call historyput( &
3707 & varname, & ! (in)
3708 & array_avr, & ! (in)
3709
3710 & history = gthist ) ! (inout) optional
3711 end if
3712
3713 ! 最後に出力した時刻を保存
3714 ! Save last time of output
3715 !
3716 if ( output_timing_vars(vnum, svtstep) ) then
3717 if ( .not. create_timing_vars(vnum, svtstep) .and. &
3718 & .not. renew_timing_vars(vnum, svtstep) ) then
3719
3720 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
3721 & time_eps * max(1.0_dp, abs(time), &
3722 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
3723 prev_outtime_vars(vnum) = time
3724 else
3725 prev_outtime_vars(vnum) = &
3727 end if
3728 end if
3729 end if
3730
3731 ! 結合解除
3732 ! Release associations
3733 !
3734 nullify( gthist )
3735 nullify( array_avr, array_slice )
3736
3737
3738999 continue
3739 call storeerror(stat, subname, cause_c = cause_c, err = err)
3740 call endsub(subname)
3741 end subroutine historyautoputreal1
3742
3743
3823 & time, varname, array, & ! (in)
3824 & err & ! (out) optional
3825 & )
3826 !
3827
3828 !
3829
3844 use gtool_history, only: gt_history, historyput, historyinitialized, &
3845 & historyaddvariable, historyinquire, historyvarinfoinquire, &
3847 use dc_string, only: tochar
3848 use dc_message, only: messagenotify
3849 use dc_trace, only: beginsub, endsub
3850 use dc_error, only: storeerror, dc_noerr, &
3852 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
3853 use dc_date_generic, only: operator(-), operator(+), &
3854 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
3857 use dc_types, only: dp, string
3858 implicit none
3859 real(DP), intent(in):: time
3860 real(DP), parameter:: time_eps = epsilon(1.0_dp)
3861
3862 character(*), intent(in):: varname
3863
3864 real, intent(in), target:: array(:,:)
3865
3866 logical, intent(out), optional:: err
3867
3868
3869 type(gt_history), pointer:: gthist =>null()
3870 ! gtool_history モジュール用構造体.
3871 ! Derived type for "gtool_history" module
3872
3873 real, pointer:: array_slice(:,:) =>null()
3874 type(slice_info), pointer:: sv =>null()
3875 real, pointer:: array_avr(:,:) =>null()
3876
3877 real(DP):: settime
3878 integer:: stat, i
3879 integer:: vnum
3880 character(STRING):: cause_c
3881 integer, save:: svnum = 1, svtstep
3882 character(*), parameter:: subname = "HistoryAutoPutReal2"
3883 continue
3884 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
3885 stat = dc_noerr
3886 cause_c = ""
3887
3888 ! 初期設定チェック
3889 ! Check initialization
3890 !
3891 if ( .not. initialized ) then
3892 stat = dc_enotinit
3893 cause_c = 'gtool_historyauto'
3894 goto 999
3895 end if
3896
3897 ! 時刻に関するエラー処理
3898 ! Error handling for time
3899 !
3900 if ( time < zero_time ) then
3901 cause_c = tochar( time )
3902 call messagenotify( 'W', subname, &
3903 & '"time=<%c>" must be positive value (varname=<%c>).', &
3904 & c1 = trim( cause_c ), c2 = trim( varname ) )
3905 stat = dc_enegative
3906 cause_c = 'time'
3907 goto 999
3908 end if
3909
3910 ! 変数 ID のサーチ
3911 ! Search variable ID
3912 !
3913 varsearch: do
3914 do i = svnum, numvars
3915 if ( trim( varname_vars(i) ) == trim(varname) ) then
3916 vnum = i
3917 exit varsearch
3918 end if
3919 end do
3920 do i = 1, svnum - 1
3921 if ( trim( varname_vars(i) ) == trim(varname) ) then
3922 vnum = i
3923 exit varsearch
3924 end if
3925 end do
3926
3927 stat = hst_ebadvarname
3928 cause_c = varname
3929 goto 999
3930 end do varsearch
3931
3932 svnum = vnum
3933
3934 ! 定義モードからデータモードへ
3935 ! Transit from define mode to data mode
3936 !
3937 if ( hstnmlinfodefinemode( gthstnml ) ) then
3938 call hstnmlinfoenddefine( gthstnml ) ! (inout)
3939 end if
3940
3941 ! 出力タイミングのチェックとファイルの作成
3942 ! Check output timing and create files
3943 !
3944 call hstvarsoutputcheck( &
3945 & time = time, & ! (in)
3946 & stime_index = svtstep ) ! (out)
3947
3948 ! ファイルのオープン・クローズ・再オープン
3949 ! Open, close, reopen files
3950 !
3951 if ( create_timing_vars(vnum, svtstep) &
3952 & .and. .not. histaddvar_vars(vnum) ) then
3953 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
3954 & varname_vars(vnum), time ) ! (in)
3955 histaddvar_vars(vnum) = .true.
3956 if ( flag_output_prev_vars(vnum) ) then
3957 prev_outtime_vars(vnum) = time
3958 else
3959 flag_output_prev_vars(vnum) = .true.
3960 if ( origin_time_vars(vnum) > zero_time ) then
3962 else
3963 prev_outtime_vars(vnum) = time
3964 end if
3965 end if
3966 end if
3967
3968 if ( close_timing_vars(vnum, svtstep) ) then
3969 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
3970 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
3971 end if
3972 end if
3973
3974 if ( renew_timing_vars(vnum, svtstep) ) then
3975 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
3976 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
3977 end if
3978 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
3979 & varname_vars(vnum), time ) ! (in)
3980 newfile_createtime_vars(vnum) = time
3981 prev_outtime_vars(vnum) = time
3982 end if
3983
3984 ! 出力が有効かどうかを確認する
3985 ! Confirm whether the output is effective
3986 !
3987 if ( .not. output_timing_vars(vnum, svtstep) &
3988 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
3989
3990 goto 999
3991 end if
3992
3993 ! GT_HISTORY 変数の取得
3994 ! Get "GT_HISTORY" variable
3995 !
3996 gthist => gthst_history_vars(vnum) % gthist
3997
3998
3999 ! 空間切り出し
4000 ! Slice of spaces
4001 !
4002 sv => slice_vars(vnum)
4003
4004 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
4005
4006!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
4007
4008
4009 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
4010 & , sv%st(2):sv%ed(2):sv%sd(2) &
4011
4012 & )
4013
4014
4015
4016 ! 空間平均
4017 ! Spatial average
4018 !
4019 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
4020 array_avr => array_slice
4021 else
4022 call averagereduce( &
4023 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
4024 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
4025
4026 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
4027
4028 & array_avr ) ! (out)
4029 end if
4030
4031 ! 座標重みを取得 ; Get weights of axes
4032
4033
4034
4035 ! 単位に応じて時刻を変換
4036 ! Convert time according to units
4037 !
4038 if ( output_timing_vars(vnum, svtstep) &
4039 & .or. output_timing_avr_vars(vnum, svtstep) ) then
4040
4041 settime = &
4042 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
4043 end if
4044
4045 ! 時刻設定
4046 ! Set time
4047 !
4048 if ( output_timing_vars(vnum, svtstep) ) then
4049 call historysettime( &
4050 & history = gthist, & ! (in) optional
4051 & timed = settime ) ! (in) optional
4052 end if
4053
4054 ! 出力
4055 ! OutPut
4056 !
4057 if ( output_timing_avr_vars(vnum, svtstep) ) then
4058 call historyput( &
4059 & varname, & ! (in)
4060 & array_avr, & ! (in)
4061
4062 & timed = settime, & ! (in) optional
4063 & time_average_store = &
4064 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
4065 & history = gthist ) ! (inout) optional
4066 else
4067 call historyput( &
4068 & varname, & ! (in)
4069 & array_avr, & ! (in)
4070
4071 & history = gthist ) ! (inout) optional
4072 end if
4073
4074 ! 最後に出力した時刻を保存
4075 ! Save last time of output
4076 !
4077 if ( output_timing_vars(vnum, svtstep) ) then
4078 if ( .not. create_timing_vars(vnum, svtstep) .and. &
4079 & .not. renew_timing_vars(vnum, svtstep) ) then
4080
4081 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
4082 & time_eps * max(1.0_dp, abs(time), &
4083 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
4084 prev_outtime_vars(vnum) = time
4085 else
4086 prev_outtime_vars(vnum) = &
4088 end if
4089 end if
4090 end if
4091
4092 ! 結合解除
4093 ! Release associations
4094 !
4095 nullify( gthist )
4096 nullify( array_avr, array_slice )
4097
4098
4099999 continue
4100 call storeerror(stat, subname, cause_c = cause_c, err = err)
4101 call endsub(subname)
4102 end subroutine historyautoputreal2
4103
4104
4184 & time, varname, array, & ! (in)
4185 & err & ! (out) optional
4186 & )
4187 !
4188
4189 !
4190
4205 use gtool_history, only: gt_history, historyput, historyinitialized, &
4206 & historyaddvariable, historyinquire, historyvarinfoinquire, &
4208 use dc_string, only: tochar
4209 use dc_message, only: messagenotify
4210 use dc_trace, only: beginsub, endsub
4211 use dc_error, only: storeerror, dc_noerr, &
4213 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
4214 use dc_date_generic, only: operator(-), operator(+), &
4215 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
4218 use dc_types, only: dp, string
4219 implicit none
4220 real(DP), intent(in):: time
4221 real(DP), parameter:: time_eps = epsilon(1.0_dp)
4222
4223 character(*), intent(in):: varname
4224
4225 real, intent(in), target:: array(:,:,:)
4226
4227 logical, intent(out), optional:: err
4228
4229
4230 type(gt_history), pointer:: gthist =>null()
4231 ! gtool_history モジュール用構造体.
4232 ! Derived type for "gtool_history" module
4233
4234 real, pointer:: array_slice(:,:,:) =>null()
4235 type(slice_info), pointer:: sv =>null()
4236 real, pointer:: array_avr(:,:,:) =>null()
4237
4238 real(DP):: settime
4239 integer:: stat, i
4240 integer:: vnum
4241 character(STRING):: cause_c
4242 integer, save:: svnum = 1, svtstep
4243 character(*), parameter:: subname = "HistoryAutoPutReal3"
4244 continue
4245 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
4246 stat = dc_noerr
4247 cause_c = ""
4248
4249 ! 初期設定チェック
4250 ! Check initialization
4251 !
4252 if ( .not. initialized ) then
4253 stat = dc_enotinit
4254 cause_c = 'gtool_historyauto'
4255 goto 999
4256 end if
4257
4258 ! 時刻に関するエラー処理
4259 ! Error handling for time
4260 !
4261 if ( time < zero_time ) then
4262 cause_c = tochar( time )
4263 call messagenotify( 'W', subname, &
4264 & '"time=<%c>" must be positive value (varname=<%c>).', &
4265 & c1 = trim( cause_c ), c2 = trim( varname ) )
4266 stat = dc_enegative
4267 cause_c = 'time'
4268 goto 999
4269 end if
4270
4271 ! 変数 ID のサーチ
4272 ! Search variable ID
4273 !
4274 varsearch: do
4275 do i = svnum, numvars
4276 if ( trim( varname_vars(i) ) == trim(varname) ) then
4277 vnum = i
4278 exit varsearch
4279 end if
4280 end do
4281 do i = 1, svnum - 1
4282 if ( trim( varname_vars(i) ) == trim(varname) ) then
4283 vnum = i
4284 exit varsearch
4285 end if
4286 end do
4287
4288 stat = hst_ebadvarname
4289 cause_c = varname
4290 goto 999
4291 end do varsearch
4292
4293 svnum = vnum
4294
4295 ! 定義モードからデータモードへ
4296 ! Transit from define mode to data mode
4297 !
4298 if ( hstnmlinfodefinemode( gthstnml ) ) then
4299 call hstnmlinfoenddefine( gthstnml ) ! (inout)
4300 end if
4301
4302 ! 出力タイミングのチェックとファイルの作成
4303 ! Check output timing and create files
4304 !
4305 call hstvarsoutputcheck( &
4306 & time = time, & ! (in)
4307 & stime_index = svtstep ) ! (out)
4308
4309 ! ファイルのオープン・クローズ・再オープン
4310 ! Open, close, reopen files
4311 !
4312 if ( create_timing_vars(vnum, svtstep) &
4313 & .and. .not. histaddvar_vars(vnum) ) then
4314 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
4315 & varname_vars(vnum), time ) ! (in)
4316 histaddvar_vars(vnum) = .true.
4317 if ( flag_output_prev_vars(vnum) ) then
4318 prev_outtime_vars(vnum) = time
4319 else
4320 flag_output_prev_vars(vnum) = .true.
4321 if ( origin_time_vars(vnum) > zero_time ) then
4323 else
4324 prev_outtime_vars(vnum) = time
4325 end if
4326 end if
4327 end if
4328
4329 if ( close_timing_vars(vnum, svtstep) ) then
4330 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
4331 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
4332 end if
4333 end if
4334
4335 if ( renew_timing_vars(vnum, svtstep) ) then
4336 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
4337 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
4338 end if
4339 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
4340 & varname_vars(vnum), time ) ! (in)
4341 newfile_createtime_vars(vnum) = time
4342 prev_outtime_vars(vnum) = time
4343 end if
4344
4345 ! 出力が有効かどうかを確認する
4346 ! Confirm whether the output is effective
4347 !
4348 if ( .not. output_timing_vars(vnum, svtstep) &
4349 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
4350
4351 goto 999
4352 end if
4353
4354 ! GT_HISTORY 変数の取得
4355 ! Get "GT_HISTORY" variable
4356 !
4357 gthist => gthst_history_vars(vnum) % gthist
4358
4359
4360 ! 空間切り出し
4361 ! Slice of spaces
4362 !
4363 sv => slice_vars(vnum)
4364
4365 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
4366
4367!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
4368
4369!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
4370
4371
4372 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
4373 & , sv%st(2):sv%ed(2):sv%sd(2) &
4374
4375 & , sv%st(3):sv%ed(3):sv%sd(3) &
4376
4377 & )
4378
4379
4380
4381 ! 空間平均
4382 ! Spatial average
4383 !
4384 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
4385 array_avr => array_slice
4386 else
4387 call averagereduce( &
4388 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
4389 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
4390
4391 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
4392
4393 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
4394
4395 & array_avr ) ! (out)
4396 end if
4397
4398 ! 座標重みを取得 ; Get weights of axes
4399
4400
4401
4402 ! 単位に応じて時刻を変換
4403 ! Convert time according to units
4404 !
4405 if ( output_timing_vars(vnum, svtstep) &
4406 & .or. output_timing_avr_vars(vnum, svtstep) ) then
4407
4408 settime = &
4409 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
4410 end if
4411
4412 ! 時刻設定
4413 ! Set time
4414 !
4415 if ( output_timing_vars(vnum, svtstep) ) then
4416 call historysettime( &
4417 & history = gthist, & ! (in) optional
4418 & timed = settime ) ! (in) optional
4419 end if
4420
4421 ! 出力
4422 ! OutPut
4423 !
4424 if ( output_timing_avr_vars(vnum, svtstep) ) then
4425 call historyput( &
4426 & varname, & ! (in)
4427 & array_avr, & ! (in)
4428
4429 & timed = settime, & ! (in) optional
4430 & time_average_store = &
4431 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
4432 & history = gthist ) ! (inout) optional
4433 else
4434 call historyput( &
4435 & varname, & ! (in)
4436 & array_avr, & ! (in)
4437
4438 & history = gthist ) ! (inout) optional
4439 end if
4440
4441 ! 最後に出力した時刻を保存
4442 ! Save last time of output
4443 !
4444 if ( output_timing_vars(vnum, svtstep) ) then
4445 if ( .not. create_timing_vars(vnum, svtstep) .and. &
4446 & .not. renew_timing_vars(vnum, svtstep) ) then
4447
4448 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
4449 & time_eps * max(1.0_dp, abs(time), &
4450 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
4451 prev_outtime_vars(vnum) = time
4452 else
4453 prev_outtime_vars(vnum) = &
4455 end if
4456 end if
4457 end if
4458
4459 ! 結合解除
4460 ! Release associations
4461 !
4462 nullify( gthist )
4463 nullify( array_avr, array_slice )
4464
4465
4466999 continue
4467 call storeerror(stat, subname, cause_c = cause_c, err = err)
4468 call endsub(subname)
4469 end subroutine historyautoputreal3
4470
4471
4551 & time, varname, array, & ! (in)
4552 & err & ! (out) optional
4553 & )
4554 !
4555
4556 !
4557
4572 use gtool_history, only: gt_history, historyput, historyinitialized, &
4573 & historyaddvariable, historyinquire, historyvarinfoinquire, &
4575 use dc_string, only: tochar
4576 use dc_message, only: messagenotify
4577 use dc_trace, only: beginsub, endsub
4578 use dc_error, only: storeerror, dc_noerr, &
4580 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
4581 use dc_date_generic, only: operator(-), operator(+), &
4582 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
4585 use dc_types, only: dp, string
4586 implicit none
4587 real(DP), intent(in):: time
4588 real(DP), parameter:: time_eps = epsilon(1.0_dp)
4589
4590 character(*), intent(in):: varname
4591
4592 real, intent(in), target:: array(:,:,:,:)
4593
4594 logical, intent(out), optional:: err
4595
4596
4597 type(gt_history), pointer:: gthist =>null()
4598 ! gtool_history モジュール用構造体.
4599 ! Derived type for "gtool_history" module
4600
4601 real, pointer:: array_slice(:,:,:,:) =>null()
4602 type(slice_info), pointer:: sv =>null()
4603 real, pointer:: array_avr(:,:,:,:) =>null()
4604
4605 real(DP):: settime
4606 integer:: stat, i
4607 integer:: vnum
4608 character(STRING):: cause_c
4609 integer, save:: svnum = 1, svtstep
4610 character(*), parameter:: subname = "HistoryAutoPutReal4"
4611 continue
4612 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
4613 stat = dc_noerr
4614 cause_c = ""
4615
4616 ! 初期設定チェック
4617 ! Check initialization
4618 !
4619 if ( .not. initialized ) then
4620 stat = dc_enotinit
4621 cause_c = 'gtool_historyauto'
4622 goto 999
4623 end if
4624
4625 ! 時刻に関するエラー処理
4626 ! Error handling for time
4627 !
4628 if ( time < zero_time ) then
4629 cause_c = tochar( time )
4630 call messagenotify( 'W', subname, &
4631 & '"time=<%c>" must be positive value (varname=<%c>).', &
4632 & c1 = trim( cause_c ), c2 = trim( varname ) )
4633 stat = dc_enegative
4634 cause_c = 'time'
4635 goto 999
4636 end if
4637
4638 ! 変数 ID のサーチ
4639 ! Search variable ID
4640 !
4641 varsearch: do
4642 do i = svnum, numvars
4643 if ( trim( varname_vars(i) ) == trim(varname) ) then
4644 vnum = i
4645 exit varsearch
4646 end if
4647 end do
4648 do i = 1, svnum - 1
4649 if ( trim( varname_vars(i) ) == trim(varname) ) then
4650 vnum = i
4651 exit varsearch
4652 end if
4653 end do
4654
4655 stat = hst_ebadvarname
4656 cause_c = varname
4657 goto 999
4658 end do varsearch
4659
4660 svnum = vnum
4661
4662 ! 定義モードからデータモードへ
4663 ! Transit from define mode to data mode
4664 !
4665 if ( hstnmlinfodefinemode( gthstnml ) ) then
4666 call hstnmlinfoenddefine( gthstnml ) ! (inout)
4667 end if
4668
4669 ! 出力タイミングのチェックとファイルの作成
4670 ! Check output timing and create files
4671 !
4672 call hstvarsoutputcheck( &
4673 & time = time, & ! (in)
4674 & stime_index = svtstep ) ! (out)
4675
4676 ! ファイルのオープン・クローズ・再オープン
4677 ! Open, close, reopen files
4678 !
4679 if ( create_timing_vars(vnum, svtstep) &
4680 & .and. .not. histaddvar_vars(vnum) ) then
4681 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
4682 & varname_vars(vnum), time ) ! (in)
4683 histaddvar_vars(vnum) = .true.
4684 if ( flag_output_prev_vars(vnum) ) then
4685 prev_outtime_vars(vnum) = time
4686 else
4687 flag_output_prev_vars(vnum) = .true.
4688 if ( origin_time_vars(vnum) > zero_time ) then
4690 else
4691 prev_outtime_vars(vnum) = time
4692 end if
4693 end if
4694 end if
4695
4696 if ( close_timing_vars(vnum, svtstep) ) then
4697 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
4698 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
4699 end if
4700 end if
4701
4702 if ( renew_timing_vars(vnum, svtstep) ) then
4703 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
4704 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
4705 end if
4706 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
4707 & varname_vars(vnum), time ) ! (in)
4708 newfile_createtime_vars(vnum) = time
4709 prev_outtime_vars(vnum) = time
4710 end if
4711
4712 ! 出力が有効かどうかを確認する
4713 ! Confirm whether the output is effective
4714 !
4715 if ( .not. output_timing_vars(vnum, svtstep) &
4716 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
4717
4718 goto 999
4719 end if
4720
4721 ! GT_HISTORY 変数の取得
4722 ! Get "GT_HISTORY" variable
4723 !
4724 gthist => gthst_history_vars(vnum) % gthist
4725
4726
4727 ! 空間切り出し
4728 ! Slice of spaces
4729 !
4730 sv => slice_vars(vnum)
4731
4732 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
4733
4734!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
4735
4736!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
4737
4738!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
4739
4740
4741 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
4742 & , sv%st(2):sv%ed(2):sv%sd(2) &
4743
4744 & , sv%st(3):sv%ed(3):sv%sd(3) &
4745
4746 & , sv%st(4):sv%ed(4):sv%sd(4) &
4747
4748 & )
4749
4750
4751
4752 ! 空間平均
4753 ! Spatial average
4754 !
4755 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
4756 array_avr => array_slice
4757 else
4758 call averagereduce( &
4759 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
4760 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
4761
4762 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
4763
4764 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
4765
4766 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
4767
4768 & array_avr ) ! (out)
4769 end if
4770
4771 ! 座標重みを取得 ; Get weights of axes
4772
4773
4774
4775 ! 単位に応じて時刻を変換
4776 ! Convert time according to units
4777 !
4778 if ( output_timing_vars(vnum, svtstep) &
4779 & .or. output_timing_avr_vars(vnum, svtstep) ) then
4780
4781 settime = &
4782 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
4783 end if
4784
4785 ! 時刻設定
4786 ! Set time
4787 !
4788 if ( output_timing_vars(vnum, svtstep) ) then
4789 call historysettime( &
4790 & history = gthist, & ! (in) optional
4791 & timed = settime ) ! (in) optional
4792 end if
4793
4794 ! 出力
4795 ! OutPut
4796 !
4797 if ( output_timing_avr_vars(vnum, svtstep) ) then
4798 call historyput( &
4799 & varname, & ! (in)
4800 & array_avr, & ! (in)
4801
4802 & timed = settime, & ! (in) optional
4803 & time_average_store = &
4804 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
4805 & history = gthist ) ! (inout) optional
4806 else
4807 call historyput( &
4808 & varname, & ! (in)
4809 & array_avr, & ! (in)
4810
4811 & history = gthist ) ! (inout) optional
4812 end if
4813
4814 ! 最後に出力した時刻を保存
4815 ! Save last time of output
4816 !
4817 if ( output_timing_vars(vnum, svtstep) ) then
4818 if ( .not. create_timing_vars(vnum, svtstep) .and. &
4819 & .not. renew_timing_vars(vnum, svtstep) ) then
4820
4821 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
4822 & time_eps * max(1.0_dp, abs(time), &
4823 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
4824 prev_outtime_vars(vnum) = time
4825 else
4826 prev_outtime_vars(vnum) = &
4828 end if
4829 end if
4830 end if
4831
4832 ! 結合解除
4833 ! Release associations
4834 !
4835 nullify( gthist )
4836 nullify( array_avr, array_slice )
4837
4838
4839999 continue
4840 call storeerror(stat, subname, cause_c = cause_c, err = err)
4841 call endsub(subname)
4842 end subroutine historyautoputreal4
4843
4844
4924 & time, varname, array, & ! (in)
4925 & err & ! (out) optional
4926 & )
4927 !
4928
4929 !
4930
4945 use gtool_history, only: gt_history, historyput, historyinitialized, &
4946 & historyaddvariable, historyinquire, historyvarinfoinquire, &
4948 use dc_string, only: tochar
4949 use dc_message, only: messagenotify
4950 use dc_trace, only: beginsub, endsub
4951 use dc_error, only: storeerror, dc_noerr, &
4953 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
4954 use dc_date_generic, only: operator(-), operator(+), &
4955 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
4958 use dc_types, only: dp, string
4959 implicit none
4960 real(DP), intent(in):: time
4961 real(DP), parameter:: time_eps = epsilon(1.0_dp)
4962
4963 character(*), intent(in):: varname
4964
4965 real, intent(in), target:: array(:,:,:,:,:)
4966
4967 logical, intent(out), optional:: err
4968
4969
4970 type(gt_history), pointer:: gthist =>null()
4971 ! gtool_history モジュール用構造体.
4972 ! Derived type for "gtool_history" module
4973
4974 real, pointer:: array_slice(:,:,:,:,:) =>null()
4975 type(slice_info), pointer:: sv =>null()
4976 real, pointer:: array_avr(:,:,:,:,:) =>null()
4977
4978 real(DP):: settime
4979 integer:: stat, i
4980 integer:: vnum
4981 character(STRING):: cause_c
4982 integer, save:: svnum = 1, svtstep
4983 character(*), parameter:: subname = "HistoryAutoPutReal5"
4984 continue
4985 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
4986 stat = dc_noerr
4987 cause_c = ""
4988
4989 ! 初期設定チェック
4990 ! Check initialization
4991 !
4992 if ( .not. initialized ) then
4993 stat = dc_enotinit
4994 cause_c = 'gtool_historyauto'
4995 goto 999
4996 end if
4997
4998 ! 時刻に関するエラー処理
4999 ! Error handling for time
5000 !
5001 if ( time < zero_time ) then
5002 cause_c = tochar( time )
5003 call messagenotify( 'W', subname, &
5004 & '"time=<%c>" must be positive value (varname=<%c>).', &
5005 & c1 = trim( cause_c ), c2 = trim( varname ) )
5006 stat = dc_enegative
5007 cause_c = 'time'
5008 goto 999
5009 end if
5010
5011 ! 変数 ID のサーチ
5012 ! Search variable ID
5013 !
5014 varsearch: do
5015 do i = svnum, numvars
5016 if ( trim( varname_vars(i) ) == trim(varname) ) then
5017 vnum = i
5018 exit varsearch
5019 end if
5020 end do
5021 do i = 1, svnum - 1
5022 if ( trim( varname_vars(i) ) == trim(varname) ) then
5023 vnum = i
5024 exit varsearch
5025 end if
5026 end do
5027
5028 stat = hst_ebadvarname
5029 cause_c = varname
5030 goto 999
5031 end do varsearch
5032
5033 svnum = vnum
5034
5035 ! 定義モードからデータモードへ
5036 ! Transit from define mode to data mode
5037 !
5038 if ( hstnmlinfodefinemode( gthstnml ) ) then
5039 call hstnmlinfoenddefine( gthstnml ) ! (inout)
5040 end if
5041
5042 ! 出力タイミングのチェックとファイルの作成
5043 ! Check output timing and create files
5044 !
5045 call hstvarsoutputcheck( &
5046 & time = time, & ! (in)
5047 & stime_index = svtstep ) ! (out)
5048
5049 ! ファイルのオープン・クローズ・再オープン
5050 ! Open, close, reopen files
5051 !
5052 if ( create_timing_vars(vnum, svtstep) &
5053 & .and. .not. histaddvar_vars(vnum) ) then
5054 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
5055 & varname_vars(vnum), time ) ! (in)
5056 histaddvar_vars(vnum) = .true.
5057 if ( flag_output_prev_vars(vnum) ) then
5058 prev_outtime_vars(vnum) = time
5059 else
5060 flag_output_prev_vars(vnum) = .true.
5061 if ( origin_time_vars(vnum) > zero_time ) then
5063 else
5064 prev_outtime_vars(vnum) = time
5065 end if
5066 end if
5067 end if
5068
5069 if ( close_timing_vars(vnum, svtstep) ) then
5070 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
5071 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
5072 end if
5073 end if
5074
5075 if ( renew_timing_vars(vnum, svtstep) ) then
5076 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
5077 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
5078 end if
5079 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
5080 & varname_vars(vnum), time ) ! (in)
5081 newfile_createtime_vars(vnum) = time
5082 prev_outtime_vars(vnum) = time
5083 end if
5084
5085 ! 出力が有効かどうかを確認する
5086 ! Confirm whether the output is effective
5087 !
5088 if ( .not. output_timing_vars(vnum, svtstep) &
5089 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
5090
5091 goto 999
5092 end if
5093
5094 ! GT_HISTORY 変数の取得
5095 ! Get "GT_HISTORY" variable
5096 !
5097 gthist => gthst_history_vars(vnum) % gthist
5098
5099
5100 ! 空間切り出し
5101 ! Slice of spaces
5102 !
5103 sv => slice_vars(vnum)
5104
5105 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
5106
5107!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
5108
5109!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
5110
5111!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
5112
5113!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
5114
5115
5116 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
5117 & , sv%st(2):sv%ed(2):sv%sd(2) &
5118
5119 & , sv%st(3):sv%ed(3):sv%sd(3) &
5120
5121 & , sv%st(4):sv%ed(4):sv%sd(4) &
5122
5123 & , sv%st(5):sv%ed(5):sv%sd(5) &
5124
5125 & )
5126
5127
5128
5129 ! 空間平均
5130 ! Spatial average
5131 !
5132 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
5133 array_avr => array_slice
5134 else
5135 call averagereduce( &
5136 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
5137 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
5138
5139 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
5140
5141 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
5142
5143 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
5144
5145 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
5146
5147 & array_avr ) ! (out)
5148 end if
5149
5150 ! 座標重みを取得 ; Get weights of axes
5151
5152
5153
5154 ! 単位に応じて時刻を変換
5155 ! Convert time according to units
5156 !
5157 if ( output_timing_vars(vnum, svtstep) &
5158 & .or. output_timing_avr_vars(vnum, svtstep) ) then
5159
5160 settime = &
5161 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
5162 end if
5163
5164 ! 時刻設定
5165 ! Set time
5166 !
5167 if ( output_timing_vars(vnum, svtstep) ) then
5168 call historysettime( &
5169 & history = gthist, & ! (in) optional
5170 & timed = settime ) ! (in) optional
5171 end if
5172
5173 ! 出力
5174 ! OutPut
5175 !
5176 if ( output_timing_avr_vars(vnum, svtstep) ) then
5177 call historyput( &
5178 & varname, & ! (in)
5179 & array_avr, & ! (in)
5180
5181 & timed = settime, & ! (in) optional
5182 & time_average_store = &
5183 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
5184 & history = gthist ) ! (inout) optional
5185 else
5186 call historyput( &
5187 & varname, & ! (in)
5188 & array_avr, & ! (in)
5189
5190 & history = gthist ) ! (inout) optional
5191 end if
5192
5193 ! 最後に出力した時刻を保存
5194 ! Save last time of output
5195 !
5196 if ( output_timing_vars(vnum, svtstep) ) then
5197 if ( .not. create_timing_vars(vnum, svtstep) .and. &
5198 & .not. renew_timing_vars(vnum, svtstep) ) then
5199
5200 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
5201 & time_eps * max(1.0_dp, abs(time), &
5202 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
5203 prev_outtime_vars(vnum) = time
5204 else
5205 prev_outtime_vars(vnum) = &
5207 end if
5208 end if
5209 end if
5210
5211 ! 結合解除
5212 ! Release associations
5213 !
5214 nullify( gthist )
5215 nullify( array_avr, array_slice )
5216
5217
5218999 continue
5219 call storeerror(stat, subname, cause_c = cause_c, err = err)
5220 call endsub(subname)
5221 end subroutine historyautoputreal5
5222
5223
5303 & time, varname, array, & ! (in)
5304 & err & ! (out) optional
5305 & )
5306 !
5307
5308 !
5309
5324 use gtool_history, only: gt_history, historyput, historyinitialized, &
5325 & historyaddvariable, historyinquire, historyvarinfoinquire, &
5327 use dc_string, only: tochar
5328 use dc_message, only: messagenotify
5329 use dc_trace, only: beginsub, endsub
5330 use dc_error, only: storeerror, dc_noerr, &
5332 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
5333 use dc_date_generic, only: operator(-), operator(+), &
5334 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
5337 use dc_types, only: dp, string
5338 implicit none
5339 real(DP), intent(in):: time
5340 real(DP), parameter:: time_eps = epsilon(1.0_dp)
5341
5342 character(*), intent(in):: varname
5343
5344 real, intent(in), target:: array(:,:,:,:,:,:)
5345
5346 logical, intent(out), optional:: err
5347
5348
5349 type(gt_history), pointer:: gthist =>null()
5350 ! gtool_history モジュール用構造体.
5351 ! Derived type for "gtool_history" module
5352
5353 real, pointer:: array_slice(:,:,:,:,:,:) =>null()
5354 type(slice_info), pointer:: sv =>null()
5355 real, pointer:: array_avr(:,:,:,:,:,:) =>null()
5356
5357 real(DP):: settime
5358 integer:: stat, i
5359 integer:: vnum
5360 character(STRING):: cause_c
5361 integer, save:: svnum = 1, svtstep
5362 character(*), parameter:: subname = "HistoryAutoPutReal6"
5363 continue
5364 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
5365 stat = dc_noerr
5366 cause_c = ""
5367
5368 ! 初期設定チェック
5369 ! Check initialization
5370 !
5371 if ( .not. initialized ) then
5372 stat = dc_enotinit
5373 cause_c = 'gtool_historyauto'
5374 goto 999
5375 end if
5376
5377 ! 時刻に関するエラー処理
5378 ! Error handling for time
5379 !
5380 if ( time < zero_time ) then
5381 cause_c = tochar( time )
5382 call messagenotify( 'W', subname, &
5383 & '"time=<%c>" must be positive value (varname=<%c>).', &
5384 & c1 = trim( cause_c ), c2 = trim( varname ) )
5385 stat = dc_enegative
5386 cause_c = 'time'
5387 goto 999
5388 end if
5389
5390 ! 変数 ID のサーチ
5391 ! Search variable ID
5392 !
5393 varsearch: do
5394 do i = svnum, numvars
5395 if ( trim( varname_vars(i) ) == trim(varname) ) then
5396 vnum = i
5397 exit varsearch
5398 end if
5399 end do
5400 do i = 1, svnum - 1
5401 if ( trim( varname_vars(i) ) == trim(varname) ) then
5402 vnum = i
5403 exit varsearch
5404 end if
5405 end do
5406
5407 stat = hst_ebadvarname
5408 cause_c = varname
5409 goto 999
5410 end do varsearch
5411
5412 svnum = vnum
5413
5414 ! 定義モードからデータモードへ
5415 ! Transit from define mode to data mode
5416 !
5417 if ( hstnmlinfodefinemode( gthstnml ) ) then
5418 call hstnmlinfoenddefine( gthstnml ) ! (inout)
5419 end if
5420
5421 ! 出力タイミングのチェックとファイルの作成
5422 ! Check output timing and create files
5423 !
5424 call hstvarsoutputcheck( &
5425 & time = time, & ! (in)
5426 & stime_index = svtstep ) ! (out)
5427
5428 ! ファイルのオープン・クローズ・再オープン
5429 ! Open, close, reopen files
5430 !
5431 if ( create_timing_vars(vnum, svtstep) &
5432 & .and. .not. histaddvar_vars(vnum) ) then
5433 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
5434 & varname_vars(vnum), time ) ! (in)
5435 histaddvar_vars(vnum) = .true.
5436 if ( flag_output_prev_vars(vnum) ) then
5437 prev_outtime_vars(vnum) = time
5438 else
5439 flag_output_prev_vars(vnum) = .true.
5440 if ( origin_time_vars(vnum) > zero_time ) then
5442 else
5443 prev_outtime_vars(vnum) = time
5444 end if
5445 end if
5446 end if
5447
5448 if ( close_timing_vars(vnum, svtstep) ) then
5449 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
5450 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
5451 end if
5452 end if
5453
5454 if ( renew_timing_vars(vnum, svtstep) ) then
5455 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
5456 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
5457 end if
5458 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
5459 & varname_vars(vnum), time ) ! (in)
5460 newfile_createtime_vars(vnum) = time
5461 prev_outtime_vars(vnum) = time
5462 end if
5463
5464 ! 出力が有効かどうかを確認する
5465 ! Confirm whether the output is effective
5466 !
5467 if ( .not. output_timing_vars(vnum, svtstep) &
5468 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
5469
5470 goto 999
5471 end if
5472
5473 ! GT_HISTORY 変数の取得
5474 ! Get "GT_HISTORY" variable
5475 !
5476 gthist => gthst_history_vars(vnum) % gthist
5477
5478
5479 ! 空間切り出し
5480 ! Slice of spaces
5481 !
5482 sv => slice_vars(vnum)
5483
5484 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
5485
5486!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
5487
5488!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
5489
5490!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
5491
5492!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
5493
5494!!$ write(*,*) ' sv%st(6), sv%ed(6), sv%sd(6)=', sv%st(6), sv%ed(6), sv%sd(6)
5495
5496
5497 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
5498 & , sv%st(2):sv%ed(2):sv%sd(2) &
5499
5500 & , sv%st(3):sv%ed(3):sv%sd(3) &
5501
5502 & , sv%st(4):sv%ed(4):sv%sd(4) &
5503
5504 & , sv%st(5):sv%ed(5):sv%sd(5) &
5505
5506 & , sv%st(6):sv%ed(6):sv%sd(6) &
5507
5508 & )
5509
5510
5511
5512 ! 空間平均
5513 ! Spatial average
5514 !
5515 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
5516 array_avr => array_slice
5517 else
5518 call averagereduce( &
5519 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
5520 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
5521
5522 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
5523
5524 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
5525
5526 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
5527
5528 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
5529
5530 & weight_vars(vnum) % wgt6( sv%st(6):sv%ed(6):sv%sd(6) ) , & ! (in)
5531
5532 & array_avr ) ! (out)
5533 end if
5534
5535 ! 座標重みを取得 ; Get weights of axes
5536
5537
5538
5539 ! 単位に応じて時刻を変換
5540 ! Convert time according to units
5541 !
5542 if ( output_timing_vars(vnum, svtstep) &
5543 & .or. output_timing_avr_vars(vnum, svtstep) ) then
5544
5545 settime = &
5546 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
5547 end if
5548
5549 ! 時刻設定
5550 ! Set time
5551 !
5552 if ( output_timing_vars(vnum, svtstep) ) then
5553 call historysettime( &
5554 & history = gthist, & ! (in) optional
5555 & timed = settime ) ! (in) optional
5556 end if
5557
5558 ! 出力
5559 ! OutPut
5560 !
5561 if ( output_timing_avr_vars(vnum, svtstep) ) then
5562 call historyput( &
5563 & varname, & ! (in)
5564 & array_avr, & ! (in)
5565
5566 & timed = settime, & ! (in) optional
5567 & time_average_store = &
5568 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
5569 & history = gthist ) ! (inout) optional
5570 else
5571 call historyput( &
5572 & varname, & ! (in)
5573 & array_avr, & ! (in)
5574
5575 & history = gthist ) ! (inout) optional
5576 end if
5577
5578 ! 最後に出力した時刻を保存
5579 ! Save last time of output
5580 !
5581 if ( output_timing_vars(vnum, svtstep) ) then
5582 if ( .not. create_timing_vars(vnum, svtstep) .and. &
5583 & .not. renew_timing_vars(vnum, svtstep) ) then
5584
5585 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
5586 & time_eps * max(1.0_dp, abs(time), &
5587 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
5588 prev_outtime_vars(vnum) = time
5589 else
5590 prev_outtime_vars(vnum) = &
5592 end if
5593 end if
5594 end if
5595
5596 ! 結合解除
5597 ! Release associations
5598 !
5599 nullify( gthist )
5600 nullify( array_avr, array_slice )
5601
5602
5603999 continue
5604 call storeerror(stat, subname, cause_c = cause_c, err = err)
5605 call endsub(subname)
5606 end subroutine historyautoputreal6
5607
5608
5688 & time, varname, array, & ! (in)
5689 & err & ! (out) optional
5690 & )
5691 !
5692
5693 !
5694
5709 use gtool_history, only: gt_history, historyput, historyinitialized, &
5710 & historyaddvariable, historyinquire, historyvarinfoinquire, &
5712 use dc_string, only: tochar
5713 use dc_message, only: messagenotify
5714 use dc_trace, only: beginsub, endsub
5715 use dc_error, only: storeerror, dc_noerr, &
5717 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
5718 use dc_date_generic, only: operator(-), operator(+), &
5719 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
5722 use dc_types, only: dp, string
5723 implicit none
5724 real(DP), intent(in):: time
5725 real(DP), parameter:: time_eps = epsilon(1.0_dp)
5726
5727 character(*), intent(in):: varname
5728
5729 real, intent(in), target:: array(:,:,:,:,:,:,:)
5730
5731 logical, intent(out), optional:: err
5732
5733
5734 type(gt_history), pointer:: gthist =>null()
5735 ! gtool_history モジュール用構造体.
5736 ! Derived type for "gtool_history" module
5737
5738 real, pointer:: array_slice(:,:,:,:,:,:,:) =>null()
5739 type(slice_info), pointer:: sv =>null()
5740 real, pointer:: array_avr(:,:,:,:,:,:,:) =>null()
5741
5742 real(DP):: settime
5743 integer:: stat, i
5744 integer:: vnum
5745 character(STRING):: cause_c
5746 integer, save:: svnum = 1, svtstep
5747 character(*), parameter:: subname = "HistoryAutoPutReal7"
5748 continue
5749 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
5750 stat = dc_noerr
5751 cause_c = ""
5752
5753 ! 初期設定チェック
5754 ! Check initialization
5755 !
5756 if ( .not. initialized ) then
5757 stat = dc_enotinit
5758 cause_c = 'gtool_historyauto'
5759 goto 999
5760 end if
5761
5762 ! 時刻に関するエラー処理
5763 ! Error handling for time
5764 !
5765 if ( time < zero_time ) then
5766 cause_c = tochar( time )
5767 call messagenotify( 'W', subname, &
5768 & '"time=<%c>" must be positive value (varname=<%c>).', &
5769 & c1 = trim( cause_c ), c2 = trim( varname ) )
5770 stat = dc_enegative
5771 cause_c = 'time'
5772 goto 999
5773 end if
5774
5775 ! 変数 ID のサーチ
5776 ! Search variable ID
5777 !
5778 varsearch: do
5779 do i = svnum, numvars
5780 if ( trim( varname_vars(i) ) == trim(varname) ) then
5781 vnum = i
5782 exit varsearch
5783 end if
5784 end do
5785 do i = 1, svnum - 1
5786 if ( trim( varname_vars(i) ) == trim(varname) ) then
5787 vnum = i
5788 exit varsearch
5789 end if
5790 end do
5791
5792 stat = hst_ebadvarname
5793 cause_c = varname
5794 goto 999
5795 end do varsearch
5796
5797 svnum = vnum
5798
5799 ! 定義モードからデータモードへ
5800 ! Transit from define mode to data mode
5801 !
5802 if ( hstnmlinfodefinemode( gthstnml ) ) then
5803 call hstnmlinfoenddefine( gthstnml ) ! (inout)
5804 end if
5805
5806 ! 出力タイミングのチェックとファイルの作成
5807 ! Check output timing and create files
5808 !
5809 call hstvarsoutputcheck( &
5810 & time = time, & ! (in)
5811 & stime_index = svtstep ) ! (out)
5812
5813 ! ファイルのオープン・クローズ・再オープン
5814 ! Open, close, reopen files
5815 !
5816 if ( create_timing_vars(vnum, svtstep) &
5817 & .and. .not. histaddvar_vars(vnum) ) then
5818 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
5819 & varname_vars(vnum), time ) ! (in)
5820 histaddvar_vars(vnum) = .true.
5821 if ( flag_output_prev_vars(vnum) ) then
5822 prev_outtime_vars(vnum) = time
5823 else
5824 flag_output_prev_vars(vnum) = .true.
5825 if ( origin_time_vars(vnum) > zero_time ) then
5827 else
5828 prev_outtime_vars(vnum) = time
5829 end if
5830 end if
5831 end if
5832
5833 if ( close_timing_vars(vnum, svtstep) ) then
5834 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
5835 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
5836 end if
5837 end if
5838
5839 if ( renew_timing_vars(vnum, svtstep) ) then
5840 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
5841 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
5842 end if
5843 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
5844 & varname_vars(vnum), time ) ! (in)
5845 newfile_createtime_vars(vnum) = time
5846 prev_outtime_vars(vnum) = time
5847 end if
5848
5849 ! 出力が有効かどうかを確認する
5850 ! Confirm whether the output is effective
5851 !
5852 if ( .not. output_timing_vars(vnum, svtstep) &
5853 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
5854
5855 goto 999
5856 end if
5857
5858 ! GT_HISTORY 変数の取得
5859 ! Get "GT_HISTORY" variable
5860 !
5861 gthist => gthst_history_vars(vnum) % gthist
5862
5863
5864 ! 空間切り出し
5865 ! Slice of spaces
5866 !
5867 sv => slice_vars(vnum)
5868
5869 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
5870
5871!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
5872
5873!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
5874
5875!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
5876
5877!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
5878
5879!!$ write(*,*) ' sv%st(6), sv%ed(6), sv%sd(6)=', sv%st(6), sv%ed(6), sv%sd(6)
5880
5881!!$ write(*,*) ' sv%st(7), sv%ed(7), sv%sd(7)=', sv%st(7), sv%ed(7), sv%sd(7)
5882
5883
5884 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
5885 & , sv%st(2):sv%ed(2):sv%sd(2) &
5886
5887 & , sv%st(3):sv%ed(3):sv%sd(3) &
5888
5889 & , sv%st(4):sv%ed(4):sv%sd(4) &
5890
5891 & , sv%st(5):sv%ed(5):sv%sd(5) &
5892
5893 & , sv%st(6):sv%ed(6):sv%sd(6) &
5894
5895 & , sv%st(7):sv%ed(7):sv%sd(7) &
5896
5897 & )
5898
5899
5900
5901 ! 空間平均
5902 ! Spatial average
5903 !
5904 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
5905 array_avr => array_slice
5906 else
5907 call averagereduce( &
5908 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
5909 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
5910
5911 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
5912
5913 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
5914
5915 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
5916
5917 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
5918
5919 & weight_vars(vnum) % wgt6( sv%st(6):sv%ed(6):sv%sd(6) ) , & ! (in)
5920
5921 & weight_vars(vnum) % wgt7( sv%st(7):sv%ed(7):sv%sd(7) ) , & ! (in)
5922
5923 & array_avr ) ! (out)
5924 end if
5925
5926 ! 座標重みを取得 ; Get weights of axes
5927
5928
5929
5930 ! 単位に応じて時刻を変換
5931 ! Convert time according to units
5932 !
5933 if ( output_timing_vars(vnum, svtstep) &
5934 & .or. output_timing_avr_vars(vnum, svtstep) ) then
5935
5936 settime = &
5937 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
5938 end if
5939
5940 ! 時刻設定
5941 ! Set time
5942 !
5943 if ( output_timing_vars(vnum, svtstep) ) then
5944 call historysettime( &
5945 & history = gthist, & ! (in) optional
5946 & timed = settime ) ! (in) optional
5947 end if
5948
5949 ! 出力
5950 ! OutPut
5951 !
5952 if ( output_timing_avr_vars(vnum, svtstep) ) then
5953 call historyput( &
5954 & varname, & ! (in)
5955 & array_avr, & ! (in)
5956
5957 & timed = settime, & ! (in) optional
5958 & time_average_store = &
5959 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
5960 & history = gthist ) ! (inout) optional
5961 else
5962 call historyput( &
5963 & varname, & ! (in)
5964 & array_avr, & ! (in)
5965
5966 & history = gthist ) ! (inout) optional
5967 end if
5968
5969 ! 最後に出力した時刻を保存
5970 ! Save last time of output
5971 !
5972 if ( output_timing_vars(vnum, svtstep) ) then
5973 if ( .not. create_timing_vars(vnum, svtstep) .and. &
5974 & .not. renew_timing_vars(vnum, svtstep) ) then
5975
5976 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
5977 & time_eps * max(1.0_dp, abs(time), &
5978 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
5979 prev_outtime_vars(vnum) = time
5980 else
5981 prev_outtime_vars(vnum) = &
5983 end if
5984 end if
5985 end if
5986
5987 ! 結合解除
5988 ! Release associations
5989 !
5990 nullify( gthist )
5991 nullify( array_avr, array_slice )
5992
5993
5994999 continue
5995 call storeerror(stat, subname, cause_c = cause_c, err = err)
5996 call endsub(subname)
5997 end subroutine historyautoputreal7
5998
5999
6079 & time, varname, value, & ! (in)
6080 & err & ! (out) optional
6081 & )
6082 !
6083
6084 !
6085
6099 use gtool_history, only: gt_history, historyput, historyinitialized, &
6100 & historyaddvariable, historyinquire, historyvarinfoinquire, &
6102 use dc_string, only: tochar
6103 use dc_message, only: messagenotify
6104 use dc_trace, only: beginsub, endsub
6105 use dc_error, only: storeerror, dc_noerr, &
6107 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
6108 use dc_date_generic, only: operator(-), operator(+), &
6109 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
6112 use dc_types, only: dp, string
6113 implicit none
6114 real(DP), intent(in):: time
6115 real(DP), parameter:: time_eps = epsilon(1.0_dp)
6116
6117 character(*), intent(in):: varname
6118
6119 integer, intent(in), target:: value
6120
6121 logical, intent(out), optional:: err
6122
6123
6124 type(gt_history), pointer:: gthist =>null()
6125 ! gtool_history モジュール用構造体.
6126 ! Derived type for "gtool_history" module
6127
6128
6129 real(DP):: settime
6130 integer:: stat, i
6131 integer:: vnum
6132 character(STRING):: cause_c
6133 integer, save:: svnum = 1, svtstep
6134 character(*), parameter:: subname = "HistoryAutoPutInt0"
6135 continue
6136 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
6137 stat = dc_noerr
6138 cause_c = ""
6139
6140 ! 初期設定チェック
6141 ! Check initialization
6142 !
6143 if ( .not. initialized ) then
6144 stat = dc_enotinit
6145 cause_c = 'gtool_historyauto'
6146 goto 999
6147 end if
6148
6149 ! 時刻に関するエラー処理
6150 ! Error handling for time
6151 !
6152 if ( time < zero_time ) then
6153 cause_c = tochar( time )
6154 call messagenotify( 'W', subname, &
6155 & '"time=<%c>" must be positive value (varname=<%c>).', &
6156 & c1 = trim( cause_c ), c2 = trim( varname ) )
6157 stat = dc_enegative
6158 cause_c = 'time'
6159 goto 999
6160 end if
6161
6162 ! 変数 ID のサーチ
6163 ! Search variable ID
6164 !
6165 varsearch: do
6166 do i = svnum, numvars
6167 if ( trim( varname_vars(i) ) == trim(varname) ) then
6168 vnum = i
6169 exit varsearch
6170 end if
6171 end do
6172 do i = 1, svnum - 1
6173 if ( trim( varname_vars(i) ) == trim(varname) ) then
6174 vnum = i
6175 exit varsearch
6176 end if
6177 end do
6178
6179 stat = hst_ebadvarname
6180 cause_c = varname
6181 goto 999
6182 end do varsearch
6183
6184 svnum = vnum
6185
6186 ! 定義モードからデータモードへ
6187 ! Transit from define mode to data mode
6188 !
6189 if ( hstnmlinfodefinemode( gthstnml ) ) then
6190 call hstnmlinfoenddefine( gthstnml ) ! (inout)
6191 end if
6192
6193 ! 出力タイミングのチェックとファイルの作成
6194 ! Check output timing and create files
6195 !
6196 call hstvarsoutputcheck( &
6197 & time = time, & ! (in)
6198 & stime_index = svtstep ) ! (out)
6199
6200 ! ファイルのオープン・クローズ・再オープン
6201 ! Open, close, reopen files
6202 !
6203 if ( create_timing_vars(vnum, svtstep) &
6204 & .and. .not. histaddvar_vars(vnum) ) then
6205 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
6206 & varname_vars(vnum), time ) ! (in)
6207 histaddvar_vars(vnum) = .true.
6208 if ( flag_output_prev_vars(vnum) ) then
6209 prev_outtime_vars(vnum) = time
6210 else
6211 flag_output_prev_vars(vnum) = .true.
6212 if ( origin_time_vars(vnum) > zero_time ) then
6214 else
6215 prev_outtime_vars(vnum) = time
6216 end if
6217 end if
6218 end if
6219
6220 if ( close_timing_vars(vnum, svtstep) ) then
6221 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
6222 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
6223 end if
6224 end if
6225
6226 if ( renew_timing_vars(vnum, svtstep) ) then
6227 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
6228 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
6229 end if
6230 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
6231 & varname_vars(vnum), time ) ! (in)
6232 newfile_createtime_vars(vnum) = time
6233 prev_outtime_vars(vnum) = time
6234 end if
6235
6236 ! 出力が有効かどうかを確認する
6237 ! Confirm whether the output is effective
6238 !
6239 if ( .not. output_timing_vars(vnum, svtstep) &
6240 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
6241
6242 goto 999
6243 end if
6244
6245 ! GT_HISTORY 変数の取得
6246 ! Get "GT_HISTORY" variable
6247 !
6248 gthist => gthst_history_vars(vnum) % gthist
6249
6250
6251 ! 空間切り出し
6252 ! Slice of spaces
6253 !
6254 ! array only
6255
6256
6257
6258 ! 空間平均
6259 ! Spatial average
6260 !
6261 ! array only
6262
6263
6264 ! 単位に応じて時刻を変換
6265 ! Convert time according to units
6266 !
6267 if ( output_timing_vars(vnum, svtstep) &
6268 & .or. output_timing_avr_vars(vnum, svtstep) ) then
6269
6270 settime = &
6271 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
6272 end if
6273
6274 ! 時刻設定
6275 ! Set time
6276 !
6277 if ( output_timing_vars(vnum, svtstep) ) then
6278 call historysettime( &
6279 & history = gthist, & ! (in) optional
6280 & timed = settime ) ! (in) optional
6281 end if
6282
6283 ! 出力
6284 ! OutPut
6285 !
6286 if ( output_timing_avr_vars(vnum, svtstep) ) then
6287 call historyput( &
6288 & varname, & ! (in)
6289 & (/value/), & ! (in)
6290
6291 & timed = settime, & ! (in) optional
6292 & time_average_store = &
6293 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
6294 & history = gthist ) ! (inout) optional
6295 else
6296 call historyput( &
6297 & varname, & ! (in)
6298 & (/value/), & ! (in)
6299
6300 & history = gthist ) ! (inout) optional
6301 end if
6302
6303 ! 最後に出力した時刻を保存
6304 ! Save last time of output
6305 !
6306 if ( output_timing_vars(vnum, svtstep) ) then
6307 if ( .not. create_timing_vars(vnum, svtstep) .and. &
6308 & .not. renew_timing_vars(vnum, svtstep) ) then
6309
6310 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
6311 & time_eps * max(1.0_dp, abs(time), &
6312 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
6313 prev_outtime_vars(vnum) = time
6314 else
6315 prev_outtime_vars(vnum) = &
6317 end if
6318 end if
6319 end if
6320
6321 ! 結合解除
6322 ! Release associations
6323 !
6324 nullify( gthist )
6325
6326
6327999 continue
6328 call storeerror(stat, subname, cause_c = cause_c, err = err)
6329 call endsub(subname)
6330 end subroutine historyautoputint0
6331
6332
6412 & time, varname, array, & ! (in)
6413 & err & ! (out) optional
6414 & )
6415 !
6416
6417 !
6418
6433 use gtool_history, only: gt_history, historyput, historyinitialized, &
6434 & historyaddvariable, historyinquire, historyvarinfoinquire, &
6436 use dc_string, only: tochar
6437 use dc_message, only: messagenotify
6438 use dc_trace, only: beginsub, endsub
6439 use dc_error, only: storeerror, dc_noerr, &
6441 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
6442 use dc_date_generic, only: operator(-), operator(+), &
6443 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
6446 use dc_types, only: dp, string
6447 implicit none
6448 real(DP), intent(in):: time
6449 real(DP), parameter:: time_eps = epsilon(1.0_dp)
6450
6451 character(*), intent(in):: varname
6452
6453 integer, intent(in), target:: array(:)
6454
6455 logical, intent(out), optional:: err
6456
6457
6458 type(gt_history), pointer:: gthist =>null()
6459 ! gtool_history モジュール用構造体.
6460 ! Derived type for "gtool_history" module
6461
6462 integer, pointer:: array_slice(:) =>null()
6463 type(slice_info), pointer:: sv =>null()
6464 integer, pointer:: array_avr(:) =>null()
6465
6466 real(DP):: settime
6467 integer:: stat, i
6468 integer:: vnum
6469 character(STRING):: cause_c
6470 integer, save:: svnum = 1, svtstep
6471 character(*), parameter:: subname = "HistoryAutoPutInt1"
6472 continue
6473 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
6474 stat = dc_noerr
6475 cause_c = ""
6476
6477 ! 初期設定チェック
6478 ! Check initialization
6479 !
6480 if ( .not. initialized ) then
6481 stat = dc_enotinit
6482 cause_c = 'gtool_historyauto'
6483 goto 999
6484 end if
6485
6486 ! 時刻に関するエラー処理
6487 ! Error handling for time
6488 !
6489 if ( time < zero_time ) then
6490 cause_c = tochar( time )
6491 call messagenotify( 'W', subname, &
6492 & '"time=<%c>" must be positive value (varname=<%c>).', &
6493 & c1 = trim( cause_c ), c2 = trim( varname ) )
6494 stat = dc_enegative
6495 cause_c = 'time'
6496 goto 999
6497 end if
6498
6499 ! 変数 ID のサーチ
6500 ! Search variable ID
6501 !
6502 varsearch: do
6503 do i = svnum, numvars
6504 if ( trim( varname_vars(i) ) == trim(varname) ) then
6505 vnum = i
6506 exit varsearch
6507 end if
6508 end do
6509 do i = 1, svnum - 1
6510 if ( trim( varname_vars(i) ) == trim(varname) ) then
6511 vnum = i
6512 exit varsearch
6513 end if
6514 end do
6515
6516 stat = hst_ebadvarname
6517 cause_c = varname
6518 goto 999
6519 end do varsearch
6520
6521 svnum = vnum
6522
6523 ! 定義モードからデータモードへ
6524 ! Transit from define mode to data mode
6525 !
6526 if ( hstnmlinfodefinemode( gthstnml ) ) then
6527 call hstnmlinfoenddefine( gthstnml ) ! (inout)
6528 end if
6529
6530 ! 出力タイミングのチェックとファイルの作成
6531 ! Check output timing and create files
6532 !
6533 call hstvarsoutputcheck( &
6534 & time = time, & ! (in)
6535 & stime_index = svtstep ) ! (out)
6536
6537 ! ファイルのオープン・クローズ・再オープン
6538 ! Open, close, reopen files
6539 !
6540 if ( create_timing_vars(vnum, svtstep) &
6541 & .and. .not. histaddvar_vars(vnum) ) then
6542 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
6543 & varname_vars(vnum), time ) ! (in)
6544 histaddvar_vars(vnum) = .true.
6545 if ( flag_output_prev_vars(vnum) ) then
6546 prev_outtime_vars(vnum) = time
6547 else
6548 flag_output_prev_vars(vnum) = .true.
6549 if ( origin_time_vars(vnum) > zero_time ) then
6551 else
6552 prev_outtime_vars(vnum) = time
6553 end if
6554 end if
6555 end if
6556
6557 if ( close_timing_vars(vnum, svtstep) ) then
6558 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
6559 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
6560 end if
6561 end if
6562
6563 if ( renew_timing_vars(vnum, svtstep) ) then
6564 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
6565 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
6566 end if
6567 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
6568 & varname_vars(vnum), time ) ! (in)
6569 newfile_createtime_vars(vnum) = time
6570 prev_outtime_vars(vnum) = time
6571 end if
6572
6573 ! 出力が有効かどうかを確認する
6574 ! Confirm whether the output is effective
6575 !
6576 if ( .not. output_timing_vars(vnum, svtstep) &
6577 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
6578
6579 goto 999
6580 end if
6581
6582 ! GT_HISTORY 変数の取得
6583 ! Get "GT_HISTORY" variable
6584 !
6585 gthist => gthst_history_vars(vnum) % gthist
6586
6587
6588 ! 空間切り出し
6589 ! Slice of spaces
6590 !
6591 sv => slice_vars(vnum)
6592
6593 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
6594
6595
6596 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
6597
6598 & )
6599
6600
6601
6602 ! 空間平均
6603 ! Spatial average
6604 !
6605 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
6606 array_avr => array_slice
6607 else
6608 call averagereduce( &
6609 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
6610 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
6611
6612 & array_avr ) ! (out)
6613 end if
6614
6615 ! 座標重みを取得 ; Get weights of axes
6616
6617
6618
6619 ! 単位に応じて時刻を変換
6620 ! Convert time according to units
6621 !
6622 if ( output_timing_vars(vnum, svtstep) &
6623 & .or. output_timing_avr_vars(vnum, svtstep) ) then
6624
6625 settime = &
6626 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
6627 end if
6628
6629 ! 時刻設定
6630 ! Set time
6631 !
6632 if ( output_timing_vars(vnum, svtstep) ) then
6633 call historysettime( &
6634 & history = gthist, & ! (in) optional
6635 & timed = settime ) ! (in) optional
6636 end if
6637
6638 ! 出力
6639 ! OutPut
6640 !
6641 if ( output_timing_avr_vars(vnum, svtstep) ) then
6642 call historyput( &
6643 & varname, & ! (in)
6644 & array_avr, & ! (in)
6645
6646 & timed = settime, & ! (in) optional
6647 & time_average_store = &
6648 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
6649 & history = gthist ) ! (inout) optional
6650 else
6651 call historyput( &
6652 & varname, & ! (in)
6653 & array_avr, & ! (in)
6654
6655 & history = gthist ) ! (inout) optional
6656 end if
6657
6658 ! 最後に出力した時刻を保存
6659 ! Save last time of output
6660 !
6661 if ( output_timing_vars(vnum, svtstep) ) then
6662 if ( .not. create_timing_vars(vnum, svtstep) .and. &
6663 & .not. renew_timing_vars(vnum, svtstep) ) then
6664
6665 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
6666 & time_eps * max(1.0_dp, abs(time), &
6667 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
6668 prev_outtime_vars(vnum) = time
6669 else
6670 prev_outtime_vars(vnum) = &
6672 end if
6673 end if
6674 end if
6675
6676 ! 結合解除
6677 ! Release associations
6678 !
6679 nullify( gthist )
6680 nullify( array_avr, array_slice )
6681
6682
6683999 continue
6684 call storeerror(stat, subname, cause_c = cause_c, err = err)
6685 call endsub(subname)
6686 end subroutine historyautoputint1
6687
6688
6768 & time, varname, array, & ! (in)
6769 & err & ! (out) optional
6770 & )
6771 !
6772
6773 !
6774
6789 use gtool_history, only: gt_history, historyput, historyinitialized, &
6790 & historyaddvariable, historyinquire, historyvarinfoinquire, &
6792 use dc_string, only: tochar
6793 use dc_message, only: messagenotify
6794 use dc_trace, only: beginsub, endsub
6795 use dc_error, only: storeerror, dc_noerr, &
6797 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
6798 use dc_date_generic, only: operator(-), operator(+), &
6799 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
6802 use dc_types, only: dp, string
6803 implicit none
6804 real(DP), intent(in):: time
6805 real(DP), parameter:: time_eps = epsilon(1.0_dp)
6806
6807 character(*), intent(in):: varname
6808
6809 integer, intent(in), target:: array(:,:)
6810
6811 logical, intent(out), optional:: err
6812
6813
6814 type(gt_history), pointer:: gthist =>null()
6815 ! gtool_history モジュール用構造体.
6816 ! Derived type for "gtool_history" module
6817
6818 integer, pointer:: array_slice(:,:) =>null()
6819 type(slice_info), pointer:: sv =>null()
6820 integer, pointer:: array_avr(:,:) =>null()
6821
6822 real(DP):: settime
6823 integer:: stat, i
6824 integer:: vnum
6825 character(STRING):: cause_c
6826 integer, save:: svnum = 1, svtstep
6827 character(*), parameter:: subname = "HistoryAutoPutInt2"
6828 continue
6829 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
6830 stat = dc_noerr
6831 cause_c = ""
6832
6833 ! 初期設定チェック
6834 ! Check initialization
6835 !
6836 if ( .not. initialized ) then
6837 stat = dc_enotinit
6838 cause_c = 'gtool_historyauto'
6839 goto 999
6840 end if
6841
6842 ! 時刻に関するエラー処理
6843 ! Error handling for time
6844 !
6845 if ( time < zero_time ) then
6846 cause_c = tochar( time )
6847 call messagenotify( 'W', subname, &
6848 & '"time=<%c>" must be positive value (varname=<%c>).', &
6849 & c1 = trim( cause_c ), c2 = trim( varname ) )
6850 stat = dc_enegative
6851 cause_c = 'time'
6852 goto 999
6853 end if
6854
6855 ! 変数 ID のサーチ
6856 ! Search variable ID
6857 !
6858 varsearch: do
6859 do i = svnum, numvars
6860 if ( trim( varname_vars(i) ) == trim(varname) ) then
6861 vnum = i
6862 exit varsearch
6863 end if
6864 end do
6865 do i = 1, svnum - 1
6866 if ( trim( varname_vars(i) ) == trim(varname) ) then
6867 vnum = i
6868 exit varsearch
6869 end if
6870 end do
6871
6872 stat = hst_ebadvarname
6873 cause_c = varname
6874 goto 999
6875 end do varsearch
6876
6877 svnum = vnum
6878
6879 ! 定義モードからデータモードへ
6880 ! Transit from define mode to data mode
6881 !
6882 if ( hstnmlinfodefinemode( gthstnml ) ) then
6883 call hstnmlinfoenddefine( gthstnml ) ! (inout)
6884 end if
6885
6886 ! 出力タイミングのチェックとファイルの作成
6887 ! Check output timing and create files
6888 !
6889 call hstvarsoutputcheck( &
6890 & time = time, & ! (in)
6891 & stime_index = svtstep ) ! (out)
6892
6893 ! ファイルのオープン・クローズ・再オープン
6894 ! Open, close, reopen files
6895 !
6896 if ( create_timing_vars(vnum, svtstep) &
6897 & .and. .not. histaddvar_vars(vnum) ) then
6898 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
6899 & varname_vars(vnum), time ) ! (in)
6900 histaddvar_vars(vnum) = .true.
6901 if ( flag_output_prev_vars(vnum) ) then
6902 prev_outtime_vars(vnum) = time
6903 else
6904 flag_output_prev_vars(vnum) = .true.
6905 if ( origin_time_vars(vnum) > zero_time ) then
6907 else
6908 prev_outtime_vars(vnum) = time
6909 end if
6910 end if
6911 end if
6912
6913 if ( close_timing_vars(vnum, svtstep) ) then
6914 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
6915 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
6916 end if
6917 end if
6918
6919 if ( renew_timing_vars(vnum, svtstep) ) then
6920 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
6921 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
6922 end if
6923 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
6924 & varname_vars(vnum), time ) ! (in)
6925 newfile_createtime_vars(vnum) = time
6926 prev_outtime_vars(vnum) = time
6927 end if
6928
6929 ! 出力が有効かどうかを確認する
6930 ! Confirm whether the output is effective
6931 !
6932 if ( .not. output_timing_vars(vnum, svtstep) &
6933 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
6934
6935 goto 999
6936 end if
6937
6938 ! GT_HISTORY 変数の取得
6939 ! Get "GT_HISTORY" variable
6940 !
6941 gthist => gthst_history_vars(vnum) % gthist
6942
6943
6944 ! 空間切り出し
6945 ! Slice of spaces
6946 !
6947 sv => slice_vars(vnum)
6948
6949 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
6950
6951!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
6952
6953
6954 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
6955 & , sv%st(2):sv%ed(2):sv%sd(2) &
6956
6957 & )
6958
6959
6960
6961 ! 空間平均
6962 ! Spatial average
6963 !
6964 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
6965 array_avr => array_slice
6966 else
6967 call averagereduce( &
6968 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
6969 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
6970
6971 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
6972
6973 & array_avr ) ! (out)
6974 end if
6975
6976 ! 座標重みを取得 ; Get weights of axes
6977
6978
6979
6980 ! 単位に応じて時刻を変換
6981 ! Convert time according to units
6982 !
6983 if ( output_timing_vars(vnum, svtstep) &
6984 & .or. output_timing_avr_vars(vnum, svtstep) ) then
6985
6986 settime = &
6987 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
6988 end if
6989
6990 ! 時刻設定
6991 ! Set time
6992 !
6993 if ( output_timing_vars(vnum, svtstep) ) then
6994 call historysettime( &
6995 & history = gthist, & ! (in) optional
6996 & timed = settime ) ! (in) optional
6997 end if
6998
6999 ! 出力
7000 ! OutPut
7001 !
7002 if ( output_timing_avr_vars(vnum, svtstep) ) then
7003 call historyput( &
7004 & varname, & ! (in)
7005 & array_avr, & ! (in)
7006
7007 & timed = settime, & ! (in) optional
7008 & time_average_store = &
7009 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
7010 & history = gthist ) ! (inout) optional
7011 else
7012 call historyput( &
7013 & varname, & ! (in)
7014 & array_avr, & ! (in)
7015
7016 & history = gthist ) ! (inout) optional
7017 end if
7018
7019 ! 最後に出力した時刻を保存
7020 ! Save last time of output
7021 !
7022 if ( output_timing_vars(vnum, svtstep) ) then
7023 if ( .not. create_timing_vars(vnum, svtstep) .and. &
7024 & .not. renew_timing_vars(vnum, svtstep) ) then
7025
7026 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
7027 & time_eps * max(1.0_dp, abs(time), &
7028 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
7029 prev_outtime_vars(vnum) = time
7030 else
7031 prev_outtime_vars(vnum) = &
7033 end if
7034 end if
7035 end if
7036
7037 ! 結合解除
7038 ! Release associations
7039 !
7040 nullify( gthist )
7041 nullify( array_avr, array_slice )
7042
7043
7044999 continue
7045 call storeerror(stat, subname, cause_c = cause_c, err = err)
7046 call endsub(subname)
7047 end subroutine historyautoputint2
7048
7049
7129 & time, varname, array, & ! (in)
7130 & err & ! (out) optional
7131 & )
7132 !
7133
7134 !
7135
7150 use gtool_history, only: gt_history, historyput, historyinitialized, &
7151 & historyaddvariable, historyinquire, historyvarinfoinquire, &
7153 use dc_string, only: tochar
7154 use dc_message, only: messagenotify
7155 use dc_trace, only: beginsub, endsub
7156 use dc_error, only: storeerror, dc_noerr, &
7158 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
7159 use dc_date_generic, only: operator(-), operator(+), &
7160 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
7163 use dc_types, only: dp, string
7164 implicit none
7165 real(DP), intent(in):: time
7166 real(DP), parameter:: time_eps = epsilon(1.0_dp)
7167
7168 character(*), intent(in):: varname
7169
7170 integer, intent(in), target:: array(:,:,:)
7171
7172 logical, intent(out), optional:: err
7173
7174
7175 type(gt_history), pointer:: gthist =>null()
7176 ! gtool_history モジュール用構造体.
7177 ! Derived type for "gtool_history" module
7178
7179 integer, pointer:: array_slice(:,:,:) =>null()
7180 type(slice_info), pointer:: sv =>null()
7181 integer, pointer:: array_avr(:,:,:) =>null()
7182
7183 real(DP):: settime
7184 integer:: stat, i
7185 integer:: vnum
7186 character(STRING):: cause_c
7187 integer, save:: svnum = 1, svtstep
7188 character(*), parameter:: subname = "HistoryAutoPutInt3"
7189 continue
7190 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
7191 stat = dc_noerr
7192 cause_c = ""
7193
7194 ! 初期設定チェック
7195 ! Check initialization
7196 !
7197 if ( .not. initialized ) then
7198 stat = dc_enotinit
7199 cause_c = 'gtool_historyauto'
7200 goto 999
7201 end if
7202
7203 ! 時刻に関するエラー処理
7204 ! Error handling for time
7205 !
7206 if ( time < zero_time ) then
7207 cause_c = tochar( time )
7208 call messagenotify( 'W', subname, &
7209 & '"time=<%c>" must be positive value (varname=<%c>).', &
7210 & c1 = trim( cause_c ), c2 = trim( varname ) )
7211 stat = dc_enegative
7212 cause_c = 'time'
7213 goto 999
7214 end if
7215
7216 ! 変数 ID のサーチ
7217 ! Search variable ID
7218 !
7219 varsearch: do
7220 do i = svnum, numvars
7221 if ( trim( varname_vars(i) ) == trim(varname) ) then
7222 vnum = i
7223 exit varsearch
7224 end if
7225 end do
7226 do i = 1, svnum - 1
7227 if ( trim( varname_vars(i) ) == trim(varname) ) then
7228 vnum = i
7229 exit varsearch
7230 end if
7231 end do
7232
7233 stat = hst_ebadvarname
7234 cause_c = varname
7235 goto 999
7236 end do varsearch
7237
7238 svnum = vnum
7239
7240 ! 定義モードからデータモードへ
7241 ! Transit from define mode to data mode
7242 !
7243 if ( hstnmlinfodefinemode( gthstnml ) ) then
7244 call hstnmlinfoenddefine( gthstnml ) ! (inout)
7245 end if
7246
7247 ! 出力タイミングのチェックとファイルの作成
7248 ! Check output timing and create files
7249 !
7250 call hstvarsoutputcheck( &
7251 & time = time, & ! (in)
7252 & stime_index = svtstep ) ! (out)
7253
7254 ! ファイルのオープン・クローズ・再オープン
7255 ! Open, close, reopen files
7256 !
7257 if ( create_timing_vars(vnum, svtstep) &
7258 & .and. .not. histaddvar_vars(vnum) ) then
7259 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
7260 & varname_vars(vnum), time ) ! (in)
7261 histaddvar_vars(vnum) = .true.
7262 if ( flag_output_prev_vars(vnum) ) then
7263 prev_outtime_vars(vnum) = time
7264 else
7265 flag_output_prev_vars(vnum) = .true.
7266 if ( origin_time_vars(vnum) > zero_time ) then
7268 else
7269 prev_outtime_vars(vnum) = time
7270 end if
7271 end if
7272 end if
7273
7274 if ( close_timing_vars(vnum, svtstep) ) then
7275 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
7276 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
7277 end if
7278 end if
7279
7280 if ( renew_timing_vars(vnum, svtstep) ) then
7281 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
7282 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
7283 end if
7284 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
7285 & varname_vars(vnum), time ) ! (in)
7286 newfile_createtime_vars(vnum) = time
7287 prev_outtime_vars(vnum) = time
7288 end if
7289
7290 ! 出力が有効かどうかを確認する
7291 ! Confirm whether the output is effective
7292 !
7293 if ( .not. output_timing_vars(vnum, svtstep) &
7294 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
7295
7296 goto 999
7297 end if
7298
7299 ! GT_HISTORY 変数の取得
7300 ! Get "GT_HISTORY" variable
7301 !
7302 gthist => gthst_history_vars(vnum) % gthist
7303
7304
7305 ! 空間切り出し
7306 ! Slice of spaces
7307 !
7308 sv => slice_vars(vnum)
7309
7310 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
7311
7312!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
7313
7314!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
7315
7316
7317 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
7318 & , sv%st(2):sv%ed(2):sv%sd(2) &
7319
7320 & , sv%st(3):sv%ed(3):sv%sd(3) &
7321
7322 & )
7323
7324
7325
7326 ! 空間平均
7327 ! Spatial average
7328 !
7329 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
7330 array_avr => array_slice
7331 else
7332 call averagereduce( &
7333 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
7334 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
7335
7336 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
7337
7338 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
7339
7340 & array_avr ) ! (out)
7341 end if
7342
7343 ! 座標重みを取得 ; Get weights of axes
7344
7345
7346
7347 ! 単位に応じて時刻を変換
7348 ! Convert time according to units
7349 !
7350 if ( output_timing_vars(vnum, svtstep) &
7351 & .or. output_timing_avr_vars(vnum, svtstep) ) then
7352
7353 settime = &
7354 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
7355 end if
7356
7357 ! 時刻設定
7358 ! Set time
7359 !
7360 if ( output_timing_vars(vnum, svtstep) ) then
7361 call historysettime( &
7362 & history = gthist, & ! (in) optional
7363 & timed = settime ) ! (in) optional
7364 end if
7365
7366 ! 出力
7367 ! OutPut
7368 !
7369 if ( output_timing_avr_vars(vnum, svtstep) ) then
7370 call historyput( &
7371 & varname, & ! (in)
7372 & array_avr, & ! (in)
7373
7374 & timed = settime, & ! (in) optional
7375 & time_average_store = &
7376 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
7377 & history = gthist ) ! (inout) optional
7378 else
7379 call historyput( &
7380 & varname, & ! (in)
7381 & array_avr, & ! (in)
7382
7383 & history = gthist ) ! (inout) optional
7384 end if
7385
7386 ! 最後に出力した時刻を保存
7387 ! Save last time of output
7388 !
7389 if ( output_timing_vars(vnum, svtstep) ) then
7390 if ( .not. create_timing_vars(vnum, svtstep) .and. &
7391 & .not. renew_timing_vars(vnum, svtstep) ) then
7392
7393 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
7394 & time_eps * max(1.0_dp, abs(time), &
7395 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
7396 prev_outtime_vars(vnum) = time
7397 else
7398 prev_outtime_vars(vnum) = &
7400 end if
7401 end if
7402 end if
7403
7404 ! 結合解除
7405 ! Release associations
7406 !
7407 nullify( gthist )
7408 nullify( array_avr, array_slice )
7409
7410
7411999 continue
7412 call storeerror(stat, subname, cause_c = cause_c, err = err)
7413 call endsub(subname)
7414 end subroutine historyautoputint3
7415
7416
7496 & time, varname, array, & ! (in)
7497 & err & ! (out) optional
7498 & )
7499 !
7500
7501 !
7502
7517 use gtool_history, only: gt_history, historyput, historyinitialized, &
7518 & historyaddvariable, historyinquire, historyvarinfoinquire, &
7520 use dc_string, only: tochar
7521 use dc_message, only: messagenotify
7522 use dc_trace, only: beginsub, endsub
7523 use dc_error, only: storeerror, dc_noerr, &
7525 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
7526 use dc_date_generic, only: operator(-), operator(+), &
7527 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
7530 use dc_types, only: dp, string
7531 implicit none
7532 real(DP), intent(in):: time
7533 real(DP), parameter:: time_eps = epsilon(1.0_dp)
7534
7535 character(*), intent(in):: varname
7536
7537 integer, intent(in), target:: array(:,:,:,:)
7538
7539 logical, intent(out), optional:: err
7540
7541
7542 type(gt_history), pointer:: gthist =>null()
7543 ! gtool_history モジュール用構造体.
7544 ! Derived type for "gtool_history" module
7545
7546 integer, pointer:: array_slice(:,:,:,:) =>null()
7547 type(slice_info), pointer:: sv =>null()
7548 integer, pointer:: array_avr(:,:,:,:) =>null()
7549
7550 real(DP):: settime
7551 integer:: stat, i
7552 integer:: vnum
7553 character(STRING):: cause_c
7554 integer, save:: svnum = 1, svtstep
7555 character(*), parameter:: subname = "HistoryAutoPutInt4"
7556 continue
7557 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
7558 stat = dc_noerr
7559 cause_c = ""
7560
7561 ! 初期設定チェック
7562 ! Check initialization
7563 !
7564 if ( .not. initialized ) then
7565 stat = dc_enotinit
7566 cause_c = 'gtool_historyauto'
7567 goto 999
7568 end if
7569
7570 ! 時刻に関するエラー処理
7571 ! Error handling for time
7572 !
7573 if ( time < zero_time ) then
7574 cause_c = tochar( time )
7575 call messagenotify( 'W', subname, &
7576 & '"time=<%c>" must be positive value (varname=<%c>).', &
7577 & c1 = trim( cause_c ), c2 = trim( varname ) )
7578 stat = dc_enegative
7579 cause_c = 'time'
7580 goto 999
7581 end if
7582
7583 ! 変数 ID のサーチ
7584 ! Search variable ID
7585 !
7586 varsearch: do
7587 do i = svnum, numvars
7588 if ( trim( varname_vars(i) ) == trim(varname) ) then
7589 vnum = i
7590 exit varsearch
7591 end if
7592 end do
7593 do i = 1, svnum - 1
7594 if ( trim( varname_vars(i) ) == trim(varname) ) then
7595 vnum = i
7596 exit varsearch
7597 end if
7598 end do
7599
7600 stat = hst_ebadvarname
7601 cause_c = varname
7602 goto 999
7603 end do varsearch
7604
7605 svnum = vnum
7606
7607 ! 定義モードからデータモードへ
7608 ! Transit from define mode to data mode
7609 !
7610 if ( hstnmlinfodefinemode( gthstnml ) ) then
7611 call hstnmlinfoenddefine( gthstnml ) ! (inout)
7612 end if
7613
7614 ! 出力タイミングのチェックとファイルの作成
7615 ! Check output timing and create files
7616 !
7617 call hstvarsoutputcheck( &
7618 & time = time, & ! (in)
7619 & stime_index = svtstep ) ! (out)
7620
7621 ! ファイルのオープン・クローズ・再オープン
7622 ! Open, close, reopen files
7623 !
7624 if ( create_timing_vars(vnum, svtstep) &
7625 & .and. .not. histaddvar_vars(vnum) ) then
7626 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
7627 & varname_vars(vnum), time ) ! (in)
7628 histaddvar_vars(vnum) = .true.
7629 if ( flag_output_prev_vars(vnum) ) then
7630 prev_outtime_vars(vnum) = time
7631 else
7632 flag_output_prev_vars(vnum) = .true.
7633 if ( origin_time_vars(vnum) > zero_time ) then
7635 else
7636 prev_outtime_vars(vnum) = time
7637 end if
7638 end if
7639 end if
7640
7641 if ( close_timing_vars(vnum, svtstep) ) then
7642 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
7643 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
7644 end if
7645 end if
7646
7647 if ( renew_timing_vars(vnum, svtstep) ) then
7648 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
7649 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
7650 end if
7651 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
7652 & varname_vars(vnum), time ) ! (in)
7653 newfile_createtime_vars(vnum) = time
7654 prev_outtime_vars(vnum) = time
7655 end if
7656
7657 ! 出力が有効かどうかを確認する
7658 ! Confirm whether the output is effective
7659 !
7660 if ( .not. output_timing_vars(vnum, svtstep) &
7661 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
7662
7663 goto 999
7664 end if
7665
7666 ! GT_HISTORY 変数の取得
7667 ! Get "GT_HISTORY" variable
7668 !
7669 gthist => gthst_history_vars(vnum) % gthist
7670
7671
7672 ! 空間切り出し
7673 ! Slice of spaces
7674 !
7675 sv => slice_vars(vnum)
7676
7677 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
7678
7679!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
7680
7681!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
7682
7683!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
7684
7685
7686 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
7687 & , sv%st(2):sv%ed(2):sv%sd(2) &
7688
7689 & , sv%st(3):sv%ed(3):sv%sd(3) &
7690
7691 & , sv%st(4):sv%ed(4):sv%sd(4) &
7692
7693 & )
7694
7695
7696
7697 ! 空間平均
7698 ! Spatial average
7699 !
7700 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
7701 array_avr => array_slice
7702 else
7703 call averagereduce( &
7704 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
7705 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
7706
7707 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
7708
7709 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
7710
7711 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
7712
7713 & array_avr ) ! (out)
7714 end if
7715
7716 ! 座標重みを取得 ; Get weights of axes
7717
7718
7719
7720 ! 単位に応じて時刻を変換
7721 ! Convert time according to units
7722 !
7723 if ( output_timing_vars(vnum, svtstep) &
7724 & .or. output_timing_avr_vars(vnum, svtstep) ) then
7725
7726 settime = &
7727 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
7728 end if
7729
7730 ! 時刻設定
7731 ! Set time
7732 !
7733 if ( output_timing_vars(vnum, svtstep) ) then
7734 call historysettime( &
7735 & history = gthist, & ! (in) optional
7736 & timed = settime ) ! (in) optional
7737 end if
7738
7739 ! 出力
7740 ! OutPut
7741 !
7742 if ( output_timing_avr_vars(vnum, svtstep) ) then
7743 call historyput( &
7744 & varname, & ! (in)
7745 & array_avr, & ! (in)
7746
7747 & timed = settime, & ! (in) optional
7748 & time_average_store = &
7749 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
7750 & history = gthist ) ! (inout) optional
7751 else
7752 call historyput( &
7753 & varname, & ! (in)
7754 & array_avr, & ! (in)
7755
7756 & history = gthist ) ! (inout) optional
7757 end if
7758
7759 ! 最後に出力した時刻を保存
7760 ! Save last time of output
7761 !
7762 if ( output_timing_vars(vnum, svtstep) ) then
7763 if ( .not. create_timing_vars(vnum, svtstep) .and. &
7764 & .not. renew_timing_vars(vnum, svtstep) ) then
7765
7766 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
7767 & time_eps * max(1.0_dp, abs(time), &
7768 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
7769 prev_outtime_vars(vnum) = time
7770 else
7771 prev_outtime_vars(vnum) = &
7773 end if
7774 end if
7775 end if
7776
7777 ! 結合解除
7778 ! Release associations
7779 !
7780 nullify( gthist )
7781 nullify( array_avr, array_slice )
7782
7783
7784999 continue
7785 call storeerror(stat, subname, cause_c = cause_c, err = err)
7786 call endsub(subname)
7787 end subroutine historyautoputint4
7788
7789
7869 & time, varname, array, & ! (in)
7870 & err & ! (out) optional
7871 & )
7872 !
7873
7874 !
7875
7890 use gtool_history, only: gt_history, historyput, historyinitialized, &
7891 & historyaddvariable, historyinquire, historyvarinfoinquire, &
7893 use dc_string, only: tochar
7894 use dc_message, only: messagenotify
7895 use dc_trace, only: beginsub, endsub
7896 use dc_error, only: storeerror, dc_noerr, &
7898 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
7899 use dc_date_generic, only: operator(-), operator(+), &
7900 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
7903 use dc_types, only: dp, string
7904 implicit none
7905 real(DP), intent(in):: time
7906 real(DP), parameter:: time_eps = epsilon(1.0_dp)
7907
7908 character(*), intent(in):: varname
7909
7910 integer, intent(in), target:: array(:,:,:,:,:)
7911
7912 logical, intent(out), optional:: err
7913
7914
7915 type(gt_history), pointer:: gthist =>null()
7916 ! gtool_history モジュール用構造体.
7917 ! Derived type for "gtool_history" module
7918
7919 integer, pointer:: array_slice(:,:,:,:,:) =>null()
7920 type(slice_info), pointer:: sv =>null()
7921 integer, pointer:: array_avr(:,:,:,:,:) =>null()
7922
7923 real(DP):: settime
7924 integer:: stat, i
7925 integer:: vnum
7926 character(STRING):: cause_c
7927 integer, save:: svnum = 1, svtstep
7928 character(*), parameter:: subname = "HistoryAutoPutInt5"
7929 continue
7930 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
7931 stat = dc_noerr
7932 cause_c = ""
7933
7934 ! 初期設定チェック
7935 ! Check initialization
7936 !
7937 if ( .not. initialized ) then
7938 stat = dc_enotinit
7939 cause_c = 'gtool_historyauto'
7940 goto 999
7941 end if
7942
7943 ! 時刻に関するエラー処理
7944 ! Error handling for time
7945 !
7946 if ( time < zero_time ) then
7947 cause_c = tochar( time )
7948 call messagenotify( 'W', subname, &
7949 & '"time=<%c>" must be positive value (varname=<%c>).', &
7950 & c1 = trim( cause_c ), c2 = trim( varname ) )
7951 stat = dc_enegative
7952 cause_c = 'time'
7953 goto 999
7954 end if
7955
7956 ! 変数 ID のサーチ
7957 ! Search variable ID
7958 !
7959 varsearch: do
7960 do i = svnum, numvars
7961 if ( trim( varname_vars(i) ) == trim(varname) ) then
7962 vnum = i
7963 exit varsearch
7964 end if
7965 end do
7966 do i = 1, svnum - 1
7967 if ( trim( varname_vars(i) ) == trim(varname) ) then
7968 vnum = i
7969 exit varsearch
7970 end if
7971 end do
7972
7973 stat = hst_ebadvarname
7974 cause_c = varname
7975 goto 999
7976 end do varsearch
7977
7978 svnum = vnum
7979
7980 ! 定義モードからデータモードへ
7981 ! Transit from define mode to data mode
7982 !
7983 if ( hstnmlinfodefinemode( gthstnml ) ) then
7984 call hstnmlinfoenddefine( gthstnml ) ! (inout)
7985 end if
7986
7987 ! 出力タイミングのチェックとファイルの作成
7988 ! Check output timing and create files
7989 !
7990 call hstvarsoutputcheck( &
7991 & time = time, & ! (in)
7992 & stime_index = svtstep ) ! (out)
7993
7994 ! ファイルのオープン・クローズ・再オープン
7995 ! Open, close, reopen files
7996 !
7997 if ( create_timing_vars(vnum, svtstep) &
7998 & .and. .not. histaddvar_vars(vnum) ) then
7999 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
8000 & varname_vars(vnum), time ) ! (in)
8001 histaddvar_vars(vnum) = .true.
8002 if ( flag_output_prev_vars(vnum) ) then
8003 prev_outtime_vars(vnum) = time
8004 else
8005 flag_output_prev_vars(vnum) = .true.
8006 if ( origin_time_vars(vnum) > zero_time ) then
8008 else
8009 prev_outtime_vars(vnum) = time
8010 end if
8011 end if
8012 end if
8013
8014 if ( close_timing_vars(vnum, svtstep) ) then
8015 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
8016 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
8017 end if
8018 end if
8019
8020 if ( renew_timing_vars(vnum, svtstep) ) then
8021 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
8022 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
8023 end if
8024 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
8025 & varname_vars(vnum), time ) ! (in)
8026 newfile_createtime_vars(vnum) = time
8027 prev_outtime_vars(vnum) = time
8028 end if
8029
8030 ! 出力が有効かどうかを確認する
8031 ! Confirm whether the output is effective
8032 !
8033 if ( .not. output_timing_vars(vnum, svtstep) &
8034 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
8035
8036 goto 999
8037 end if
8038
8039 ! GT_HISTORY 変数の取得
8040 ! Get "GT_HISTORY" variable
8041 !
8042 gthist => gthst_history_vars(vnum) % gthist
8043
8044
8045 ! 空間切り出し
8046 ! Slice of spaces
8047 !
8048 sv => slice_vars(vnum)
8049
8050 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
8051
8052!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
8053
8054!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
8055
8056!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
8057
8058!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
8059
8060
8061 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
8062 & , sv%st(2):sv%ed(2):sv%sd(2) &
8063
8064 & , sv%st(3):sv%ed(3):sv%sd(3) &
8065
8066 & , sv%st(4):sv%ed(4):sv%sd(4) &
8067
8068 & , sv%st(5):sv%ed(5):sv%sd(5) &
8069
8070 & )
8071
8072
8073
8074 ! 空間平均
8075 ! Spatial average
8076 !
8077 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
8078 array_avr => array_slice
8079 else
8080 call averagereduce( &
8081 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
8082 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
8083
8084 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
8085
8086 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
8087
8088 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
8089
8090 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
8091
8092 & array_avr ) ! (out)
8093 end if
8094
8095 ! 座標重みを取得 ; Get weights of axes
8096
8097
8098
8099 ! 単位に応じて時刻を変換
8100 ! Convert time according to units
8101 !
8102 if ( output_timing_vars(vnum, svtstep) &
8103 & .or. output_timing_avr_vars(vnum, svtstep) ) then
8104
8105 settime = &
8106 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
8107 end if
8108
8109 ! 時刻設定
8110 ! Set time
8111 !
8112 if ( output_timing_vars(vnum, svtstep) ) then
8113 call historysettime( &
8114 & history = gthist, & ! (in) optional
8115 & timed = settime ) ! (in) optional
8116 end if
8117
8118 ! 出力
8119 ! OutPut
8120 !
8121 if ( output_timing_avr_vars(vnum, svtstep) ) then
8122 call historyput( &
8123 & varname, & ! (in)
8124 & array_avr, & ! (in)
8125
8126 & timed = settime, & ! (in) optional
8127 & time_average_store = &
8128 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
8129 & history = gthist ) ! (inout) optional
8130 else
8131 call historyput( &
8132 & varname, & ! (in)
8133 & array_avr, & ! (in)
8134
8135 & history = gthist ) ! (inout) optional
8136 end if
8137
8138 ! 最後に出力した時刻を保存
8139 ! Save last time of output
8140 !
8141 if ( output_timing_vars(vnum, svtstep) ) then
8142 if ( .not. create_timing_vars(vnum, svtstep) .and. &
8143 & .not. renew_timing_vars(vnum, svtstep) ) then
8144
8145 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
8146 & time_eps * max(1.0_dp, abs(time), &
8147 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
8148 prev_outtime_vars(vnum) = time
8149 else
8150 prev_outtime_vars(vnum) = &
8152 end if
8153 end if
8154 end if
8155
8156 ! 結合解除
8157 ! Release associations
8158 !
8159 nullify( gthist )
8160 nullify( array_avr, array_slice )
8161
8162
8163999 continue
8164 call storeerror(stat, subname, cause_c = cause_c, err = err)
8165 call endsub(subname)
8166 end subroutine historyautoputint5
8167
8168
8248 & time, varname, array, & ! (in)
8249 & err & ! (out) optional
8250 & )
8251 !
8252
8253 !
8254
8269 use gtool_history, only: gt_history, historyput, historyinitialized, &
8270 & historyaddvariable, historyinquire, historyvarinfoinquire, &
8272 use dc_string, only: tochar
8273 use dc_message, only: messagenotify
8274 use dc_trace, only: beginsub, endsub
8275 use dc_error, only: storeerror, dc_noerr, &
8277 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
8278 use dc_date_generic, only: operator(-), operator(+), &
8279 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
8282 use dc_types, only: dp, string
8283 implicit none
8284 real(DP), intent(in):: time
8285 real(DP), parameter:: time_eps = epsilon(1.0_dp)
8286
8287 character(*), intent(in):: varname
8288
8289 integer, intent(in), target:: array(:,:,:,:,:,:)
8290
8291 logical, intent(out), optional:: err
8292
8293
8294 type(gt_history), pointer:: gthist =>null()
8295 ! gtool_history モジュール用構造体.
8296 ! Derived type for "gtool_history" module
8297
8298 integer, pointer:: array_slice(:,:,:,:,:,:) =>null()
8299 type(slice_info), pointer:: sv =>null()
8300 integer, pointer:: array_avr(:,:,:,:,:,:) =>null()
8301
8302 real(DP):: settime
8303 integer:: stat, i
8304 integer:: vnum
8305 character(STRING):: cause_c
8306 integer, save:: svnum = 1, svtstep
8307 character(*), parameter:: subname = "HistoryAutoPutInt6"
8308 continue
8309 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
8310 stat = dc_noerr
8311 cause_c = ""
8312
8313 ! 初期設定チェック
8314 ! Check initialization
8315 !
8316 if ( .not. initialized ) then
8317 stat = dc_enotinit
8318 cause_c = 'gtool_historyauto'
8319 goto 999
8320 end if
8321
8322 ! 時刻に関するエラー処理
8323 ! Error handling for time
8324 !
8325 if ( time < zero_time ) then
8326 cause_c = tochar( time )
8327 call messagenotify( 'W', subname, &
8328 & '"time=<%c>" must be positive value (varname=<%c>).', &
8329 & c1 = trim( cause_c ), c2 = trim( varname ) )
8330 stat = dc_enegative
8331 cause_c = 'time'
8332 goto 999
8333 end if
8334
8335 ! 変数 ID のサーチ
8336 ! Search variable ID
8337 !
8338 varsearch: do
8339 do i = svnum, numvars
8340 if ( trim( varname_vars(i) ) == trim(varname) ) then
8341 vnum = i
8342 exit varsearch
8343 end if
8344 end do
8345 do i = 1, svnum - 1
8346 if ( trim( varname_vars(i) ) == trim(varname) ) then
8347 vnum = i
8348 exit varsearch
8349 end if
8350 end do
8351
8352 stat = hst_ebadvarname
8353 cause_c = varname
8354 goto 999
8355 end do varsearch
8356
8357 svnum = vnum
8358
8359 ! 定義モードからデータモードへ
8360 ! Transit from define mode to data mode
8361 !
8362 if ( hstnmlinfodefinemode( gthstnml ) ) then
8363 call hstnmlinfoenddefine( gthstnml ) ! (inout)
8364 end if
8365
8366 ! 出力タイミングのチェックとファイルの作成
8367 ! Check output timing and create files
8368 !
8369 call hstvarsoutputcheck( &
8370 & time = time, & ! (in)
8371 & stime_index = svtstep ) ! (out)
8372
8373 ! ファイルのオープン・クローズ・再オープン
8374 ! Open, close, reopen files
8375 !
8376 if ( create_timing_vars(vnum, svtstep) &
8377 & .and. .not. histaddvar_vars(vnum) ) then
8378 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
8379 & varname_vars(vnum), time ) ! (in)
8380 histaddvar_vars(vnum) = .true.
8381 if ( flag_output_prev_vars(vnum) ) then
8382 prev_outtime_vars(vnum) = time
8383 else
8384 flag_output_prev_vars(vnum) = .true.
8385 if ( origin_time_vars(vnum) > zero_time ) then
8387 else
8388 prev_outtime_vars(vnum) = time
8389 end if
8390 end if
8391 end if
8392
8393 if ( close_timing_vars(vnum, svtstep) ) then
8394 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
8395 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
8396 end if
8397 end if
8398
8399 if ( renew_timing_vars(vnum, svtstep) ) then
8400 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
8401 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
8402 end if
8403 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
8404 & varname_vars(vnum), time ) ! (in)
8405 newfile_createtime_vars(vnum) = time
8406 prev_outtime_vars(vnum) = time
8407 end if
8408
8409 ! 出力が有効かどうかを確認する
8410 ! Confirm whether the output is effective
8411 !
8412 if ( .not. output_timing_vars(vnum, svtstep) &
8413 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
8414
8415 goto 999
8416 end if
8417
8418 ! GT_HISTORY 変数の取得
8419 ! Get "GT_HISTORY" variable
8420 !
8421 gthist => gthst_history_vars(vnum) % gthist
8422
8423
8424 ! 空間切り出し
8425 ! Slice of spaces
8426 !
8427 sv => slice_vars(vnum)
8428
8429 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
8430
8431!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
8432
8433!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
8434
8435!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
8436
8437!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
8438
8439!!$ write(*,*) ' sv%st(6), sv%ed(6), sv%sd(6)=', sv%st(6), sv%ed(6), sv%sd(6)
8440
8441
8442 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
8443 & , sv%st(2):sv%ed(2):sv%sd(2) &
8444
8445 & , sv%st(3):sv%ed(3):sv%sd(3) &
8446
8447 & , sv%st(4):sv%ed(4):sv%sd(4) &
8448
8449 & , sv%st(5):sv%ed(5):sv%sd(5) &
8450
8451 & , sv%st(6):sv%ed(6):sv%sd(6) &
8452
8453 & )
8454
8455
8456
8457 ! 空間平均
8458 ! Spatial average
8459 !
8460 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
8461 array_avr => array_slice
8462 else
8463 call averagereduce( &
8464 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
8465 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
8466
8467 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
8468
8469 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
8470
8471 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
8472
8473 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
8474
8475 & weight_vars(vnum) % wgt6( sv%st(6):sv%ed(6):sv%sd(6) ) , & ! (in)
8476
8477 & array_avr ) ! (out)
8478 end if
8479
8480 ! 座標重みを取得 ; Get weights of axes
8481
8482
8483
8484 ! 単位に応じて時刻を変換
8485 ! Convert time according to units
8486 !
8487 if ( output_timing_vars(vnum, svtstep) &
8488 & .or. output_timing_avr_vars(vnum, svtstep) ) then
8489
8490 settime = &
8491 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
8492 end if
8493
8494 ! 時刻設定
8495 ! Set time
8496 !
8497 if ( output_timing_vars(vnum, svtstep) ) then
8498 call historysettime( &
8499 & history = gthist, & ! (in) optional
8500 & timed = settime ) ! (in) optional
8501 end if
8502
8503 ! 出力
8504 ! OutPut
8505 !
8506 if ( output_timing_avr_vars(vnum, svtstep) ) then
8507 call historyput( &
8508 & varname, & ! (in)
8509 & array_avr, & ! (in)
8510
8511 & timed = settime, & ! (in) optional
8512 & time_average_store = &
8513 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
8514 & history = gthist ) ! (inout) optional
8515 else
8516 call historyput( &
8517 & varname, & ! (in)
8518 & array_avr, & ! (in)
8519
8520 & history = gthist ) ! (inout) optional
8521 end if
8522
8523 ! 最後に出力した時刻を保存
8524 ! Save last time of output
8525 !
8526 if ( output_timing_vars(vnum, svtstep) ) then
8527 if ( .not. create_timing_vars(vnum, svtstep) .and. &
8528 & .not. renew_timing_vars(vnum, svtstep) ) then
8529
8530 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
8531 & time_eps * max(1.0_dp, abs(time), &
8532 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
8533 prev_outtime_vars(vnum) = time
8534 else
8535 prev_outtime_vars(vnum) = &
8537 end if
8538 end if
8539 end if
8540
8541 ! 結合解除
8542 ! Release associations
8543 !
8544 nullify( gthist )
8545 nullify( array_avr, array_slice )
8546
8547
8548999 continue
8549 call storeerror(stat, subname, cause_c = cause_c, err = err)
8550 call endsub(subname)
8551 end subroutine historyautoputint6
8552
8553
8633 & time, varname, array, & ! (in)
8634 & err & ! (out) optional
8635 & )
8636 !
8637
8638 !
8639
8654 use gtool_history, only: gt_history, historyput, historyinitialized, &
8655 & historyaddvariable, historyinquire, historyvarinfoinquire, &
8657 use dc_string, only: tochar
8658 use dc_message, only: messagenotify
8659 use dc_trace, only: beginsub, endsub
8660 use dc_error, only: storeerror, dc_noerr, &
8662 use dc_calendar, only: unit_symbol_sec, dccalconvertbyunit
8663 use dc_date_generic, only: operator(-), operator(+), &
8664 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
8667 use dc_types, only: dp, string
8668 implicit none
8669 real(DP), intent(in):: time
8670 real(DP), parameter:: time_eps = epsilon(1.0_dp)
8671
8672 character(*), intent(in):: varname
8673
8674 integer, intent(in), target:: array(:,:,:,:,:,:,:)
8675
8676 logical, intent(out), optional:: err
8677
8678
8679 type(gt_history), pointer:: gthist =>null()
8680 ! gtool_history モジュール用構造体.
8681 ! Derived type for "gtool_history" module
8682
8683 integer, pointer:: array_slice(:,:,:,:,:,:,:) =>null()
8684 type(slice_info), pointer:: sv =>null()
8685 integer, pointer:: array_avr(:,:,:,:,:,:,:) =>null()
8686
8687 real(DP):: settime
8688 integer:: stat, i
8689 integer:: vnum
8690 character(STRING):: cause_c
8691 integer, save:: svnum = 1, svtstep
8692 character(*), parameter:: subname = "HistoryAutoPutInt7"
8693 continue
8694 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
8695 stat = dc_noerr
8696 cause_c = ""
8697
8698 ! 初期設定チェック
8699 ! Check initialization
8700 !
8701 if ( .not. initialized ) then
8702 stat = dc_enotinit
8703 cause_c = 'gtool_historyauto'
8704 goto 999
8705 end if
8706
8707 ! 時刻に関するエラー処理
8708 ! Error handling for time
8709 !
8710 if ( time < zero_time ) then
8711 cause_c = tochar( time )
8712 call messagenotify( 'W', subname, &
8713 & '"time=<%c>" must be positive value (varname=<%c>).', &
8714 & c1 = trim( cause_c ), c2 = trim( varname ) )
8715 stat = dc_enegative
8716 cause_c = 'time'
8717 goto 999
8718 end if
8719
8720 ! 変数 ID のサーチ
8721 ! Search variable ID
8722 !
8723 varsearch: do
8724 do i = svnum, numvars
8725 if ( trim( varname_vars(i) ) == trim(varname) ) then
8726 vnum = i
8727 exit varsearch
8728 end if
8729 end do
8730 do i = 1, svnum - 1
8731 if ( trim( varname_vars(i) ) == trim(varname) ) then
8732 vnum = i
8733 exit varsearch
8734 end if
8735 end do
8736
8737 stat = hst_ebadvarname
8738 cause_c = varname
8739 goto 999
8740 end do varsearch
8741
8742 svnum = vnum
8743
8744 ! 定義モードからデータモードへ
8745 ! Transit from define mode to data mode
8746 !
8747 if ( hstnmlinfodefinemode( gthstnml ) ) then
8748 call hstnmlinfoenddefine( gthstnml ) ! (inout)
8749 end if
8750
8751 ! 出力タイミングのチェックとファイルの作成
8752 ! Check output timing and create files
8753 !
8754 call hstvarsoutputcheck( &
8755 & time = time, & ! (in)
8756 & stime_index = svtstep ) ! (out)
8757
8758 ! ファイルのオープン・クローズ・再オープン
8759 ! Open, close, reopen files
8760 !
8761 if ( create_timing_vars(vnum, svtstep) &
8762 & .and. .not. histaddvar_vars(vnum) ) then
8763 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
8764 & varname_vars(vnum), time ) ! (in)
8765 histaddvar_vars(vnum) = .true.
8766 if ( flag_output_prev_vars(vnum) ) then
8767 prev_outtime_vars(vnum) = time
8768 else
8769 flag_output_prev_vars(vnum) = .true.
8770 if ( origin_time_vars(vnum) > zero_time ) then
8772 else
8773 prev_outtime_vars(vnum) = time
8774 end if
8775 end if
8776 end if
8777
8778 if ( close_timing_vars(vnum, svtstep) ) then
8779 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
8780 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
8781 end if
8782 end if
8783
8784 if ( renew_timing_vars(vnum, svtstep) ) then
8785 if ( historyinitialized( gthst_history_vars(vnum) % gthist ) ) then
8786 call historyclose( gthst_history_vars(vnum) % gthist ) ! (inout)
8787 end if
8788 call hstfilecreate( gthst_history_vars(vnum) % gthist, & ! (inout)
8789 & varname_vars(vnum), time ) ! (in)
8790 newfile_createtime_vars(vnum) = time
8791 prev_outtime_vars(vnum) = time
8792 end if
8793
8794 ! 出力が有効かどうかを確認する
8795 ! Confirm whether the output is effective
8796 !
8797 if ( .not. output_timing_vars(vnum, svtstep) &
8798 & .and. .not. output_timing_avr_vars(vnum, svtstep) ) then
8799
8800 goto 999
8801 end if
8802
8803 ! GT_HISTORY 変数の取得
8804 ! Get "GT_HISTORY" variable
8805 !
8806 gthist => gthst_history_vars(vnum) % gthist
8807
8808
8809 ! 空間切り出し
8810 ! Slice of spaces
8811 !
8812 sv => slice_vars(vnum)
8813
8814 !!$ write(*,*) ' sv%st(1), sv%ed(1), sv%sd(1)=', sv%st(1), sv%ed(1), sv%sd(1)
8815
8816!!$ write(*,*) ' sv%st(2), sv%ed(2), sv%sd(2)=', sv%st(2), sv%ed(2), sv%sd(2)
8817
8818!!$ write(*,*) ' sv%st(3), sv%ed(3), sv%sd(3)=', sv%st(3), sv%ed(3), sv%sd(3)
8819
8820!!$ write(*,*) ' sv%st(4), sv%ed(4), sv%sd(4)=', sv%st(4), sv%ed(4), sv%sd(4)
8821
8822!!$ write(*,*) ' sv%st(5), sv%ed(5), sv%sd(5)=', sv%st(5), sv%ed(5), sv%sd(5)
8823
8824!!$ write(*,*) ' sv%st(6), sv%ed(6), sv%sd(6)=', sv%st(6), sv%ed(6), sv%sd(6)
8825
8826!!$ write(*,*) ' sv%st(7), sv%ed(7), sv%sd(7)=', sv%st(7), sv%ed(7), sv%sd(7)
8827
8828
8829 array_slice => array(sv%st(1):sv%ed(1):sv%sd(1) &
8830 & , sv%st(2):sv%ed(2):sv%sd(2) &
8831
8832 & , sv%st(3):sv%ed(3):sv%sd(3) &
8833
8834 & , sv%st(4):sv%ed(4):sv%sd(4) &
8835
8836 & , sv%st(5):sv%ed(5):sv%sd(5) &
8837
8838 & , sv%st(6):sv%ed(6):sv%sd(6) &
8839
8840 & , sv%st(7):sv%ed(7):sv%sd(7) &
8841
8842 & )
8843
8844
8845
8846 ! 空間平均
8847 ! Spatial average
8848 !
8849 if ( count(space_avr_vars(vnum) % avr) == 0 ) then
8850 array_avr => array_slice
8851 else
8852 call averagereduce( &
8853 & array_slice, space_avr_vars(vnum) % avr, & ! (in)
8854 & weight_vars(vnum) % wgt1( sv%st(1):sv%ed(1):sv%sd(1) ) , & ! (in)
8855
8856 & weight_vars(vnum) % wgt2( sv%st(2):sv%ed(2):sv%sd(2) ) , & ! (in)
8857
8858 & weight_vars(vnum) % wgt3( sv%st(3):sv%ed(3):sv%sd(3) ) , & ! (in)
8859
8860 & weight_vars(vnum) % wgt4( sv%st(4):sv%ed(4):sv%sd(4) ) , & ! (in)
8861
8862 & weight_vars(vnum) % wgt5( sv%st(5):sv%ed(5):sv%sd(5) ) , & ! (in)
8863
8864 & weight_vars(vnum) % wgt6( sv%st(6):sv%ed(6):sv%sd(6) ) , & ! (in)
8865
8866 & weight_vars(vnum) % wgt7( sv%st(7):sv%ed(7):sv%sd(7) ) , & ! (in)
8867
8868 & array_avr ) ! (out)
8869 end if
8870
8871 ! 座標重みを取得 ; Get weights of axes
8872
8873
8874
8875 ! 単位に応じて時刻を変換
8876 ! Convert time according to units
8877 !
8878 if ( output_timing_vars(vnum, svtstep) &
8879 & .or. output_timing_avr_vars(vnum, svtstep) ) then
8880
8881 settime = &
8882 & dccalconvertbyunit( time, unit_symbol_sec, interval_unitsym_vars(vnum), cal_save )
8883 end if
8884
8885 ! 時刻設定
8886 ! Set time
8887 !
8888 if ( output_timing_vars(vnum, svtstep) ) then
8889 call historysettime( &
8890 & history = gthist, & ! (in) optional
8891 & timed = settime ) ! (in) optional
8892 end if
8893
8894 ! 出力
8895 ! OutPut
8896 !
8897 if ( output_timing_avr_vars(vnum, svtstep) ) then
8898 call historyput( &
8899 & varname, & ! (in)
8900 & array_avr, & ! (in)
8901
8902 & timed = settime, & ! (in) optional
8903 & time_average_store = &
8904 & .not. output_timing_vars(vnum, svtstep), & ! (in) optional
8905 & history = gthist ) ! (inout) optional
8906 else
8907 call historyput( &
8908 & varname, & ! (in)
8909 & array_avr, & ! (in)
8910
8911 & history = gthist ) ! (inout) optional
8912 end if
8913
8914 ! 最後に出力した時刻を保存
8915 ! Save last time of output
8916 !
8917 if ( output_timing_vars(vnum, svtstep) ) then
8918 if ( .not. create_timing_vars(vnum, svtstep) .and. &
8919 & .not. renew_timing_vars(vnum, svtstep) ) then
8920
8921 if ( abs(mod(time, interval_time_vars(vnum)) - zero_time) <= &
8922 & time_eps * max(1.0_dp, abs(time), &
8923 & abs(interval_time_vars(vnum)), abs(zero_time)) ) then
8924 prev_outtime_vars(vnum) = time
8925 else
8926 prev_outtime_vars(vnum) = &
8928 end if
8929 end if
8930 end if
8931
8932 ! 結合解除
8933 ! Release associations
8934 !
8935 nullify( gthist )
8936 nullify( array_avr, array_slice )
8937
8938
8939999 continue
8940 call storeerror(stat, subname, cause_c = cause_c, err = err)
8941 call endsub(subname)
8942 end subroutine historyautoputint7
8943
8944
8969 & time, varname, value, & ! (in)
8970 & err & ! (out) optional
8971 & )
8973 use dc_date_generic, only: operator(-), operator(+), &
8974 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
8975 & dcdifftimeputline, assignment(=)
8976 use dc_types, only: dp
8978 implicit none
8979 type(dc_difftime), intent(in):: time
8980 character(*), intent(in):: varname
8981 real(DP), intent(in), target:: value
8982 logical, intent(out), optional:: err
8983
8984 real(DP):: timed
8985
8986 continue
8987 timed = evalsec( time )
8988
8989 call historyautoput( &
8990 & timed, varname, value, & ! (in)
8991 & err ) ! (out) optional
8992
8993 end subroutine historyautoputold1double0
8994
8995
9020 & time, varname, array, & ! (in)
9021 & err & ! (out) optional
9022 & )
9024 use dc_date_generic, only: operator(-), operator(+), &
9025 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9026 & dcdifftimeputline, assignment(=)
9027 use dc_types, only: dp
9029 implicit none
9030 type(dc_difftime), intent(in):: time
9031 character(*), intent(in):: varname
9032 real(DP), intent(in), target:: array(:)
9033 logical, intent(out), optional:: err
9034
9035 real(DP):: timed
9036
9037 continue
9038 timed = evalsec( time )
9039
9040 call historyautoput( &
9041 & timed, varname, array, & ! (in)
9042 & err ) ! (out) optional
9043
9044 end subroutine historyautoputold1double1
9045
9046
9071 & time, varname, array, & ! (in)
9072 & err & ! (out) optional
9073 & )
9075 use dc_date_generic, only: operator(-), operator(+), &
9076 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9077 & dcdifftimeputline, assignment(=)
9078 use dc_types, only: dp
9080 implicit none
9081 type(dc_difftime), intent(in):: time
9082 character(*), intent(in):: varname
9083 real(DP), intent(in), target:: array(:,:)
9084 logical, intent(out), optional:: err
9085
9086 real(DP):: timed
9087
9088 continue
9089 timed = evalsec( time )
9090
9091 call historyautoput( &
9092 & timed, varname, array, & ! (in)
9093 & err ) ! (out) optional
9094
9095 end subroutine historyautoputold1double2
9096
9097
9122 & time, varname, array, & ! (in)
9123 & err & ! (out) optional
9124 & )
9126 use dc_date_generic, only: operator(-), operator(+), &
9127 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9128 & dcdifftimeputline, assignment(=)
9129 use dc_types, only: dp
9131 implicit none
9132 type(dc_difftime), intent(in):: time
9133 character(*), intent(in):: varname
9134 real(DP), intent(in), target:: array(:,:,:)
9135 logical, intent(out), optional:: err
9136
9137 real(DP):: timed
9138
9139 continue
9140 timed = evalsec( time )
9141
9142 call historyautoput( &
9143 & timed, varname, array, & ! (in)
9144 & err ) ! (out) optional
9145
9146 end subroutine historyautoputold1double3
9147
9148
9173 & time, varname, array, & ! (in)
9174 & err & ! (out) optional
9175 & )
9177 use dc_date_generic, only: operator(-), operator(+), &
9178 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9179 & dcdifftimeputline, assignment(=)
9180 use dc_types, only: dp
9182 implicit none
9183 type(dc_difftime), intent(in):: time
9184 character(*), intent(in):: varname
9185 real(DP), intent(in), target:: array(:,:,:,:)
9186 logical, intent(out), optional:: err
9187
9188 real(DP):: timed
9189
9190 continue
9191 timed = evalsec( time )
9192
9193 call historyautoput( &
9194 & timed, varname, array, & ! (in)
9195 & err ) ! (out) optional
9196
9197 end subroutine historyautoputold1double4
9198
9199
9224 & time, varname, array, & ! (in)
9225 & err & ! (out) optional
9226 & )
9228 use dc_date_generic, only: operator(-), operator(+), &
9229 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9230 & dcdifftimeputline, assignment(=)
9231 use dc_types, only: dp
9233 implicit none
9234 type(dc_difftime), intent(in):: time
9235 character(*), intent(in):: varname
9236 real(DP), intent(in), target:: array(:,:,:,:,:)
9237 logical, intent(out), optional:: err
9238
9239 real(DP):: timed
9240
9241 continue
9242 timed = evalsec( time )
9243
9244 call historyautoput( &
9245 & timed, varname, array, & ! (in)
9246 & err ) ! (out) optional
9247
9248 end subroutine historyautoputold1double5
9249
9250
9275 & time, varname, array, & ! (in)
9276 & err & ! (out) optional
9277 & )
9279 use dc_date_generic, only: operator(-), operator(+), &
9280 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9281 & dcdifftimeputline, assignment(=)
9282 use dc_types, only: dp
9284 implicit none
9285 type(dc_difftime), intent(in):: time
9286 character(*), intent(in):: varname
9287 real(DP), intent(in), target:: array(:,:,:,:,:,:)
9288 logical, intent(out), optional:: err
9289
9290 real(DP):: timed
9291
9292 continue
9293 timed = evalsec( time )
9294
9295 call historyautoput( &
9296 & timed, varname, array, & ! (in)
9297 & err ) ! (out) optional
9298
9299 end subroutine historyautoputold1double6
9300
9301
9326 & time, varname, array, & ! (in)
9327 & err & ! (out) optional
9328 & )
9330 use dc_date_generic, only: operator(-), operator(+), &
9331 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9332 & dcdifftimeputline, assignment(=)
9333 use dc_types, only: dp
9335 implicit none
9336 type(dc_difftime), intent(in):: time
9337 character(*), intent(in):: varname
9338 real(DP), intent(in), target:: array(:,:,:,:,:,:,:)
9339 logical, intent(out), optional:: err
9340
9341 real(DP):: timed
9342
9343 continue
9344 timed = evalsec( time )
9345
9346 call historyautoput( &
9347 & timed, varname, array, & ! (in)
9348 & err ) ! (out) optional
9349
9350 end subroutine historyautoputold1double7
9351
9352
9377 & time, varname, value, & ! (in)
9378 & err & ! (out) optional
9379 & )
9381 use dc_date_generic, only: operator(-), operator(+), &
9382 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9383 & dcdifftimeputline, assignment(=)
9384 use dc_types, only: dp
9386 implicit none
9387 type(dc_difftime), intent(in):: time
9388 character(*), intent(in):: varname
9389 real, intent(in), target:: value
9390 logical, intent(out), optional:: err
9391
9392 real(DP):: timed
9393
9394 continue
9395 timed = evalsec( time )
9396
9397 call historyautoput( &
9398 & timed, varname, value, & ! (in)
9399 & err ) ! (out) optional
9400
9401 end subroutine historyautoputold1real0
9402
9403
9428 & time, varname, array, & ! (in)
9429 & err & ! (out) optional
9430 & )
9432 use dc_date_generic, only: operator(-), operator(+), &
9433 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9434 & dcdifftimeputline, assignment(=)
9435 use dc_types, only: dp
9437 implicit none
9438 type(dc_difftime), intent(in):: time
9439 character(*), intent(in):: varname
9440 real, intent(in), target:: array(:)
9441 logical, intent(out), optional:: err
9442
9443 real(DP):: timed
9444
9445 continue
9446 timed = evalsec( time )
9447
9448 call historyautoput( &
9449 & timed, varname, array, & ! (in)
9450 & err ) ! (out) optional
9451
9452 end subroutine historyautoputold1real1
9453
9454
9479 & time, varname, array, & ! (in)
9480 & err & ! (out) optional
9481 & )
9483 use dc_date_generic, only: operator(-), operator(+), &
9484 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9485 & dcdifftimeputline, assignment(=)
9486 use dc_types, only: dp
9488 implicit none
9489 type(dc_difftime), intent(in):: time
9490 character(*), intent(in):: varname
9491 real, intent(in), target:: array(:,:)
9492 logical, intent(out), optional:: err
9493
9494 real(DP):: timed
9495
9496 continue
9497 timed = evalsec( time )
9498
9499 call historyautoput( &
9500 & timed, varname, array, & ! (in)
9501 & err ) ! (out) optional
9502
9503 end subroutine historyautoputold1real2
9504
9505
9530 & time, varname, array, & ! (in)
9531 & err & ! (out) optional
9532 & )
9534 use dc_date_generic, only: operator(-), operator(+), &
9535 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9536 & dcdifftimeputline, assignment(=)
9537 use dc_types, only: dp
9539 implicit none
9540 type(dc_difftime), intent(in):: time
9541 character(*), intent(in):: varname
9542 real, intent(in), target:: array(:,:,:)
9543 logical, intent(out), optional:: err
9544
9545 real(DP):: timed
9546
9547 continue
9548 timed = evalsec( time )
9549
9550 call historyautoput( &
9551 & timed, varname, array, & ! (in)
9552 & err ) ! (out) optional
9553
9554 end subroutine historyautoputold1real3
9555
9556
9581 & time, varname, array, & ! (in)
9582 & err & ! (out) optional
9583 & )
9585 use dc_date_generic, only: operator(-), operator(+), &
9586 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9587 & dcdifftimeputline, assignment(=)
9588 use dc_types, only: dp
9590 implicit none
9591 type(dc_difftime), intent(in):: time
9592 character(*), intent(in):: varname
9593 real, intent(in), target:: array(:,:,:,:)
9594 logical, intent(out), optional:: err
9595
9596 real(DP):: timed
9597
9598 continue
9599 timed = evalsec( time )
9600
9601 call historyautoput( &
9602 & timed, varname, array, & ! (in)
9603 & err ) ! (out) optional
9604
9605 end subroutine historyautoputold1real4
9606
9607
9632 & time, varname, array, & ! (in)
9633 & err & ! (out) optional
9634 & )
9636 use dc_date_generic, only: operator(-), operator(+), &
9637 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9638 & dcdifftimeputline, assignment(=)
9639 use dc_types, only: dp
9641 implicit none
9642 type(dc_difftime), intent(in):: time
9643 character(*), intent(in):: varname
9644 real, intent(in), target:: array(:,:,:,:,:)
9645 logical, intent(out), optional:: err
9646
9647 real(DP):: timed
9648
9649 continue
9650 timed = evalsec( time )
9651
9652 call historyautoput( &
9653 & timed, varname, array, & ! (in)
9654 & err ) ! (out) optional
9655
9656 end subroutine historyautoputold1real5
9657
9658
9683 & time, varname, array, & ! (in)
9684 & err & ! (out) optional
9685 & )
9687 use dc_date_generic, only: operator(-), operator(+), &
9688 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9689 & dcdifftimeputline, assignment(=)
9690 use dc_types, only: dp
9692 implicit none
9693 type(dc_difftime), intent(in):: time
9694 character(*), intent(in):: varname
9695 real, intent(in), target:: array(:,:,:,:,:,:)
9696 logical, intent(out), optional:: err
9697
9698 real(DP):: timed
9699
9700 continue
9701 timed = evalsec( time )
9702
9703 call historyautoput( &
9704 & timed, varname, array, & ! (in)
9705 & err ) ! (out) optional
9706
9707 end subroutine historyautoputold1real6
9708
9709
9734 & time, varname, array, & ! (in)
9735 & err & ! (out) optional
9736 & )
9738 use dc_date_generic, only: operator(-), operator(+), &
9739 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9740 & dcdifftimeputline, assignment(=)
9741 use dc_types, only: dp
9743 implicit none
9744 type(dc_difftime), intent(in):: time
9745 character(*), intent(in):: varname
9746 real, intent(in), target:: array(:,:,:,:,:,:,:)
9747 logical, intent(out), optional:: err
9748
9749 real(DP):: timed
9750
9751 continue
9752 timed = evalsec( time )
9753
9754 call historyautoput( &
9755 & timed, varname, array, & ! (in)
9756 & err ) ! (out) optional
9757
9758 end subroutine historyautoputold1real7
9759
9760
9785 & time, varname, value, & ! (in)
9786 & err & ! (out) optional
9787 & )
9789 use dc_date_generic, only: operator(-), operator(+), &
9790 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9791 & dcdifftimeputline, assignment(=)
9792 use dc_types, only: dp
9794 implicit none
9795 type(dc_difftime), intent(in):: time
9796 character(*), intent(in):: varname
9797 integer, intent(in), target:: value
9798 logical, intent(out), optional:: err
9799
9800 real(DP):: timed
9801
9802 continue
9803 timed = evalsec( time )
9804
9805 call historyautoput( &
9806 & timed, varname, value, & ! (in)
9807 & err ) ! (out) optional
9808
9809 end subroutine historyautoputold1int0
9810
9811
9836 & time, varname, array, & ! (in)
9837 & err & ! (out) optional
9838 & )
9840 use dc_date_generic, only: operator(-), operator(+), &
9841 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9842 & dcdifftimeputline, assignment(=)
9843 use dc_types, only: dp
9845 implicit none
9846 type(dc_difftime), intent(in):: time
9847 character(*), intent(in):: varname
9848 integer, intent(in), target:: array(:)
9849 logical, intent(out), optional:: err
9850
9851 real(DP):: timed
9852
9853 continue
9854 timed = evalsec( time )
9855
9856 call historyautoput( &
9857 & timed, varname, array, & ! (in)
9858 & err ) ! (out) optional
9859
9860 end subroutine historyautoputold1int1
9861
9862
9887 & time, varname, array, & ! (in)
9888 & err & ! (out) optional
9889 & )
9891 use dc_date_generic, only: operator(-), operator(+), &
9892 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9893 & dcdifftimeputline, assignment(=)
9894 use dc_types, only: dp
9896 implicit none
9897 type(dc_difftime), intent(in):: time
9898 character(*), intent(in):: varname
9899 integer, intent(in), target:: array(:,:)
9900 logical, intent(out), optional:: err
9901
9902 real(DP):: timed
9903
9904 continue
9905 timed = evalsec( time )
9906
9907 call historyautoput( &
9908 & timed, varname, array, & ! (in)
9909 & err ) ! (out) optional
9910
9911 end subroutine historyautoputold1int2
9912
9913
9938 & time, varname, array, & ! (in)
9939 & err & ! (out) optional
9940 & )
9942 use dc_date_generic, only: operator(-), operator(+), &
9943 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9944 & dcdifftimeputline, assignment(=)
9945 use dc_types, only: dp
9947 implicit none
9948 type(dc_difftime), intent(in):: time
9949 character(*), intent(in):: varname
9950 integer, intent(in), target:: array(:,:,:)
9951 logical, intent(out), optional:: err
9952
9953 real(DP):: timed
9954
9955 continue
9956 timed = evalsec( time )
9957
9958 call historyautoput( &
9959 & timed, varname, array, & ! (in)
9960 & err ) ! (out) optional
9961
9962 end subroutine historyautoputold1int3
9963
9964
9989 & time, varname, array, & ! (in)
9990 & err & ! (out) optional
9991 & )
9993 use dc_date_generic, only: operator(-), operator(+), &
9994 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
9995 & dcdifftimeputline, assignment(=)
9996 use dc_types, only: dp
9998 implicit none
9999 type(dc_difftime), intent(in):: time
10000 character(*), intent(in):: varname
10001 integer, intent(in), target:: array(:,:,:,:)
10002 logical, intent(out), optional:: err
10003
10004 real(DP):: timed
10005
10006 continue
10007 timed = evalsec( time )
10008
10009 call historyautoput( &
10010 & timed, varname, array, & ! (in)
10011 & err ) ! (out) optional
10012
10013 end subroutine historyautoputold1int4
10014
10015
10040 & time, varname, array, & ! (in)
10041 & err & ! (out) optional
10042 & )
10044 use dc_date_generic, only: operator(-), operator(+), &
10045 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
10046 & dcdifftimeputline, assignment(=)
10047 use dc_types, only: dp
10049 implicit none
10050 type(dc_difftime), intent(in):: time
10051 character(*), intent(in):: varname
10052 integer, intent(in), target:: array(:,:,:,:,:)
10053 logical, intent(out), optional:: err
10054
10055 real(DP):: timed
10056
10057 continue
10058 timed = evalsec( time )
10059
10060 call historyautoput( &
10061 & timed, varname, array, & ! (in)
10062 & err ) ! (out) optional
10063
10064 end subroutine historyautoputold1int5
10065
10066
10091 & time, varname, array, & ! (in)
10092 & err & ! (out) optional
10093 & )
10095 use dc_date_generic, only: operator(-), operator(+), &
10096 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
10097 & dcdifftimeputline, assignment(=)
10098 use dc_types, only: dp
10100 implicit none
10101 type(dc_difftime), intent(in):: time
10102 character(*), intent(in):: varname
10103 integer, intent(in), target:: array(:,:,:,:,:,:)
10104 logical, intent(out), optional:: err
10105
10106 real(DP):: timed
10107
10108 continue
10109 timed = evalsec( time )
10110
10111 call historyautoput( &
10112 & timed, varname, array, & ! (in)
10113 & err ) ! (out) optional
10114
10115 end subroutine historyautoputold1int6
10116
10117
10142 & time, varname, array, & ! (in)
10143 & err & ! (out) optional
10144 & )
10146 use dc_date_generic, only: operator(-), operator(+), &
10147 & operator(>), operator(<), mod, operator(==), tochar, evalsec, &
10148 & dcdifftimeputline, assignment(=)
10149 use dc_types, only: dp
10151 implicit none
10152 type(dc_difftime), intent(in):: time
10153 character(*), intent(in):: varname
10154 integer, intent(in), target:: array(:,:,:,:,:,:,:)
10155 logical, intent(out), optional:: err
10156
10157 real(DP):: timed
10158
10159 continue
10160 timed = evalsec( time )
10161
10162 call historyautoput( &
10163 & timed, varname, array, & ! (in)
10164 & err ) ! (out) optional
10165
10166 end subroutine historyautoputold1int7
10167
10168!--
10169! vi:set readonly sw=4 ts=8:
10170!
10171!Local Variables:
10172!mode: f90
10173!buffer-read-only: t
10174!End:
10175!
10176!++
subroutine historyautoputold1int2(time, varname, array, err)
subroutine historyautoputold1double2(time, varname, array, err)
subroutine historyautoputint1(time, varname, array, err)
subroutine historyautoputold1real5(time, varname, array, err)
subroutine historyautoputold1double7(time, varname, array, err)
subroutine historyautoputold1int4(time, varname, array, err)
subroutine historyautoputreal3(time, varname, array, err)
subroutine historyautoputint6(time, varname, array, err)
subroutine historyautoputold1double0(time, varname, value, err)
subroutine historyautoputold1real3(time, varname, array, err)
subroutine historyautoputold1real7(time, varname, array, err)
subroutine historyautoputreal6(time, varname, array, err)
subroutine historyautoputint2(time, varname, array, err)
subroutine historyautoputold1int3(time, varname, array, err)
subroutine historyautoputold1int5(time, varname, array, err)
subroutine historyautoputold1int6(time, varname, array, err)
subroutine historyautoputdouble4(time, varname, array, err)
subroutine historyautoputdouble5(time, varname, array, err)
subroutine historyautoputdouble7(time, varname, array, err)
subroutine historyautoputold1double4(time, varname, array, err)
subroutine historyautoputold1real0(time, varname, value, err)
subroutine historyautoputold1real2(time, varname, array, err)
subroutine historyautoputint7(time, varname, array, err)
subroutine historyautoputold1double3(time, varname, array, err)
subroutine historyautoputreal2(time, varname, array, err)
subroutine historyautoputold1real6(time, varname, array, err)
subroutine historyautoputint4(time, varname, array, err)
subroutine historyautoputdouble0(time, varname, value, err)
subroutine historyautoputint5(time, varname, array, err)
subroutine historyautoputint3(time, varname, array, err)
subroutine historyautoputreal4(time, varname, array, err)
subroutine historyautoputdouble6(time, varname, array, err)
subroutine historyautoputold1double6(time, varname, array, err)
subroutine historyautoputint0(time, varname, value, err)
subroutine historyautoputdouble2(time, varname, array, err)
subroutine historyautoputold1real1(time, varname, array, err)
subroutine historyautoputreal7(time, varname, array, err)
subroutine historyautoputreal0(time, varname, value, err)
subroutine historyautoputreal1(time, varname, array, err)
subroutine historyautoputold1int0(time, varname, value, err)
subroutine historyautoputold1int1(time, varname, array, err)
subroutine historyautoputold1double1(time, varname, array, err)
subroutine historyautoputold1real4(time, varname, array, err)
subroutine historyautoputold1double5(time, varname, array, err)
subroutine historyautoputreal5(time, varname, array, err)
subroutine historyautoputdouble1(time, varname, array, err)
subroutine historyautoputdouble3(time, varname, array, err)
subroutine historyautoputold1int7(time, varname, array, err)
subroutine historyclose(history, quiet, err)
subroutine historysettime(time, history, difftime, timed)
Calendar and date module.
Interface declarations for procedures provided from dc_date.
Derived types and parameters for date and time.
integer, parameter, public unit_symbol_sec
Symbol for second unit
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public hst_ebadvarname
Definition dc_error.f90:563
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public dc_enegative
Definition dc_error.f90:545
Message output module.
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
type(axes_weight), dimension(1:max_vars), target, save, public weight_vars
logical, dimension(1:max_vars, 1:save_tstepnum), save, public close_timing_vars
type(gthst_nmlinfo), save, public gthstnml
logical, dimension(1:max_vars, 1:save_tstepnum), save, public create_timing_vars
type(gt_history_multi), dimension(1:max_vars), save, public gthst_history_vars
character(token), dimension(1:max_vars), save, public varname_vars
type(space_avr_info), dimension(1:max_vars), target, save, public space_avr_vars
type(slice_info), dimension(1:max_vars), target, save, public slice_vars
logical, dimension(1:max_vars), save, public flag_output_prev_vars
real(dp), dimension(1:max_vars), save, public interval_time_vars
logical, dimension(1:max_vars, 1:save_tstepnum), save, public renew_timing_vars
logical, dimension(1:max_vars, 1:save_tstepnum), save, public output_timing_vars
real(dp), dimension(1:max_vars), save, public newfile_createtime_vars
logical, dimension(1:max_vars, 1:save_tstepnum), save, public output_timing_avr_vars
real(dp), dimension(1:max_vars), save, public prev_outtime_vars
real(dp), dimension(1:max_vars), save, public origin_time_vars
integer, dimension(1:max_vars), save, public interval_unitsym_vars
logical, dimension(1:max_vars), save, public histaddvar_vars
Derived type for information of slice of space.