management_initialise Subroutine

public subroutine management_initialise(config_fid, frar, icodes, inum1s, iyr, mb, mhyd, mstruc, nDaysSim, nbyr, neap, sbar, output_path)

Uses

  • proc~~management_initialise~~UsesGraph proc~management_initialise management_initialise module~utilities utilities proc~management_initialise->module~utilities

initialise some required variables


read water transfer control file

read transfer control file and allocate water transfer arrays, pointers, and user-defined data types


read water transfer time series input files

input time series will be converted to daily if necessary and stored in TWU%data and wamTSub%pSub%Q_min

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: config_fid
real(kind=dp), intent(in), dimension(:, :):: frar
integer, intent(in), dimension(:):: icodes
integer, intent(in), dimension(:):: inum1s
integer, intent(in) :: iyr
integer, intent(in) :: mb
integer, intent(in) :: mhyd
integer, intent(in), dimension(:, :, :):: mstruc
integer, intent(in) :: nDaysSim
integer, intent(in) :: nbyr
integer, intent(in), dimension(:):: neap
real(kind=dp), intent(in), dimension(:):: sbar
character(len=path_max_length), intent(in) :: output_path

Calls

proc~~management_initialise~~CallsGraph proc~management_initialise management_initialise proc~log_info log_info proc~management_initialise->proc~log_info proc~log_debug log_debug proc~management_initialise->proc~log_debug proc~log_create log_create proc~management_initialise->proc~log_create proc~management_read_ctrl management_read_ctrl proc~management_initialise->proc~management_read_ctrl proc~management_read_wu_inout management_read_wu_inout proc~management_initialise->proc~management_read_wu_inout proc~management_route_transfer management_route_transfer proc~management_initialise->proc~management_route_transfer proc~log_message log_message proc~log_info->proc~log_message proc~log_debug->proc~log_message proc~log_str2level log_str2level proc~log_create->proc~log_str2level proc~open_file open_file proc~log_create->proc~open_file proc~management_read_ctrl->proc~log_info proc~management_subbasin_pointer management_subbasin_pointer proc~management_read_ctrl->proc~management_subbasin_pointer proc~log_error log_error proc~management_read_ctrl->proc~log_error proc~input_count_rows input_count_rows proc~management_read_ctrl->proc~input_count_rows proc~read_string_column read_string_column proc~management_read_ctrl->proc~read_string_column proc~read_real_column read_real_column proc~management_read_ctrl->proc~read_real_column proc~input_open_file input_open_file proc~management_read_ctrl->proc~input_open_file proc~management_is_transfer_subbasin management_is_transfer_subbasin proc~management_read_ctrl->proc~management_is_transfer_subbasin proc~management_deallocate_transfer management_deallocate_transfer proc~management_read_ctrl->proc~management_deallocate_transfer proc~management_allocate_transfer management_allocate_transfer proc~management_read_ctrl->proc~management_allocate_transfer proc~read_integer_column read_integer_column proc~management_read_ctrl->proc~read_integer_column proc~management_read_time_series management_read_time_series proc~management_read_wu_inout->proc~management_read_time_series proc~log_error->proc~log_message proc~input_count_rows->proc~log_error proc~open_file->proc~log_error proc~read_string_column->proc~log_error proc~move_lines move_lines proc~read_string_column->proc~move_lines proc~read_csv_item read_csv_item proc~read_string_column->proc~read_csv_item proc~header_column_index header_column_index proc~read_string_column->proc~header_column_index proc~input_error_column_not_found input_error_column_not_found proc~read_string_column->proc~input_error_column_not_found proc~read_real_column->proc~log_error proc~input_type_conversion_error input_type_conversion_error proc~read_real_column->proc~input_type_conversion_error proc~read_real_column->proc~move_lines proc~check_range check_range proc~read_real_column->proc~check_range proc~read_real_column->proc~read_csv_item proc~read_real_column->proc~header_column_index proc~read_real_column->proc~input_error_column_not_found proc~input_open_file->proc~open_file proc~log_write log_write proc~log_message->proc~log_write proc~log_format_message log_format_message proc~log_message->proc~log_format_message proc~management_read_time_series->proc~open_file proc~management_read_time_series->proc~read_real_column proc~management_convert_to_daily management_convert_to_daily proc~management_read_time_series->proc~management_convert_to_daily proc~read_integer_column->proc~log_error proc~read_integer_column->proc~input_type_conversion_error proc~read_integer_column->proc~move_lines proc~check_int_range check_int_range proc~read_integer_column->proc~check_int_range proc~read_integer_column->proc~read_csv_item proc~read_integer_column->proc~header_column_index proc~read_integer_column->proc~input_error_column_not_found proc~to_string to_string proc~log_write->proc~to_string proc~input_type_conversion_error->proc~log_error proc~days_in_month days_in_month proc~management_convert_to_daily->proc~days_in_month proc~check_int_range->proc~log_error proc~out_of_range_error out_of_range_error proc~check_int_range->proc~out_of_range_error proc~log_warn log_warn proc~check_int_range->proc~log_warn proc~date_time_str date_time_str proc~log_format_message->proc~date_time_str proc~colourise colourise proc~log_format_message->proc~colourise proc~check_range->proc~log_error proc~check_range->proc~out_of_range_error proc~check_range->proc~log_warn proc~header_column_index->proc~move_lines proc~header_column_index->proc~input_error_column_not_found proc~input_error_column_not_found->proc~log_error proc~out_of_range_error->proc~log_error proc~out_of_range_error->proc~to_string proc~string_index string_index proc~colourise->proc~string_index proc~is_leap_year is_leap_year proc~days_in_month->proc~is_leap_year proc~log_warn->proc~log_message

