33 character (len=:),
allocatable :: proj4_string
34 integer (c_int) :: number_of_columns
35 integer (c_int) :: number_of_rows
36 real (c_double) :: x_ll, y_ll
37 real (c_double) :: x_ur, y_ur
38 real (c_double),
allocatable :: x(:), y(:)
39 real (c_double),
allocatable :: x_lon(:,:), y_lat(:,:)
40 real (c_double) :: gridcellsize
42 logical (c_bool),
allocatable :: active(:,:)
43 real (c_float),
allocatable :: nodata_fill_value(:,:)
44 real (c_float),
allocatable :: array_output(:,:)
46 integer (c_int),
allocatable :: landuse_code(:)
47 integer (c_int),
allocatable :: landuse_index(:)
48 integer (c_int),
allocatable :: soil_code(:)
49 integer (c_int),
allocatable :: soil_group(:)
50 integer (c_int),
allocatable :: num_upslope_connections(:)
51 integer (c_int),
allocatable :: sum_upslope_cells(:)
53 integer (c_int),
allocatable :: col_num_2d(:,:)
54 integer (c_int),
allocatable :: row_num_2d(:,:)
56 integer (c_int),
allocatable :: col_num_1d(:)
57 integer (c_int),
allocatable :: row_num_1d(:)
59 real (c_float),
allocatable :: pervious_fraction(:)
60 real (c_float),
allocatable :: canopy_cover_fraction(:)
61 real (c_float),
allocatable :: awc(:)
62 real (c_float),
allocatable :: curve_num_adj(:)
63 real (c_float),
allocatable :: gdd(:)
64 real (c_float),
allocatable :: crop_coefficient_kcb(:)
65 real (c_double),
allocatable :: surf_evap_coef_ke(:)
66 real (c_double),
allocatable :: plant_stress_coef_ks(:)
67 real (c_double),
allocatable :: evap_reduction_coef_kr(:)
68 real (c_double),
allocatable :: total_available_water_taw(:)
69 real (c_double),
allocatable :: readily_available_water_raw(:)
72 real (c_float),
allocatable :: cfgi_lower_limit(:)
73 real (c_float),
allocatable :: cfgi_upper_limit(:)
75 real (c_float),
allocatable :: hargreaves_et0_slope(:)
76 real (c_float),
allocatable :: hargreaves_et0_exponent(:)
77 real (c_float),
allocatable :: hargreaves_et0_constant(:)
81 integer (c_int),
allocatable :: polygon_id(:)
82 real (c_float),
allocatable :: latitude(:)
83 real (c_double),
allocatable :: reference_et0(:)
84 real (c_float),
allocatable :: crop_etc(:)
86 real (c_double),
allocatable :: actual_et_interception(:)
87 real (c_double),
allocatable :: actual_et_impervious(:)
88 real (c_double),
allocatable :: actual_et_soil(:)
89 real (c_double),
pointer :: actual_et(:)
90 real (c_float),
allocatable :: bare_soil_evap(:)
92 real (c_float),
allocatable :: inflow(:)
93 real (c_float),
allocatable :: runon(:)
94 real (c_float),
allocatable :: runoff(:)
95 real (c_float),
allocatable :: monthly_runoff(:)
96 real (c_float),
allocatable :: runoff_outside(:)
97 real (c_float),
allocatable :: outflow(:)
98 real (c_float),
allocatable :: infiltration(:)
99 real (c_float),
allocatable :: potential_snowmelt(:)
100 real (c_float),
allocatable :: snowmelt(:)
102 real (c_float),
allocatable :: interception(:)
103 real (c_float),
pointer :: interception_storage(:)
104 real (c_float),
allocatable :: interception_storage_max(:)
106 real (c_float),
pointer :: snow_storage(:)
107 real (c_double),
pointer :: surface_storage(:)
108 real (c_float),
allocatable :: surface_storage_max(:)
109 real (c_float),
allocatable :: surface_storage_excess(:)
111 real (c_float),
allocatable :: delta_soil_storage(:)
112 real (c_double),
pointer :: soil_storage(:)
113 real (c_float),
allocatable :: soil_storage_max(:)
114 real (c_double),
allocatable :: soil_moisture_deficit(:)
115 real (c_float),
pointer :: net_infiltration(:)
116 real (c_float),
allocatable :: rejected_net_infiltration(:)
117 real (c_float),
allocatable :: direct_net_infiltration(:)
118 real (c_float),
allocatable :: direct_soil_moisture(:)
119 real (c_float),
allocatable :: current_rooting_depth(:)
120 real (c_float),
allocatable :: current_plant_height(:)
121 integer (c_int),
allocatable :: number_of_days_since_planting(:)
122 logical (c_bool),
allocatable :: it_is_growing_season(:)
124 real (c_float),
allocatable :: gross_precip(:)
125 real (c_float),
allocatable :: monthly_gross_precip(:)
126 real (c_float),
pointer :: fog(:)
127 real (c_float),
allocatable :: rainfall(:)
128 real (c_float),
allocatable :: net_rainfall(:)
129 real (c_float),
allocatable :: snowfall(:)
130 real (c_float),
allocatable :: net_snowfall(:)
133 real (c_float),
allocatable :: tmin(:)
134 real (c_float),
allocatable :: tmax(:)
135 real (c_float),
allocatable :: tmean(:)
136 real (c_float),
allocatable :: tmax_minus_tmin(:)
137 real (c_float),
allocatable :: climatic_deficit(:)
139 real (c_float),
allocatable :: routing_fraction(:)
141 integer (c_int),
allocatable :: sort_order(:)
143 real (c_double),
allocatable :: adjusted_depletion_fraction_p(:)
144 real (c_float),
allocatable :: fraction_exposed_and_wetted_soil(:)
146 real (c_float),
allocatable :: evaporable_water_storage(:)
147 real (c_float),
allocatable :: evaporable_water_deficit(:)
151 real (c_float),
allocatable :: irrigation_mask(:)
178 procedure(
array_method ),
pointer :: init_continuous_frozen_ground_index
179 procedure(
array_method ),
pointer :: calc_continuous_frozen_ground_index
201 procedure(
array_method ),
pointer :: calculate_range_in_air_temperature
262 integer (c_int),
intent(in) :: index
267 procedure :: minmaxmean_float
268 procedure :: minmaxmean_int
272 integer (c_int) :: unitnum = 0
273 integer (c_int) :: col = 0
274 integer (c_int) ::
row = 0
275 real (c_float) :: x_coord = 0
276 real (c_float) :: y_coord = 0
277 integer (c_int) :: indx_start = 0
278 integer (c_int) :: indx_end = 0
309 character (len=*),
intent(in) :: output_dir_name
311 this%output_directory_name = output_dir_name
388 integer (c_int),
intent(in) :: iNumCols
389 integer (c_int),
intent(in) :: iNumRows
390 real (c_double),
intent(in) :: dX_ll
391 real (c_double),
intent(in) :: dY_ll
392 real (c_double),
intent(in) :: dGridcellSize
395 integer (c_int) :: iStat
397 this%number_of_columns = inumcols
398 this%number_of_rows = inumrows
401 this%gridcellsize = dgridcellsize
403 allocate(this%active(inumcols, inumrows), stat=istat )
404 call assert (istat == 0,
"Problem allocating memory", __file__, __line__)
406 allocate(this%nodata_fill_value(inumcols, inumrows), stat=istat )
407 call assert (istat == 0,
"Problem allocating memory", __file__, __line__)
409 allocate(this%array_output(inumcols, inumrows), stat=istat )
410 call assert (istat == 0,
"Problem allocating memory", __file__, __line__)
412 allocate(this%col_num_2D(inumcols, inumrows), stat=istat )
413 call assert (istat == 0,
"Problem allocating memory", __file__, __line__)
415 allocate(this%row_num_2D(inumcols, inumrows), stat=istat )
416 call assert (istat == 0,
"Problem allocating memory", __file__, __line__)
419 rx0=dx_ll, ry0=dy_ll, rgridcellsize=dgridcellsize, &
433 integer (c_int) :: iCount
434 integer (c_int) :: iIndex
435 integer (c_int) :: iStat(72)
437 icount = count( this%active )
440 allocate( this%landuse_code(icount), stat=istat(1) )
441 allocate( this%landuse_index(icount), stat=istat(2) )
442 allocate( this%soil_group(icount), stat=istat(3) )
443 allocate( this%num_upslope_connections(icount), stat=istat(4) )
444 allocate( this%sum_upslope_cells(icount), stat=istat(5) )
445 allocate( this%awc(icount), stat=istat(6) )
446 allocate( this%latitude(icount), stat=istat(7) )
447 allocate( this%reference_ET0(icount), stat=istat(8) )
448 allocate( this%actual_ET(icount), stat=istat(9) )
449 allocate( this%inflow(icount), stat=istat(10))
450 allocate( this%runon(icount), stat=istat(11) )
451 allocate( this%runoff(icount), stat=istat(12) )
452 allocate( this%outflow(icount), stat=istat(13) )
453 allocate( this%infiltration(icount), stat=istat(14) )
454 allocate( this%snowfall(icount), stat=istat(15) )
455 allocate( this%snowmelt(icount), stat=istat(16) )
456 allocate( this%interception(icount), stat=istat(17) )
457 allocate( this%rainfall(icount), stat=istat(18) )
458 allocate( this%interception_storage(icount), stat=istat(19) )
459 allocate( this%interception_storage_max(icount), stat=istat(20) )
460 allocate( this%snow_storage(icount), stat=istat(21) )
461 allocate( this%soil_storage(icount), stat=istat(22) )
462 allocate( this%soil_storage_max(icount), stat=istat(23) )
463 allocate( this%net_infiltration(icount), stat=istat(24) )
464 allocate( this%fog(icount), stat=istat(25) )
465 allocate( this%irrigation(icount), stat=istat(26) )
466 allocate( this%sort_order(icount), stat=istat(27) )
467 allocate( this%runoff_outside( icount ), stat=istat(28) )
468 allocate( this%pervious_fraction( icount ), stat=istat(29) )
469 allocate( this%surface_storage( icount ), stat=istat(30) )
470 allocate( this%surface_storage_excess( icount ), stat=istat(31) )
471 allocate( this%surface_storage_max( icount ), stat=istat(32) )
472 allocate( this%storm_drain_capture( icount ), stat=istat(33) )
473 allocate( this%canopy_cover_fraction( icount ), stat=istat(34) )
474 allocate( this%crop_coefficient_kcb( icount ), stat=istat(35) )
475 allocate( this%potential_snowmelt( icount ), stat=istat(36) )
476 allocate( this%continuous_frozen_ground_index( icount ), stat=istat(37) )
477 allocate( this%cfgi_lower_limit( icount), stat=istat(38) )
478 allocate( this%cfgi_upper_limit( icount), stat=istat(39) )
479 allocate( this%rooting_depth_max( icount ), stat=istat(40) )
480 allocate( this%current_rooting_depth( icount ), stat=istat(41) )
481 allocate( this%current_plant_height( icount ), stat=istat(42) )
482 allocate( this%polygon_id( icount ), stat=istat(43) )
483 allocate( this%actual_et_soil( icount ), stat=istat(44) )
484 allocate( this%actual_et_impervious( icount ), stat=istat(45) )
485 allocate( this%actual_et_interception( icount ), stat=istat(46) )
486 allocate( this%adjusted_depletion_fraction_p( icount ), stat=istat(47) )
487 allocate( this%crop_etc( icount ), stat=istat(48) )
488 allocate( this%direct_net_infiltration( icount ), stat=istat(49) )
489 allocate( this%direct_soil_moisture( icount ), stat=istat(50) )
490 allocate( this%number_of_days_since_planting( icount ), stat=istat(51) )
491 allocate( this%col_num_1D( icount ), stat=istat(52) )
492 allocate( this%row_num_1D( icount ), stat=istat(53) )
493 allocate( this%it_is_growing_season( icount ), stat=istat(54) )
494 allocate( this%curve_num_adj( icount ), stat=istat(55) )
495 allocate( this%rejected_net_infiltration( icount ), stat=istat(56) )
496 allocate( this%evap_reduction_coef_kr( icount ), stat=istat(57) )
497 allocate( this%surf_evap_coef_ke( icount ), stat=istat(58) )
498 allocate( this%plant_stress_coef_ks( icount ), stat=istat(59) )
499 allocate( this%total_available_water_taw( icount ), stat=istat(60) )
500 allocate( this%readily_available_water_raw( icount ), stat=istat(61) )
501 allocate( this%bare_soil_evap( icount ), stat=istat(62) )
502 allocate( this%fraction_exposed_and_wetted_soil( icount ), stat=istat(63) )
503 allocate( this%delta_soil_storage( icount ), stat=istat(64) )
504 allocate( this%soil_moisture_deficit( icount ), stat=istat(65) )
505 allocate( this%net_rainfall( icount ), stat=istat(66) )
506 allocate( this%net_snowfall( icount ), stat=istat(67) )
507 allocate( this%evaporable_water_storage( icount ), stat=istat(68) )
508 allocate( this%evaporable_water_deficit( icount ), stat=istat(69) )
509 allocate( this%irrigation_mask( icount ), stat=istat(70) )
510 allocate( this%tmax_minus_tmin( icount ), stat=istat(71) )
511 allocate( this%climatic_deficit( icount ), stat=istat(72) )
513 do iindex = 1, ubound( istat, 1)
514 if ( istat( iindex ) /= 0 )
call warn(
"INTERNAL PROGRAMMING ERROR" &
515 //
"--Problem allocating memory; iIndex=" &
519 if (any( istat /= 0) )
call die (
"Unable to allocate memory for one or more arrays.", &
522 this%landuse_code = 0_c_int
523 this%landuse_index = 0_c_int
524 this%soil_group = 0_c_int
525 this%num_upslope_connections = 0_c_int
526 this%sum_upslope_cells = 0_c_int
527 this%awc = 0.0_c_float
528 this%latitude = 0.0_c_float
529 this%reference_ET0 = 0.0_c_float
530 this%actual_ET = 0.0_c_double
531 this%bare_soil_evap = 0.0_c_float
532 this%inflow = 0.0_c_float
533 this%runon = 0.0_c_float
534 this%runoff = 0.0_c_float
535 this%outflow = 0.0_c_float
536 this%infiltration = 0.0_c_float
537 this%snowfall = 0.0_c_float
538 this%net_snowfall = 0.0_c_float
539 this%snowmelt = 0.0_c_float
541 this%interception = 0.0_c_float
542 this%rainfall = 0.0_c_float
543 this%net_rainfall = 0.0_c_float
544 this%interception_storage = 0.0_c_float
545 this%interception_storage_max = 0.0_c_float
546 this%snow_storage = 0.0_c_float
547 this%soil_storage = 0.0_c_double
548 this%soil_storage_max = 0.0_c_float
549 this%delta_soil_storage = 0.0_c_float
550 this%soil_moisture_deficit = 0.0_c_float
552 this%net_infiltration = 0.0_c_float
553 this%rejected_net_infiltration = 0.0_c_float
554 this%fog = 0.0_c_float
555 this%irrigation = 0.0_c_float
556 this%curve_num_adj = 0.0_c_float
557 this%runoff_outside = 0.0_c_float
558 this%pervious_fraction = 1.0_c_float
559 this%surface_storage = 0.0_c_float
560 this%surface_storage_excess = 0.0_c_float
561 this%surface_storage_max = 0.0_c_float
562 this%storm_drain_capture = 0.0_c_float
563 this%canopy_cover_fraction = 0.0_c_float
564 this%crop_coefficient_kcb = 0.0_c_float
565 this%potential_snowmelt = 0.0_c_float
566 this%continuous_frozen_ground_index = 0.0_c_float
567 this%cfgi_lower_limit = 0.0_c_float
568 this%cfgi_upper_limit = 0.0_c_float
569 this%rooting_depth_max = 0.0_c_float
570 this%current_rooting_depth = 0.0_c_float
571 this%current_plant_height = 0.0_c_float
572 this%polygon_id = 0_c_int
573 this%actual_et_soil = 0.0_c_double
574 this%actual_et_impervious = 0.0_c_double
575 this%actual_et_interception = 0.0_c_double
576 this%adjusted_depletion_fraction_p = 0.0_c_float
577 this%crop_etc = 0.0_c_float
578 this%direct_net_infiltration = 0.0_c_float
579 this%direct_soil_moisture = 0.0_c_float
580 this%number_of_days_since_planting = 0_c_int
581 this%evap_reduction_coef_kr = 1.0_c_float
582 this%surf_evap_coef_ke = 0.0_c_float
583 this%plant_stress_coef_ks = 1.0_c_float
584 this%total_available_water_taw = 0.0_c_float
585 this%readily_available_water_raw = 0.0_c_float
586 this%fraction_exposed_and_wetted_soil = 0.0_c_float
587 this%evaporable_water_storage = 0.0_c_float
588 this%evaporable_water_deficit = 0.0_c_float
589 this%it_is_growing_season =
false
590 this%irrigation_mask = 1.0_c_float
591 this%tmax_minus_tmin = 0.0_c_float
592 this%climatic_deficit = 0.0_c_float
595 this%sort_order( iindex ) = iindex
607 integer (c_int) :: row_num, col_num
608 integer (c_int) :: status
610 do row_num=lbound( this%row_num_2D, 2), ubound( this%row_num_2D, 2)
611 this%row_num_2D( :, row_num ) = row_num
614 do col_num=lbound( this%col_num_2D, 1), ubound( this%col_num_2D, 1 )
615 this%col_num_2D( col_num, : ) = col_num
618 this%col_num_1D = pack( this%col_num_2D, this%active )
619 this%row_num_1D = pack( this%row_num_2D, this%active )
621 deallocate( this%col_num_2D, stat=status )
622 deallocate( this%row_num_2D, stat=status )
631 integer (c_int),
intent(in) :: col_num
632 integer (c_int),
intent(in) :: row_num
633 integer (c_int) :: indexval
636 logical (c_bool) :: found_match
640 do indexval=lbound( this%col_num_1D, 1 ), ubound( this%col_num_1D, 1 )
642 if ( ( this%col_num_1D( indexval ) == col_num ) &
643 .and. ( this%row_num_1D( indexval ) == row_num ) )
then
650 if ( .not. found_match ) indexval = -9999
660 call this%init_interception
662 call this%init_snowfall
664 call this%init_rooting_depth
666 call this%init_snowmelt
670 call this%init_precipitation_data
672 call this%init_runoff
674 call this%init_soil_storage_max
676 call this%init_routing
678 call this%init_actual_et
680 call this%init_reference_et
684 call this%init_irrigation
686 call this%init_direct_net_infiltration
688 call this%init_direct_soil_moisture
690 call this%init_maximum_net_infiltration
692 call this%init_crop_coefficient
703 type (DATA_CATALOG_ENTRY_T),
pointer :: pHSG
704 type (DATA_CATALOG_ENTRY_T),
pointer :: pLULC
705 type (DATA_CATALOG_ENTRY_T),
pointer :: pAWC
706 type (DATA_CATALOG_ENTRY_T),
pointer :: pSoil_Storage_Max
707 type (DATA_CATALOG_ENTRY_T),
pointer :: pD8_FLOWDIR
708 type ( GENERAL_GRID_T ),
pointer :: pTempGrd
710 plulc =>
dat%find(
"LAND_USE")
711 phsg =>
dat%find(
"HYDROLOGIC_SOILS_GROUP")
712 pawc =>
dat%find(
"AVAILABLE_WATER_CONTENT")
713 psoil_storage_max =>
dat%find(
"SOIL_STORAGE_MAX")
714 pd8_flowdir =>
dat%find(
"FLOW_DIRECTION")
716 if( .not.
associated( pawc ) ) pawc =>
dat%find(
"AVAILABLE_WATER_CONTENT")
718 if ( .not.
associated(phsg) ) &
719 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
721 if ( .not.
associated(phsg%pGrdBase) ) &
722 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
724 if ( .not.
allocated(phsg%pGrdBase%iData) ) &
725 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of UNALLOCATED variable", __file__, __line__)
736 if ( .not.
associated(plulc) ) &
737 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
739 if ( .not.
associated(plulc%pGrdBase) ) &
740 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
742 if ( .not.
allocated(plulc%pGrdBase%iData) ) &
743 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of UNALLOCATED variable", __file__, __line__)
745 this%active = .
true._c_bool
747 if (
associated( pd8_flowdir ) )
then
749 call pd8_flowdir%getvalues()
750 where ( pd8_flowdir%pGrdBase%iData < 0 ) this%active = .
false._c_bool
756 if (
associated( pawc) )
then
758 where ( ( phsg%pGrdBase%iData < 1 ) &
759 .or. ( plulc%pGrdBase%iData < 0 ) &
760 .or. ( pawc%pGrdBase%rData < 0.0 ) )
762 this%active = .
false._c_bool
770 where ( ( phsg%pGrdBase%iData < 1 ) &
771 .or. ( plulc%pGrdBase%iData < 0 ) &
774 this%active = .
false._c_bool
779 elseif (
associated( psoil_storage_max ) )
then
781 call psoil_storage_max%getvalues()
783 where ( ( phsg%pGrdBase%iData < 1 ) &
784 .or. ( plulc%pGrdBase%iData < 0 ) &
785 .or. ( psoil_storage_max%pGrdBase%rData < 0.0 ) )
787 this%active = .
false._c_bool
793 call die(
"Failed to find gridded or tabular data to use in initializing " &
794 //
"available water capacity or soil storage.", &
799 call logs%write(
ascharacter(count(this%active))//
" cells are currently active out of a total of " &
803 ptempgrd =>
grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
804 rx0=this%X_ll, ry0=this%Y_ll, &
807 where ( this%active )
808 ptempgrd%iData = 1_c_int
810 ptempgrd%iData = 0_c_int
824 character (len=10) :: date_str
826 plulc =>
dat%find(
"LAND_USE")
828 if (
associated(plulc) )
then
834 call plulc%getvalues(
sim_dt%curr )
836 if ( plulc%lGridHasChanged )
then
837 date_str =
sim_dt%curr%prettydate()
839 //trim(date_str)//
".asc", plulc%pGrdBase )
844 call plulc%getvalues()
845 call grid_writearcgrid(
"Landuse_land_cover__as_read_into_SWB.asc", plulc%pGrdBase )
851 call warn(smessage=
"LAND_USE dataset is flawed or missing.", lfatal=
true, &
852 iloglevel =
log_all, shints=
"Check to see that a valid path and filename have" &
853 //
" been ~included in the control file for the LAND_USE dataset.", &
869 integer (c_int) :: iindex
870 integer (c_int),
allocatable :: ilandusecodes(:)
872 integer (c_int) :: iindex2
873 integer (c_int) :: icount
874 logical (c_bool) :: lmatch
877 call sllist%append(
"LU_Code")
878 call sllist%append(
"LU_code")
879 call sllist%append(
"Landuse_Code")
880 call sllist%append(
"LULC_Code")
883 call params%get_parameters( slkeys=sllist, ivalues=ilandusecodes, lfatal=
true )
885 if (ubound(ilandusecodes,1) <= 1)
then
886 call warn(smessage=
"A lookup table with a only a single entry will not work with swb2.", &
887 shints=
"Please use a lookup table with more than a single line of data.", &
892 plulc =>
dat%find(
"LAND_USE")
894 if (
associated(plulc) )
then
896 if (
associated( plulc%pGrdBase) )
then
897 model%landuse_code = pack( plulc%pGrdBase%iData,
model%active )
899 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
902 call die(
"Attempted use of NULL pointer. Failed to find LAND_USE data element.", &
909 model%landuse_index = -9999
916 if ( all( ilandusecodes >= 0 ) )
then
918 do iindex = 1, ubound(
model%landuse_code,1)
922 do iindex2=1, ubound(ilandusecodes, 1)
924 if (
model%landuse_code(iindex) == ilandusecodes(iindex2) )
then
925 model%landuse_index(iindex) = iindex2
933 if ( .not. lmatch )
then
935 //
" with a corresponding landuse code from lookup tables.", &
936 shints=
"Make sure your lookup table(s) have landuse codes corresponding to all values in " &
940 model%landuse_index(iindex) = 1
944 call logs%write(
"Matches were found between landuse grid value and table value for " &
946 ilinesbefore=1, ilinesafter=1, iloglevel=
log_all)
953 if ( count(
model%landuse_index < 0) > 0 )
then
955 //
" assigned a landuse index value.", lfatal=
true, shints=
"Make sure that you have an " &
956 //
"entry in the landuse lookup table for each unique code contained in your landuse grid." )
998 integer (c_int) :: iJulianDay
999 integer (c_int) ::iMonth
1000 integer (c_int) ::iDay
1001 integer (c_int) ::iYear
1003 associate( dt =>
sim_dt%curr )
1005 ijulianday = dt%getJulianDay()
1006 imonth =
asint( dt%iMonth )
1007 iday =
asint( dt%iDay )
1014 call this%get_precipitation_data()
1015 call this%get_minimum_air_temperature_data()
1016 call this%get_maximum_air_temperature_data()
1018 call this%calculate_mean_air_temperature()
1019 call this%calculate_range_in_air_temperature()
1031 if (.not.
associated( this%init_interception) ) &
1032 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1033 if (.not.
associated( this%calc_interception) ) &
1034 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1036 if (.not.
associated( this%init_irrigation) ) &
1037 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1038 if (.not.
associated( this%calc_irrigation) ) &
1039 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1041 if (.not.
associated( this%init_runoff) ) &
1042 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1043 if (.not.
associated( this%calc_runoff) ) &
1044 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1046 if (.not.
associated( this%init_reference_et) ) &
1047 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1048 if (.not.
associated( this%calc_reference_et) ) &
1049 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1051 if (.not.
associated( this%init_snowmelt) ) &
1052 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1053 if (.not.
associated( this%calc_snowmelt) ) &
1054 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1056 if (.not.
associated( this%init_snowfall) ) &
1057 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1058 if (.not.
associated( this%calc_snowfall) ) &
1059 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1061 if (.not.
associated( this%init_GDD) ) &
1062 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1063 if (.not.
associated( this%calc_GDD) ) &
1064 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1066 if (.not.
associated( this%init_routing) ) &
1067 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1068 if (.not.
associated( this%calc_routing) ) &
1069 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1071 if (.not.
associated( this%init_direct_net_infiltration) ) &
1072 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1073 if (.not.
associated( this%calc_direct_net_infiltration) ) &
1074 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1076 if (.not.
associated( this%init_soil_storage_max) ) &
1077 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1079 if (.not.
associated( this%get_precipitation_data ) ) &
1080 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1082 if (.not.
associated( this%get_minimum_air_temperature_data ) ) &
1083 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1085 if (.not.
associated( this%get_maximum_air_temperature_data ) ) &
1086 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1095 character (len=*),
intent(in) :: sCmdText
1096 type (FSTRING_LIST_T) :: argv_list
1099 integer (c_int) :: indx
1100 integer (c_int) :: iostat
1101 integer (c_int) :: unitnum
1102 character (len=256) :: filename
1103 character (len=:),
allocatable :: Method_Name
1104 character (len=:),
allocatable :: modifier_text
1105 character (len=:),
allocatable :: dump_file_prefix
1106 character (len=:),
allocatable :: temp_str
1107 integer (c_int) :: col, row
1108 integer (c_int) :: indx_start, indx_end
1109 real (c_double) :: xcoord, ycoord
1110 logical (c_bool) :: row_col_num_are_valid
1111 logical (c_bool) :: coordinates_are_valid
1112 logical (c_bool) :: indices_are_valid
1114 method_name = argv_list%get(1)
1116 if ( scmdtext .containssimilar.
"INTERCEPTION" )
then
1118 if ( (method_name .strapprox.
"BUCKET") .or. (method_name .strapprox.
"HORTON"))
then
1123 call logs%WRITE(
"==> BUCKET/HORTON INTERCEPTION submodel selected.", iloglevel = log_all, lecho = false )
1125 elseif ( method_name .strapprox.
"GASH" )
then
1130 call logs%WRITE(
"==> GASH INTERCEPTION submodel selected.", iloglevel = log_all, lecho = false )
1134 call warn(
"Your control file specifies an unknown or unsupported INTERCEPTION method.", &
1135 lfatal = true, iloglevel = log_all, lecho = true )
1139 elseif ( scmdtext .containssimilar.
"RUNOFF" )
then
1141 if ( ( method_name .strapprox.
"C-N" ) .or. ( method_name .strapprox.
"CURVE_NUMBER" ) )
then
1146 call logs%WRITE(
"==> CURVE NUMBER RUNOFF submodel selected.", iloglevel = log_all, lecho = false )
1148 elseif ( ( method_name .strapprox.
"RUNOFF_RATIO" ) .or. ( method_name .strapprox.
"MONTHLY_GRID" ) )
then
1153 call logs%WRITE(
"==> RUNOFF RATIO submodel selected.", iloglevel = log_all, lecho = false )
1157 call warn(
"Your control file specifies an unknown or unsupported RUNOFF method.", &
1158 lfatal = true, iloglevel = log_all, lecho = true )
1162 elseif ( scmdtext .containssimilar.
"ROOTING" )
then
1164 if ( ( method_name .strapprox.
"DYNAMIC" ) .or. ( method_name .strapprox.
"FAO_56" ) &
1165 .or. ( method_name .strapprox.
"FAO-56" ) .or. ( method_name .strapprox.
"FAO56" ) )
then
1169 call logs%WRITE(
"==> DYNAMIC rooting depth submodel selected.", iloglevel = log_all, lecho = false )
1175 call logs%WRITE(
"==> STATIC rooting depth submodel selected.", iloglevel = log_all, lecho = false )
1179 elseif ( scmdtext .containssimilar.
"DYNAMIC_LANDUSE" )
then
1183 elseif ( scmdtext .containssimilar.
"STATIC_LANDUSE" )
then
1187 elseif ( scmdtext .containssimilar.
"SNOWFALL" )
then
1189 if ( ( method_name .strapprox.
"ORIGINAL" ) .or. ( method_name .strapprox.
"ORIGINAL_SWB_METHOD" ) )
then
1194 call logs%WRITE(
"==> ORIGINAL SNOWFALL submodel selected.", iloglevel = log_all, lecho = false )
1196 elseif ( method_name .strapprox.
"PRMS" )
then
1201 call logs%WRITE(
"==> PRMS SNOWFALL submodel selected.", iloglevel = log_all, lecho = false )
1205 call warn(
"Your control file specifies an unknown or unsupported SNOWFALL method.", &
1206 lfatal = true, iloglevel = log_all, lecho = true )
1210 elseif ( ( scmdtext .containssimilar.
"AVAILABLE_WATER_CONTENT" ) &
1211 .or. ( scmdtext .containssimilar.
"AVAILABLE_WATER_CAPACITY") )
then
1213 if ( ( method_name .strapprox.
"TABLE" ) )
then
1218 call logs%WRITE(
"==> TABLE method for populating AVAILABLE_WATER_CONTENT/AVAILABLE_WATER_CAPACITY selected.", &
1219 iloglevel = log_all, lecho = false )
1221 elseif ( ( method_name .strapprox.
"GRID" ) .or. ( method_name .strapprox.
"GRIDDED" ) )
then
1226 call logs%WRITE(
"==> GRIDDED VALUES method for populating AVAILABLE_WATER_CONTENT/AVAILABLE_WATER_CAPACITY selected.", &
1227 iloglevel = log_all, lecho = false )
1231 call warn(
"Your control file specifies an unknown or unsupported AVAILABLE_WATER_CONTENT/" &
1232 //
"AVAILABLE_WATER_CAPACITY method.", &
1233 lfatal = true, iloglevel = log_all, lecho = true )
1237 elseif ( scmdtext .containssimilar.
"FLOW_ROUTING" )
then
1239 if ( ( method_name .strapprox.
"D8" ) &
1240 .or. ( method_name .strapprox.
"DOWNHILL" ) )
then
1245 call logs%WRITE(
"==> D8 FLOW ROUTING submodel selected.", iloglevel = log_all, lecho = false )
1252 call logs%WRITE(
"==> NULL FLOW ROUTING submodel selected -- NO routing will be performed.", &
1253 iloglevel = log_all, lecho = false )
1257 elseif ( ( scmdtext .containssimilar.
"CROP_COEFFICIENT" ) &
1258 .or. ( scmdtext .containssimilar.
"CROP_COEF" ) )
then
1260 if ( ( method_name .strapprox.
"FAO56" ) &
1261 .or. ( method_name .strapprox.
"FAO-56" ) &
1262 .or. ( method_name .strapprox.
"FAO_56" ) )
then
1268 call logs%WRITE(
"==> FAO-56 crop coefficient calculation method selected.", iloglevel = log_all, &
1276 call logs%WRITE(
"==> NO crop coefficient calculation method selected. Kcb defaults to 1.0.", &
1277 iloglevel = log_all, lecho = false )
1281 elseif ( scmdtext .containssimilar.
"FOG" )
then
1283 if ( method_name .strapprox.
"MONTHLY_GRID" )
then
1288 call logs%WRITE(
"==> MONTHLY_GRID FOG submodel selected.", iloglevel = log_all, lecho = false )
1295 call logs%WRITE(
"==> NULL FOG submodel selected (i.e. no fog term).", iloglevel = log_all, lecho = false )
1299 elseif ( scmdtext .containssimilar.
"GROWING_DEGREE_DAY" )
then
1301 if ( ( method_name .strapprox.
"BASKERVILLE_EMIN" ) &
1302 .or. ( method_name .strapprox.
"BE" ) &
1303 .or. ( method_name .strapprox.
"SINUSOIDAL" ) )
then
1307 call logs%WRITE(
"==> Growing degree-day (GDD) will be calculated as described " &
1308 //
"in Baskerville and Emin (1969)", iloglevel = log_all, lecho = false )
1314 elseif( ( method_name .strapprox.
"SIMPLE" ) &
1315 .or. ( method_name .strapprox.
"SIMPLE_GROWING_DEGREE_DAY" ) &
1316 .or. ( method_name .strapprox.
"SIMPLE_GROWING_DEGREE-DAY") )
then
1320 call logs%WRITE(
"==> Growing degree-day (GDD) will be calculated using " &
1321 //
"simple averaging of TMAX and TMIN.", iloglevel = log_all, lecho = false )
1323 elseif( ( method_name .strapprox.
"MODIFIED" ) &
1324 .or. ( method_name .strapprox.
"MODIFIED_GROWING_DEGREE-DAY" ) &
1325 .or. ( method_name .strapprox.
"MODIFIED_GROWING_DEGREE_DAY" ) )
then
1329 call logs%WRITE(
"==> Modified growing degree-day (GDD) will be calculated using " &
1330 //
"a simple averaging of TMAX and TMIN.", iloglevel = log_all, lecho = false )
1334 call warn(
"Your control file specifies an unknown or unsupported GROWING DEGREE-DAY method.", &
1335 lfatal = true, iloglevel = log_all, lecho = true )
1339 elseif ( scmdtext .containssimilar.
"IRRIGATION" )
then
1341 if ( ( method_name .strapprox.
"FAO56" ) &
1342 .or. ( method_name .strapprox.
"FAO-56" ) &
1343 .or. ( method_name .strapprox.
"FAO_56" ) )
then
1348 call logs%WRITE(
"==> IRRIGATION will be calculated and applied as needed.", iloglevel = log_all, lecho = false )
1355 call logs%WRITE(
"==> IRRIGATION will *NOT* be active.", iloglevel = log_all, lecho = false )
1360 elseif ( ( scmdtext .containssimilar.
"SOIL_STORAGE_MAX" ) &
1361 .or. ( scmdtext .containssimilar.
"PLANT_AVAILABLE_WATER" ) )
then
1363 if ( method_name .strapprox.
"GRIDDED" )
then
1367 call logs%WRITE(
"==> SOIL_STORAGE_MAX will be read from a grid. Rooting depths will be recalculated" &
1368 //
" as ~SOIL_STORAGE_MAX / AWC.", iloglevel = log_all, lecho = false )
1374 call logs%WRITE(
"==> SOIL_STORAGE_MAX will be internally calculated from the given AWC and rooting depth values.", &
1375 iloglevel = log_all, lecho = false )
1380 elseif ( scmdtext .containssimilar.
"EVAPOTRANSPIRATION" )
then
1382 if ( ( method_name .strapprox.
"HARGREAVES" ) &
1383 .or. ( method_name .strapprox.
"HARGREAVES-SAMANI" ) &
1384 .or. ( method_name .strapprox.
"HARGREAVES_SAMANI" ) )
then
1389 call logs%WRITE(
"==> HARGREAVES-SAMANI EVAPOTRANSPIRATION submodel selected.", &
1390 iloglevel = log_all, lecho = false )
1392 elseif ( ( method_name .strapprox.
"JENSEN-HAISE" ) &
1393 .or. ( method_name .strapprox.
"JENSEN_HAISE" ) &
1394 .or. ( method_name .strapprox.
"JH" ) )
then
1399 call logs%WRITE(
"==> JENSEN_HAISE EVAPOTRANSPIRATION submodel selected.", &
1400 iloglevel = log_all, lecho = false )
1402 elseif ( ( method_name .strapprox.
"MONTHLY_GRID" ) &
1403 .or. ( method_name .strapprox.
"MONTHLY_GRID" ) )
then
1408 call logs%WRITE(
"==> MONTHLY_GRID EVAPOTRANSPIRATION submodel selected.", &
1409 iloglevel = log_all, lecho = false )
1411 elseif ( ( method_name .strapprox.
"MONTHLY_ZONE" ) &
1412 .or. ( method_name .strapprox.
"MONTHLY_ZONE_GRID" ) )
then
1417 call logs%WRITE(
"==> MONTHLY_GRID EVAPOTRANSPIRATION submodel selected.", &
1418 iloglevel = log_all, lecho = false )
1420 elseif ( ( method_name .strapprox.
"DAILY_GRID" ) &
1421 .or. ( method_name .strapprox.
"DAILY_GRID" ) )
then
1426 call logs%WRITE(
"==> DAILY_GRID EVAPOTRANSPIRATION submodel selected.", &
1427 iloglevel = log_all, lecho = false )
1431 call warn(
"Your control file specifies an unknown or unsupported EVAPOTRANSPIRATION method.", &
1432 lfatal = true, iloglevel = log_all, lecho = true )
1436 elseif ( scmdtext .containssimilar.
"PRECIPITATION" )
then
1438 if ( ( method_name .strapprox.
"NORMAL" ) &
1439 .or. ( method_name .strapprox.
"GRIDDED" ) &
1440 .or. ( method_name .strapprox.
"STANDARD" ) )
then
1445 call logs%WRITE(
"==> STANDARD PRECIPITATION submodel selected.", &
1446 iloglevel = log_all, lecho = false )
1448 elseif ( ( method_name .strapprox.
"TABLE") &
1449 .or. (method_name .strapprox.
"TABULAR") )
then
1456 call logs%WRITE(
"==> TABULAR PRECIPITATION submodel selected.", &
1457 iloglevel = log_all, lecho = false )
1458 call logs%WRITE(
" PRECIPITATION, TMIN, and TMAX will be supplied as TABLE values.", &
1459 iloglevel = log_all, lecho = false )
1461 elseif ( ( method_name .strapprox.
"METHOD_OF_FRAGMENTS" ) &
1462 .or. ( method_name .strapprox.
"FRAGMENTS" ) )
then
1467 call logs%WRITE(
"==> METHOD OF FRAGMENTS PRECIPITATION submodel selected.", &
1468 iloglevel = log_all, lecho = false )
1472 call warn(
"Your control file specifies an unknown or unsupported PRECIPITATION method.", &
1473 lfatal = true, iloglevel = log_all, lecho = true )
1477 elseif ( (scmdtext .containssimilar.
"DIRECT_NET_INFILTRATION" ) &
1478 .or. ( scmdtext .containssimilar.
"DIRECT_RECHARGE" ) )
then
1483 call logs%WRITE(
"==> GRIDDED or TABULAR values for water main leakage and other direct " &
1484 //
"net infiltration will be used.", iloglevel = log_all, lecho = false )
1486 elseif ( scmdtext .containssimilar.
"DIRECT_SOIL_MOISTURE" )
then
1491 call logs%WRITE(
"==> GRIDDED or TABULAR values for septic drainage and other direct " &
1492 //
"inputs to the root zone will be used.", iloglevel = log_all, lecho = false )
1494 elseif ( scmdtext .containssimilar.
"SOIL_MOISTURE" )
then
1496 if ( ( method_name .strapprox.
"T-M" ) &
1497 .or. ( method_name .strapprox.
"THORNTHWAITE-MATHER" ) &
1498 .or. ( method_name .strapprox.
"THORNTHWAITE_MATHER" ) &
1499 .or. ( method_name .strapprox.
"THORNTHWAITE") )
then
1504 call logs%WRITE(
"==> THORNTHWAITE-MATHER SOIL MOISTURE RETENTION submodel selected.", &
1505 iloglevel = log_all, lecho = false )
1507 elseif ( ( method_name .strapprox.
"T-M_EQUATIONS" ) &
1508 .or. ( method_name .strapprox.
"THORNTHWAITE-MATHER_EQUATIONS" ) &
1509 .or. ( method_name .strapprox.
"THORNTHWAITE_MATHER_EQUATIONS") )
then
1515 call warn(smessage=
"The SOIL_MOISTURE_METHOD 'THORNTHWAITE_MATHER_EQUATIONS' option has" &
1516 //
" been removed.", &
1517 shints=
"Please select the normal 'THORNTHWAITE_MATHER' SOIL_MOISTURE_METHOD and " &
1518 //
"try rerunning swb.", lfatal=true)
1521 elseif ( ( method_name .strapprox.
"FAO56_TWO_STAGE" ) .or. ( method_name .strapprox.
"FAO-56_TWO_STAGE" ) &
1522 .or. ( method_name .strapprox.
"FAO-56_TWO-STAGE" ))
then
1527 call logs%WRITE(
"==> **TWO-STAGE** FAO-56 SOIL MOISTURE RETENTION submodel selected.", &
1528 iloglevel = log_all, lecho = false )
1530 elseif ( ( method_name .strapprox.
"FAO56" ) .or. ( method_name .strapprox.
"FAO-56" ) )
then
1535 call logs%WRITE(
"==> FAO-56 SOIL MOISTURE RETENTION submodel selected.", &
1536 iloglevel = log_all, lecho = false )
1538 elseif ( ( method_name .strapprox.
"GRIDDED" ) )
then
1543 call logs%WRITE(
"==> **GRIDDED** ACTUAL ET will determine SOIL MOISTURE RETENTION.", &
1544 iloglevel = log_all, lecho = false )
1548 call warn(
"Your control file specifies an unknown or unsupported SOIL_MOISTURE method.", &
1549 lfatal = true, iloglevel = log_all, lecho = true )
1553 elseif ( scmdtext .containssimilar.
"DUMP_VARIABLES" )
then
1555 row = 0; col = 0; indx_start = 0; indx_end = 0
1556 xcoord=99999.; ycoord=99999.
1557 dump_file_prefix =
""
1561 if ( ( method_name .containssimilar.
"INDEX_RANGE") .and. ( argv_list%count >= 3 ) )
then
1563 indx_start = asint( argv_list%get(2) )
1564 indx_end = asint( argv_list%get(3) )
1566 elseif ( ( method_name .containssimilar.
"COORDINATES") .and. ( argv_list%count >= 3 ) &
1567 .or. ( method_name .containssimilar.
"COORD") .and. ( argv_list%count >= 3 ) )
then
1569 xcoord = asfloat( argv_list%get(2) )
1570 ycoord = asfloat( argv_list%get(3) )
1571 row = grid_getgridrownum( this%pGrdOut, ycoord )
1572 col = grid_getgridcolnum( this%pGrdOut, xcoord )
1574 elseif ( ( method_name .containssimilar.
"COL_ROW") .and. ( argv_list%count >= 3 ) )
then
1576 col = asint( argv_list%get(2) )
1577 row = asint( argv_list%get(3) )
1578 xcoord = grid_getgridx( this%pGrdOut, col )
1579 ycoord = grid_getgridy( this%pGrdOut, row )
1583 call warn(
"Unknown option and/or arguments supplied to DUMP_VARIABLES method.", &
1584 shints=
"The known option keywords are 'COL_ROW', 'COORD(INATES)' and 'INDEX_RANGE'.", &
1585 lfatal = true, iloglevel = log_all, lecho = true )
1589 if ( argv_list%count == 5)
then
1590 modifier_text = argv_list%get(4)
1591 if (modifier_text .containssimilar.
"ID")
then
1592 dump_file_prefix = argv_list%get(5)
1593 temp_str =
"__"//trim(dump_file_prefix)//
"__"
1595 call warn(
"Unknown option modifier supplied to DUMP_VARIABLES method.", &
1596 shints=
"The known option modifier is 'ID. You supplied "//trim(modifier_text), &
1597 lfatal = true, iloglevel = log_all, lecho = true )
1601 row_col_num_are_valid = grid_rowcolfallsinsidegrid( this%pGrdOut, row, col )
1602 coordinates_are_valid = grid_coordinatesfallinsidegrid( this%pGrdOut, xcoord, ycoord )
1603 indices_are_valid = ( (indx_start >= lbound(this%col_num_1D, 1) ) &
1604 .and. (indx_start <= ubound(this%col_num_1D, 1) ) &
1605 .and. (indx_end >= lbound(this%col_num_1D, 1) ) &
1606 .and. (indx_end <= ubound(this%col_num_1D, 1) ) )
1608 if ( row_col_num_are_valid .or. indices_are_valid )
then
1610 if (
allocated(
dump) )
then
1619 do indx=1, ubound(
dump, 1)
1623 if (
dump( indx )%col /= 0 .or.
dump( indx )%indx_start /= 0 ) cycle
1625 dump( indx )%col = col
1626 dump( indx )%row = row
1627 dump( indx )%indx_start = indx_start
1628 dump( indx )%indx_end = indx_end
1629 dump( indx )%x_coord = real(xcoord, c_float)
1630 dump( indx )%y_coord = real(ycoord, c_float)
1632 if ( row_col_num_are_valid )
then
1633 call logs%WRITE(
"==> SWB will dump variables for cell ("//ascharacter(col)//
"," &
1634 //ascharacter(row)//
").", iloglevel = log_all, lecho = false )
1635 filename = trim(output_directory_name)//
"SWB2_variable_values" &
1636 //trim(temp_str)//
"col_" &
1637 //ascharacter( col )//
"__row_" &
1638 //ascharacter( row )//
"__x_"//ascharacter(asint(xcoord)) &
1639 //
"__y_"//ascharacter(asint(ycoord))//
".csv"
1641 elseif ( indices_are_valid )
then
1642 call logs%WRITE(
"==> SWB will dump variables for cell indices ranging from " &
1643 //ascharacter(indx_start)//
" to "//ascharacter(indx_end)//
").", &
1644 iloglevel = log_all, lecho = false )
1645 filename = trim(output_directory_name)//
"SWB2_variable_values" &
1646 //trim(temp_str)//
"start_index_" &
1647 //ascharacter( indx_start )//
"__end_index_"//ascharacter( indx_end )//
".csv"
1650 open( newunit=unitnum, file=trim(filename), iostat=iostat, action=
"write", status=
"replace" )
1652 call assert( iostat == 0,
"Could not open variable dump file "//squote(filename) &
1653 //
" for writing. iostat = "//ascharacter( iostat ) )
1654 dump( indx )%unitnum = unitnum
1656 write( unit=
dump( indx )%unitnum, fmt=
"(a)") &
1657 "date, month, day, year,landuse_code, landuse_index, soil_group, num_upslope_connections, " &
1658 //
"sum_upslope_cells, solution_order, cell_index, target_index, growing_season, " &
1659 //
"awc, latitude, reference_ET0, " &
1660 //
"actual_ET, curve_num_adj, gross_precip, inflow, runon, " &
1661 //
"runoff, outflow, infiltration, snowfall, potential_snowmelt, snowmelt, interception, " &
1662 //
"rainfall, net_rainfall, monthly_gross_precip, monthly_runoff, interception_storage, tmax, tmin, " &
1663 //
" tmean, snow_storage, soil_storage, soil_storage_max, " &
1664 //
"evaporable_water_storage, evaporable_water_deficit, delta_soil_storage, " &
1665 //
"soil_moisture_deficit, surface_storage, " &
1666 //
"surface_storage_excess, surface_storage_max, net_infiltration, " &
1667 //
"rejected_net_infiltration, fog, irrigation, gdd, runoff_outside, " &
1668 //
"pervious_fraction, storm_drain_capture, canopy_cover_fraction, crop_coefficient_kcb, " &
1669 //
"cfgi, rooting_depth_max, current_rooting_depth, current_plant_height, actual_et_soil, " &
1670 //
"readily_available_water, total_available_water, plant_stress_coef_ks, " &
1671 //
"evap_reduction_coef_kr, surf_evap_coef_ke, fraction_exposed_and_wetted_soil, " &
1672 //
"actual_et_impervious, actual_et_interception, adjusted_depletion_fraction_p, crop_etc, " &
1673 //
" bare_soil_evap, direct_net_infiltration, " &
1674 //
"direct_soil_moisture, inflowbuf1, inflowbuf2, inflowbuf3, inflowbuf4, inflowbuf5, inflowbuf_sum"
1681 call warn(
"You are attempting to dump variables using invalid coordinates or index values.", &
1682 lfatal = false, iloglevel = log_all, lecho = true )
1688 call warn(
"Your control file references an unknown or unsupported method: "//dquote(scmdtext), &
1689 lfatal = true, iloglevel = log_all, lecho = true )
1717 where ( this%it_is_growing_season )
1724 this%canopy_cover_fraction, this%it_is_growing_season, &
1739 where ( this%it_is_growing_season )
1756 real (c_float),
allocatable :: fTrunk_Storage_Capacity(:)
1757 real (c_float),
allocatable :: fStemflow_Fraction(:)
1764 this%canopy_cover_fraction, &
1766 ftrunk_storage_capacity, &
1768 fstemflow_fraction, &
1781 this%runon = 0.0_c_float
1790 integer (c_int),
intent(in) :: indx
1792 this%runoff_outside( indx ) = &
1793 this%runoff( indx ) &
1794 + this%rejected_net_infiltration( indx )
1819 integer (c_int),
intent(in) :: indx
1822 integer (c_int) :: target_index
1823 integer (c_int) :: cell_index
1825 integer (c_int) :: cell_row, cell_col, targ_row, targ_col
1830 cell_row=this%row_num_1D(cell_index)
1831 cell_col=this%col_num_1D(cell_index)
1836 if ( ( target_index >= lbound( this%runon, 1) ) &
1837 .and. ( target_index <= ubound( this%runon, 1) ) )
then
1839 targ_row=this%row_num_1D(target_index)
1840 targ_col=this%col_num_1D(target_index)
1842 this%runon( target_index ) = &
1843 this%runon( target_index ) &
1844 + this%runoff( cell_index ) &
1845 + this%rejected_net_infiltration( cell_index )
1874 this%runoff_outside( cell_index ) = &
1875 this%runoff_outside( cell_index ) &
1876 + this%runoff( cell_index ) &
1877 + this%rejected_net_infiltration( cell_index )
1892 this%cfgi_lower_limit, &
1893 this%cfgi_upper_limit, &
1907 this%tmax, this%snow_storage )
1925 call snowfall_original_calculate( this%snowfall, this%net_snowfall, &
1926 this%rainfall, this%net_rainfall, &
1927 this%tmin, this%tmax, &
1928 this%interception, this%gross_precip )
1965 tmax=this%tmax, imperial_units=true )
2006 flatitude=this%latitude, ftmin=this%Tmin, ftmax=this%Tmax )
2032 this%reference_ET0 = pack(
pet_grid%pGrdBase%rData, this%active )
2059 this%reference_ET0 = pack(
pet_grid%pGrdBase%rData, this%active ) *
et_ratios / real( sim_dt%iDaysInMonth, c_float)
2085 this%reference_ET0 = pack(
pet_grid%pGrdBase%rData, this%active ) &
2086 / real( sim_dt%iDaysInMonth, c_float)
2108 this%reference_ET0 =
et_jh_calculate( idayofyear=sim_dt%iDOY, inumdaysinyear=sim_dt%iDaysInYear, &
2109 flatitude=this%latitude, ftmin=this%Tmin, ftmax=this%Tmax )
2129 use ieee_arithmetic,
only : ieee_is_nan, ieee_is_finite
2134 integer (c_int),
intent(in) :: cell_index
2143 curve_num_adj=this%curve_num_adj( cell_index ), &
2144 landuse_index=this%landuse_index( cell_index ), &
2145 cell_index=cell_index, &
2146 soil_group=this%soil_group( cell_index ), &
2147 soil_storage_max=this%soil_storage_max( cell_index ), &
2148 it_is_growing_season=this%it_is_growing_season( cell_index ), &
2149 inflow=this%inflow( cell_index ), &
2151 this%continuous_frozen_ground_index( cell_index ), &
2152 cfgi_lower_limit=this%cfgi_lower_limit(cell_index), &
2153 cfgi_upper_limit=this%cfgi_upper_limit( cell_index) )
2184 integer (c_int) :: status
2186 allocate( this%monthly_runoff( count( this%active ) ), stat=status)
2187 call assert( status==0,
"Problem allocating memory", __file__, __line__ )
2202 integer (c_int),
intent(in) :: indx
2205 type (DATETIME_T),
save :: date_of_last_grid_update
2206 real (c_float) :: interim_inflow
2208 if ( .not. ( date_of_last_grid_update == sim_dt%curr ) )
then
2210 date_of_last_grid_update = sim_dt%curr
2213 interim_inflow = this%rainfall( indx ) + this%snowmelt( indx )
2215 this%runoff( indx ) = interim_inflow *
runoff_ratios( indx )
2217 if (
allocated( this%monthly_gross_precip ) ) &
2218 this%monthly_runoff( indx ) = this%monthly_gross_precip( indx ) *
runoff_ratios( indx )
2229 integer (c_int) :: iNumActiveCells
2230 integer (c_int) :: iStat
2231 integer (c_int) :: iNumberOfLanduses
2232 integer (c_int) :: iNumberOfSoilGroups
2233 integer (c_int) :: iSoilsIndex
2234 integer (c_int) :: iLUIndex
2235 integer (c_int),
allocatable :: iLanduseCodes(:)
2236 type (FSTRING_LIST_T) :: slList
2237 type (FSTRING_LIST_T) :: slRZ
2238 integer (c_int),
allocatable :: iRZ_SeqNums(:)
2239 real (c_float),
allocatable :: RZ(:)
2240 character (len=:),
allocatable :: sText
2241 type (GENERAL_GRID_T),
pointer :: pRooting_Depth
2242 real (c_float),
allocatable :: fMax_Rooting_Depth(:,:)
2243 character (len=10) :: date_str
2245 type (DATA_CATALOG_ENTRY_T),
pointer :: pHSG
2246 type (DATA_CATALOG_ENTRY_T),
pointer :: pLULC
2248 plulc => dat%find(
"LAND_USE")
2249 phsg => dat%find(
"HYDROLOGIC_SOILS_GROUP")
2251 date_str = sim_dt%curr%prettydate()
2253 call assert(
associated( plulc),
"Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pLULC", &
2254 __file__, __line__ )
2256 call assert(
associated( plulc%pGrdBase ), &
2257 "Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pLULC%pGrdBase", __file__, __line__ )
2259 call assert(
allocated( plulc%pGrdBase%iData ), &
2260 "Possible INTERNAL PROGRAMMING ERROR -- Unallocated array detected for pLULC%pGrdBase%iData", __file__, __line__ )
2262 call assert(
associated( phsg),
"Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pHSG", &
2263 __file__, __line__ )
2265 call assert(
associated( phsg%pGrdBase ), &
2266 "Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pHSG%pGrdBase", __file__, __line__ )
2268 call assert(
allocated( phsg%pGrdBase%iData ), &
2269 "Possible INTERNAL PROGRAMMING ERROR -- Unallocated array detected for pHSG%pGrdBase%iData", __file__, __line__ )
2272 prooting_depth => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2273 rx0=this%X_ll, ry0=this%Y_ll, &
2274 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2276 inumactivecells = ubound(this%soil_storage_max,1)
2278 call sllist%append(
"LU_Code")
2279 call sllist%append(
"Landuse_Code")
2280 call sllist%append(
"Landuse_Lookup_Code")
2285 slrz = params%grep_name(
"RZ", lfatal=true )
2287 irz_seqnums = slrz%get_integer()
2290 inumberofsoilgroups = count( irz_seqnums > 0 )
2293 call params%get_parameters( slkeys=sllist, ivalues=ilandusecodes, lfatal=true )
2294 inumberoflanduses = count( ilandusecodes >= 0 )
2296 allocate( fmax_rooting_depth(inumberoflanduses, inumberofsoilgroups), stat=istat )
2297 call assert( istat == 0,
"Failed to allocate memory for maximum rooting depth table", &
2301 do isoilsindex = 1, inumberofsoilgroups
2302 stext =
"RZ_"//ascharacter(isoilsindex)
2303 call params%get_parameters( skey=stext, fvalues=rz )
2304 fmax_rooting_depth(:, isoilsindex) = rz
2307 call logs%WRITE(
"Landuse Code | Soils Code | Number of Matches | Rooting Depth (ft)", &
2308 iloglevel = log_debug, lecho = false )
2309 call logs%WRITE(
"-------------|--------------|-------------------|------------------ ", &
2310 iloglevel = log_debug, lecho = false )
2312 do isoilsindex = 1, inumberofsoilgroups
2313 do iluindex = 1, inumberoflanduses
2315 call logs%WRITE( ascharacter(ilandusecodes( iluindex) )//
" | "//ascharacter(isoilsindex)//
" | "// &
2316 ascharacter(count( plulc%pGrdBase%iData == ilandusecodes( iluindex) &
2317 .and. phsg%pGrdBase%iData == isoilsindex ) )//
" | " &
2318 //ascharacter( fmax_rooting_depth( iluindex, isoilsindex) ), &
2319 iloglevel = log_debug, lecho = false )
2322 where ( plulc%pGrdBase%iData == ilandusecodes( iluindex) .and. phsg%pGrdBase%iData == isoilsindex )
2324 prooting_depth%rData = fmax_rooting_depth( iluindex, isoilsindex )
2334 date_str = sim_dt%curr%prettydate()
2336 call grid_writearcgrid(
"Maximum_rooting_depth__as_assembled_from_table__" &
2337 //trim(date_str)//
".asc", prooting_depth )
2341 call grid_destroy( prooting_depth )
2352 type ( GENERAL_GRID_T ),
pointer :: pTempGrd
2353 character (len=10) :: date_str
2359 this%soil_storage_max = this%rooting_depth_max * this%awc
2361 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2362 rx0=this%X_ll, ry0=this%Y_ll, &
2363 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2365 ptempgrd%rData = unpack( this%soil_storage_max, this%active, this%nodata_fill_value )
2367 date_str = sim_dt%curr%prettydate()
2369 call grid_writearcgrid( sfilename=
"Soil_Storage_Maximum__as_calculated_inches__" &
2370 //trim(date_str)//
".asc", pgrd=ptempgrd )
2372 call grid_destroy( ptempgrd )
2383 type ( GENERAL_GRID_T ),
pointer :: pTempGrd
2384 type (DATA_CATALOG_ENTRY_T),
pointer :: pSOIL_STORAGE_MAX_GRID
2386 psoil_storage_max_grid => null()
2388 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2389 rx0=this%X_ll, ry0=this%Y_ll, &
2390 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2393 psoil_storage_max_grid => dat%find(
"SOIL_STORAGE_MAX")
2394 if ( .not.
associated(psoil_storage_max_grid) ) &
2395 psoil_storage_max_grid => dat%find(
"PLANT_AVAILABLE_WATER")
2397 if ( .not.
associated(psoil_storage_max_grid) ) &
2398 call die(
"A SOIL_STORAGE_MAX or PLANT_AVAILABLE_WATER grid must be supplied in order" &
2399 //
" to make use of this option.", __file__, __line__ )
2401 call psoil_storage_max_grid%getvalues( )
2403 this%soil_storage_max = pack( psoil_storage_max_grid%pGrdBase%rData, this%active )
2405 ptempgrd%rData = unpack( this%soil_storage_max, this%active, this%nodata_fill_value )
2410 where ( .not. ( this%rooting_depth_max .approxequal. 0.0_c_float ) )
2412 this%awc = this%soil_storage_max / this%rooting_depth_max
2416 this%awc = 0.0_c_float
2420 this%current_rooting_depth = this%rooting_depth_max
2422 call grid_writearcgrid( sfilename=
"Maximum_Soil_Storage__as_read_in_inches.asc", pgrd=ptempgrd )
2424 ptempgrd%rData = unpack( this%rooting_depth_max, this%active, this%nodata_fill_value )
2426 call grid_writearcgrid( sfilename=
"Available_water_content__as_RECALCULATED_in_inches_per_foot.asc", pgrd=ptempgrd )
2428 call grid_destroy( ptempgrd )
2438 this%irrigation = 0.0_c_float
2447 integer (c_int),
intent(in) :: indx
2480 integer (c_int),
intent(in) :: indx
2486 if (
allocated( this%monthly_gross_precip ) .and.
allocated( this%monthly_runoff ) )
then
2489 landuse_index=this%landuse_index(indx), &
2490 soil_storage=this%soil_storage(indx), &
2491 soil_storage_max=this%soil_storage_max(indx), &
2492 total_available_water=this%total_available_water_taw(indx), &
2493 rainfall=this%rainfall(indx), &
2494 runoff=this%runoff(indx), &
2495 crop_etc=this%crop_etc(indx), &
2496 irrigation_mask=this%irrigation_mask(indx), &
2497 num_days_since_planting=this%number_of_days_since_planting(indx), &
2498 monthly_rainfall=this%monthly_gross_precip(indx), &
2499 monthly_runoff=this%monthly_runoff(indx) )
2504 landuse_index=this%landuse_index(indx), &
2505 soil_storage=this%soil_storage(indx), &
2506 soil_storage_max=this%soil_storage_max(indx), &
2507 total_available_water=this%total_available_water_taw(indx), &
2508 rainfall=this%rainfall(indx), &
2509 runoff=this%runoff(indx), &
2510 crop_etc=this%crop_etc(indx), &
2511 irrigation_mask=this%irrigation_mask(indx), &
2512 num_days_since_planting=this%number_of_days_since_planting(indx) )
2569 landuse_index=this%landuse_index, &
2570 kcb=this%crop_coefficient_kcb, &
2571 it_is_growing_season=this%it_is_growing_season )
2597 mean_air_temp=this%tmean, &
2598 it_is_growing_season=this%it_is_growing_season )
2623 type (GENERAL_GRID_T),
pointer :: pTempGrd
2625 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2626 rx0=this%X_ll, ry0=this%Y_ll, &
2627 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2632 ptempgrd%rData = unpack( this%awc, this%active, this%nodata_fill_value )
2634 call grid_writearcgrid( sfilename=
"Available_water_content__as_read_in_inches_per_foot.asc", pgrd=ptempgrd )
2636 call grid_destroy( ptempgrd )
2662 integer (c_int) :: iStat
2663 type (GENERAL_GRID_T),
pointer :: pTempGrd
2665 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2666 rx0=this%X_ll, ry0=this%Y_ll, &
2667 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2670 allocate ( this%soil_code (count( this%active ) ), stat=istat )
2674 isoils_code=this%soil_code )
2676 ptempgrd%rData = unpack( this%awc, this%active, this%nodata_fill_value )
2678 call grid_writearcgrid( sfilename=
"Available_water_content__as_calculated_inches_per_foot.asc", pgrd=ptempgrd )
2680 call grid_destroy( ptempgrd )
2691 type (DATA_CATALOG_ENTRY_T),
pointer :: pIRR_MASK
2692 character (len=10) :: date_str
2694 pirr_mask => dat%find(
"IRRIGATION_MASK")
2696 if (
associated(pirr_mask) )
then
2698 if (pirr_mask%iSourceDataForm == dynamic_grid)
then
2700 call pirr_mask%getvalues( sim_dt%curr )
2702 if ( pirr_mask%lGridHasChanged )
then
2703 date_str = sim_dt%curr%prettydate()
2704 call grid_writearcgrid(
"Irrigation_mask__as_read_into_SWB__" &
2705 //trim(date_str)//
".asc", pirr_mask%pGrdBase )
2706 this%irrigation_mask = pack( real(pirr_mask%pGrdBase%iData, c_float), this%active )
2712 if (sim_dt%iDayOfSimulation < 1)
then
2713 call pirr_mask%getvalues()
2714 this%irrigation_mask = pack( real(pirr_mask%pGrdBase%iData, c_float), this%active )
2715 call grid_writearcgrid(
"Irrigation_mask__as_read_into_SWB.asc", pirr_mask%pGrdBase )
2720 if ( any(real(pirr_mask%pGrdBase%iData, c_float) < 0.0) &
2721 .or. any(real(pirr_mask%pGrdBase%iData, c_float) > 1.0))
then
2723 call die(smessage =
"Irrigation mask contains illegal values (outside range from 0-1)", &
2724 shints=
"Check the values contained in your irrigation mask file(s).")
2730 this%irrigation_mask = 1.0_c_float
2751 type (DATA_CATALOG_ENTRY_T),
pointer :: pLULC
2753 plulc => dat%find(
"LAND_USE")
2755 if (
associated(plulc) )
then
2759 if ( plulc%lGridHasChanged )
then
2763 call this%update_rooting_depth_table()
2764 call this%init_soil_storage_max()
2799 integer (c_int) :: status
2801 allocate( this%gdd( count( this%active ) ), stat=status )
2802 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
2804 this%gdd = 0.0_c_float
2807 landuse_index=this%landuse_index )
2821 order=this%sort_order )
2836 order=this%sort_order )
2849 integer (c_int) :: status
2851 allocate( this%gdd( count( this%active ) ), stat=status )
2852 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
2854 this%gdd = 0.0_c_float
2857 landuse_index=this%landuse_index )
2873 order=this%sort_order )
2895 integer (c_int) :: jndx, indx_start, indx_end
2898 do jndx=lbound(
dump, 1), ubound(
dump, 1)
2900 indx_start =
dump( jndx )%indx_start
2901 indx_end =
dump( jndx )%indx_end
2903 if ( (indx_start >= lbound( this%landuse_code, 1) ) &
2904 .and. ( indx_start <= ubound( this%landuse_code, 1) ) &
2905 .and. (indx_end >= lbound( this%landuse_code, 1) ) &
2906 .and. (indx_end <= ubound( this%landuse_code, 1) ) )
then
2909 indx_start=indx_start, indx_end=indx_end )
2914 indx_start = this%row_column_to_index( col_num=
dump( jndx )%col, row_num=
dump( jndx )%row)
2920 if ( (indx_start >= lbound( this%landuse_code, 1) ) &
2921 .and. ( indx_start <= ubound( this%landuse_code, 1) ) ) &
2962 integer (c_int),
intent(in) :: unitnum
2963 integer (c_int),
intent(in) :: indx_start
2964 integer (c_int),
intent(in),
optional :: indx_end
2967 integer (c_int) :: kndx
2968 integer (c_int) :: target_indx
2969 integer (c_int) :: cell_indx
2970 integer (c_int) :: indx_end_l
2971 integer (c_int) :: indx
2973 real (c_float) :: previous_5_day_rain(6)
2974 real (c_float) :: monthly_runoff
2975 real (c_float) :: monthly_gross_precip
2977 previous_5_day_rain = -9999.0
2978 monthly_runoff = -9999.0
2979 monthly_gross_precip = -9999.0
2981 if (
present( indx_end ) )
then
2982 indx_end_l = indx_end
2984 indx_end_l = indx_start
2987 do indx=indx_start, indx_end_l
2992 if (
allocated(this%monthly_runoff) ) monthly_runoff = this%monthly_runoff( cell_indx )
2993 if (
allocated(this%monthly_gross_precip) ) monthly_gross_precip = this%monthly_gross_precip( cell_indx )
2995 write( unit=unitnum, fmt=
"(i4,'-',i2.2,'-',i2.2,',',i2,',',i2,',',i4,',',9(i6,','),66(g20.12,','),g20.12)") &
2996 sim_dt%curr%iYear, sim_dt%curr%iMonth, sim_dt%curr%iDay, &
2997 sim_dt%curr%iMonth, sim_dt%curr%iDay, sim_dt%curr%iYear, &
2998 this%landuse_code( cell_indx ), &
2999 this%landuse_index( cell_indx ), &
3000 this%soil_group( cell_indx ), &
3001 this%num_upslope_connections( cell_indx ), &
3002 this%sum_upslope_cells( cell_indx ), &
3006 asint(this%it_is_growing_season( cell_indx )), &
3007 this%awc( cell_indx ), &
3008 this%latitude( cell_indx ), &
3009 this%reference_ET0( cell_indx ), &
3010 this%actual_ET( cell_indx ), &
3011 this%curve_num_adj( cell_indx ), &
3012 this%gross_precip( cell_indx ), &
3013 this%inflow( cell_indx ), &
3014 this%runon( cell_indx ), &
3015 this%runoff( cell_indx ), &
3016 this%outflow( cell_indx ), &
3017 this%infiltration( cell_indx ), &
3018 this%snowfall( cell_indx ), &
3019 this%potential_snowmelt( cell_indx ), &
3020 this%snowmelt( cell_indx ), &
3021 this%interception( cell_indx ), &
3022 this%rainfall( cell_indx ), &
3023 this%net_rainfall( cell_indx ), &
3024 monthly_gross_precip, &
3026 this%interception_storage( cell_indx ), &
3027 this%tmax( cell_indx ), &
3028 this%tmin( cell_indx ), &
3029 this%tmean( cell_indx ), &
3030 this%snow_storage( cell_indx ), &
3031 this%soil_storage( cell_indx ), &
3032 this%soil_storage_max( cell_indx ), &
3033 this%evaporable_water_storage( cell_indx ), &
3034 this%evaporable_water_deficit( cell_indx ), &
3035 this%delta_soil_storage( cell_indx ), &
3036 this%soil_moisture_deficit( cell_indx ), &
3037 this%surface_storage( cell_indx ), &
3038 this%surface_storage_excess( cell_indx ), &
3039 this%surface_storage_max( cell_indx ), &
3040 this%net_infiltration( cell_indx ), &
3041 this%rejected_net_infiltration( cell_indx ), &
3042 this%fog( cell_indx ), &
3043 this%irrigation( cell_indx ), &
3044 this%gdd( cell_indx ), &
3045 this%runoff_outside( cell_indx ), &
3046 this%pervious_fraction( cell_indx ), &
3047 this%storm_drain_capture( cell_indx ), &
3048 this%canopy_cover_fraction( cell_indx ), &
3049 this%crop_coefficient_kcb( cell_indx ), &
3050 this%continuous_frozen_ground_index( cell_indx ), &
3051 this%rooting_depth_max( cell_indx ), &
3052 this%current_rooting_depth( cell_indx ), &
3053 this%current_plant_height( cell_indx), &
3054 this%actual_et_soil( cell_indx ), &
3055 this%readily_available_water_raw( cell_indx ), &
3056 this%total_available_water_taw( cell_indx ), &
3057 this%plant_stress_coef_ks( cell_indx ), &
3058 this%evap_reduction_coef_kr( cell_indx ), &
3059 this%surf_evap_coef_ke( cell_indx ), &
3060 this%fraction_exposed_and_wetted_soil( cell_indx ), &
3061 this%actual_et_impervious( cell_indx ), &
3062 this%actual_et_interception( cell_indx ), &
3063 this%adjusted_depletion_fraction_p( cell_indx ), &
3064 this%crop_etc( cell_indx ), &
3065 this%bare_soil_evap( cell_indx ), &
3066 this%direct_net_infiltration( cell_indx ), &
3067 this%direct_soil_moisture( cell_indx ), &
3068 (previous_5_day_rain(kndx), kndx=1,6)
3096 integer (c_int),
intent(in) :: indx
3101 this%actual_et_soil(indx) = max(
actual_et(indx) - this%actual_et_interception(indx) &
3102 * this%canopy_cover_fraction(indx), 0.0_c_double)
3121 integer (c_int),
intent(in) :: indx
3124 soil_storage=this%soil_storage( indx ), &
3125 soil_storage_max=this%soil_storage_max( indx ), &
3126 infiltration=this%infiltration( indx ), &
3127 crop_etc=this%crop_etc( indx ) )
3150 integer (c_int),
intent(in) :: indx
3153 integer (c_int) :: landuse_index
3155 landuse_index = this%landuse_index( indx )
3158 adjusted_depletion_fraction_p=this%adjusted_depletion_fraction_p( indx ), &
3159 soil_storage=this%soil_storage( indx ), &
3160 soil_storage_max=this%soil_storage_max( indx ), &
3161 infiltration=this%infiltration( indx ), &
3162 crop_etc=this%crop_etc( indx ), &
3186 integer (c_int),
intent(in) :: indx
3189 integer (c_int) :: landuse_index
3191 landuse_index = this%landuse_index( indx )
3194 actual_et=this%actual_et_soil( indx ), &
3195 crop_etc=this%crop_etc( indx ), &
3196 bare_soil_evap=this%bare_soil_evap( indx ), &
3197 taw=this%total_available_water_taw( indx ), &
3198 raw=this%readily_available_water_raw( indx ), &
3199 fraction_exposed_and_wetted_soil=this%fraction_exposed_and_wetted_soil( indx ), &
3200 kr=this%evap_reduction_coef_kr( indx ), &
3201 ke=this%surf_evap_coef_ke( indx ), &
3202 ks=this%plant_stress_coef_ks( indx ), &
3203 adjusted_depletion_fraction_p=this%adjusted_depletion_fraction_p( indx ), &
3204 soil_moisture_deficit=this%soil_moisture_deficit( indx ), &
3205 current_plant_height=this%current_plant_height( indx ), &
3206 evaporable_water_storage=this%evaporable_water_storage( indx ), &
3207 evaporable_water_deficit=this%evaporable_water_deficit( indx ), &
3208 it_is_growing_season=this%it_is_growing_season( indx ), &
3209 kcb=this%crop_coefficient_kcb( indx ), &
3210 landuse_index=this%landuse_index( indx ), &
3211 soil_group=this%soil_group( indx ), &
3212 awc=this%awc( indx ), &
3213 current_rooting_depth=this%current_rooting_depth( indx ), &
3214 soil_storage=this%soil_storage( indx ), &
3215 soil_storage_max=this%soil_storage_max( indx ), &
3216 reference_et0=max(this%reference_et0( indx ) &
3217 - this%actual_et_interception( indx ), 0.0_c_double), &
3218 infiltration=this%infiltration( indx ) )
3235 integer ( c_int ),
intent(in) :: indx
3248 landuse_index=this%landuse_index )
3259 integer ( c_int ),
intent(in) :: indx
3263 is_cell_active=this%active, &
3264 nodata_fill_value=this%nodata_fill_value )
3281 integer ( c_int ),
intent(in) :: indx
3294 landuse_index=this%landuse_index )
3305 integer ( c_int ),
intent(in) :: indx
3309 is_cell_active=this%active )
3326 integer ( c_int ),
intent(in) :: indx
3339 landuse_index=this%landuse_index )
3350 integer ( c_int ),
intent(in) :: indx
3353 rejected_net_infiltration = this%rejected_net_infiltration( indx ), &
3396 zr_i=this%current_rooting_depth, &
3397 zr_max=this%rooting_depth_max, &
3398 landuse_index=this%landuse_index, &
3399 kcb=this%crop_coefficient_kcb )
3409 this%crop_coefficient_kcb = 1.0_c_float
3444 integer (c_int) :: indx
3448 do indx=1,ubound(this%number_of_days_since_planting,1)
3450 this%number_of_days_since_planting(indx) = int(sim_dt%curr &
3457 landuse_index=this%landuse_index )
3468 this%fog = 0.0_c_float
3523 ilanduse_index=this%landuse_index, lactive=this%active, &
3524 nodata_fill_value=this%nodata_fill_value )
3534 this%tmean = ( this%tmin + this%tmax ) / 2.0_c_float
3544 this%tmax_minus_tmin = this%tmax - this%tmin
3553 integer (c_int),
intent(in) :: cell_index
3555 if (this%reference_et0(cell_index) > this%actual_et(cell_index))
then
3556 this%climatic_deficit(cell_index) = real(this%reference_et0(cell_index) - this%actual_et(cell_index), c_float)
3558 this%climatic_deficit(cell_index) = 0.0_c_float
3569 type (DATA_CATALOG_ENTRY_T),
pointer :: pTMAX
3571 ptmax => dat%find(
"TMAX")
3572 if ( .not.
associated(ptmax) ) &
3573 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3575 associate( dt => sim_dt%curr )
3577 call ptmax%getvalues( dt )
3581 if (.not.
associated(ptmax%pGrdBase) ) &
3582 call die(
"INTERNAL PROGRAMMING ERROR: Call to NULL pointer.", __file__, __line__)
3584 this%tmax = pack( ptmax%pGrdBase%rData, this%active )
3595 real (kind=c_float) :: tmax_value
3597 associate( dt => sim_dt%curr )
3603 if (.not.
allocated(this%tmax))
allocate(this%tmax(count(this%active)))
3605 this%tmax = tmax_value
3615 type (DATA_CATALOG_ENTRY_T),
pointer :: pTMIN
3617 ptmin => dat%find(
"TMIN")
3618 if ( .not.
associated(ptmin) ) &
3619 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3621 associate( dt => sim_dt%curr )
3623 call ptmin%getvalues( dt )
3627 if (.not.
associated(ptmin%pGrdBase) ) &
3628 call die(
"INTERNAL PROGRAMMING ERROR: Call to NULL pointer.", __file__, __line__)
3630 this%tmin = pack( ptmin%pGrdBase%rData, this%active )
3641 real (kind=c_float) :: tmin_value
3643 associate( dt => sim_dt%curr )
3649 if (.not.
allocated(this%tmin))
allocate(this%tmin(count(this%active)))
3651 this%tmin = tmin_value
3663 type (DATA_CATALOG_ENTRY_T),
pointer :: pPRCP
3665 pprcp => dat%find(
"PRECIPITATION")
3666 if ( .not.
associated(pprcp) ) &
3667 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3669 associate( dt => sim_dt%curr )
3671 call pprcp%getvalues( dt )
3675 if (.not.
associated(pprcp%pGrdBase) ) &
3676 call die(
"INTERNAL PROGRAMMING ERROR: Call to NULL pointer.", __file__, __line__)
3678 this%gross_precip = pack( pprcp%pGrdBase%rData, this%active )
3689 real (kind=c_float) :: precip_value
3691 associate( dt => sim_dt%curr )
3697 if (.not.
allocated(this%gross_precip))
allocate(this%gross_precip(count(this%active)))
3698 this%gross_precip = precip_value
3711 integer (c_int) :: status
3713 allocate( this%monthly_gross_precip( count( this%active ) ), stat=status)
3714 call assert( status==0,
"Problem allocating memory", __file__, __line__ )
3730 type (DATA_CATALOG_ENTRY_T),
pointer :: pPRCP
3734 pprcp => dat%find(
"PRECIPITATION")
3735 if ( .not.
associated(pprcp) ) &
3736 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3738 associate( dt => sim_dt%curr )
3742 call pprcp%getvalues( dt )
3746 if (.not.
associated(pprcp%pGrdBase) ) &
3747 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer.", __file__, __line__)
3749 call precipitation_method_of_fragments_calculate( this%active )
3751 this%gross_precip = pack( pprcp%pGrdBase%rData, this%active ) * fragment_value * rainfall_adjust_factor
3752 this%monthly_gross_precip = pack( pprcp%pGrdBase%rData, this%active ) * rainfall_adjust_factor
3782 real (c_float),
dimension(:) :: variable
3783 character (len=*),
intent(in) :: varname
3784 logical,
dimension(:),
optional :: active_cells
3787 character (len=20) :: sVarname
3788 character (len=14) :: sMin
3789 character (len=14) :: sMax
3790 character (len=14) :: sMean
3791 character (len=10) :: sCount
3793 write (svarname, fmt=
"(a20)") adjustl(varname)
3795 if (
present( active_cells ) )
then
3797 if (count( active_cells ) > 0 )
then
3798 write (smin, fmt=
"(g14.3)") minval(variable, active_cells )
3799 write (smax, fmt=
"(g14.3)") maxval(variable, active_cells )
3800 write (smean, fmt=
"(g14.3)") sum(variable, active_cells ) / count( active_cells )
3801 write (scount, fmt=
"(i10)") count( active_cells )
3803 write (smin, fmt=
"(g14.3)") -9999.
3804 write (smax, fmt=
"(g14.3)") -9999.
3805 write (smean, fmt=
"(g14.3)") -9999.
3806 write (scount, fmt=
"(i10)") 0
3811 if (
size( variable, 1) > 0 )
then
3812 write (smin, fmt=
"(g14.3)") minval(variable)
3813 write (smax, fmt=
"(g14.3)") maxval(variable)
3814 write (smean, fmt=
"(g14.3)") sum(variable) /
size(variable,1)
3815 write (scount, fmt=
"(i10)")
size(variable,1)
3817 write (smin, fmt=
"(g14.3)") -9999.
3818 write (smax, fmt=
"(g14.3)") -9999.
3819 write (smean, fmt=
"(g14.3)") -9999.
3820 write (scount, fmt=
"(i10)") 0
3825 call logs%write( adjustl(svarname)//
" | "//adjustl(smin)//
" | "//adjustl(smax) &
3826 //
" | "//adjustl(smean)//
" | "//adjustl(scount), iloglevel=log_all, lecho=true )
3834 integer (c_int),
dimension(:) :: variable
3835 character (len=*),
intent(in) :: varname
3836 logical,
dimension(:),
optional :: active_cells
3839 character (len=20) :: sVarname
3840 character (len=14) :: sMin
3841 character (len=14) :: sMax
3842 character (len=14) :: sMean
3843 character (len=10) :: sCount
3845 write (svarname, fmt=
"(a20)") adjustl(varname)
3847 if (
present( active_cells ) )
then
3849 if (count( active_cells ) > 0 )
then
3850 write (smin, fmt=
"(i14)") minval(variable, active_cells )
3851 write (smax, fmt=
"(i14)") maxval(variable, active_cells )
3852 write (smean, fmt=
"(i14)") sum(variable, active_cells ) / count( active_cells )
3853 write (scount, fmt=
"(i10)") count( active_cells )
3855 write (smin, fmt=
"(i14)") -9999
3856 write (smax, fmt=
"(i14)") -9999
3857 write (smean, fmt=
"(i14)") -9999
3858 write (scount, fmt=
"(i10)") 0
3863 if (
size( variable, 1) > 0 )
then
3864 write (smin, fmt=
"(i14)") minval(variable)
3865 write (smax, fmt=
"(i14)") maxval(variable)
3866 write (smean, fmt=
"(i14)") sum(variable) /
size(variable,1)
3867 write (scount, fmt=
"(i10)")
size(variable,1)
3869 write (smin, fmt=
"(i14)") -9999
3870 write (smax, fmt=
"(i14)") -9999
3871 write (smean, fmt=
"(i14)") -9999
3872 write (scount, fmt=
"(i10)") 0
3877 call logs%write( adjustl(svarname)//
" | "//adjustl(smin)//
" | "//adjustl(smax) &
3878 //
" | "//adjustl(smean)//
" | "//adjustl(scount), iloglevel=log_all, lecho=true )
3886 call logs%write(
"variable name | min | max | mean | count ")
3887 call logs%write(
"-------------------- | -------------- | -------------- | -------------- | --------------")
3890 call minmaxmean( this%landuse_index,
"LULC_index")
3892 call minmaxmean( this%num_upslope_connections,
"upslope")
3893 call minmaxmean( this%sum_upslope_cells,
"sum_upslope")
3898 call minmaxmean( real(this%reference_ET0, c_float),
"ET0")
3899 call minmaxmean( real( this%actual_ET, c_float),
"actET")
3904 call minmaxmean( this%infiltration,
"infilt")
3907 call minmaxmean( this%interception,
"intercept")
3910 call minmaxmean( this%interception_storage,
"intcp_stor")
3911 call minmaxmean( this%snow_storage,
"snow_stor")
3912 call minmaxmean( real(this%soil_storage, c_float),
"soil_stor")
3913 call minmaxmean( this%soil_storage_max,
"soil_stor_max")
3914 call minmaxmean( this%net_infiltration,
"net_infiltration")
Calculates actual evapotranspiration by means of the SINGLE CROP COEFFICIENT procedure outlined in th...
elemental subroutine calculate_actual_et_fao56(actual_et, adjusted_depletion_fraction_p, soil_storage, depletion_fraction_p, soil_storage_max, infiltration, crop_etc)
subroutine initialize_actual_et_fao56()
real(c_float), dimension(:), allocatable depletion_fraction
Provide support for assessing the effect of irrigation on recharge values by estimating the irrigatio...
subroutine actual_et_fao56_two_stage_initialize()
impure elemental subroutine calculate_actual_et_fao56_two_stage(actual_et, crop_etc, bare_soil_evap, taw, raw, fraction_exposed_and_wetted_soil, kr, ke, ks, adjusted_depletion_fraction_p, soil_moisture_deficit, evaporable_water_storage, evaporable_water_deficit, it_is_growing_season, kcb, landuse_index, soil_group, awc, current_rooting_depth, current_plant_height, soil_storage, soil_storage_max, reference_et0, infiltration)
Populate actual evapotranspiration by substituting in the daily average actual ET from a gridded data...
subroutine, public actual_et_gridded_values_initialize(is_cell_active)
subroutine, public actual_et_gridded_values_calculate(is_cell_active)
real(c_float), dimension(:), allocatable, public actual_et
Calculate actual ET by means of an approximation to the Thornthwaite-Mather soil-moisture-retention t...
elemental subroutine calculate_actual_et_thornthwaite_mather(actual_et, soil_storage, soil_storage_max, infiltration, crop_etc)
Populate the available water content by reading in and depth-averaging soil available water contents ...
subroutine, public awc_depth_integrated_initialize(lactive, fawc, isoils_code)
subroutine, public awc_depth_integrated_read(frooting_depth)
real(c_float), dimension(:,:), allocatable, public available_water_content
Populate available water content by reading in the available water content from a gridded data source...
subroutine, public awc_gridded_values_read()
subroutine, public awc_gridded_values_initialize(lactive, fawc)
This module contains physical constants and convenience functions aimed at performing unit conversion...
logical(c_bool), parameter, public true
logical(c_bool), parameter, public false
character(len=:), allocatable, public output_directory_name
subroutine, public initialize_continuous_frozen_ground_index(cfgi, cfgi_ll, cfgi_ul, active_cells)
elemental subroutine, public update_continuous_frozen_ground_index(fcfgi, ftmax_f, ftmin_f, fsnowcover)
Update the continuous frozen ground index (CFGI) for a cell.
Update crop coefficients for crop types in simulation.
subroutine, public crop_coefficients_fao56_initialize()
impure elemental subroutine, public crop_coefficients_fao56_update_growing_season(landuse_index, kcb, it_is_growing_season)
subroutine, public crop_coefficients_fao56_update_growth_stage_dates()
impure elemental subroutine, public crop_coefficients_fao56_calculate(kcb, landuse_index, gdd)
type(datetime_t), dimension(:,:), allocatable, public growth_stage_date
Defines the DATA_CATALOG_T data type, which contains type-bound procedures to add,...
type(data_catalog_t), public dat
DAT is a global to hold data catalog entries.
type(general_grid_t), pointer, public pgrd
integer(c_int), parameter, public dynamic_grid
This module contains the DATETIME_T class and associated time and date-related routines,...
Module direct_net_infiltration__gridded_data provides support for adding miscellaneous source and sin...
subroutine, public direct_net_infiltration_calculate(direct_net_infiltration, indx, is_cell_active, nodata_fill_value)
subroutine, public direct_net_infiltration_initialize(is_cell_active, landuse_index)
Initialize the routine to enable input/output of arbitrary sources/sink terms.
Module direct_soil_moisture__gridded_data provides support for adding miscellaneous source and sink t...
subroutine, public direct_soil_moisture_calculate(direct_soil_moisture, is_cell_active, indx)
subroutine, public direct_soil_moisture_initialize(is_cell_active, landuse_index)
Initialize the routine to enable input/output of arbitrary sources/sink terms to be added directly to...
Populate potential evapotranspiration by substituting in the daily average ET from a gridded data sou...
subroutine, public et_gridded_values_calculate()
type(data_catalog_entry_t), pointer, public pet_grid
subroutine, public et_gridded_values_initialize(lactive)
Calculates potential evapotranspiration by means of the Hargreaves-Samani (1985) method.
impure elemental real(c_double) function et_hargreaves_calculate(idayofyear, inumdaysinyear, flatitude, ftmin, ftmax)
subroutine et_hargreaves_initialize()
Calculates potential evapotranspiration by means of the Jensen-Haise (1963) method.
elemental real(c_double) function, public et_jh_calculate(idayofyear, inumdaysinyear, flatitude, ftmin, ftmax, fas, fbs, fsunpct)
Module et__zone_values provides support for estimating reference ET given a zone map of ET_ZONE.
real(c_float), dimension(:), allocatable, public et_ratios
subroutine, public et_zone_values_initialize(lactive)
Initialize the ET grid.
type(data_catalog_entry_t), pointer, public pet_grid
subroutine, public et_zone_values_calculate()
subroutine, public warn(smessage, smodule, iline, shints, lfatal, iloglevel, lecho)
subroutine, public die(smessage, smodule, iline, shints, scalledby, icalledbyline)
Module fog__monthly_grid provides support for estimating fog drip given a gridded map of FOG_RATIO an...
subroutine, public fog_monthly_grid_initialize(lactive)
Initialize the fog drip algorithm.
subroutine, public fog_monthly_grid_calculate(frainfall, ffog, ilanduse_index, lactive, nodata_fill_value)
Provides support for input and output of gridded ASCII data, as well as for creation and destruction ...
real(c_float), parameter nc_fill_float
type(general_grid_t) function, pointer, public grid_createsimple(inx, iny, rx0, ry0, rgridcellsize, idatatype)
integer(c_int), parameter, public grid_datatype_int
subroutine, public grid_destroy(pgrd)
subroutine, public grid_writearcgrid(sfilename, pgrd)
integer(c_int), parameter, private row
integer(c_int), parameter, public grid_datatype_real
subroutine, public growing_degree_day_initialize(is_cell_active, landuse_index)
impure elemental subroutine, public modified_growing_degree_day_calculate(gdd, tmin, tmax, order)
impure elemental subroutine, public growing_degree_day_calculate(gdd, tmean, order)
subroutine, public growing_degree_day_be_calculate(gdd, tmean, tmin, tmax, order)
subroutine, public growing_degree_day_be_initialize(is_cell_active, landuse_index)
elemental subroutine, public growing_season_update(landuse_index, gdd, mean_air_temp, it_is_growing_season)
subroutine, public growing_season_initialize()
real(c_float), dimension(:), allocatable, public bucket_interception_storage_max_growing_season
real(c_float), dimension(:), allocatable, public bucket_interception_storage_max_nongrowing_season
elemental subroutine, public interception_bucket_calculate(ilanduseindex, fprecip, ffog, fcanopy_cover_fraction, it_is_growing_season, finterception)
subroutine, public interception_bucket_initialize(active_cells)
real(c_float), dimension(:), allocatable, public stemflow_fraction_table_values
real(c_float), dimension(:), allocatable, public trunk_storage_capacity_table_values
real(c_float), dimension(:), allocatable, public evaporation_to_rainfall_ratio
subroutine, public interception_gash_initialize(lactive, fcanopy_cover_fraction, ilanduseindex)
Initialize the Gash interception algorithm.
real(c_float), dimension(:), allocatable, public gash_interception_storage_max_nongrowing_season
real(c_float), dimension(:), allocatable, public p_sat
elemental subroutine, public interception_gash_calculate(frainfall, ffog, fcanopy_cover_fraction, ftrunk_storage_capacity, fstemflow_fraction, fevaporation_to_rainfall_ratio, fprecipitation_at_saturation, finterception)
real(c_float), dimension(:), allocatable, public gash_interception_storage_max_growing_season
Provides support for assessing the effect of irrigation on recharge values by estimating the irrigati...
impure elemental subroutine, public irrigation__calculate(irrigation_amount, landuse_index, soil_storage, soil_storage_max, total_available_water, rainfall, runoff, crop_etc, irrigation_mask, num_days_since_planting, monthly_rainfall, monthly_runoff)
subroutine, public irrigation__initialize(is_active)
Estimate the irrigation water required to sustain plant growth.
type(logfile_t), public logs
Module maximum_net_infiltration__gridded_data provides support for adding miscellaneous source and si...
subroutine, public maximum_net_infiltration_initialize(is_cell_active, landuse_index)
Initialize the routine to establish maximum potential recharge rates.
elemental subroutine, public maximum_net_infiltration_calculate(net_infiltration, rejected_net_infiltration, indx)
subroutine model_initialize_direct_soil_moisture_gridded(this)
subroutine model_initialize_et_hargreaves(this)
subroutine model_initialize_snowfall_prms(this)
subroutine initialize_row_column_indices_sub(this)
subroutine model_initialize_snowfall_original(this)
subroutine model_initialize_snowmelt_original(this)
subroutine set_default_procedure_pointers_sub(this)
subroutine model_read_available_water_content_gridded(this)
subroutine model_initialize_routing_d8(this)
subroutine model_initialize_precip_method_of_fragments(this)
subroutine model_calculate_maximum_net_infiltration_none(this, indx)
integer(c_int) function row_column_to_index_fn(this, col_num, row_num)
subroutine model_update_growing_season_crop_coefficient_fao56(this)
subroutine model_calculate_direct_net_infiltration_none(this, indx)
subroutine model_get_precip_normal(this)
subroutine model_initialize_soil_storage_max_gridded(this)
subroutine model_calculate_snowfall_original(this)
subroutine initialize_methods_sub(this)
subroutine initialize_arrays_sub(this)
subroutine model_calculate_et_hargreaves(this)
subroutine model_initialize_continuous_frozen_ground_index(this)
subroutine model_calculate_modified_gdd(this)
subroutine model_update_rooting_depth_fao56(this)
subroutine model_calculate_gdd_none(this)
subroutine model_initialize_available_water_content_gridded(this)
subroutine model_calculate_maximum_net_infiltration_gridded(this, indx)
subroutine model_update_irrigation_mask(this)
subroutine model_calculate_direct_soil_moisture_none(this, indx)
subroutine, public initialize_landuse_codes()
Match landuse codes from table with those contained in the gridded landuse.
subroutine model_update_landuse_codes_dynamic(this)
subroutine model_initialize_soil_storage_max_internally_calculated(this)
subroutine model_initialize_precip_normal(this)
subroutine model_calculate_actual_et_fao56__two_stage(this, indx)
subroutine model_calculate_routing_d8(this, indx)
subroutine model_calculate_snowmelt_prms(this)
subroutine model_initialize_actual_et_gridded_values(this)
subroutine model_initialize_direct_soil_moisture_none(this)
subroutine model_calculate_et_daily_grid(this)
subroutine model_initialize_direct_net_infiltration_none(this)
subroutine model_update_rooting_depth_none(this)
subroutine model_calculate_runoff_gridded_values(this, indx)
subroutine model_calculate_actual_et_gridded_values(this, indx)
subroutine model_initialize_crop_coefficient_none(this)
subroutine model_initialize_irrigation_none(this)
subroutine model_initialize_actual_et_fao56(this)
subroutine model_calculate_irrigation(this, indx)
subroutine model_calculate_snowmelt_original(this)
subroutine model_initialize_actual_et_fao56__two_stage(this)
type(model_domain_t), public model
subroutine model_initialize_gdd_none(this)
type(cell_col_row_t), dimension(:), allocatable temp_dump
subroutine set_method_pointers_sub(this, scmdtext, argv_list)
subroutine model_initialize_et_monthly_zone_grid(this)
subroutine model_initialize_gdd_be(this)
subroutine model_initialize_runoff_gridded_values(this)
subroutine model_initialize_rooting_depth_none(this)
subroutine model_dump_variables(this, unitnum, indx_start, indx_end)
subroutine preflight_check_method_pointers(this)
subroutine model_output_irrigation_none(this)
subroutine model_calculate_direct_soil_moisture_gridded(this, indx)
subroutine model_initialize_precip_tabular(this)
subroutine model_update_crop_coefficient_fao56(this)
subroutine model_get_minimum_air_temperature_normal(this)
subroutine model_initialize_et_jensen_haise(this)
type(cell_col_row_t), dimension(:), allocatable dump
subroutine set_inactive_cells_sub(this)
subroutine model_get_maximum_air_temperature_tabular(this)
subroutine model_calculate_et_monthly_zone_grid(this)
subroutine model_initialize_irrigation(this)
subroutine model_get_minimum_air_temperature_tabular(this)
subroutine model_get_precip_method_of_fragments(this)
subroutine model_update_rooting_depth_table_sub(this)
subroutine model_read_available_water_content_depth_integrated(this)
subroutine model_initialize_maximum_net_infiltration_gridded(this)
subroutine model_calculate_snowfall_prms(this)
subroutine model_initialize_snowmelt_prms(this)
subroutine model_update_landuse_codes_static(this)
subroutine get_weather_data(this)
subroutine model_calculate_et_jensen_haise(this)
subroutine model_calculate_gdd_be(this)
subroutine model_initialize_et_daily_grid(this)
subroutine model_calculate_et_monthly_grid(this)
subroutine model_initialize_interception_gash(this)
subroutine model_calculate_runoff_curve_number(this, cell_index)
subroutine model_initialize_runoff_curve_number(this)
subroutine model_calculate_interception_gash(this)
subroutine model_initialize_fog_none(this)
subroutine model_calculate_gdd(this)
type(general_grid_t), pointer prooting_depth
subroutine model_calculate_actual_et_fao56(this, indx)
subroutine model_calculate_climatic_water_deficit(this, cell_index)
subroutine model_calculate_range_in_air_temperature(this)
subroutine model_initialize_crop_coefficient_fao56(this)
subroutine model_initialize_actual_et_thornthwaite_mather(this)
subroutine model_initialize_maximum_net_infiltration_none(this)
subroutine model_get_maximum_air_temperature_normal(this)
subroutine model_dump_variables_none(this)
subroutine model_initialize_gdd(this)
subroutine model_initialize_available_water_content_depth_integrated(this)
subroutine model_initialize_fog_monthly_grid(this)
subroutine model_dump_variables_by_cell(this)
subroutine model_calculate_interception_bucket(this)
subroutine model_calculate_fog_none(this)
subroutine, public read_landuse_codes
subroutine model_calculate_continuous_frozen_ground_index(this)
subroutine set_output_directory_sub(this, output_dir_name)
subroutine model_calculate_irrigation_none(this, indx)
subroutine model_initialize_et_monthly_grid(this)
subroutine minmaxmean_float(variable, varname, active_cells)
subroutine initialize_grid_sub(this, inumcols, inumrows, dx_ll, dy_ll, dgridcellsize)
subroutine model_calculate_direct_net_infiltration_gridded(this, indx)
subroutine model_initialize_rooting_depth_fao56(this)
subroutine model_get_precip_tabular(this)
subroutine minmaxmean_int(variable, varname, active_cells)
subroutine summarize_state_variables_sub(this)
subroutine model_calculate_actual_et_thornthwaite_mather(this, indx)
subroutine model_update_growing_season(this)
subroutine model_initialize_growing_season(this)
real(c_float), dimension(:,:), allocatable, public rooting_depth_max
subroutine model_update_crop_coefficient_none(this)
subroutine model_initialize_routing_none(this)
subroutine model_calculate_fog_monthly_grid(this)
subroutine model_initialize_direct_net_infiltration_gridded(this)
subroutine model_calculate_mean_air_temperature(this)
subroutine model_initialize_growing_season_crop_coefficient_fao56(this)
subroutine model_calculate_routing_none(this, indx)
subroutine model_initialize_interception_bucket(this)
Provide support for use of netCDF files as input for time-varying, gridded meteorlogic data,...
type(parameters_t), public params
type(dict_t), public params_dict
Module precipitation__method_of_fragments provides support for creating synthetic daily precipitation...
subroutine, public precipitation_method_of_fragments_initialize(lactive)
Initialize method of fragments.
elemental subroutine, public update_rooting_depth(zr_i, zr_max, landuse_index, kcb)
Calculate the effective root zone depth.
subroutine, public initialize_rooting_depth()
integer(c_int), dimension(:,:), allocatable, public number_of_upslope_connections
integer(c_int), dimension(:,:), allocatable, public sum_of_upslope_cells
elemental integer(c_int) function, public get_target_index(iteration_index)
elemental integer(c_int) function, public get_sort_order(cell_index)
subroutine, public routing_d8_initialize(lactive, sort_order)
elemental integer(c_int) function, public get_cell_index(iteration_index)
elemental subroutine, public runoff_curve_number_calculate(runoff, curve_num_adj, cell_index, landuse_index, soil_group, it_is_growing_season, inflow, soil_storage_max, continuous_frozen_ground_index, cfgi_lower_limit, cfgi_upper_limit)
Calculate the runoff by means of the curve number method.
real(c_float), dimension(:,:), allocatable, public prev_5_days_rain
subroutine, public update_previous_5_day_rainfall(infil, indx)
subroutine, public runoff_curve_number_initialize(cell_is_active)
Module runoff__gridded_values provides support for estimating fog drip given a gridded map of RUNOFF_...
subroutine, public runoff_gridded_values_initialize(lactive)
Initialize the infiltration grid.
subroutine, public runoff_gridded_values_update_ratios()
real(c_float), dimension(:), allocatable, public runoff_ratios
type(date_range_t), public sim_dt
elemental subroutine, public snowmelt_original_calculate(potential_snowmelt, tmin, tmax, imperial_units)
subroutine weather_data_tabular_initialize()
subroutine weather_data_tabular_get_tmin(dt, tmin_value)
subroutine weather_data_tabular_get_precip(dt, precip_value)
subroutine weather_data_tabular_get_tmax(dt, tmax_value)