gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
gtool_historyauto_internal Module Reference

Data Types

type  gt_history_axis_data
 座標軸データ用の構造型. More...
type  gt_history_multi
 GT_HISTORY 型変数を指す構造体. More...
type  slice_info
 空間切り出し情報管理用の構造型. More...
type  axes_weight
 座標重み情報管理用の構造型. More...
type  space_avr_info
 空間平均情報管理用の構造型. More...
interface  hstvarsoutputcheck
interface  hstfilecreate
interface  averagereduce

Functions/Subroutines

subroutine, public hstvarsoutputcheck (time, stime_index)
subroutine, public hstfilecreate (gthist, varname, time)

Variables

integer, save, public numdims
integer, save, public numwgts = 0
character(*), parameter, public wgtsuf = '_weight'
integer, save, public numvars = 0
integer, parameter, public max_dims_depended_by_var = 7
real(dp), parameter, public max_remainder_range = 1.0e-3_DP
character(string), save, public title_save
character(string), save, public source_save
character(string), save, public institution_save
character(string), save, public conventions_save
character(token), save, public gt_version_save
character(token), save, public rank_save
integer, parameter, public save_tstepnum = 1
real(dp), dimension(1:save_tstepnum), save, public saved_time
integer, save, public checked_tstepnum = 0
integer, save, public checked_tstep_varnum = 0
integer, save, public saved_tstep = 1
character(token), save, public time_unit_bycreate = ''
character(string), save, public time_unit_suffix = ''
type(gthst_nmlinfo), save, public gthstnml
type(gt_history_axis), dimension(1:nf90_max_dims), target, save, public gthst_axes
type(gt_history_axis_data), dimension(1:nf90_max_dims), target, save, public data_axes
type(gt_history_axis_data), dimension(1:nf90_max_dims), target, save, public data_axes_whole
type(gt_history_varinfo), dimension(1:nf90_max_dims), save, public gthst_weights
type(gt_history_axis_data), dimension(1:nf90_max_dims), target, save, public data_weights
logical, save, public save_mpi_split = .false.
logical, save, public save_mpi_gather = .false.
integer, parameter, public max_vars = NF90_MAX_VARS
type(gt_history_varinfo), dimension(1:max_vars), save, public gthst_vars
character(token), dimension(1:max_vars), save, public varname_vars = ''
type(gt_history_multi), dimension(1:max_vars), save, public gthst_history_vars
logical, dimension(1:max_vars), save, public output_valid_vars = .false.
logical, dimension(1:max_vars, 1:save_tstepnum), save, public create_timing_vars = .false.
logical, dimension(1:max_vars, 1:save_tstepnum), save, public close_timing_vars = .false.
logical, dimension(1:max_vars, 1:save_tstepnum), save, public renew_timing_vars = .false.
logical, dimension(1:max_vars, 1:save_tstepnum), save, public output_timing_vars = .false.
logical, dimension(1:max_vars, 1:save_tstepnum), save, public output_timing_avr_vars = .false.
real(dp), dimension(1:max_vars), save, public interval_time_vars
integer, dimension(1:max_vars), save, public interval_unitsym_vars
real(dp), dimension(1:max_vars), save, public prev_outtime_vars
logical, dimension(1:max_vars), save, public tavr_vars = .false.
real(dp), dimension(1:max_vars), save, public origin_time_vars
real(dp), dimension(1:max_vars), save, public terminus_time_vars
logical, dimension(1:max_vars), save, public histaddvar_vars = .false.
real(dp), dimension(1:max_vars), save, public newfile_inttime_vars
real(dp), dimension(1:max_vars), save, public newfile_createtime_vars
logical, dimension(1:max_vars), save, public flag_output_prev_vars = .false.
real(dp), save, public zero_time
type(slice_info), dimension(1:max_vars), target, save, public slice_vars
type(axes_weight), dimension(1:max_vars), target, save, public weight_vars
type(space_avr_info), dimension(1:max_vars), target, save, public space_avr_vars
logical, save, public all_output_save = .false.
logical, save, public flag_allvarfixed = .false.
type(dc_cal), save, public cal_save
logical, save, public initialized = .false.
character(*), parameter, public sub_sname = "HistAuto"
character(*), parameter, public version = '$Name: $' // '$Id: gtool_historyauto_internal.rb2f90,v 1.6 2010-07-04 22:01:51 morikawa Exp $'

Function/Subroutine Documentation

◆ hstfilecreate()

subroutine, public gtool_historyauto_internal::hstfilecreate ( type(gt_history), intent(inout) gthist,
character(*), intent(in) varname,
real(dp), intent(in) time )

ファイル作成用内部サブルーチン.

Parameters
[in,out]gthistgtool_history モジュール用構造体.
[in]varname変数の名前.
[in]time現在時刻.

Definition at line 645 of file gtool_historyauto_internal.f90.

