soil_initialise Subroutine

public subroutine soil_initialise(mb, meap, mstruc, neap, bSubcatch, da, slope_length, stp, ovn, chs, flu, chn, chl, cn2a, cn2b, cn2c, cn2d)

Uses

  • proc~~soil_initialise~~UsesGraph proc~soil_initialise soil_initialise module~input input proc~soil_initialise->module~input module~utilities utilities proc~soil_initialise->module~utilities module~output output proc~soil_initialise->module~output module~input->module~utilities module~output->module~utilities

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: mb
integer, intent(in) :: meap
integer, intent(in), dimension(:, :, :):: mstruc
integer, intent(inout) :: neap(:)
logical, intent(in) :: bSubcatch
real(kind=dp), intent(in) :: da
real(kind=dp), intent(in) :: slope_length(:)
real(kind=dp), intent(in) :: stp(:)
real(kind=dp), intent(in) :: ovn(mb)
real(kind=dp), intent(in) :: chs(mb)
real(kind=dp), intent(in) :: flu(mb)
real(kind=dp), intent(in) :: chn(mb)
real(kind=dp), intent(in) :: chl(2,mb)
real(kind=dp), intent(in), dimension(:):: cn2a
real(kind=dp), intent(in), dimension(:):: cn2b
real(kind=dp), intent(in), dimension(:):: cn2c
real(kind=dp), intent(in), dimension(:):: cn2d

Calls

proc~~soil_initialise~~CallsGraph proc~soil_initialise soil_initialise proc~soil_allocate soil_allocate proc~soil_initialise->proc~soil_allocate proc~log_error log_error proc~soil_initialise->proc~log_error proc~input_count_rows input_count_rows proc~soil_initialise->proc~input_count_rows proc~log_debug log_debug proc~soil_initialise->proc~log_debug proc~output_register_hydrotope_var output_register_hydrotope_var proc~soil_initialise->proc~output_register_hydrotope_var proc~get_config_fid get_config_fid proc~soil_initialise->proc~get_config_fid proc~input_open_file input_open_file proc~soil_initialise->proc~input_open_file proc~soil_read_input soil_read_input proc~soil_initialise->proc~soil_read_input proc~random_n random_n proc~soil_initialise->proc~random_n proc~log_message log_message proc~log_error->proc~log_message proc~input_count_rows->proc~log_error proc~log_debug->proc~log_message proc~output_register_var output_register_var proc~output_register_hydrotope_var->proc~output_register_var proc~open_file open_file proc~get_config_fid->proc~open_file proc~input_open_file->proc~open_file proc~soil_read_input->proc~log_error proc~soil_read_input->proc~log_debug proc~log_info log_info proc~soil_read_input->proc~log_info proc~to_string to_string proc~soil_read_input->proc~to_string proc~check_range check_range proc~soil_read_input->proc~check_range proc~soil_read_input->proc~open_file proc~read_string_column read_string_column proc~soil_read_input->proc~read_string_column float float proc~random_n->float proc~log_info->proc~log_message proc~output_register_var->proc~log_error proc~string_index string_index proc~output_register_var->proc~string_index proc~check_range->proc~log_error proc~out_of_range_error out_of_range_error proc~check_range->proc~out_of_range_error proc~log_warn log_warn proc~check_range->proc~log_warn 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~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~log_write->proc~to_string proc~out_of_range_error->proc~log_error proc~out_of_range_error->proc~to_string 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~header_column_index->proc~move_lines proc~header_column_index->proc~input_error_column_not_found proc~log_warn->proc~log_message proc~input_error_column_not_found->proc~log_error proc~colourise->proc~string_index

Called by

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

Contents

Source Code


Source Code

  subroutine soil_initialise(mb, meap, mstruc, neap, bSubcatch, da, slope_length, stp, ovn, chs, flu, chn, chl, cn2a, cn2b, cn2c, cn2d)
    use input, only : input_open_file, input_count_rows, get_config_fid
    use output, only : output_register_hydrotope_var
    use utilities, only : log_error, random_n
    integer, intent(in) :: mb, meap
    integer, dimension(:, :, :), intent(in) :: mstruc
    integer, intent(inout) :: neap(:)
    logical, intent(in) :: bSubcatch
    real(dp), intent(in) :: da
    real(dp), intent(in) :: slope_length(:)
    real(dp), intent(in) :: stp(:)
    real(dp), intent(in) :: ovn(mb)
    real(dp), intent(in) :: chs(mb)
    real(dp), intent(in) :: flu(mb)
    real(dp), intent(in) :: chn(mb)
    real(dp), intent(in) :: chl(2, mb)
    real(dp), dimension(:), intent(in) :: cn2a, cn2b, cn2c, cn2d

    integer j
    real(dp) ot, ct

    read(get_config_fid(), SOIL_PARAMETERS)

    if (bSubcatch .AND. icn == 1) call log_error("soil_initialise", &
      "Inconsistency in .bsn input file: "// &
      "Switch icn is set to 1 and subcatchment calibration is switched ON. "// &
      "Either set icn = 0 or deactivate subcatchment calibration.")
    if (isc.eq.0) call log_debug("soil_initialise", 'Codes: SC - read, isc =', int=isc)
    if (isc.eq.1) call log_debug("soil_initialise", 'Codes: SC - calculated, isc =', int=isc)
    if (icn.eq.0) call log_debug("soil_initialise", 'Codes: CN - standard, icn =', int=icn)
    if (icn.eq.1) call log_debug("soil_initialise", 'Codes: CN = f(cnum1, cnum3), icn =', int=icn)

    surface_runoff_output_id = output_register_hydrotope_var("surface_runoff", .False.)
    subsurface_runoff_output_id = output_register_hydrotope_var("subsurface_runoff", .False.)
    percolation_output_id = output_register_hydrotope_var("percolation", .False.)
    soil_water_index_output_id = output_register_hydrotope_var("soil_water_index", .False.)

    soil_input_file_id = input_open_file(soil_input_file)
    ! **** count number of soils used in simulation (soil.cio)
    msdb = input_count_rows(soil_input_file_id, .true.) ! if soil parms read from single soil files then no header
    ms = msdb

    call soil_allocate(mb, meap)
    call soil_read_input(mb, mstruc, neap, cn2a, cn2b, cn2c, cn2d)

    !**** COMPUTE TIME OF CONCENTRATION for basins tc()
    do j = 1, mb
      ot = .0556 * (slope_length(j) * ovn(j)) ** .6 / stp(j) ** .3
      ct = .62 * chl(1, j) * chn(j) ** .75 / ((da * flu(j)) ** .125 * chs(j) ** .375)
      tc(j) = ot + ct
    end do

    rn1 = random_n(k7)

  end subroutine soil_initialise