validate_time_varying_inputs
!
!NOTE: THIS IS A PRIVATE SUBROUTINE.
!
subroutine validate_time_varying_inputs &
(gas, base_time, base_value, specification_type, &
change_rate, gas_dataset_entry, &
negative_offset_gas, Gas_offset, Gas_entry, &
variation_type, Gas_time_list, gas_value)
!---------------------------------------------------------------------
! validate_time_varying_inputs checks for consistency among the
! namelist parameters defining the time variation of the input gas.
!--------------------------------------------------------------------
character(len=*), intent(in) :: gas
integer, dimension(6), intent(in) :: base_time, gas_dataset_entry
real, intent(in) :: base_value, &
change_rate
logical, intent(inout) :: negative_offset_gas
character(len=*), intent(in) :: specification_type, variation_type
type(time_type),dimension(:), intent(inout) :: Gas_time_list
type(time_type), intent(inout) :: Gas_offset, Gas_entry
real, dimension(:), intent(in) :: gas_value
!--------------------------------------------------------------------
! local variables:
integer :: n
call validate_time_varying_inputs & (gas, base_time, base_value, specification_type, & change_rate, variation_type, Gas_time_list, & gas_value)
-
DESCRIPTION
- Subroutine validate_time_varying_inputs performs the following
checks of the namelist variables:
1) Verifies that base_time has a non-zero month and day number,
indicating a change from the default;
2) Verifies that the base value of gas mixing ratio is non-zero;
3) Verifies that specification_type is valid, either
'base_and_trend' or 'time_series';
4) Verifies that variation_type is valid, either 'linear' or
'logarithmic';
5) When specification_type is 'base_and_trend', verifies that
change_rate is non-zero;
-
INPUT
-
gas | name associated with the current gas |
base_time | time at which the base_value is applicable
[ year, month, day, hour, minute, second ] |
base_value | base value for vol. mixing ratio of gas
[ number / number ] |
specification_type | specification of form of time variation of gas |
change_rate | rate of change of gas; 1.00 + [ percent change / year ] |
variation_type | form of the temporal behavior of gas; either 'linear' or
'logarithmic' |
gas_value | array of values of gas concentrations corresponding to the times
in Gas_time_list [ number / number ] |
-
INPUT/OUTPUT
-
Gas_time_list | array of time_type variables defining the data times for the gas;
if specification_type is timeseries, then it is the set of times
in the daa set, if specification type is base_and_trend, then it
is an array of dimension 1 containing the xxx_base_time.
[ time_type ] |
define_gas_amount
!
!NOTE: THIS IS A PRIVATE SUBROUTINE>
!
subroutine define_gas_amount &
(gas, Rad_time, gas_specification_type, &
! negative_offset_gas, Gas_offset, gas_variation_type, &
gas_variation_type, &
gas_floor, gas_ceiling, rgas, gas_uses_tfs, gas_change_rate, &
rrvgas, Gas_time_list, gas_value, gas_tf_calc_intrvl, &
gas_tf_time_displacement, calc_gas_tfs_on_first_step, &
calc_gas_tfs_monthly, &
use_current_gas_for_tf, gas_tf_offset, gas_for_last_tf_calc, &
gas_for_next_tf_calc, gas_tfs_needed, &
define_gas_for_last_tf_calc)
!--------------------------------------------------------------------
character(len=*), intent(in) :: gas
type(time_type), intent(in) :: Rad_time
character(len=*), intent(in) :: gas_specification_type,&
gas_variation_type
real, intent(in) :: gas_floor, gas_ceiling,&
rgas
logical, intent(in) :: gas_uses_tfs
!logical, intent(in) :: negative_offset_gas
real, intent(inout) :: gas_change_rate, rrvgas
type(time_type), dimension(:), intent(in) :: Gas_time_list
!type(time_type), intent(inout) :: Gas_offset
real, dimension(:), intent(in) :: gas_value
real, intent(in), optional :: gas_tf_calc_intrvl, &
gas_tf_time_displacement
logical, intent(in), optional :: &
gas_tfs_needed, &
calc_gas_tfs_on_first_step, &
calc_gas_tfs_monthly, &
use_current_gas_for_tf
real, intent(out), optional :: gas_tf_offset, &
gas_for_last_tf_calc, &
gas_for_next_tf_calc
logical, intent(inout), optional :: &
define_gas_for_last_tf_calc
!---------------------------------------------------------------------
! local variables:
type(time_type) :: Gas_yrs
integer :: days, seconds
real :: years_of_gas, years_of_gas_till_next
integer :: days2, seconds2
integer :: days3, seconds3
real :: mean_days, calc_time
character(len=16) :: chvers7, chvers8, chvers9, chvers11
integer :: alarm, minutes_from_start
integer :: dum, year
real :: percent_of_period
type(time_type) :: Tf_offset, Tf_calc_intrvl
real :: rseconds3
integer :: index1, index2
integer :: yr, mo, dy, hr, mn, sc
integer :: days7, seconds7
type(time_type) :: Tf_displ, First_of_month, Gas_tf_next, &
Time_left
!---------------------------------------------------------------------
! local variables:
!
! Gas_yrs time interval from start of time variation
! until current time [ time_type ]
! days days component of Gas_yrs [ days ]
! seconds seconds component of Gas_yrs [ seconds ]
! minutes_from_start time interval from start of time variation
! until current time [ minutes ]
! years_of_gas time interval from start of time variation
! until current time [ years ]
! years_of_gas_till_next time interval from start of time variation
! until next tf calculation [ years ]
! days2 days component of the mean length of year
! time_type variable [ days ]
! seconds2 seconds component of the mean length of
! year time_type variable [ seconds ]
! mean_days average number of days in a year [ days ]
! calc_time time at which tfs were last calculated
! [ years from start of gas time variation ]
! chvers7 character variable used to output model
! variables through error_mesg interface
! chvers8 character variable used to output model
! variables through error_mesg interface
! chvers9 character variable used to output model
! variables through error_mesg interface
! chvers11 character variable used to output model
! variables through error_mesg interface
! alarm time since last tf calculation until
! current time [ minutes ]
!
!--------------------------------------------------------------------
! type(time_type) :: Gas_time ! time for which gas data is desired
call define_gas_amount & (gas, Rad_time, gas_specification_type, gas_variation_type, & gas_floor, gas_ceiling, rgas, gas_uses_tfs, gas_change_rate, & rrvgas, Gas_time_list, gas_value, gas_tf_calc_intrvl, & gas_tf_time_displacement, calc_gas_tfs_on_first_step, & use_current_gas_for_tf, gas_tf_offset, gas_for_last_tf_calc, & gas_for_next_tf_calc, define_gas_for_last_tf_calc)
-
DESCRIPTION
- define_gas_amount performs the following actions:
1) checks for the presence of needed optional arguments;
2) determines how long the gas has been varying with time;
3) calculates values for the gas mixing ratio at the current time;
4) constrains calculated gas values to lie between the
specified floor and ceiling;
if transmission functions are calculated for the gas, then:
1) it is determined if the gas value used when the tfs were last
calculated is needed;
2) if the gas does not use its current value at the time when tfs
are calculated, the offset from the current time to the time
used for tfs is obtained;
3) if the gas value used when the tfs were last calculated is
needed, it is calculated along with the time offset of that
time from the present time;
4) if the gas value at the time when the tfs are next to be cal-
culated is needed, it is calculated;
5) gas values relevant at the time when tfs are next to be
calculated are constrained to lie between the specified floor
and ceiling;
-
INPUT
-
gas | character string associated with the gas being processed |
Rad_time | time at which radiation calculation is to apply |
gas_specification_type | indicator as to the form of time variation of vol. mixing ratio;
either 'base_and_trend' or 'time_series'. |
gas_variation_type | indicator as to the form of time variation of the vol. mixing ratio
of gas; either 'linear' or 'logarithmic' |
gas_floor | smallest value allowed for gas xxx vol. mixing ratio [ no. / no. ] |
gas_ceiling | largest value allowed for gas xxx vol. mixing ratio [ no. / no. ] |
rgas | initially specified gas mixing ratio [ no. / no. ] |
gas_uses_tfs | this gas has transmission functions associated with it ? |
Gas_time_list | list of times in gas timeseries [ time_type ] |
gas_value | gas concentrations [ no. / no. ] associated with the times
in Gas_time_list |
gas_tf_calc_intrvl | time interval between calculating gas tfs [ hours ]
OPTIONAL: present only when the gas has tfs associated with it |
gas_tf_time_displacement | time displacement from present to the time at which gas values are
to be used in the calculation of tfs. may be <0, ==0, or > 0.
[ hours ]
OPTIONAL: present only when the gas has tfs associated with it, only
used when calc_gas_tfs_on_first_step is .true. |
calc_gas_tfs_on_first_step | if true, tfs are calculated ONLY on the first time step of a run,
using gas mixing ratios valid gas_tf_time_displacement hours from
the start time
OPTIONAL: present only when the gas has tfs associated with it |
use_current_gas_for_tf | if true, the gas mixing ratio at the current time is used to cal-
culate the gas tfs
OPTIONAL: present only when the gas has tfs associated with it |
-
INPUT/OUTPUT
-
gas_change_rate | time rate of change of gas xxx vol. mixing ratio
[ 1 +/- % per year ] |
rrvgas | gas mixing ratio at current time [ no. / no. ] |
define_gas_for_last_tf_calc | logical indicating if the gas value used for the last tf calculation
must be obtained |
-
OUTPUT
-
gas_tf_offset | time between last tf calculation and present [ hours ]
OPTIONAL: present only when the gas has tfs associated with it |
gas_for_last_tf_calc | value of gas mixing ratio used in last tf calculation [ no. / no. ]
OPTIONAL: present only when the gas has tfs associated with it |
gas_for_next_tf_calc | value of gas mixing ratio to be used in next tf calculation
OPTIONAL: present only when the gas has tfs associated with it
[ no. / no. ] |