650 use dc_trace, only: beginsub, endsub
653 use dc_calendar, only: dccalconvertbyunit
654 use dc_date_types, only: dc_difftime
655 use dc_date, only: dcdifftimecreate, evalbyunit
657 use dc_message, only: messagenotify
660 use gtool_history, only: gt_history, &
661 & historycreate, historyaddvariable, historyaddattr, &
662 & historyinitialized, historyput, historyputaxismpi, &
663 & historyaxiscreate, historyaxisinquire, historyaxiscopy, &
664 & historyvarinfoinquire, historyvarinfocreate, &
665 & historyvarinfocopy, historyvarinfoinitialized, &
666 & historyvarinfoclear
667
668 implicit none
669 type(GT_HISTORY), intent(inout):: gthist
670 ! gtool_history モジュール用構造体.
671 ! Derived type for "gtool_history" module
672 character(*), intent(in):: varname
673 ! 変数の名前.
674 ! Variable name
675 real(DP), intent(in):: time
676 ! 現在時刻. Current time
677
678 character(TOKEN):: interval_unit
679 ! データの出力間隔の単位.
680 ! Unit for interval of history data output
681 real(DP):: origin_value
682 ! データの出力開始時刻の数値.
683 ! Numerical value for start time of history data output
684 character(TOKEN):: origin_unit
685 ! データの出力開始時刻の単位.
686 ! Unit for start time of history data output
687
688 real(DP):: origin_sec
689 integer:: newfile_intvalue
690 real(DP):: newfile_intvalued
691 ! ファイル分割時間間隔.
692 ! Interval of time of separation of a file.
693 character(TOKEN):: newfile_intunit
694 ! ファイル分割時間間隔の単位.
695 ! Unit of interval of time of separation of a file.
696
697 character(STRING):: file, file_base, file_suffix, file_newfile_time, file_rank
698 ! 出力ファイル名.
699 ! Output file name.
700 integer:: stat, i, j, k, vnum, numdims_slice, dim_size, cnt
701 character(STRING):: name, units, longname, cause_c, wgt_name
702 character(TOKEN):: xtype
703 type(GT_HISTORY_AXIS):: gthst_axes_time
704 type(GT_HISTORY_AXIS), pointer:: gthst_axes_slices(:) =>null()
705 type(GT_HISTORY_AXIS_DATA), pointer:: data_axes_slices(:) =>null()
706 type(GT_HISTORY_AXIS_DATA), pointer:: data_weights_slices(:) =>null()
707 real(DP):: wgt_sum, wgt_sum_s
708 logical:: slice_valid
709 integer:: slice_start(1:numdims-1)
710 ! 空間方向の開始点.
711 ! Start points of spaces.
712 integer:: slice_end(1:numdims-1)
713 ! 空間方向の終了点.
714 ! End points of spaces.
715 integer:: slice_stride(1:numdims-1)
716 ! 空間方向の刻み幅.
717 ! Strides of spaces
718
719 character(*), parameter:: subname = "HstFileCreate"
720 continue
721 call beginsub(subname, 'varname=%c', c1 = trim(varname) )
722 stat = dc_noerr
723 cause_c = ""
724
725 ! varname から変数情報の探査
726 ! Search information of a variable from "varname"
727 !
728 vnum = 0
729 do i = 1, numvars
730 call historyvarinfoinquire( &
731 & varinfo = gthst_vars(i), & ! (in)
732 & name = name ) ! (out)
733 if ( trim(varname) == trim(name) ) vnum = i
734 end do
735
736 if ( vnum == 0 ) then
737 stat = hst_ebadvarname
738 cause_c = varname
739 goto 999
740 end if
741
742 ! 出力が有効かどうかを確認する
743 ! Confirm whether the output is effective
744 !
745 if ( .not. hstnmlinfooutputvalid( gthstnml, varname ) ) then
746 goto 999
747 end if
748
749 ! 出力間隔の単位に応じて時間座標情報の作り直し
750 ! Remake time axis information correspond to units of output interval
751 !
752 call hstnmlinfoinquire( &
753 & gthstnml = gthstnml, & ! (in)
754 & name = varname, & ! (in)
755 & file = file, & ! (out)
756 & interval_unit = interval_unit ) ! (out)
757
758 call historyaxiscopy( &
759 & gthst_axes_time, & ! (out)
760 & gthst_axes(numdims), & ! (in)
761 & units = trim(interval_unit) // ' ' // &
762 & trim(time_unit_suffix) ) ! (in)
763
764 ! 空間方向のスライスに対応して, 座標および座標重み情報の作り直し
765 ! Remake axes and weights information correspond to spatial slices
766 !
767 call hstnmlinfoinquire( &
768 & gthstnml = gthstnml, & ! (in)
769 & name = varname, & ! (in)
770 & slice_start = slice_start, & ! (out)
771 & slice_end = slice_end, & ! (out)
772 & slice_stride = slice_stride ) ! (out)
773
774 ! ファイルが未作成の場合は, まずファイル作成
775 ! At first, the file is created if the file is not created yet
776 !
777 if ( .not. historyinitialized( gthist ) ) then
778
779 if ( all( slice_start == (/ ( 1, i = 1, numdims -1 ) /) ) &
780 & .and. all( slice_end < (/ ( 1, i = 1, numdims -1 ) /) ) &
781 & .and. all( slice_stride == (/ ( 1, i = 1, numdims -1 ) /) ) ) then
782
783 allocate( gthst_axes_slices(1:numdims) )
784 gthst_axes_slices(1:numdims-1) = gthst_axes(1:numdims-1)
785 gthst_axes_slices(numdims:numdims) = gthst_axes_time
786
787 data_axes_slices => data_axes
788 data_weights_slices => data_weights
789 slice_valid = .false.
790
791 else
792 allocate( gthst_axes_slices(1:numdims) )
793 allocate( data_axes_slices(1:numdims) )
794 allocate( data_weights_slices(1:numdims) )
795
796 do i = 1, numdims-1
797
798 ! スライス値の有効性をチェック
799 ! Check validity of slices
800 !
801 if ( slice_start(i) < 1 ) then
802 stat = hst_ebadslice
803 cause_c = cprintf('slice_start=%d', &
804 & i = (/ slice_start(i) /) )
805 goto 999
806 end if
807
808 if ( slice_stride(i) < 1 ) then
809 stat = hst_ebadslice
810 cause_c = cprintf('slice_stride=%d', &
811 & i = (/ slice_stride(i) /) )
812 goto 999
813 end if
814
815 ! 再生成の必要性をチェック
816 ! Check necessity of remaking
817 !
818 if ( ( slice_start(i) == 1 ) &
819 & .and. ( slice_end(i) < 1 ) &
820 & .and. ( slice_stride(i) == 1 ) ) then
821
822 call historyaxiscopy( &
823 & axis_dest = gthst_axes_slices(i) , & ! (out)
824 & axis_src = gthst_axes(i) ) ! (in)
825
826 data_axes_slices(i) = data_axes(i)
827
828 cycle
829 end if
830
831 ! 座標情報の再生成
832 ! Remake information of axis
833 !
834 call historyaxisinquire( &
835 & axis = gthst_axes(i), & ! (in)
836 & name = name, & ! (out)
837 & size = dim_size, & ! (out)
838 & longname = longname, & ! (out)
839 & units = units, & ! (out)
840 & xtype = xtype ) ! (out)
841
842 ! 終点のスライス値の補正 ; Correct end points of slices
843 if ( slice_end(i) < 1 ) slice_end(i) = dim_size
844 if ( slice_end(i) > dim_size ) then
845 call messagenotify( 'W', subname, &
846 & 'slice options to (%c) are undesirable ' // &
847 & '(@slice_end=%d). @slice_end is corrected forcibly to (%d) ', &
848 & c1 = trim(name), &
849 & i = (/ slice_end(i), dim_size /) )
850
851 slice_end(i) = dim_size
852 end if
853
854 ! スライス値の有効性をチェック ; Check validity of slices
855 if ( slice_start(i) > slice_end(i) ) then
856 stat = hst_ebadslice
857 cause_c = cprintf('slice_start=%d, slice_end=%d', &
858 & i = (/ slice_start(i), slice_end(i) /) )
859 goto 999
860 end if
861
862 numdims_slice = int( ( slice_end(i) - slice_start(i) + 1 ) / slice_stride(i) )
863
864 ! スライス値の有効性をチェック ; Check validity of slices
865 if ( numdims_slice < 1 ) then
866 call messagenotify( 'W', subname, &
867 & 'slice options to (%c) are invalid. ' // &
868 & '(@slice_start=%d @slice_end=%d @slice_stride=%d)', &
869 & c1 = trim(name), &
870 & i = (/ slice_start(i), slice_end(i), slice_stride(i) /) )
871 stat = hst_ebadslice
872 cause_c = cprintf('slice_start=%d, slice_end=%d, slice_stride=%d', &
873 & i = (/ slice_start(i), slice_end(i), slice_stride(i) /) )
874 goto 999
875 end if
876
877 call historyaxiscreate( &
878 & axis = gthst_axes_slices(i), & ! (out)
879 & name = name, & ! (in)
880 & size = numdims_slice, & ! (in)
881 & longname = longname, & ! (in)
882 & units = units, & ! (in)
883 & xtype = xtype ) ! (in)
884
885
886 ! 座標データの再生成
887 ! Regenerate data of axis
888 !
889 allocate( data_axes_slices(i) % a_axis( numdims_slice ) )
890 cnt = 1
891 do j = slice_start(i), slice_end(i), slice_stride(i)
892 data_axes_slices(i) % a_axis( cnt ) = data_axes(i) % a_axis( j )
893 cnt = cnt + 1
894 end do
895
896 ! 座標重みデータの再生成
897 ! Remake information of axis data
898 !
899 do j = 1, numwgts
900 call historyvarinfoinquire( &
901 & varinfo = gthst_weights(j), & ! (in)
902 & name = wgt_name ) ! (out) optional
903
904 if ( trim(name) // wgtsuf == trim(wgt_name) ) then
905
906 ! 座標重みの計算は結構いい加減...
907 ! Calculation about axis weight is irresponsible...
908 !
909 wgt_sum = sum( data_weights(j) % a_axis )
910
911 allocate( data_weights_slices(j) % a_axis( numdims_slice ) )
912 cnt = 1
913 do k = slice_start(i), slice_end(i), slice_stride(i)
914 data_weights_slices(j) % a_axis( cnt ) = data_weights(j) % a_axis( k )
915 cnt = cnt + 1
916 end do
917
918 wgt_sum_s = sum( data_weights_slices(j) % a_axis )
919 data_weights_slices(j) % a_axis = data_weights_slices(j) % a_axis * ( wgt_sum / wgt_sum_s )
920
921 end if
922
923 end do
924
925 end do
926
927 ! 空間切り出しされていない座標に関する座標重みデータを作成
928 ! Make data of axis weight not sliced
929 !
930 do i = 1, numwgts
931 if ( .not. associated( data_weights_slices(i) % a_axis ) ) then
932 allocate( data_weights_slices(i) % a_axis( size(data_weights(i) % a_axis ) ) )
933 data_weights_slices(i) % a_axis = data_weights(i) % a_axis
934 end if
935 end do
936
937 ! 時刻次元のコピー
938 ! Copy time dimension
939 !
940 gthst_axes_slices(numdims) = gthst_axes_time
941
942 slice_valid = .true.
943 end if
944
945 ! HistoryCreate のための設定値の取得
946 ! Get the settings for "HistoryCreate"
947 !
948 call hstnmlinfoinquire( &
949 & gthstnml = gthstnml, & ! (in)
950 & name = varname, & ! (in)
951 & file = file, & ! (out)
952 & origin_value = origin_value, & ! (out)
953 & origin_unit = origin_unit, & ! (out)
954 & interval_unit = interval_unit, & ! (out)
955 & newfile_intvalue = newfile_intvalue, & ! (out)
956 & newfile_intunit = newfile_intunit ) ! (out)
957
958 ! データ出力時刻の設定
959 ! Configure data output time
960 !
961 origin_sec = &
962 & dccalconvertbyunit( &
963 & real( origin_value, dp ), origin_unit, 'sec', cal_save )
964
965!!$ ! dc_date モジュール使用時
966!!$ !
967!!$ call DCDiffTimeCreate( &
968!!$ & origin_sec, & ! (out)
969!!$ & origin_value, origin_unit ) ! (in)
970
971 if ( newfile_intvalue < 1 ) then
972
973 origin_value = dccalconvertbyunit( &
974 & origin_sec, 'sec', interval_unit, cal_save )
975
976! origin_value = EvalbyUnit( origin_sec, interval_unit )
977 else
978
979 origin_value = &
980 & dccalconvertbyunit( time, 'sec', interval_unit, cal_save )
981
982! origin_value = EvalbyUnit( time, interval_unit )
983 end if
984
985 ! ファイル名の設定
986 ! Configure file name
987 !
988 if ( len_trim( file ) - index(file, '.nc', .true.) == 2 ) then
989 file_base = file(1:len_trim( file ) - 3)
990 file_suffix = '.nc'
991 else
992 file_base = file
993 file_suffix = ''
994 end if
995 if ( trim(rank_save) == '' ) then
996 file_rank = ''
997 else
998 file_rank = '_rank' // trim( adjustl(rank_save) )
999 end if
1000 if ( newfile_intvalue > 0 ) then
1001 newfile_intvalued = &
1002 & dccalconvertbyunit( time, 'sec', newfile_intunit, cal_save )
1003
1004 file_newfile_time = &
1005 & cprintf( '_time%08d', i = (/ int( newfile_intvalued ) /) )
1006! & i = (/ int( EvalbyUnit( time, newfile_intunit ) ) /) )
1007 else
1008 file_newfile_time = ''
1009 end if
1010
1011 file = trim(file_base) // trim(file_rank) // trim(file_newfile_time) // trim(file_suffix)
1012
1013 ! HistoryCreate によるファイル作成
1014 ! Files are created by "HistoryCreate"
1015 !
1016 call historycreate( &
1017 & history = gthist, & ! (inout)
1018 & file = file, title = title_save, & ! (in)
1019 & source = source_save, institution = institution_save, & ! (in)
1020 & axes = gthst_axes_slices(1:numdims), & ! (in)
1021 & origind = origin_value, & ! (in)
1022 & conventions = conventions_save, & ! (in)
1023 & gt_version = gt_version_save, & ! (in)
1024 & flag_mpi_split = save_mpi_split, & ! (in)
1025 & flag_mpi_gather = save_mpi_gather ) ! (in)
1026
1027 ! 座標データを出力
1028 ! Output axes data
1029 !
1030 do i = 1, numdims - 1
1031 call historyaxisinquire( &
1032 & axis = gthst_axes_slices(i), & ! (in)
1033 & name = name ) ! (out)
1034 call historyput( &
1035 & history = gthist, & ! (inout) optional
1036 & varname = name, & ! (in)
1037 & array = data_axes_slices(i) % a_axis ) ! (in)
1038 end do
1039
1040 ! MPI 用に領域全体の座標データを出力
1041 ! Output axes data in whole area for MPI
1042 !
1043 if ( save_mpi_gather ) then
1044 do i = 1, numdims - 1
1045 call historyaxisinquire( &
1046 & axis = gthst_axes_slices(i), & ! (in)
1047 & name = name ) ! (out)
1048
1049 if ( .not. associated( data_axes_whole(i) % a_axis ) ) then
1050 call messagenotify('W', subname, &
1051 & 'data of axis (%c) in whole area is lack. ' // &
1052 & 'Specify the data by "HistoryAutoPutAxisMPI" explicitly.', &
1053 & c1 = trim(name) )
1054 stat = hst_empinoaxisdata
1055 cause_c = name
1056 end if
1057
1058 call historyputaxismpi( &
1059 & history = gthist, & ! (inout) optional
1060 & varname = name, & ! (in)
1061 & array = data_axes_whole(i) % a_axis ) ! (in)
1062 end do
1063 end if
1064
1065 ! 割付解除
1066 ! Deallocation
1067 !
1068 if ( slice_valid ) then
1069 deallocate( gthst_axes_slices )
1070 deallocate( data_axes_slices )
1071 else
1072 deallocate( gthst_axes_slices )
1073 nullify( data_axes_slices )
1074 end if
1075
1076 ! 座標重みデータを追加
1077 ! Add axes weights data
1078 !
1079 do i = 1, numwgts
1080 call historyaddvariable( &
1081 & history = gthist, & ! (inout)
1082 & varinfo = gthst_weights(i) ) ! (in)
1083 call historyvarinfoinquire( &
1084 & varinfo = gthst_weights(i), & ! (in)
1085 & name = name ) ! (out)
1086 call historyput( &
1087 & history = gthist, & ! (inout) optional
1088 & varname = name, & ! (in)
1089 & array = data_weights_slices(i) % a_axis ) ! (in)
1090 end do
1091
1092 if ( slice_valid ) then
1093 deallocate( data_weights_slices )
1094 else
1095 nullify( data_weights_slices )
1096 end if
1097
1098 ! ファイル作成おしまい; Creation of file is finished
1099 end if
1100
1101
1102 ! 変数情報を追加
1103 ! Add information of variables
1104 !
1105 call historyaddvariable( &
1106 & varinfo = gthst_vars(vnum), & ! (in)
1107 & history = gthist ) ! (inout) optional
1108
1109999 continue
1110 call storeerror(stat, subname, cause_c = cause_c)
1111 call endsub(subname)
暦と日時モジュール
日付・時刻に関する構造データ型と定数
日付および時刻に関する手続きを提供するモジュール
Definition dc_date.f90:57
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public hst_ebadslice
Definition dc_error.f90:568
integer, parameter, public hst_ebadvarname
Definition dc_error.f90:563
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
integer, parameter, public hst_empinoaxisdata
Definition dc_error.f90:574
メッセージの出力
文字型変数の操作
Definition dc_string.f90:83
character(string) function, public joinchar(carray, expr)
デバッグ時の追跡用モジュール
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

