3 use iso_c_binding,
only : c_bool, c_float, c_int, c_double
53 integer (c_int),
intent(in) :: number_of_simulations
56 integer (c_int) :: length
57 integer (c_int) :: indx
59 length =
size( cells%soil_storage, 1)
67 allocate(
fog_per_sim(length, number_of_simulations))
78 if (
associated(cells%snow_storage))
then
79 do indx=1,number_of_simulations
82 deallocate(cells%snow_storage)
85 if (
associated(cells%soil_storage))
then
86 do indx=1,number_of_simulations
89 deallocate(cells%soil_storage)
92 if (
associated(cells%surface_storage))
then
93 do indx=1,number_of_simulations
96 deallocate(cells%surface_storage)
99 if (
associated(cells%interception_storage))
then
100 do indx=1,number_of_simulations
103 deallocate(cells%interception_storage)
106 if (
associated(cells%net_infiltration))
then
107 do indx=1,number_of_simulations
110 deallocate(cells%net_infiltration)
113 if (
associated(cells%actual_et))
then
114 do indx=1,number_of_simulations
117 deallocate(cells%actual_et)
120 if (
associated(cells%fog))
then
121 do indx=1,number_of_simulations
124 deallocate(cells%fog)
136 integer (c_int),
intent(inout) :: number_of_simulations
139 integer (c_int) :: sim_number
154 call cells%update_landuse_codes()
156 do sim_number=1,number_of_simulations
161 call cells%get_weather_data( )
163 if (sim_number==1)
then
164 call logs%write(
"Calculating: "//
sim_dt%curr%prettydate(), &
166 write(*,
"(a,i0,a)", advance=
"no")
" running ",number_of_simulations, &
170 write(*,fmt=
"(a)", advance=
"no")
"."
187 call cells%dump_variables( )
227 integer (c_int),
intent(in) :: simulation_number
230 integer (c_int) :: month
232 month =
sim_dt%curr%iMonth
234 if (simulation_number == 1) &
239 + cells%net_infiltration
242 + real(cells%actual_et, c_float)
260 integer (c_int),
intent(in) :: number_of_simulations
263 real (c_float) :: number_of_simulation_days
264 integer (c_int) :: month
265 character (len=256) :: filename, file_suffix
266 integer (c_int) :: start_year, end_year
267 integer (c_int) :: nx, ny
268 character (len=3) :: month_abbrev
270 type (GENERAL_GRID_T),
pointer :: pTempGrid
272 start_year =
sim_dt%start%iYear
273 end_year =
sim_dt%end%iYear
274 nx = cells%number_of_columns
275 ny = cells%number_of_rows
277 file_suffix =
"__"//trim(
ascharacter(number_of_simulations))//
"-simulations__" &
281 ptempgrid =>
grid_create( inx=cells%number_of_columns, iny=cells%number_of_rows, &
282 rx0=cells%X_ll, ry0=cells%Y_ll, &
287 number_of_simulation_days = real(
sim_dt%end -
sim_dt%start + 1.0, c_float)
291 month_abbrev =
months(month)%sName
303 / real(number_of_simulations, c_float) &
304 * real(
months(month)%iNumDays, c_float) &
308 / real(number_of_simulations, c_float) &
309 * real(
months(month)%iNumDays, c_float) &
313 / real(number_of_simulations, c_float) &
314 * real(
months(month)%iNumDays, c_float) &
318 filename =
"MEAN_MONTHLY_SUM-"//trim(month_abbrev)//
"__actual_evapotranspiration"//trim(file_suffix)
322 filename =
"MEAN_MONTHLY_SUM-"//trim(month_abbrev)//
"__net_infiltration"//trim(file_suffix)
326 filename =
"MEAN_MONTHLY_SUM-"//trim(month_abbrev)//
"__rainfall"//trim(file_suffix)
332 / real(number_of_simulations, c_float) &
334 / real(number_of_simulation_days, c_float)
337 / real(number_of_simulations, c_float) &
339 / real(number_of_simulation_days, c_float)
342 / real(number_of_simulations, c_float) &
344 / real(number_of_simulation_days, c_float)
347 filename =
"MEAN_ANNUAL_SUM__actual_evapotranspiration"//trim(file_suffix)
351 filename =
"MEAN_ANNUAL_SUM__net_infiltration"//trim(file_suffix)
355 filename =
"MEAN_ANNUAL_SUM__rainfall"//trim(file_suffix)
This module contains physical constants and convenience functions aimed at performing unit conversion...
logical(c_bool), parameter, public true
type(bounds_t), public bnds
subroutine, public perform_daily_calculation(cells)
This module contains the DATETIME_T class and associated time and date-related routines,...
type(month_t), dimension(12), target, public months
Month information.
Provides support for input and output of gridded ASCII data, as well as for creation and destruction ...
subroutine, public grid_destroy(pgrd)
subroutine, public grid_writearcgrid(sfilename, pgrd)
subroutine, public grid_set_nodata_value(pgrd, ivalue, fvalue)
integer(c_int), parameter, public grid_datatype_real
type(logfile_t), public logs
subroutine, public iterate_over_multiple_simulation_days(cells, number_of_simulations)
real(c_float), dimension(:,:), allocatable monthly_actual_et_stats
subroutine allocate_space_for_simulation_storage_state_variables(cells, number_of_simulations)
real(c_float), dimension(:,:), allocatable monthly_rainfall_stats
real(c_float), dimension(:), allocatable annual_net_infiltration_stats
real(c_float), dimension(:), allocatable annual_actual_et_stats
real(c_float), dimension(:,:), allocatable, target net_infiltration_per_sim
real(c_double), dimension(:,:), allocatable, target actual_et_per_sim
subroutine finalize_accumulators(cells, number_of_simulations)
real(c_float), dimension(:,:), allocatable, target fog_per_sim
real(c_float), dimension(:), allocatable annual_rainfall_stats
real(c_double), dimension(:,:), allocatable, target soil_moisture_storage_per_sim
real(c_float), dimension(:,:), allocatable, target interception_storage_per_sim
real(c_float), dimension(:,:), allocatable monthly_net_infiltration_stats
subroutine update_accumulators(cells, simulation_number)
subroutine reset_monthly_accumulators()
real(c_float), dimension(:,:), allocatable, target snow_storage_per_sim
real(c_double), dimension(:,:), allocatable, target surface_storage_per_sim
integer(c_int), dimension(12) day_count_by_month
subroutine reset_annual_accumulators()
subroutine write_output(cells)
subroutine write_multi_sim_output(cells, simulation_number)
type(output_specs_t), dimension(ncdf_num_outputs) outspecs
subroutine initialize_output(cells)
subroutine initialize_multiple_sim_output(cells, number_of_simulations)
Module precipitation__method_of_fragments provides support for creating synthetic daily precipitation...
integer(c_int), public simulation_number
Module variable indicating which "simulation number" is active Only has meaning if the rainfall fragm...
type(date_range_t), public sim_dt