Called by

proc~~management_initialise~~CalledByGraph proc~management_initialise management_initialise proc~initialise initialise proc~initialise->proc~management_initialise program~swim swim program~swim->proc~initialise

Contents

Source Code


Source Code

  subroutine management_initialise(config_fid, frar, icodes, inum1s, iyr, mb, mhyd, mstruc, ndayssim, nbyr, neap, sbar, output_path)
    use utilities, only: log_create
    integer, intent(in) :: config_fid
    real(dp), dimension(:, :), intent(in) :: frar
    integer, dimension(:), intent(in) :: icodes
    integer, dimension(:), intent(in) :: inum1s
    integer, intent(in) :: iyr
    integer, intent(in) :: mb
    integer, intent(in) :: mhyd
    integer, dimension(:, :, :), intent(in) :: mstruc
    integer, intent(in) :: nDaysSim
    integer, intent(in) :: nbyr
    integer, dimension(:), intent(in) :: neap
    real(dp), dimension(:), intent(in) :: sbar
    character(len=path_max_length), intent(in) :: output_path
    integer :: i, logicalint

    ! overwrite parameters with user input
    read(config_fid, nml=MANAGEMENT_PARAMETERS)

    if (.not. bWAM_Module) return

    !-------------------------------------------------------
    ! initialise some required variables
    !-------------------------------------------------------
    allocate(wam_y(nDaysSim))
    wam_y = 0
    allocate(wam_d(nDaysSim))
    wam_d = 0
    allocate(wam_plantDemand_summary(nDaysSim))
    wam_plantDemand_summary = 0.
    allocate(wam_irrigationDemand_summary(nDaysSim))
    wam_irrigationDemand_summary = 0.
    allocate(wam_supplied_summary(nDaysSim))
    wam_supplied_summary = 0.

    ! create water users configuration output file
    management_log = log_create(trim(output_path)//'/wam_transfer.log', &
      stdout_level='warn', stderr_level='warn', logfile_level='debug')
    call log_debug('management_initialise', 'Water Management Module logfile: '// &
      management_log%logfile)

    !-------------------------------------------------------
    ! read water transfer control file
    !-------------------------------------------------------
    ! read transfer control file
    ! and allocate water transfer arrays, pointers, and user-defined data types
    call management_read_ctrl(frar, mb, mstruc, nDaysSim, neap, sbar)

    !-------------------------------------------------------
    ! read water transfer time series input files
    !-------------------------------------------------------
    ! input time series will be converted to daily if necessary and
    ! stored in TWU%data and wamTSub%pSub%Q_min
    call management_read_wu_inout(iyr, nDaysSim, nbyr)

    ! Identify hydrograph storage locations of water transfer points (hydrograph storage locations)
    allocate(bWAMHydrograph(mhyd))
    bWAMHydrograph = .false.
    call management_route_transfer(icodes, inum1s, mhyd)
    call log_info("management_initialise", 'Hydrograph storage locations identified', &
      log=management_log)

    do i = 1, mhyd
        if (bWAMHydrograph(i)) then
          logicalint = transfer(bWAMHydrograph(i), logicalint)
          call log_info('management_initialise', ' (HYDST) bWAMHyd', i1=i, int=logicalint, log=management_log)
        end if
    end do

  end subroutine management_initialise