◆ hstvarsoutputcheck()

subroutine, public gtool_historyauto_internal::hstvarsoutputcheck ( real(dp), intent(in) time,
integer, intent(out) stime_index )

各変数の出力タイミングのチェック.

与えられた時刻 time が各変数にとって出力のタイミングかどうかを 調査して output_timing_vars, output_timing_avr_vars, create_timing_vars, close_timing_vars, renew_timing_vars へ反映し, time に対応する saved_time の配列添字を stime_index へ返します.

また, ファイルのオープンクローズのタイミングであれば, それらもこのサブルーチン内で行います.

Parameters
[in]time現在時刻.
[out]stime_indexsaved_time 配列の添字.

Definition at line 449 of file gtool_historyauto_internal.f90.

451 use dc_error, only: storeerror, dc_noerr
452 use gtool_history, only: historyinitialized, historyclose
453 use dc_date_types, only: dc_difftime
454 use dc_date, only: operator(==), operator(>), operator(<), &
455 & operator(>=), operator(<=), operator(-), dcdifftimeputline, &
456 & evalsec
457 implicit none
458 real(DP), intent(in):: time
459 ! 現在時刻. Current time
460 integer, intent(out):: stime_index
461
462 integer:: tstep
463 integer:: stat, i, startnum, endnum
464 character(STRING):: cause_c
465 character(*), parameter:: subname = "HstVarsOutputCheck"
466 real(DP), parameter:: time_eps = epsilon(1.0_dp)
467 continue
468 call beginsub(subname)
469 stat = dc_noerr
470 cause_c = ""
471
472 ! 与えられた時刻がチェック済みかどうかを調べる
473 ! Examine whether given time is already checked or not
474 !
475 timestepsearch: do
476 do i = saved_tstep, checked_tstepnum
477 if ( abs(saved_time(i) - time) <= &
478 & time_eps * max(1.0_dp, abs(time), abs(saved_time(i))) ) then
479 tstep = i
480 exit timestepsearch
481 end if
482 end do
483 do i = 1, saved_tstep - 1
484 if ( abs(saved_time(i) - time) <= &
485 & time_eps * max(1.0_dp, abs(time), abs(saved_time(i))) ) then
486 tstep = i
487 exit timestepsearch
488 end if
489 end do
490
491 tstep = 0
492 exit timestepsearch
493 end do timestepsearch
494
495 saved_tstep = tstep
496
497 if ( saved_tstep /= 0 .and. checked_tstep_varnum == numvars ) then
498 ! * output_timing_vars(:,saved_tstep) を使う.
499 ! * saved_tstep を stime_index として返す.
500
501 stime_index = saved_tstep
502 call dbgmessage( 'saved_tstep=<%d> is already checked.', &
503 & i =(/ saved_tstep /) )
504 goto 999
505 end if
506
507 ! チェックする時間ステップと, 変数 ID の設定
508 ! Configure checked time step, and variable ID
509 !
510 if ( saved_tstep /= 0 ) then
511 startnum = checked_tstep_varnum + 1
512 endnum = numvars
513
514 stime_index = saved_tstep
515 else
516 startnum = 1
517 endnum = numvars
518
519 if ( save_tstepnum < 2 ) then
520 checked_tstepnum = 1
521 saved_time(checked_tstepnum) = time
522
523 saved_tstep = checked_tstepnum
524 stime_index = saved_tstep
525
526 elseif ( .not. checked_tstepnum < save_tstepnum ) then
527 create_timing_vars(:,1:checked_tstepnum-1) = create_timing_vars(:,2:checked_tstepnum)
528 close_timing_vars(:,1:checked_tstepnum-1) = close_timing_vars(:,2:checked_tstepnum)
529 renew_timing_vars(:,1:checked_tstepnum-1) = renew_timing_vars(:,2:checked_tstepnum)
530 output_timing_vars(:,1:checked_tstepnum-1) = output_timing_vars(:,2:checked_tstepnum)
531 output_timing_avr_vars(:,1:checked_tstepnum-1) = output_timing_avr_vars(:,2:checked_tstepnum)
532
533 saved_time(1:checked_tstepnum-1) = saved_time(2:checked_tstepnum)
534 saved_time(checked_tstepnum) = time
535
536 saved_tstep = checked_tstepnum
537 stime_index = saved_tstep
538
539 else
540 checked_tstepnum = checked_tstepnum + 1
541 saved_time(checked_tstepnum) = time
542
543 saved_tstep = checked_tstepnum
544 stime_index = saved_tstep
545 end if
546 end if
547
548 call dbgmessage( 'numvar=<%d:%d> in saved_tstep=<%d> will be checked from now.', &
549 & i =(/ startnum, endnum, saved_tstep /) )
550
551
552 ! それぞれのタイミングをチェックして各変数に格納
553 !
554 ! * ファイルオープン: create_timing_vars
555 ! * ファイルクローズ: close_timing_vars
556 ! * ファイルクローズ/作成: renew_timing_vars
557 ! * データ出力: output_timing_vars
558 ! * データ平均化: output_avr_timing_vars
559
560 create_timing_vars(startnum:endnum, checked_tstepnum:checked_tstepnum) = .false.
561 close_timing_vars(startnum:endnum, checked_tstepnum:checked_tstepnum) = .false.
562 renew_timing_vars(startnum:endnum, checked_tstepnum:checked_tstepnum) = .false.
563 output_timing_vars(startnum:endnum, checked_tstepnum:checked_tstepnum) = .false.
564 output_timing_avr_vars(startnum:endnum, checked_tstepnum:checked_tstepnum) = .false.
565
566 do i = startnum, endnum
567
568 if ( .not. output_valid_vars(i) ) cycle
569
570 if ( origin_time_vars(i) > time ) cycle
571
572 if ( origin_time_vars(i) <= time &
573 & .and. ( terminus_time_vars(i) < zero_time &
574 & .or. terminus_time_vars(i) >= time ) &
575 & .and. .not. histaddvar_vars(i) ) then
576
577 create_timing_vars(i,checked_tstepnum) = .true.
578
579 if ( newfile_inttime_vars(i) > zero_time ) then
580 newfile_createtime_vars(i) = time
581 end if
582
583 output_timing_vars(i,checked_tstepnum) = .true.
584 output_timing_avr_vars(i,checked_tstepnum) = tavr_vars(i)
585 cycle
586 end if
587
588 if ( terminus_time_vars(i) > zero_time .and. terminus_time_vars(i) < time ) then
589 close_timing_vars(i,checked_tstepnum) = .true.
590 output_timing_vars(i,checked_tstepnum) = .false.
591 output_timing_avr_vars(i,checked_tstepnum) = .false.
592 cycle
593 end if
594
595 ! * newfile_inttime_vars だけでは, ぴったり一致しないとうまく行かない.
596 ! * そこで...
597 ! * 前回に出力した時刻を記憶しておく.
598 ! * 前回の時刻と今回の時刻の差が newfile_inttime_vars
599 ! よりも大きい場合には現ファイルを閉じ, 新ファイルを作成する.
600
601 if ( newfile_inttime_vars(i) > zero_time ) then
602 if ( time - newfile_createtime_vars(i) >= newfile_inttime_vars(i) ) then
603 renew_timing_vars(i,checked_tstepnum) = .true.
604
605 output_timing_vars(i,checked_tstepnum) = .true.
606 output_timing_avr_vars(i,checked_tstepnum) = tavr_vars(i)
607
608 cycle
609 end if
610 end if
611
612 if ( time - prev_outtime_vars(i) >= interval_time_vars(i) ) then
613 output_timing_vars(i,checked_tstepnum) = .true.
614 output_timing_avr_vars(i,checked_tstepnum) = tavr_vars(i)
615 cycle
616 end if
617
618 output_timing_vars(i,checked_tstepnum) = .false.
619 output_timing_avr_vars(i,checked_tstepnum) = tavr_vars(i)
620
621 end do
622
623 checked_tstep_varnum = numvars
624
625999 continue
626 call storeerror(stat, subname, cause_c = cause_c)
627 call endsub(subname)
subroutine dcdifftimeputline(diff, unit, indent)
subroutine historyclose(history, quiet, err)
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:661

