subroutine initialise
use catchment, only : &
bSubcatch, &
catchment_ids, &
catchment_initialise, &
catchment_initialise_parameters, &
da, &
subcatch_id
use crop, only : crop_initialise, crop_read_input, mcrdb
use erosion, only : cvm, erosion_initialise
use evapotranspiration, only : evapotranspiration_initialise, lat
use groundwater, only : groundwater_correct_params, groundwater_initialise
use hydrotope, only : &
frar, &
hydrotope_area, &
hydrotope_ids, &
hydrotope_initialise, &
hydrotope_input_file_id, &
hydrotope_subbasin_id, &
meap, &
mstruc
use input, only : &
get_config_fid, &
input_initialise, &
#ifdef with_netcdf
input_nc_initialise, &
#endif
parse_commandline_arguments, &
print_splash
use landuse, only : LULC, landuse_initialise, nlut
use management, only : management_initialise
use nutrient, only : &
bn1, &
bn2, &
bn3, &
bnu1, &
bnu2, &
bp1, &
bp2, &
bp3, &
bpu1, &
bpu2, &
nutrient_initialise
use output, only : &
output_initialise, &
output_initialise_user_input, &
output_print_variables, &
output_dir
use reservoir, only : reservoir_initialise
use river, only : &
chd, &
chl, &
chn, &
chnn, &
chs, &
chss, &
ovn, &
river_initialise, &
river_initialise_travel_time
use snow, only : snow_initialise
use soil, only : al, amp, avt, ffc, ml, ms, soil_initialise, tc, wft, wi
use subbasin, only : &
flu, &
icodes, &
inum1s, &
mb, &
mch, &
mhyd, &
neap, &
sbar, &
slope_length, &
stp, &
subbasin_ids, &
subbasin_initialise, &
subbasin_initialise_area, &
subbasin_initialise_weather_gen, &
subbasin_input_file_id, &
tp5, &
tp6
use time, only : iyr, nbyr, nc, ndayssim, time_initialise
use utilities, only : log_info, identifier_max_length
use vegetation, only : vegetation_initialise
character(len=identifier_max_length) :: print_defaults
logical :: print_output_variables
call parse_commandline_arguments(version, print_output_variables, print_defaults)
if (trim(print_defaults) /= '') call print_module_parameters(print_defaults)
call print_splash(version)
! Utility modules
call input_initialise
call output_initialise_user_input
! Space-time modules
call time_initialise
call subbasin_initialise
call hydrotope_initialise(mb, neap, sbar)
call catchment_initialise(sbar, flu)
! Process modules
call landuse_initialise
call river_initialise(mb, mch, mhyd, subbasin_input_file_id)
call soil_initialise(mb, meap, mstruc, neap, bSubcatch, da, slope_length, stp, ovn, chs, flu, chn, chl, LULC%cn2a, LULC%cn2b, LULC%cn2c, LULC%cn2d)
call crop_initialise(iyr, mb, meap, ms, nbyr)
call erosion_initialise(mb, mcrdb, meap, subbasin_input_file_id, da, flu, stp, slope_length, tc, tp6, tp5, al, chl, chnn, chd, chss)
call nutrient_initialise(mb, mcrdb, meap, ml)
call evapotranspiration_initialise(mb, meap, subbasin_input_file_id)
call vegetation_initialise(mb, nlut, mcrdb, meap, lat)
call crop_read_input(bn1, bn2, bn3, bnu1, bnu2, bp1, bp2, bp3, bpu1, bpu2, cvm)
call groundwater_initialise(mb, subbasin_input_file_id)
call reservoir_initialise(icodes, inum1s, mb, mhyd)
call snow_initialise(mb, meap, subbasin_input_file_id, mstruc)
call management_initialise(get_config_fid(), frar, icodes, inum1s, iyr, &
mb, mhyd, mstruc, ndayssim, nbyr, neap, sbar, output_dir)
! Preprocessing that depends on many modules input data (could likely be detangled)
call catchment_initialise_parameters(mb, nbyr, sbar)
call river_initialise_travel_time(mb)
call subbasin_initialise_area(da)
call groundwater_correct_params
call subbasin_initialise_weather_gen(amp, avt, ffc, lat, nc, wft, wi)
! open ncdf climate files and initialise module
#ifdef with_netcdf
call input_nc_initialise(iyr, mb)
#endif
call output_initialise( &
hydrotope_ids, hydrotope_area, hydrotope_subbasin_id, subbasin_ids, neap, &
subcatch_id, catchment_ids, hydrotope_input_file_id, subbasin_input_file_id)
call log_info('swim', 'MAX number of soil layers =', int=ml)
call log_info('swim', 'MAX number of simulation years =', int=nbyr)
call log_info('swim', 'Number of years of simulation =', int=nbyr)
call log_info('swim', 'First year =', int=iyr)
call log_info('swim', 'Number of subbasins =', int=mb)
call log_info('swim', 'Number of soil types =', int=ms)
call log_info('swim', 'Number of crops in crop DB =', int=mcrdb)
call log_info('swim', 'Number of land use types =', int=nlut)
call log_info('swim', 'Program codes & Routing structure files - READ!')
if (print_output_variables) call output_print_variables
end subroutine initialise