Variable Documentation

◆ all_output_save

logical, save, public gtool_historyauto_internal::all_output_save = .false.

Definition at line 303 of file gtool_historyauto_internal.f90.

303 logical, save, public:: all_output_save = .false.

◆ cal_save

type(dc_cal), save, public gtool_historyauto_internal::cal_save

Definition at line 318 of file gtool_historyauto_internal.f90.

318 type(DC_CAL), save, public:: cal_save

◆ checked_tstep_varnum

integer, save, public gtool_historyauto_internal::checked_tstep_varnum = 0

Definition at line 135 of file gtool_historyauto_internal.f90.

135 integer, save, public:: checked_tstep_varnum = 0

◆ checked_tstepnum

integer, save, public gtool_historyauto_internal::checked_tstepnum = 0

Definition at line 132 of file gtool_historyauto_internal.f90.

132 integer, save, public:: checked_tstepnum = 0

◆ close_timing_vars

logical, dimension(1:max_vars, 1:save_tstepnum), save, public gtool_historyauto_internal::close_timing_vars = .false.

Definition at line 198 of file gtool_historyauto_internal.f90.

198 logical, save, public:: close_timing_vars(1:MAX_VARS, 1:save_tstepnum) = .false.

◆ conventions_save

character(string), save, public gtool_historyauto_internal::conventions_save

Definition at line 120 of file gtool_historyauto_internal.f90.

120 character(STRING), save, public:: conventions_save

◆ create_timing_vars

logical, dimension(1:max_vars, 1:save_tstepnum), save, public gtool_historyauto_internal::create_timing_vars = .false.

Definition at line 195 of file gtool_historyauto_internal.f90.

195 logical, save, public:: create_timing_vars(1:MAX_VARS, 1:save_tstepnum) = .false.

◆ data_axes

type(gt_history_axis_data), dimension(1:nf90_max_dims), target, save, public gtool_historyauto_internal::data_axes

Definition at line 166 of file gtool_historyauto_internal.f90.

166 type(GT_HISTORY_AXIS_DATA), save, target, public:: data_axes(1:NF90_MAX_DIMS)

◆ data_axes_whole

type(gt_history_axis_data), dimension(1:nf90_max_dims), target, save, public gtool_historyauto_internal::data_axes_whole

Definition at line 167 of file gtool_historyauto_internal.f90.

167 type(GT_HISTORY_AXIS_DATA), save, target, public:: data_axes_whole(1:NF90_MAX_DIMS)

◆ data_weights

type(gt_history_axis_data), dimension(1:nf90_max_dims), target, save, public gtool_historyauto_internal::data_weights

Definition at line 169 of file gtool_historyauto_internal.f90.

169 type(GT_HISTORY_AXIS_DATA), save, target, public:: data_weights(1:NF90_MAX_DIMS)

◆ flag_allvarfixed

logical, save, public gtool_historyauto_internal::flag_allvarfixed = .false.

Definition at line 313 of file gtool_historyauto_internal.f90.

313 logical, save, public:: flag_allvarfixed = .false.

◆ flag_output_prev_vars

logical, dimension(1:max_vars), save, public gtool_historyauto_internal::flag_output_prev_vars = .false.

Definition at line 238 of file gtool_historyauto_internal.f90.

238 logical, save, public:: flag_output_prev_vars(1:MAX_VARS) = .false.

◆ gt_version_save

character(token), save, public gtool_historyauto_internal::gt_version_save

Definition at line 121 of file gtool_historyauto_internal.f90.

121 character(TOKEN), save, public:: gt_version_save

◆ gthst_axes

type(gt_history_axis), dimension(1:nf90_max_dims), target, save, public gtool_historyauto_internal::gthst_axes

Definition at line 165 of file gtool_historyauto_internal.f90.

165 type(GT_HISTORY_AXIS), save, target, public:: gthst_axes(1:NF90_MAX_DIMS)

◆ gthst_history_vars

type(gt_history_multi), dimension(1:max_vars), save, public gtool_historyauto_internal::gthst_history_vars

Definition at line 191 of file gtool_historyauto_internal.f90.

191 type(GT_HISTORY_MULTI), save, public:: gthst_history_vars(1:MAX_VARS)

◆ gthst_vars

type(gt_history_varinfo), dimension(1:max_vars), save, public gtool_historyauto_internal::gthst_vars

Definition at line 189 of file gtool_historyauto_internal.f90.

189 type(GT_HISTORY_VARINFO), save, public:: gthst_vars(1:MAX_VARS)

◆ gthst_weights

type(gt_history_varinfo), dimension(1:nf90_max_dims), save, public gtool_historyauto_internal::gthst_weights

Definition at line 168 of file gtool_historyauto_internal.f90.

168 type(GT_HISTORY_VARINFO), save, public:: gthst_weights(1:NF90_MAX_DIMS)

◆ gthstnml

type(gthst_nmlinfo), save, public gtool_historyauto_internal::gthstnml

Definition at line 154 of file gtool_historyauto_internal.f90.

154 type(GTHST_NMLINFO), save, public:: gthstnml

◆ histaddvar_vars

logical, dimension(1:max_vars), save, public gtool_historyauto_internal::histaddvar_vars = .false.

Definition at line 229 of file gtool_historyauto_internal.f90.

229 logical, save, public:: histaddvar_vars(1:MAX_VARS) = .false.

◆ initialized

logical, save, public gtool_historyauto_internal::initialized = .false.

Definition at line 328 of file gtool_historyauto_internal.f90.

328 logical, save, public:: initialized = .false.

◆ institution_save

character(string), save, public gtool_historyauto_internal::institution_save

Definition at line 119 of file gtool_historyauto_internal.f90.

119 character(STRING), save, public:: institution_save

◆ interval_time_vars

real(dp), dimension(1:max_vars), save, public gtool_historyauto_internal::interval_time_vars

Definition at line 211 of file gtool_historyauto_internal.f90.

211 real(DP), save, public:: interval_time_vars(1:MAX_VARS)

◆ interval_unitsym_vars

integer, dimension(1:max_vars), save, public gtool_historyauto_internal::interval_unitsym_vars

Definition at line 214 of file gtool_historyauto_internal.f90.

214 integer, save, public:: interval_unitsym_vars(1:MAX_VARS)

◆ max_dims_depended_by_var

integer, parameter, public gtool_historyauto_internal::max_dims_depended_by_var = 7

Definition at line 107 of file gtool_historyauto_internal.f90.

107 integer, parameter, public:: MAX_DIMS_DEPENDED_BY_VAR = 7

◆ max_remainder_range

real(dp), parameter, public gtool_historyauto_internal::max_remainder_range = 1.0e-3_DP

Definition at line 112 of file gtool_historyauto_internal.f90.

112 real(DP), parameter, public:: max_remainder_range = 1.0e-3_dp

◆ max_vars

integer, parameter, public gtool_historyauto_internal::max_vars = NF90_MAX_VARS

Definition at line 186 of file gtool_historyauto_internal.f90.

186 integer, parameter, public:: MAX_VARS = nf90_max_vars

◆ newfile_createtime_vars

real(dp), dimension(1:max_vars), save, public gtool_historyauto_internal::newfile_createtime_vars

Definition at line 235 of file gtool_historyauto_internal.f90.

235 real(DP), save, public:: newfile_createtime_vars(1:MAX_VARS)

◆ newfile_inttime_vars

real(dp), dimension(1:max_vars), save, public gtool_historyauto_internal::newfile_inttime_vars

Definition at line 232 of file gtool_historyauto_internal.f90.

232 real(DP), save, public:: newfile_inttime_vars(1:MAX_VARS)

◆ numdims

integer, save, public gtool_historyauto_internal::numdims

Definition at line 87 of file gtool_historyauto_internal.f90.

87 integer, save, public:: numdims

◆ numvars

integer, save, public gtool_historyauto_internal::numvars = 0

Definition at line 102 of file gtool_historyauto_internal.f90.

102 integer, save, public:: numvars = 0

◆ numwgts

integer, save, public gtool_historyauto_internal::numwgts = 0

Definition at line 92 of file gtool_historyauto_internal.f90.

92 integer, save, public:: numwgts = 0

◆ origin_time_vars

real(dp), dimension(1:max_vars), save, public gtool_historyauto_internal::origin_time_vars

Definition at line 223 of file gtool_historyauto_internal.f90.

223 real(DP), save, public:: origin_time_vars(1:MAX_VARS)

◆ output_timing_avr_vars

logical, dimension(1:max_vars, 1:save_tstepnum), save, public gtool_historyauto_internal::output_timing_avr_vars = .false.

Definition at line 208 of file gtool_historyauto_internal.f90.

208 logical, save, public:: output_timing_avr_vars(1:MAX_VARS, 1:save_tstepnum) = .false.

◆ output_timing_vars

logical, dimension(1:max_vars, 1:save_tstepnum), save, public gtool_historyauto_internal::output_timing_vars = .false.

Definition at line 205 of file gtool_historyauto_internal.f90.

205 logical, save, public:: output_timing_vars(1:MAX_VARS, 1:save_tstepnum) = .false.

◆ output_valid_vars

logical, dimension(1:max_vars), save, public gtool_historyauto_internal::output_valid_vars = .false.

Definition at line 192 of file gtool_historyauto_internal.f90.

192 logical, save, public:: output_valid_vars(1:MAX_VARS) = .false.

◆ prev_outtime_vars

real(dp), dimension(1:max_vars), save, public gtool_historyauto_internal::prev_outtime_vars

Definition at line 217 of file gtool_historyauto_internal.f90.

217 real(DP), save, public:: prev_outtime_vars(1:MAX_VARS)

◆ rank_save

character(token), save, public gtool_historyauto_internal::rank_save

Definition at line 122 of file gtool_historyauto_internal.f90.

122 character(TOKEN), save, public:: rank_save

◆ renew_timing_vars

logical, dimension(1:max_vars, 1:save_tstepnum), save, public gtool_historyauto_internal::renew_timing_vars = .false.

Definition at line 201 of file gtool_historyauto_internal.f90.

201 logical, save, public:: renew_timing_vars(1:MAX_VARS, 1:save_tstepnum) = .false.

◆ save_mpi_gather

logical, save, public gtool_historyauto_internal::save_mpi_gather = .false.

Definition at line 175 of file gtool_historyauto_internal.f90.

175 logical, save, public:: save_mpi_gather = .false.

◆ save_mpi_split

logical, save, public gtool_historyauto_internal::save_mpi_split = .false.

Definition at line 174 of file gtool_historyauto_internal.f90.

174 logical, save, public:: save_mpi_split = .false.

◆ save_tstepnum

integer, parameter, public gtool_historyauto_internal::save_tstepnum = 1

Definition at line 128 of file gtool_historyauto_internal.f90.

128 integer, parameter, public:: save_tstepnum = 1

◆ saved_time

real(dp), dimension(1:save_tstepnum), save, public gtool_historyauto_internal::saved_time

Definition at line 131 of file gtool_historyauto_internal.f90.

131 real(DP), save, public:: saved_time(1:save_tstepnum)

◆ saved_tstep

integer, save, public gtool_historyauto_internal::saved_tstep = 1

Definition at line 138 of file gtool_historyauto_internal.f90.

138 integer, save, public:: saved_tstep = 1

◆ slice_vars

type(slice_info), dimension(1:max_vars), target, save, public gtool_historyauto_internal::slice_vars

Definition at line 261 of file gtool_historyauto_internal.f90.

261 type(SLICE_INFO), save, target, public:: slice_vars(1:MAX_VARS)

◆ source_save

character(string), save, public gtool_historyauto_internal::source_save

Definition at line 118 of file gtool_historyauto_internal.f90.

118 character(STRING), save, public:: source_save

◆ space_avr_vars

type(space_avr_info), dimension(1:max_vars), target, save, public gtool_historyauto_internal::space_avr_vars

Definition at line 298 of file gtool_historyauto_internal.f90.

298 type(SPACE_AVR_INFO), save, target, public:: space_avr_vars(1:MAX_VARS)

◆ sub_sname

character(*), parameter, public gtool_historyauto_internal::sub_sname = "HistAuto"

Definition at line 330 of file gtool_historyauto_internal.f90.

330 character(*), parameter, public:: sub_sname = "HistAuto"

◆ tavr_vars

logical, dimension(1:max_vars), save, public gtool_historyauto_internal::tavr_vars = .false.

Definition at line 220 of file gtool_historyauto_internal.f90.

220 logical, save, public:: tavr_vars(1:MAX_VARS) = .false.

◆ terminus_time_vars

real(dp), dimension(1:max_vars), save, public gtool_historyauto_internal::terminus_time_vars

Definition at line 226 of file gtool_historyauto_internal.f90.

226 real(DP), save, public:: terminus_time_vars(1:MAX_VARS)

◆ time_unit_bycreate

character(token), save, public gtool_historyauto_internal::time_unit_bycreate = ''

Definition at line 148 of file gtool_historyauto_internal.f90.

148 character(TOKEN), save, public:: time_unit_bycreate = ''

◆ time_unit_suffix

character(string), save, public gtool_historyauto_internal::time_unit_suffix = ''

Definition at line 149 of file gtool_historyauto_internal.f90.

149 character(STRING), save, public:: time_unit_suffix = ''

◆ title_save

character(string), save, public gtool_historyauto_internal::title_save

Definition at line 117 of file gtool_historyauto_internal.f90.

117 character(STRING), save, public:: title_save

◆ varname_vars

character(token), dimension(1:max_vars), save, public gtool_historyauto_internal::varname_vars = ''

Definition at line 190 of file gtool_historyauto_internal.f90.

190 character(TOKEN), save, public:: varname_vars(1:MAX_VARS) = ''

◆ version

character(*), parameter, public gtool_historyauto_internal::version = '$Name: $' // '$Id: gtool_historyauto_internal.rb2f90,v 1.6 2010-07-04 22:01:51 morikawa Exp $'

Definition at line 332 of file gtool_historyauto_internal.f90.

332 character(*), parameter, public:: version = &
333 & '$Name: $' // &
334 & '$Id: gtool_historyauto_internal.rb2f90,v 1.6 2010-07-04 22:01:51 morikawa Exp $'

◆ weight_vars

type(axes_weight), dimension(1:max_vars), target, save, public gtool_historyauto_internal::weight_vars

Definition at line 285 of file gtool_historyauto_internal.f90.

285 type(AXES_WEIGHT), save, target, public:: weight_vars(1:MAX_VARS)

◆ wgtsuf

character(*), parameter, public gtool_historyauto_internal::wgtsuf = '_weight'

Definition at line 97 of file gtool_historyauto_internal.f90.

97 character(*), parameter, public:: wgtsuf = '_weight'

◆ zero_time

real(dp), save, public gtool_historyauto_internal::zero_time

Definition at line 241 of file gtool_historyauto_internal.f90.

241 real(DP), save, public:: zero_time