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) :: indx
436 integer (c_int) :: iStat(72)
438 icount = count( this%active )
441 allocate( this%landuse_code(icount), stat=istat(1) )
442 allocate( this%landuse_index(icount), stat=istat(2) )
443 allocate( this%soil_group(icount), stat=istat(3) )
444 allocate( this%num_upslope_connections(icount), stat=istat(4) )
445 allocate( this%sum_upslope_cells(icount), stat=istat(5) )
446 allocate( this%awc(icount), stat=istat(6) )
447 allocate( this%latitude(icount), stat=istat(7) )
448 allocate( this%reference_ET0(icount), stat=istat(8) )
449 allocate( this%actual_ET(icount), stat=istat(9) )
450 allocate( this%inflow(icount), stat=istat(10))
451 allocate( this%runon(icount), stat=istat(11) )
452 allocate( this%runoff(icount), stat=istat(12) )
453 allocate( this%outflow(icount), stat=istat(13) )
454 allocate( this%infiltration(icount), stat=istat(14) )
455 allocate( this%snowfall(icount), stat=istat(15) )
456 allocate( this%snowmelt(icount), stat=istat(16) )
457 allocate( this%interception(icount), stat=istat(17) )
458 allocate( this%rainfall(icount), stat=istat(18) )
459 allocate( this%interception_storage(icount), stat=istat(19) )
460 allocate( this%interception_storage_max(icount), stat=istat(20) )
461 allocate( this%snow_storage(icount), stat=istat(21) )
462 allocate( this%soil_storage(icount), stat=istat(22) )
463 allocate( this%soil_storage_max(icount), stat=istat(23) )
464 allocate( this%net_infiltration(icount), stat=istat(24) )
465 allocate( this%fog(icount), stat=istat(25) )
466 allocate( this%irrigation(icount), stat=istat(26) )
467 allocate( this%sort_order(icount), stat=istat(27) )
468 allocate( this%runoff_outside( icount ), stat=istat(28) )
469 allocate( this%pervious_fraction( icount ), stat=istat(29) )
470 allocate( this%surface_storage( icount ), stat=istat(30) )
471 allocate( this%surface_storage_excess( icount ), stat=istat(31) )
472 allocate( this%surface_storage_max( icount ), stat=istat(32) )
473 allocate( this%storm_drain_capture( icount ), stat=istat(33) )
474 allocate( this%canopy_cover_fraction( icount ), stat=istat(34) )
475 allocate( this%crop_coefficient_kcb( icount ), stat=istat(35) )
476 allocate( this%potential_snowmelt( icount ), stat=istat(36) )
477 allocate( this%continuous_frozen_ground_index( icount ), stat=istat(37) )
478 allocate( this%cfgi_lower_limit( icount), stat=istat(38) )
479 allocate( this%cfgi_upper_limit( icount), stat=istat(39) )
480 allocate( this%rooting_depth_max( icount ), stat=istat(40) )
481 allocate( this%current_rooting_depth( icount ), stat=istat(41) )
482 allocate( this%current_plant_height( icount ), stat=istat(42) )
483 allocate( this%polygon_id( icount ), stat=istat(43) )
484 allocate( this%actual_et_soil( icount ), stat=istat(44) )
485 allocate( this%actual_et_impervious( icount ), stat=istat(45) )
486 allocate( this%actual_et_interception( icount ), stat=istat(46) )
487 allocate( this%adjusted_depletion_fraction_p( icount ), stat=istat(47) )
488 allocate( this%crop_etc( icount ), stat=istat(48) )
489 allocate( this%direct_net_infiltration( icount ), stat=istat(49) )
490 allocate( this%direct_soil_moisture( icount ), stat=istat(50) )
491 allocate( this%number_of_days_since_planting( icount ), stat=istat(51) )
492 allocate( this%col_num_1D( icount ), stat=istat(52) )
493 allocate( this%row_num_1D( icount ), stat=istat(53) )
494 allocate( this%it_is_growing_season( icount ), stat=istat(54) )
495 allocate( this%curve_num_adj( icount ), stat=istat(55) )
496 allocate( this%rejected_net_infiltration( icount ), stat=istat(56) )
497 allocate( this%evap_reduction_coef_kr( icount ), stat=istat(57) )
498 allocate( this%surf_evap_coef_ke( icount ), stat=istat(58) )
499 allocate( this%plant_stress_coef_ks( icount ), stat=istat(59) )
500 allocate( this%total_available_water_taw( icount ), stat=istat(60) )
501 allocate( this%readily_available_water_raw( icount ), stat=istat(61) )
502 allocate( this%bare_soil_evap( icount ), stat=istat(62) )
503 allocate( this%fraction_exposed_and_wetted_soil( icount ), stat=istat(63) )
504 allocate( this%delta_soil_storage( icount ), stat=istat(64) )
505 allocate( this%soil_moisture_deficit( icount ), stat=istat(65) )
506 allocate( this%net_rainfall( icount ), stat=istat(66) )
507 allocate( this%net_snowfall( icount ), stat=istat(67) )
508 allocate( this%evaporable_water_storage( icount ), stat=istat(68) )
509 allocate( this%evaporable_water_deficit( icount ), stat=istat(69) )
510 allocate( this%irrigation_mask( icount ), stat=istat(70) )
511 allocate( this%tmax_minus_tmin( icount ), stat=istat(71) )
512 allocate( this%climatic_deficit( icount ), stat=istat(72) )
514 do iindex = 1, ubound( istat, 1)
515 if ( istat( iindex ) /= 0 )
call warn(
"INTERNAL PROGRAMMING ERROR" &
516 //
"--Problem allocating memory; iIndex=" &
520 if (any( istat /= 0) )
call die (
"Unable to allocate memory for one or more arrays.", &
523 this%landuse_code = 0_c_int
524 this%landuse_index = 0_c_int
525 this%soil_group = 0_c_int
526 this%num_upslope_connections = 0_c_int
527 this%sum_upslope_cells = 0_c_int
528 this%awc = 0.0_c_float
529 this%latitude = 0.0_c_float
530 this%reference_ET0 = 0.0_c_float
531 this%actual_ET = 0.0_c_double
532 this%bare_soil_evap = 0.0_c_float
533 this%inflow = 0.0_c_float
534 this%runon = 0.0_c_float
535 this%runoff = 0.0_c_float
536 this%outflow = 0.0_c_float
537 this%infiltration = 0.0_c_float
538 this%snowfall = 0.0_c_float
539 this%net_snowfall = 0.0_c_float
540 this%snowmelt = 0.0_c_float
542 this%interception = 0.0_c_float
543 this%rainfall = 0.0_c_float
544 this%net_rainfall = 0.0_c_float
545 this%interception_storage = 0.0_c_float
546 this%interception_storage_max = 0.0_c_float
547 this%snow_storage = 0.0_c_float
548 this%soil_storage = 0.0_c_double
549 this%soil_storage_max = 0.0_c_float
550 this%delta_soil_storage = 0.0_c_float
551 this%soil_moisture_deficit = 0.0_c_float
553 this%net_infiltration = 0.0_c_float
554 this%rejected_net_infiltration = 0.0_c_float
555 this%fog = 0.0_c_float
556 this%irrigation = 0.0_c_float
557 this%curve_num_adj = 0.0_c_float
558 this%runoff_outside = 0.0_c_float
559 this%pervious_fraction = 1.0_c_float
560 this%surface_storage = 0.0_c_float
561 this%surface_storage_excess = 0.0_c_float
562 this%surface_storage_max = 0.0_c_float
563 this%storm_drain_capture = 0.0_c_float
564 this%canopy_cover_fraction = 0.0_c_float
565 this%crop_coefficient_kcb = 0.0_c_float
566 this%potential_snowmelt = 0.0_c_float
567 this%continuous_frozen_ground_index = 0.0_c_float
568 this%cfgi_lower_limit = 0.0_c_float
569 this%cfgi_upper_limit = 0.0_c_float
570 this%rooting_depth_max = 0.0_c_float
571 this%current_rooting_depth = 0.0_c_float
572 this%current_plant_height = 0.0_c_float
573 this%polygon_id = 0_c_int
574 this%actual_et_soil = 0.0_c_double
575 this%actual_et_impervious = 0.0_c_double
576 this%actual_et_interception = 0.0_c_double
577 this%adjusted_depletion_fraction_p = 0.0_c_float
578 this%crop_etc = 0.0_c_float
579 this%direct_net_infiltration = 0.0_c_float
580 this%direct_soil_moisture = 0.0_c_float
581 this%number_of_days_since_planting = 0_c_int
582 this%evap_reduction_coef_kr = 0.0_c_float
583 this%surf_evap_coef_ke = 0.0_c_float
584 this%plant_stress_coef_ks = 0.0_c_float
585 this%total_available_water_taw = 0.0_c_float
586 this%readily_available_water_raw = 0.0_c_float
587 this%fraction_exposed_and_wetted_soil = 0.0_c_float
588 this%evaporable_water_storage = 0.0_c_float
589 this%evaporable_water_deficit = 0.0_c_float
590 this%it_is_growing_season =
false
591 this%irrigation_mask = 1.0_c_float
592 this%tmax_minus_tmin = 0.0_c_float
593 this%climatic_deficit = 0.0_c_float
596 this%sort_order( iindex ) = iindex
608 integer (c_int) :: row_num, col_num
609 integer (c_int) :: status
611 do row_num=lbound( this%row_num_2D, 2), ubound( this%row_num_2D, 2)
612 this%row_num_2D( :, row_num ) = row_num
615 do col_num=lbound( this%col_num_2D, 1), ubound( this%col_num_2D, 1 )
616 this%col_num_2D( col_num, : ) = col_num
619 this%col_num_1D = pack( this%col_num_2D, this%active )
620 this%row_num_1D = pack( this%row_num_2D, this%active )
622 deallocate( this%col_num_2D, stat=status )
623 deallocate( this%row_num_2D, stat=status )
632 integer (c_int),
intent(in) :: col_num
633 integer (c_int),
intent(in) :: row_num
634 integer (c_int) :: indexval
637 logical (c_bool) :: found_match
641 do indexval=lbound( this%col_num_1D, 1 ), ubound( this%col_num_1D, 1 )
643 if ( ( this%col_num_1D( indexval ) == col_num ) &
644 .and. ( this%row_num_1D( indexval ) == row_num ) )
then
651 if ( .not. found_match ) indexval = -9999
661 call this%init_interception
663 call this%init_snowfall
665 call this%init_rooting_depth
667 call this%init_snowmelt
671 call this%init_precipitation_data
673 call this%init_runoff
675 call this%init_soil_storage_max
677 call this%init_routing
679 call this%init_actual_et
681 call this%init_reference_et
685 call this%init_irrigation
687 call this%init_direct_net_infiltration
689 call this%init_direct_soil_moisture
691 call this%init_maximum_net_infiltration
693 call this%init_crop_coefficient
704 type (DATA_CATALOG_ENTRY_T),
pointer :: pHSG
705 type (DATA_CATALOG_ENTRY_T),
pointer :: pLULC
706 type (DATA_CATALOG_ENTRY_T),
pointer :: pAWC
707 type (DATA_CATALOG_ENTRY_T),
pointer :: pSoil_Storage_Max
708 type (DATA_CATALOG_ENTRY_T),
pointer :: pD8_FLOWDIR
709 type ( GENERAL_GRID_T ),
pointer :: pTempGrd
711 plulc =>
dat%find(
"LAND_USE")
712 phsg =>
dat%find(
"HYDROLOGIC_SOILS_GROUP")
713 pawc =>
dat%find(
"AVAILABLE_WATER_CONTENT")
714 psoil_storage_max =>
dat%find(
"SOIL_STORAGE_MAX")
715 pd8_flowdir =>
dat%find(
"FLOW_DIRECTION")
717 if( .not.
associated( pawc ) ) pawc =>
dat%find(
"AVAILABLE_WATER_CONTENT")
719 if ( .not.
associated(phsg) ) &
720 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
722 if ( .not.
associated(phsg%pGrdBase) ) &
723 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
725 if ( .not.
allocated(phsg%pGrdBase%iData) ) &
726 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of UNALLOCATED variable", __file__, __line__)
737 if ( .not.
associated(plulc) ) &
738 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
740 if ( .not.
associated(plulc%pGrdBase) ) &
741 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
743 if ( .not.
allocated(plulc%pGrdBase%iData) ) &
744 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of UNALLOCATED variable", __file__, __line__)
746 this%active = .
true._c_bool
748 if (
associated( pd8_flowdir ) )
then
750 call pd8_flowdir%getvalues()
751 where ( pd8_flowdir%pGrdBase%iData < 0 ) this%active = .
false._c_bool
757 if (
associated( pawc) )
then
759 where ( ( phsg%pGrdBase%iData < 1 ) &
760 .or. ( plulc%pGrdBase%iData < 0 ) &
761 .or. ( pawc%pGrdBase%rData < 0.0 ) )
763 this%active = .
false._c_bool
771 where ( ( phsg%pGrdBase%iData < 1 ) &
772 .or. ( plulc%pGrdBase%iData < 0 ) &
775 this%active = .
false._c_bool
780 elseif (
associated( psoil_storage_max ) )
then
782 call psoil_storage_max%getvalues()
784 where ( ( phsg%pGrdBase%iData < 1 ) &
785 .or. ( plulc%pGrdBase%iData < 0 ) &
786 .or. ( psoil_storage_max%pGrdBase%rData < 0.0 ) )
788 this%active = .
false._c_bool
794 call die(
"Failed to find gridded or tabular data to use in initializing " &
795 //
"available water capacity or soil storage.", &
800 call logs%write(
ascharacter(count(this%active))//
" cells are currently active out of a total of " &
804 ptempgrd =>
grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
805 rx0=this%X_ll, ry0=this%Y_ll, &
808 where ( this%active )
809 ptempgrd%iData = 1_c_int
811 ptempgrd%iData = 0_c_int
825 character (len=10) :: date_str
827 plulc =>
dat%find(
"LAND_USE")
829 if (
associated(plulc) )
then
835 call plulc%getvalues(
sim_dt%curr )
837 if ( plulc%lGridHasChanged )
then
838 date_str =
sim_dt%curr%prettydate()
840 //trim(date_str)//
".asc", plulc%pGrdBase )
845 call plulc%getvalues()
846 call grid_writearcgrid(
"Landuse_land_cover__as_read_into_SWB.asc", plulc%pGrdBase )
852 call warn(smessage=
"LAND_USE dataset is flawed or missing.", lfatal=
true, &
853 iloglevel =
log_all, shints=
"Check to see that a valid path and filename have" &
854 //
" been ~included in the control file for the LAND_USE dataset.", &
870 integer (c_int) :: iindex
871 integer (c_int),
allocatable :: ilandusecodes(:)
873 integer (c_int) :: iindex2
874 integer (c_int) :: icount
875 integer (c_int) :: istat
876 logical (c_bool) :: lmatch
879 call sllist%append(
"LU_Code")
880 call sllist%append(
"LU_code")
881 call sllist%append(
"Landuse_Code")
882 call sllist%append(
"LULC_Code")
885 call params%get_parameters( slkeys=sllist, ivalues=ilandusecodes, lfatal=
true )
887 if (ubound(ilandusecodes,1) <= 1)
then
888 call warn(smessage=
"A lookup table with a only a single entry will not work with swb2.", &
889 shints=
"Please use a lookup table with more than a single line of data.", &
894 plulc =>
dat%find(
"LAND_USE")
896 if (
associated(plulc) )
then
898 if (
associated( plulc%pGrdBase) )
then
899 model%landuse_code = pack( plulc%pGrdBase%iData,
model%active )
901 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
904 call die(
"Attempted use of NULL pointer. Failed to find LAND_USE data element.", &
911 model%landuse_index = -9999
918 if ( all( ilandusecodes >= 0 ) )
then
920 do iindex = 1, ubound(
model%landuse_code,1)
924 do iindex2=1, ubound(ilandusecodes, 1)
926 if (
model%landuse_code(iindex) == ilandusecodes(iindex2) )
then
927 model%landuse_index(iindex) = iindex2
935 if ( .not. lmatch )
then
937 //
" with a corresponding landuse code from lookup tables.", &
938 shints=
"Make sure your lookup table(s) have landuse codes corresponding to all values in " &
942 model%landuse_index(iindex) = 1
946 call logs%write(
"Matches were found between landuse grid value and table value for " &
948 ilinesbefore=1, ilinesafter=1, iloglevel=
log_all)
955 if ( count(
model%landuse_index < 0) > 0 )
then
957 //
" assigned a landuse index value.", lfatal=
true, shints=
"Make sure that you have an " &
958 //
"entry in the landuse lookup table for each unique code contained in your landuse grid." )
1000 integer (c_int) :: iJulianDay
1001 integer (c_int) ::iMonth
1002 integer (c_int) ::iDay
1003 integer (c_int) ::iYear
1005 associate( dt =>
sim_dt%curr )
1007 ijulianday = dt%getJulianDay()
1008 imonth =
asint( dt%iMonth )
1009 iday =
asint( dt%iDay )
1016 call this%get_precipitation_data()
1017 call this%get_minimum_air_temperature_data()
1018 call this%get_maximum_air_temperature_data()
1020 call this%calculate_mean_air_temperature()
1021 call this%calculate_range_in_air_temperature()
1033 if (.not.
associated( this%init_interception) ) &
1034 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1035 if (.not.
associated( this%calc_interception) ) &
1036 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1038 if (.not.
associated( this%init_irrigation) ) &
1039 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1040 if (.not.
associated( this%calc_irrigation) ) &
1041 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1043 if (.not.
associated( this%init_runoff) ) &
1044 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1045 if (.not.
associated( this%calc_runoff) ) &
1046 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1048 if (.not.
associated( this%init_reference_et) ) &
1049 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1050 if (.not.
associated( this%calc_reference_et) ) &
1051 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1053 if (.not.
associated( this%init_snowmelt) ) &
1054 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1055 if (.not.
associated( this%calc_snowmelt) ) &
1056 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1058 if (.not.
associated( this%init_snowfall) ) &
1059 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1060 if (.not.
associated( this%calc_snowfall) ) &
1061 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1063 if (.not.
associated( this%init_GDD) ) &
1064 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1065 if (.not.
associated( this%calc_GDD) ) &
1066 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1068 if (.not.
associated( this%init_routing) ) &
1069 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1070 if (.not.
associated( this%calc_routing) ) &
1071 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1073 if (.not.
associated( this%init_direct_net_infiltration) ) &
1074 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1075 if (.not.
associated( this%calc_direct_net_infiltration) ) &
1076 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1078 if (.not.
associated( this%init_soil_storage_max) ) &
1079 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1081 if (.not.
associated( this%get_precipitation_data ) ) &
1082 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1084 if (.not.
associated( this%get_minimum_air_temperature_data ) ) &
1085 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1087 if (.not.
associated( this%get_maximum_air_temperature_data ) ) &
1088 call die(
"INTERNAL PROGRAMMING ERROR--Null procedure pointer.", __file__, __line__ )
1097 character (len=*),
intent(in) :: sCmdText
1098 type (FSTRING_LIST_T) :: argv_list
1101 integer (c_int) :: indx
1102 integer (c_int) :: iostat
1103 integer (c_int) :: unitnum
1104 character (len=256) :: filename
1105 character (len=:),
allocatable :: Method_Name
1106 character (len=:),
allocatable :: modifier_text
1107 character (len=:),
allocatable :: dump_file_prefix
1108 character (len=:),
allocatable :: temp_str
1109 integer (c_int) :: col, row
1110 integer (c_int) :: indx_start, indx_end
1111 real (c_double) :: xcoord, ycoord
1112 logical (c_bool) :: row_col_num_are_valid
1113 logical (c_bool) :: coordinates_are_valid
1114 logical (c_bool) :: indices_are_valid
1115 integer (c_int) :: n
1117 method_name = argv_list%get(1)
1119 if ( scmdtext .containssimilar.
"INTERCEPTION" )
then
1121 if ( (method_name .strapprox.
"BUCKET") .or. (method_name .strapprox.
"HORTON"))
then
1126 call logs%WRITE(
"==> BUCKET/HORTON INTERCEPTION submodel selected.", iloglevel = log_all, lecho = false )
1128 elseif ( method_name .strapprox.
"GASH" )
then
1133 call logs%WRITE(
"==> GASH INTERCEPTION submodel selected.", iloglevel = log_all, lecho = false )
1137 call warn(
"Your control file specifies an unknown or unsupported INTERCEPTION method.", &
1138 lfatal = true, iloglevel = log_all, lecho = true )
1142 elseif ( scmdtext .containssimilar.
"RUNOFF" )
then
1144 if ( ( method_name .strapprox.
"C-N" ) .or. ( method_name .strapprox.
"CURVE_NUMBER" ) )
then
1149 call logs%WRITE(
"==> CURVE NUMBER RUNOFF submodel selected.", iloglevel = log_all, lecho = false )
1151 elseif ( ( method_name .strapprox.
"RUNOFF_RATIO" ) .or. ( method_name .strapprox.
"MONTHLY_GRID" ) )
then
1156 call logs%WRITE(
"==> RUNOFF RATIO submodel selected.", iloglevel = log_all, lecho = false )
1160 call warn(
"Your control file specifies an unknown or unsupported RUNOFF method.", &
1161 lfatal = true, iloglevel = log_all, lecho = true )
1165 elseif ( scmdtext .containssimilar.
"ROOTING" )
then
1167 if ( ( method_name .strapprox.
"DYNAMIC" ) .or. ( method_name .strapprox.
"FAO_56" ) &
1168 .or. ( method_name .strapprox.
"FAO-56" ) .or. ( method_name .strapprox.
"FAO56" ) )
then
1172 call logs%WRITE(
"==> DYNAMIC rooting depth submodel selected.", iloglevel = log_all, lecho = false )
1178 call logs%WRITE(
"==> STATIC rooting depth submodel selected.", iloglevel = log_all, lecho = false )
1182 elseif ( scmdtext .containssimilar.
"DYNAMIC_LANDUSE" )
then
1186 elseif ( scmdtext .containssimilar.
"STATIC_LANDUSE" )
then
1190 elseif ( scmdtext .containssimilar.
"SNOWFALL" )
then
1192 if ( ( method_name .strapprox.
"ORIGINAL" ) .or. ( method_name .strapprox.
"ORIGINAL_SWB_METHOD" ) )
then
1197 call logs%WRITE(
"==> ORIGINAL SNOWFALL submodel selected.", iloglevel = log_all, lecho = false )
1199 elseif ( method_name .strapprox.
"PRMS" )
then
1204 call logs%WRITE(
"==> PRMS SNOWFALL submodel selected.", iloglevel = log_all, lecho = false )
1208 call warn(
"Your control file specifies an unknown or unsupported SNOWFALL method.", &
1209 lfatal = true, iloglevel = log_all, lecho = true )
1213 elseif ( ( scmdtext .containssimilar.
"AVAILABLE_WATER_CONTENT" ) &
1214 .or. ( scmdtext .containssimilar.
"AVAILABLE_WATER_CAPACITY") )
then
1216 if ( ( method_name .strapprox.
"TABLE" ) )
then
1221 call logs%WRITE(
"==> TABLE method for populating AVAILABLE_WATER_CONTENT/AVAILABLE_WATER_CAPACITY selected.", &
1222 iloglevel = log_all, lecho = false )
1224 elseif ( ( method_name .strapprox.
"GRID" ) .or. ( method_name .strapprox.
"GRIDDED" ) )
then
1229 call logs%WRITE(
"==> GRIDDED VALUES method for populating AVAILABLE_WATER_CONTENT/AVAILABLE_WATER_CAPACITY selected.", &
1230 iloglevel = log_all, lecho = false )
1234 call warn(
"Your control file specifies an unknown or unsupported AVAILABLE_WATER_CONTENT/" &
1235 //
"AVAILABLE_WATER_CAPACITY method.", &
1236 lfatal = true, iloglevel = log_all, lecho = true )
1240 elseif ( scmdtext .containssimilar.
"FLOW_ROUTING" )
then
1242 if ( ( method_name .strapprox.
"D8" ) &
1243 .or. ( method_name .strapprox.
"DOWNHILL" ) )
then
1248 call logs%WRITE(
"==> D8 FLOW ROUTING submodel selected.", iloglevel = log_all, lecho = false )
1255 call logs%WRITE(
"==> NULL FLOW ROUTING submodel selected -- NO routing will be performed.", &
1256 iloglevel = log_all, lecho = false )
1260 elseif ( ( scmdtext .containssimilar.
"CROP_COEFFICIENT" ) &
1261 .or. ( scmdtext .containssimilar.
"CROP_COEF" ) )
then
1263 if ( ( method_name .strapprox.
"FAO56" ) &
1264 .or. ( method_name .strapprox.
"FAO-56" ) &
1265 .or. ( method_name .strapprox.
"FAO_56" ) )
then
1271 call logs%WRITE(
"==> FAO-56 crop coefficient calculation method selected.", iloglevel = log_all, &
1279 call logs%WRITE(
"==> NO crop coefficient calculation method selected. Kcb defaults to 1.0.", &
1280 iloglevel = log_all, lecho = false )
1284 elseif ( scmdtext .containssimilar.
"FOG" )
then
1286 if ( method_name .strapprox.
"MONTHLY_GRID" )
then
1291 call logs%WRITE(
"==> MONTHLY_GRID FOG submodel selected.", iloglevel = log_all, lecho = false )
1298 call logs%WRITE(
"==> NULL FOG submodel selected (i.e. no fog term).", iloglevel = log_all, lecho = false )
1302 elseif ( scmdtext .containssimilar.
"GROWING_DEGREE_DAY" )
then
1304 if ( ( method_name .strapprox.
"BASKERVILLE_EMIN" ) &
1305 .or. ( method_name .strapprox.
"BE" ) &
1306 .or. ( method_name .strapprox.
"SINUSOIDAL" ) )
then
1310 call logs%WRITE(
"==> Growing degree-day (GDD) will be calculated as described " &
1311 //
"in Baskerville and Emin (1969)", iloglevel = log_all, lecho = false )
1317 elseif( ( method_name .strapprox.
"SIMPLE" ) &
1318 .or. ( method_name .strapprox.
"SIMPLE_GROWING_DEGREE_DAY" ) &
1319 .or. ( method_name .strapprox.
"SIMPLE_GROWING_DEGREE-DAY") )
then
1323 call logs%WRITE(
"==> Growing degree-day (GDD) will be calculated using " &
1324 //
"simple averaging of TMAX and TMIN.", iloglevel = log_all, lecho = false )
1326 elseif( ( method_name .strapprox.
"MODIFIED" ) &
1327 .or. ( method_name .strapprox.
"MODIFIED_GROWING_DEGREE-DAY" ) &
1328 .or. ( method_name .strapprox.
"MODIFIED_GROWING_DEGREE_DAY" ) )
then
1332 call logs%WRITE(
"==> Modified growing degree-day (GDD) will be calculated using " &
1333 //
"a simple averaging of TMAX and TMIN.", iloglevel = log_all, lecho = false )
1337 call warn(
"Your control file specifies an unknown or unsupported GROWING DEGREE-DAY method.", &
1338 lfatal = true, iloglevel = log_all, lecho = true )
1342 elseif ( scmdtext .containssimilar.
"IRRIGATION" )
then
1344 if ( ( method_name .strapprox.
"FAO56" ) &
1345 .or. ( method_name .strapprox.
"FAO-56" ) &
1346 .or. ( method_name .strapprox.
"FAO_56" ) )
then
1351 call logs%WRITE(
"==> IRRIGATION will be calculated and applied as needed.", iloglevel = log_all, lecho = false )
1358 call logs%WRITE(
"==> IRRIGATION will *NOT* be active.", iloglevel = log_all, lecho = false )
1363 elseif ( ( scmdtext .containssimilar.
"SOIL_STORAGE_MAX" ) &
1364 .or. ( scmdtext .containssimilar.
"PLANT_AVAILABLE_WATER" ) )
then
1366 if ( method_name .strapprox.
"GRIDDED" )
then
1370 call logs%WRITE(
"==> SOIL_STORAGE_MAX will be read from a grid. Rooting depths will be recalculated" &
1371 //
" as ~SOIL_STORAGE_MAX / AWC.", iloglevel = log_all, lecho = false )
1377 call logs%WRITE(
"==> SOIL_STORAGE_MAX will be internally calculated from the given AWC and rooting depth values.", &
1378 iloglevel = log_all, lecho = false )
1383 elseif ( scmdtext .containssimilar.
"EVAPOTRANSPIRATION" )
then
1385 if ( ( method_name .strapprox.
"HARGREAVES" ) &
1386 .or. ( method_name .strapprox.
"HARGREAVES-SAMANI" ) &
1387 .or. ( method_name .strapprox.
"HARGREAVES_SAMANI" ) )
then
1392 call logs%WRITE(
"==> HARGREAVES-SAMANI EVAPOTRANSPIRATION submodel selected.", &
1393 iloglevel = log_all, lecho = false )
1395 elseif ( ( method_name .strapprox.
"JENSEN-HAISE" ) &
1396 .or. ( method_name .strapprox.
"JENSEN_HAISE" ) &
1397 .or. ( method_name .strapprox.
"JH" ) )
then
1402 call logs%WRITE(
"==> JENSEN_HAISE EVAPOTRANSPIRATION submodel selected.", &
1403 iloglevel = log_all, lecho = false )
1405 elseif ( ( method_name .strapprox.
"MONTHLY_GRID" ) &
1406 .or. ( method_name .strapprox.
"MONTHLY_GRID" ) )
then
1411 call logs%WRITE(
"==> MONTHLY_GRID EVAPOTRANSPIRATION submodel selected.", &
1412 iloglevel = log_all, lecho = false )
1414 elseif ( ( method_name .strapprox.
"MONTHLY_ZONE" ) &
1415 .or. ( method_name .strapprox.
"MONTHLY_ZONE_GRID" ) )
then
1420 call logs%WRITE(
"==> MONTHLY_GRID EVAPOTRANSPIRATION submodel selected.", &
1421 iloglevel = log_all, lecho = false )
1423 elseif ( ( method_name .strapprox.
"DAILY_GRID" ) &
1424 .or. ( method_name .strapprox.
"DAILY_GRID" ) )
then
1429 call logs%WRITE(
"==> DAILY_GRID EVAPOTRANSPIRATION submodel selected.", &
1430 iloglevel = log_all, lecho = false )
1434 call warn(
"Your control file specifies an unknown or unsupported EVAPOTRANSPIRATION method.", &
1435 lfatal = true, iloglevel = log_all, lecho = true )
1439 elseif ( scmdtext .containssimilar.
"PRECIPITATION" )
then
1441 if ( ( method_name .strapprox.
"NORMAL" ) &
1442 .or. ( method_name .strapprox.
"GRIDDED" ) &
1443 .or. ( method_name .strapprox.
"STANDARD" ) )
then
1448 call logs%WRITE(
"==> STANDARD PRECIPITATION submodel selected.", &
1449 iloglevel = log_all, lecho = false )
1451 elseif ( ( method_name .strapprox.
"TABLE") &
1452 .or. (method_name .strapprox.
"TABULAR") )
then
1459 call logs%WRITE(
"==> TABULAR PRECIPITATION submodel selected.", &
1460 iloglevel = log_all, lecho = false )
1461 call logs%WRITE(
" PRECIPITATION, TMIN, and TMAX will be supplied as TABLE values.", &
1462 iloglevel = log_all, lecho = false )
1464 elseif ( ( method_name .strapprox.
"METHOD_OF_FRAGMENTS" ) &
1465 .or. ( method_name .strapprox.
"FRAGMENTS" ) )
then
1470 call logs%WRITE(
"==> METHOD OF FRAGMENTS PRECIPITATION submodel selected.", &
1471 iloglevel = log_all, lecho = false )
1475 call warn(
"Your control file specifies an unknown or unsupported PRECIPITATION method.", &
1476 lfatal = true, iloglevel = log_all, lecho = true )
1480 elseif ( (scmdtext .containssimilar.
"DIRECT_NET_INFILTRATION" ) &
1481 .or. ( scmdtext .containssimilar.
"DIRECT_RECHARGE" ) )
then
1486 call logs%WRITE(
"==> GRIDDED or TABULAR values for water main leakage and other direct " &
1487 //
"net infiltration will be used.", iloglevel = log_all, lecho = false )
1489 elseif ( scmdtext .containssimilar.
"DIRECT_SOIL_MOISTURE" )
then
1494 call logs%WRITE(
"==> GRIDDED or TABULAR values for septic drainage and other direct " &
1495 //
"inputs to the root zone will be used.", iloglevel = log_all, lecho = false )
1497 elseif ( scmdtext .containssimilar.
"SOIL_MOISTURE" )
then
1499 if ( ( method_name .strapprox.
"T-M" ) &
1500 .or. ( method_name .strapprox.
"THORNTHWAITE-MATHER" ) &
1501 .or. ( method_name .strapprox.
"THORNTHWAITE_MATHER" ) &
1502 .or. ( method_name .strapprox.
"THORNTHWAITE") )
then
1507 call logs%WRITE(
"==> THORNTHWAITE-MATHER SOIL MOISTURE RETENTION submodel selected.", &
1508 iloglevel = log_all, lecho = false )
1510 elseif ( ( method_name .strapprox.
"T-M_EQUATIONS" ) &
1511 .or. ( method_name .strapprox.
"THORNTHWAITE-MATHER_EQUATIONS" ) &
1512 .or. ( method_name .strapprox.
"THORNTHWAITE_MATHER_EQUATIONS") )
then
1518 call warn(smessage=
"The SOIL_MOISTURE_METHOD 'THORNTHWAITE_MATHER_EQUATIONS' option has" &
1519 //
" been removed.", &
1520 shints=
"Please select the normal 'THORNTHWAITE_MATHER' SOIL_MOISTURE_METHOD and " &
1521 //
"try rerunning swb.", lfatal=true)
1524 elseif ( ( method_name .strapprox.
"FAO56_TWO_STAGE" ) .or. ( method_name .strapprox.
"FAO-56_TWO_STAGE" ) &
1525 .or. ( method_name .strapprox.
"FAO-56_TWO-STAGE" ))
then
1530 call logs%WRITE(
"==> **TWO-STAGE** FAO-56 SOIL MOISTURE RETENTION submodel selected.", &
1531 iloglevel = log_all, lecho = false )
1533 elseif ( ( method_name .strapprox.
"FAO56" ) .or. ( method_name .strapprox.
"FAO-56" ) )
then
1538 call logs%WRITE(
"==> FAO-56 SOIL MOISTURE RETENTION submodel selected.", &
1539 iloglevel = log_all, lecho = false )
1541 elseif ( ( method_name .strapprox.
"GRIDDED" ) )
then
1546 call logs%WRITE(
"==> **GRIDDED** ACTUAL ET will determine SOIL MOISTURE RETENTION.", &
1547 iloglevel = log_all, lecho = false )
1551 call warn(
"Your control file specifies an unknown or unsupported SOIL_MOISTURE method.", &
1552 lfatal = true, iloglevel = log_all, lecho = true )
1556 elseif ( scmdtext .containssimilar.
"DUMP_VARIABLES" )
then
1558 row = 0; col = 0; indx_start = 0; indx_end = 0
1559 xcoord=99999.; ycoord=99999.
1560 dump_file_prefix =
""
1564 if ( ( method_name .containssimilar.
"INDEX_RANGE") .and. ( argv_list%count >= 3 ) )
then
1566 indx_start = asint( argv_list%get(2) )
1567 indx_end = asint( argv_list%get(3) )
1569 elseif ( ( method_name .containssimilar.
"COORDINATES") .and. ( argv_list%count >= 3 ) &
1570 .or. ( method_name .containssimilar.
"COORD") .and. ( argv_list%count >= 3 ) )
then
1572 xcoord = asfloat( argv_list%get(2) )
1573 ycoord = asfloat( argv_list%get(3) )
1574 row = grid_getgridrownum( this%pGrdOut, ycoord )
1575 col = grid_getgridcolnum( this%pGrdOut, xcoord )
1577 elseif ( ( method_name .containssimilar.
"COL_ROW") .and. ( argv_list%count >= 3 ) )
then
1579 col = asint( argv_list%get(2) )
1580 row = asint( argv_list%get(3) )
1581 xcoord = grid_getgridx( this%pGrdOut, col )
1582 ycoord = grid_getgridy( this%pGrdOut, row )
1586 call warn(
"Unknown option and/or arguments supplied to DUMP_VARIABLES method.", &
1587 shints=
"The known option keywords are 'COL_ROW', 'COORD(INATES)' and 'INDEX_RANGE'.", &
1588 lfatal = true, iloglevel = log_all, lecho = true )
1592 if ( argv_list%count == 5)
then
1593 modifier_text = argv_list%get(4)
1594 if (modifier_text .containssimilar.
"ID")
then
1595 dump_file_prefix = argv_list%get(5)
1596 temp_str =
"__"//trim(dump_file_prefix)//
"__"
1598 call warn(
"Unknown option modifier supplied to DUMP_VARIABLES method.", &
1599 shints=
"The known option modifier is 'ID. You supplied "//trim(modifier_text), &
1600 lfatal = true, iloglevel = log_all, lecho = true )
1604 row_col_num_are_valid = grid_rowcolfallsinsidegrid( this%pGrdOut, row, col )
1605 coordinates_are_valid = grid_coordinatesfallinsidegrid( this%pGrdOut, xcoord, ycoord )
1606 indices_are_valid = ( (indx_start >= lbound(this%col_num_1D, 1) ) &
1607 .and. (indx_start <= ubound(this%col_num_1D, 1) ) &
1608 .and. (indx_end >= lbound(this%col_num_1D, 1) ) &
1609 .and. (indx_end <= ubound(this%col_num_1D, 1) ) )
1611 if ( row_col_num_are_valid .or. indices_are_valid )
then
1613 if (
allocated(
dump) )
then
1622 do indx=1, ubound(
dump, 1)
1626 if (
dump( indx )%col /= 0 .or.
dump( indx )%indx_start /= 0 ) cycle
1628 dump( indx )%col = col
1629 dump( indx )%row = row
1630 dump( indx )%indx_start = indx_start
1631 dump( indx )%indx_end = indx_end
1632 dump( indx )%x_coord = xcoord
1633 dump( indx )%y_coord = ycoord
1635 if ( row_col_num_are_valid )
then
1636 call logs%WRITE(
"==> SWB will dump variables for cell ("//ascharacter(col)//
"," &
1637 //ascharacter(row)//
").", iloglevel = log_all, lecho = false )
1638 filename = trim(output_directory_name)//
"SWB2_variable_values" &
1639 //trim(temp_str)//
"col_" &
1640 //ascharacter( col )//
"__row_" &
1641 //ascharacter( row )//
"__x_"//ascharacter(asint(xcoord)) &
1642 //
"__y_"//ascharacter(asint(ycoord))//
".csv"
1644 elseif ( indices_are_valid )
then
1645 call logs%WRITE(
"==> SWB will dump variables for cell indices ranging from " &
1646 //ascharacter(indx_start)//
" to "//ascharacter(indx_end)//
").", &
1647 iloglevel = log_all, lecho = false )
1648 filename = trim(output_directory_name)//
"SWB2_variable_values" &
1649 //trim(temp_str)//
"start_index_" &
1650 //ascharacter( indx_start )//
"__end_index_"//ascharacter( indx_end )//
".csv"
1653 open( newunit=unitnum, file=trim(filename), iostat=iostat, action=
"write", status=
"replace" )
1655 call assert( iostat == 0,
"Could not open variable dump file "//squote(filename) &
1656 //
" for writing. iostat = "//ascharacter( iostat ) )
1657 dump( indx )%unitnum = unitnum
1659 write( unit=
dump( indx )%unitnum, fmt=
"(a)") &
1660 "date, month, day, year,landuse_code, landuse_index, soil_group, num_upslope_connections, " &
1661 //
"sum_upslope_cells, solution_order, cell_index, target_index, awc, latitude, reference_ET0, " &
1662 //
"actual_ET, curve_num_adj, gross_precip, inflow, runon, " &
1663 //
"runoff, outflow, infiltration, snowfall, potential_snowmelt, snowmelt, interception, " &
1664 //
"rainfall, net_rainfall, monthly_gross_precip, monthly_runoff, interception_storage, tmax, tmin, " &
1665 //
" tmean, snow_storage, soil_storage, soil_storage_max, " &
1666 //
"evaporable_water_storage, evaporable_water_deficit, delta_soil_storage, " &
1667 //
"soil_moisture_deficit, surface_storage, " &
1668 //
"surface_storage_excess, surface_storage_max, net_infiltration, " &
1669 //
"rejected_net_infiltration, fog, irrigation, gdd, runoff_outside, " &
1670 //
"pervious_fraction, storm_drain_capture, canopy_cover_fraction, crop_coefficient_kcb, " &
1671 //
"cfgi, rooting_depth_max, current_rooting_depth, current_plant_height, actual_et_soil, " &
1672 //
"readily_available_water, total_available_water, plant_stress_coef_ks, " &
1673 //
"evap_reduction_coef_kr, surf_evap_coef_ke, fraction_exposed_and_wetted_soil, " &
1674 //
"actual_et_impervious, actual_et_interception, adjusted_depletion_fraction_p, crop_etc, " &
1675 //
" bare_soil_evap, direct_net_infiltration, " &
1676 //
"direct_soil_moisture, inflowbuf1, inflowbuf2, inflowbuf3, inflowbuf4, inflowbuf5, inflowbuf_sum"
1683 call warn(
"You are attempting to dump variables using invalid coordinates or index values.", &
1684 lfatal = false, iloglevel = log_all, lecho = true )
1690 call warn(
"Your control file references an unknown or unsupported method: "//dquote(scmdtext), &
1691 lfatal = true, iloglevel = log_all, lecho = true )
1719 where ( this%it_is_growing_season )
1726 this%canopy_cover_fraction, this%it_is_growing_season, &
1739 where ( this%it_is_growing_season )
1758 real (c_float),
allocatable :: fTrunk_Storage_Capacity(:)
1759 real (c_float),
allocatable :: fStemflow_Fraction(:)
1766 this%canopy_cover_fraction, &
1768 ftrunk_storage_capacity, &
1770 fstemflow_fraction, &
1783 this%runon = 0.0_c_float
1792 integer (c_int),
intent(in) :: indx
1794 this%runoff_outside( indx ) = &
1795 this%runoff( indx ) &
1796 + this%rejected_net_infiltration( indx )
1821 integer (c_int),
intent(in) :: indx
1824 integer (c_int) :: target_index
1825 integer (c_int) :: cell_index
1826 real (c_float) :: msb
1828 integer (c_int) :: cell_row, cell_col, targ_row, targ_col
1833 cell_row=this%row_num_1D(cell_index)
1834 cell_col=this%col_num_1D(cell_index)
1839 if ( ( target_index >= lbound( this%runon, 1) ) &
1840 .and. ( target_index <= ubound( this%runon, 1) ) )
then
1842 targ_row=this%row_num_1D(target_index)
1843 targ_col=this%col_num_1D(target_index)
1845 this%runon( target_index ) = &
1846 this%runon( target_index ) &
1847 + this%runoff( cell_index ) &
1848 + this%rejected_net_infiltration( cell_index )
1877 this%runoff_outside( cell_index ) = &
1878 this%runoff_outside( cell_index ) &
1879 + this%runoff( cell_index ) &
1880 + this%rejected_net_infiltration( cell_index )
1895 this%cfgi_lower_limit, &
1896 this%cfgi_upper_limit, &
1910 this%tmax, this%snow_storage )
1928 call snowfall_original_calculate( this%snowfall, this%net_snowfall, &
1929 this%rainfall, this%net_rainfall, &
1930 this%tmin, this%tmax, &
1931 this%interception, this%gross_precip )
1968 tmax=this%tmax, imperial_units=true )
2009 flatitude=this%latitude, ftmin=this%Tmin, ftmax=this%Tmax )
2035 this%reference_ET0 = pack(
pet_grid%pGrdBase%rData, this%active )
2062 this%reference_ET0 = pack(
pet_grid%pGrdBase%rData, this%active ) *
et_ratios / real( sim_dt%iDaysInMonth, c_float)
2088 this%reference_ET0 = pack(
pet_grid%pGrdBase%rData, this%active ) &
2089 / real( sim_dt%iDaysInMonth, c_float)
2111 this%reference_ET0 =
et_jh_calculate( idayofyear=sim_dt%iDOY, inumdaysinyear=sim_dt%iDaysInYear, &
2112 flatitude=this%latitude, ftmin=this%Tmin, ftmax=this%Tmax )
2132 use ieee_arithmetic,
only : ieee_is_nan, ieee_is_finite
2137 integer (c_int),
intent(in) :: cell_index
2139 integer (c_int) :: indx
2147 curve_num_adj=this%curve_num_adj( cell_index ), &
2148 landuse_index=this%landuse_index( cell_index ), &
2149 cell_index=cell_index, &
2150 soil_group=this%soil_group( cell_index ), &
2151 soil_storage_max=this%soil_storage_max( cell_index ), &
2152 it_is_growing_season=this%it_is_growing_season( cell_index ), &
2153 inflow=this%inflow( cell_index ), &
2155 this%continuous_frozen_ground_index( cell_index ), &
2156 cfgi_lower_limit=this%cfgi_lower_limit(cell_index), &
2157 cfgi_upper_limit=this%cfgi_upper_limit( cell_index) )
2188 integer (c_int) :: status
2190 allocate( this%monthly_runoff( count( this%active ) ), stat=status)
2191 call assert( status==0,
"Problem allocating memory", __file__, __line__ )
2206 integer (c_int),
intent(in) :: indx
2209 type (DATETIME_T),
save :: date_of_last_grid_update
2210 real (c_float) :: interim_inflow
2212 if ( .not. ( date_of_last_grid_update == sim_dt%curr ) )
then
2214 date_of_last_grid_update = sim_dt%curr
2217 interim_inflow = this%rainfall( indx ) + this%snowmelt( indx )
2219 this%runoff( indx ) = interim_inflow *
runoff_ratios( indx )
2221 if (
allocated( this%monthly_gross_precip ) ) &
2222 this%monthly_runoff( indx ) = this%monthly_gross_precip( indx ) *
runoff_ratios( indx )
2233 integer (c_int) :: iNumActiveCells
2234 integer (c_int) :: iStat
2235 integer (c_int) :: iNumberOfLanduses
2236 integer (c_int) :: iNumberOfSoilGroups
2237 integer (c_int) :: iSoilsIndex
2238 integer (c_int) :: iLUIndex
2239 integer (c_int),
allocatable :: iLanduseCodes(:)
2240 type (FSTRING_LIST_T) :: slList
2241 type (FSTRING_LIST_T) :: slRZ
2242 integer (c_int),
allocatable :: iRZ_SeqNums(:)
2243 real (c_float),
allocatable :: RZ(:)
2244 character (len=:),
allocatable :: sText
2245 real (c_float),
allocatable :: water_capacity(:)
2246 integer (c_int) :: iIndex
2247 type (GENERAL_GRID_T),
pointer :: pRooting_Depth
2248 real (c_float),
allocatable :: fMax_Rooting_Depth(:,:)
2249 character (len=10) :: date_str
2251 type (DATA_CATALOG_ENTRY_T),
pointer :: pHSG
2252 type (DATA_CATALOG_ENTRY_T),
pointer :: pLULC
2254 plulc => dat%find(
"LAND_USE")
2255 phsg => dat%find(
"HYDROLOGIC_SOILS_GROUP")
2257 date_str = sim_dt%curr%prettydate()
2259 call assert(
associated( plulc),
"Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pLULC", &
2260 __file__, __line__ )
2262 call assert(
associated( plulc%pGrdBase ), &
2263 "Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pLULC%pGrdBase", __file__, __line__ )
2265 call assert(
allocated( plulc%pGrdBase%iData ), &
2266 "Possible INTERNAL PROGRAMMING ERROR -- Unallocated array detected for pLULC%pGrdBase%iData", __file__, __line__ )
2268 call assert(
associated( phsg),
"Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pHSG", &
2269 __file__, __line__ )
2271 call assert(
associated( phsg%pGrdBase ), &
2272 "Possible INTERNAL PROGRAMMING ERROR -- Null pointer detected for pHSG%pGrdBase", __file__, __line__ )
2274 call assert(
allocated( phsg%pGrdBase%iData ), &
2275 "Possible INTERNAL PROGRAMMING ERROR -- Unallocated array detected for pHSG%pGrdBase%iData", __file__, __line__ )
2278 prooting_depth => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2279 rx0=this%X_ll, ry0=this%Y_ll, &
2280 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2282 inumactivecells = ubound(this%soil_storage_max,1)
2284 call sllist%append(
"LU_Code")
2285 call sllist%append(
"Landuse_Code")
2286 call sllist%append(
"Landuse_Lookup_Code")
2291 slrz = params%grep_name(
"RZ", lfatal=true )
2293 irz_seqnums = slrz%get_integer()
2296 inumberofsoilgroups = count( irz_seqnums > 0 )
2299 call params%get_parameters( slkeys=sllist, ivalues=ilandusecodes, lfatal=true )
2300 inumberoflanduses = count( ilandusecodes >= 0 )
2302 allocate( fmax_rooting_depth(inumberoflanduses, inumberofsoilgroups), stat=istat )
2303 call assert( istat == 0,
"Failed to allocate memory for maximum rooting depth table", &
2307 do isoilsindex = 1, inumberofsoilgroups
2308 stext =
"RZ_"//ascharacter(isoilsindex)
2309 call params%get_parameters( skey=stext, fvalues=rz )
2310 fmax_rooting_depth(:, isoilsindex) = rz
2313 call logs%WRITE(
"Landuse Code | Soils Code | Number of Matches | Rooting Depth (ft)", &
2314 iloglevel = log_debug, lecho = false )
2315 call logs%WRITE(
"-------------|--------------|-------------------|------------------ ", &
2316 iloglevel = log_debug, lecho = false )
2318 do isoilsindex = 1, inumberofsoilgroups
2319 do iluindex = 1, inumberoflanduses
2321 call logs%WRITE( ascharacter(ilandusecodes( iluindex) )//
" | "//ascharacter(isoilsindex)//
" | "// &
2322 ascharacter(count( plulc%pGrdBase%iData == ilandusecodes( iluindex) &
2323 .and. phsg%pGrdBase%iData == isoilsindex ) )//
" | " &
2324 //ascharacter( fmax_rooting_depth( iluindex, isoilsindex) ), &
2325 iloglevel = log_debug, lecho = false )
2328 where ( plulc%pGrdBase%iData == ilandusecodes( iluindex) .and. phsg%pGrdBase%iData == isoilsindex )
2330 prooting_depth%rData = fmax_rooting_depth( iluindex, isoilsindex )
2340 date_str = sim_dt%curr%prettydate()
2342 call grid_writearcgrid(
"Maximum_rooting_depth__as_assembled_from_table__" &
2343 //trim(date_str)//
".asc", prooting_depth )
2347 call grid_destroy( prooting_depth )
2358 type ( GENERAL_GRID_T ),
pointer :: pTempGrd
2359 character (len=10) :: date_str
2365 this%soil_storage_max = this%rooting_depth_max * this%awc
2367 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2368 rx0=this%X_ll, ry0=this%Y_ll, &
2369 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2371 ptempgrd%rData = unpack( this%soil_storage_max, this%active, this%nodata_fill_value )
2373 date_str = sim_dt%curr%prettydate()
2375 call grid_writearcgrid( sfilename=
"Soil_Storage_Maximum__as_calculated_inches__" &
2376 //trim(date_str)//
".asc", pgrd=ptempgrd )
2378 call grid_destroy( ptempgrd )
2389 type ( GENERAL_GRID_T ),
pointer :: pTempGrd
2390 integer (c_int) :: iStat
2391 type (DATA_CATALOG_ENTRY_T),
pointer :: pSOIL_STORAGE_MAX_GRID
2393 psoil_storage_max_grid => null()
2395 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2396 rx0=this%X_ll, ry0=this%Y_ll, &
2397 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2400 psoil_storage_max_grid => dat%find(
"SOIL_STORAGE_MAX")
2401 if ( .not.
associated(psoil_storage_max_grid) ) &
2402 psoil_storage_max_grid => dat%find(
"PLANT_AVAILABLE_WATER")
2404 if ( .not.
associated(psoil_storage_max_grid) ) &
2405 call die(
"A SOIL_STORAGE_MAX or PLANT_AVAILABLE_WATER grid must be supplied in order" &
2406 //
" to make use of this option.", __file__, __line__ )
2408 call psoil_storage_max_grid%getvalues( )
2410 this%soil_storage_max = pack( psoil_storage_max_grid%pGrdBase%rData, this%active )
2412 ptempgrd%rData = unpack( this%soil_storage_max, this%active, this%nodata_fill_value )
2417 where ( .not. ( this%rooting_depth_max .approxequal. 0.0_c_float ) )
2419 this%awc = this%soil_storage_max / this%rooting_depth_max
2423 this%awc = 0.0_c_float
2427 this%current_rooting_depth = this%rooting_depth_max
2429 call grid_writearcgrid( sfilename=
"Maximum_Soil_Storage__as_read_in_inches.asc", pgrd=ptempgrd )
2431 ptempgrd%rData = unpack( this%rooting_depth_max, this%active, this%nodata_fill_value )
2433 call grid_writearcgrid( sfilename=
"Available_water_content__as_RECALCULATED_in_inches_per_foot.asc", pgrd=ptempgrd )
2435 call grid_destroy( ptempgrd )
2445 this%irrigation = 0.0_c_float
2454 integer (c_int),
intent(in) :: indx
2487 integer (c_int),
intent(in) :: indx
2490 integer (c_int) :: index
2494 if (
allocated( this%monthly_gross_precip ) .and.
allocated( this%monthly_runoff ) )
then
2497 landuse_index=this%landuse_index(indx), &
2498 soil_storage=this%soil_storage(indx), &
2499 soil_storage_max=this%soil_storage_max(indx), &
2500 total_available_water=this%total_available_water_taw(indx), &
2501 rainfall=this%rainfall(indx), &
2502 runoff=this%runoff(indx), &
2503 crop_etc=this%crop_etc(indx), &
2504 irrigation_mask=this%irrigation_mask(indx), &
2505 num_days_since_planting=this%number_of_days_since_planting(indx), &
2506 monthly_rainfall=this%monthly_gross_precip(indx), &
2507 monthly_runoff=this%monthly_runoff(indx) )
2512 landuse_index=this%landuse_index(indx), &
2513 soil_storage=this%soil_storage(indx), &
2514 soil_storage_max=this%soil_storage_max(indx), &
2515 total_available_water=this%total_available_water_taw(indx), &
2516 rainfall=this%rainfall(indx), &
2517 runoff=this%runoff(indx), &
2518 crop_etc=this%crop_etc(indx), &
2519 irrigation_mask=this%irrigation_mask(indx), &
2520 num_days_since_planting=this%number_of_days_since_planting(indx) )
2577 landuse_index=this%landuse_index, &
2578 kcb=this%crop_coefficient_kcb, &
2579 it_is_growing_season=this%it_is_growing_season )
2605 mean_air_temp=this%tmean, &
2606 it_is_growing_season=this%it_is_growing_season )
2631 type (GENERAL_GRID_T),
pointer :: pTempGrd
2633 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2634 rx0=this%X_ll, ry0=this%Y_ll, &
2635 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2640 ptempgrd%rData = unpack( this%awc, this%active, this%nodata_fill_value )
2642 call grid_writearcgrid( sfilename=
"Available_water_content__as_read_in_inches_per_foot.asc", pgrd=ptempgrd )
2644 call grid_destroy( ptempgrd )
2670 integer (c_int) :: iStat
2671 type (GENERAL_GRID_T),
pointer :: pTempGrd
2673 ptempgrd => grid_create( inx=this%number_of_columns, iny=this%number_of_rows, &
2674 rx0=this%X_ll, ry0=this%Y_ll, &
2675 rgridcellsize=this%gridcellsize, idatatype=grid_datatype_real )
2678 allocate ( this%soil_code (count( this%active ) ), stat=istat )
2682 isoils_code=this%soil_code )
2684 ptempgrd%rData = unpack( this%awc, this%active, this%nodata_fill_value )
2686 call grid_writearcgrid( sfilename=
"Available_water_content__as_calculated_inches_per_foot.asc", pgrd=ptempgrd )
2688 call grid_destroy( ptempgrd )
2699 type (DATA_CATALOG_ENTRY_T),
pointer :: pIRR_MASK
2700 character (len=10) :: date_str
2702 pirr_mask => dat%find(
"IRRIGATION_MASK")
2704 if (
associated(pirr_mask) )
then
2706 if (pirr_mask%iSourceDataForm == dynamic_grid)
then
2708 call pirr_mask%getvalues( sim_dt%curr )
2710 if ( pirr_mask%lGridHasChanged )
then
2711 date_str = sim_dt%curr%prettydate()
2712 call grid_writearcgrid(
"Irrigation_mask__as_read_into_SWB__" &
2713 //trim(date_str)//
".asc", pirr_mask%pGrdBase )
2714 this%irrigation_mask = pack( real(pirr_mask%pGrdBase%iData, c_float), this%active )
2720 if (sim_dt%iDayOfSimulation < 1)
then
2721 call pirr_mask%getvalues()
2722 this%irrigation_mask = pack( real(pirr_mask%pGrdBase%iData, c_float), this%active )
2723 call grid_writearcgrid(
"Irrigation_mask__as_read_into_SWB.asc", pirr_mask%pGrdBase )
2728 if ( any(real(pirr_mask%pGrdBase%iData, c_float) < 0.0) &
2729 .or. any(real(pirr_mask%pGrdBase%iData, c_float) > 1.0))
then
2731 call die(smessage =
"Irrigation mask contains illegal values (outside range from 0-1)", &
2732 shints=
"Check the values contained in your irrigation mask file(s).")
2738 this%irrigation_mask = 1.0_c_float
2759 type (DATA_CATALOG_ENTRY_T),
pointer :: pLULC
2761 plulc => dat%find(
"LAND_USE")
2763 if (
associated(plulc) )
then
2767 if ( plulc%lGridHasChanged )
then
2771 call this%update_rooting_depth_table()
2772 call this%init_soil_storage_max()
2807 integer (c_int) :: status
2809 allocate( this%gdd( count( this%active ) ), stat=status )
2810 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
2812 this%gdd = 0.0_c_float
2815 landuse_index=this%landuse_index )
2829 order=this%sort_order )
2844 order=this%sort_order )
2857 integer (c_int) :: status
2859 allocate( this%gdd( count( this%active ) ), stat=status )
2860 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
2862 this%gdd = 0.0_c_float
2865 landuse_index=this%landuse_index )
2881 order=this%sort_order )
2903 integer (c_int) :: jndx, indx_start, indx_end
2906 do jndx=lbound(
dump, 1), ubound(
dump, 1)
2908 indx_start =
dump( jndx )%indx_start
2909 indx_end =
dump( jndx )%indx_end
2911 if ( (indx_start >= lbound( this%landuse_code, 1) ) &
2912 .and. ( indx_start <= ubound( this%landuse_code, 1) ) &
2913 .and. (indx_end >= lbound( this%landuse_code, 1) ) &
2914 .and. (indx_end <= ubound( this%landuse_code, 1) ) )
then
2917 indx_start=indx_start, indx_end=indx_end )
2922 indx_start = this%row_column_to_index( col_num=
dump( jndx )%col, row_num=
dump( jndx )%row)
2928 if ( (indx_start >= lbound( this%landuse_code, 1) ) &
2929 .and. ( indx_start <= ubound( this%landuse_code, 1) ) ) &
2970 integer (c_int),
intent(in) :: unitnum
2971 integer (c_int),
intent(in) :: indx_start
2972 integer (c_int),
intent(in),
optional :: indx_end
2975 integer (c_int) :: kndx
2976 integer (c_int) :: target_indx
2977 integer (c_int) :: cell_indx
2978 integer (c_int) :: indx_end_l
2979 integer (c_int) :: indx
2981 real (c_float) :: previous_5_day_rain(6)
2982 real (c_float) :: monthly_runoff
2983 real (c_float) :: monthly_gross_precip
2985 previous_5_day_rain = -9999.0
2986 monthly_runoff = -9999.0
2987 monthly_gross_precip = -9999.0
2989 if (
present( indx_end ) )
then
2990 indx_end_l = indx_end
2992 indx_end_l = indx_start
2995 do indx=indx_start, indx_end_l
3000 if (
allocated(this%monthly_runoff) ) monthly_runoff = this%monthly_runoff( cell_indx )
3001 if (
allocated(this%monthly_gross_precip) ) monthly_gross_precip = this%monthly_gross_precip( cell_indx )
3003 write( unit=unitnum, fmt=
"(i4,'-',i2.2,'-'i2.2,',',i2,',',i2,',',i4,',',8(i6,','),66(g20.12,','),g20.12)") &
3004 sim_dt%curr%iYear, sim_dt%curr%iMonth, sim_dt%curr%iDay, &
3005 sim_dt%curr%iMonth, sim_dt%curr%iDay, sim_dt%curr%iYear, &
3006 this%landuse_code( cell_indx ), &
3007 this%landuse_index( cell_indx ), &
3008 this%soil_group( cell_indx ), &
3009 this%num_upslope_connections( cell_indx ), &
3010 this%sum_upslope_cells( cell_indx ), &
3014 this%awc( cell_indx ), &
3015 this%latitude( cell_indx ), &
3016 this%reference_ET0( cell_indx ), &
3017 this%actual_ET( cell_indx ), &
3018 this%curve_num_adj( cell_indx ), &
3019 this%gross_precip( cell_indx ), &
3020 this%inflow( cell_indx ), &
3021 this%runon( cell_indx ), &
3022 this%runoff( cell_indx ), &
3023 this%outflow( cell_indx ), &
3024 this%infiltration( cell_indx ), &
3025 this%snowfall( cell_indx ), &
3026 this%potential_snowmelt( cell_indx ), &
3027 this%snowmelt( cell_indx ), &
3028 this%interception( cell_indx ), &
3029 this%rainfall( cell_indx ), &
3030 this%net_rainfall( cell_indx ), &
3031 monthly_gross_precip, &
3033 this%interception_storage( cell_indx ), &
3034 this%tmax( cell_indx ), &
3035 this%tmin( cell_indx ), &
3036 this%tmean( cell_indx ), &
3037 this%snow_storage( cell_indx ), &
3038 this%soil_storage( cell_indx ), &
3039 this%soil_storage_max( cell_indx ), &
3040 this%evaporable_water_storage( cell_indx ), &
3041 this%evaporable_water_deficit( cell_indx ), &
3042 this%delta_soil_storage( cell_indx ), &
3043 this%soil_moisture_deficit( cell_indx ), &
3044 this%surface_storage( cell_indx ), &
3045 this%surface_storage_excess( cell_indx ), &
3046 this%surface_storage_max( cell_indx ), &
3047 this%net_infiltration( cell_indx ), &
3048 this%rejected_net_infiltration( cell_indx ), &
3049 this%fog( cell_indx ), &
3050 this%irrigation( cell_indx ), &
3051 this%gdd( cell_indx ), &
3052 this%runoff_outside( cell_indx ), &
3053 this%pervious_fraction( cell_indx ), &
3054 this%storm_drain_capture( cell_indx ), &
3055 this%canopy_cover_fraction( cell_indx ), &
3056 this%crop_coefficient_kcb( cell_indx ), &
3057 this%continuous_frozen_ground_index( cell_indx ), &
3058 this%rooting_depth_max( cell_indx ), &
3059 this%current_rooting_depth( cell_indx ), &
3060 this%current_plant_height( cell_indx), &
3061 this%actual_et_soil( cell_indx ), &
3062 this%readily_available_water_raw( cell_indx ), &
3063 this%total_available_water_taw( cell_indx ), &
3064 this%plant_stress_coef_ks( cell_indx ), &
3065 this%evap_reduction_coef_kr( cell_indx ), &
3066 this%surf_evap_coef_ke( cell_indx ), &
3067 this%fraction_exposed_and_wetted_soil( cell_indx ), &
3068 this%actual_et_impervious( cell_indx ), &
3069 this%actual_et_interception( cell_indx ), &
3070 this%adjusted_depletion_fraction_p( cell_indx ), &
3071 this%crop_etc( cell_indx ), &
3072 this%bare_soil_evap( cell_indx ), &
3073 this%direct_net_infiltration( cell_indx ), &
3074 this%direct_soil_moisture( cell_indx ), &
3075 (previous_5_day_rain(kndx), kndx=1,6)
3103 integer (c_int),
intent(in) :: indx
3108 this%actual_et_soil(indx) = max(
actual_et(indx) - this%actual_et_interception(indx) &
3109 * this%canopy_cover_fraction(indx), 0.0_c_float)
3128 integer (c_int),
intent(in) :: indx
3131 soil_storage=this%soil_storage( indx ), &
3132 soil_storage_max=this%soil_storage_max( indx ), &
3133 infiltration=this%infiltration( indx ), &
3134 crop_etc=this%crop_etc( indx ) )
3157 integer (c_int),
intent(in) :: indx
3160 integer (c_int) :: landuse_index
3162 landuse_index = this%landuse_index( indx )
3165 adjusted_depletion_fraction_p=this%adjusted_depletion_fraction_p( indx ), &
3166 soil_storage=this%soil_storage( indx ), &
3167 soil_storage_max=this%soil_storage_max( indx ), &
3168 infiltration=this%infiltration( indx ), &
3169 crop_etc=this%crop_etc( indx ), &
3193 integer (c_int),
intent(in) :: indx
3196 integer (c_int) :: landuse_index
3198 landuse_index = this%landuse_index( indx )
3201 actual_et=this%actual_et_soil( indx ), &
3202 crop_etc=this%crop_etc( indx ), &
3203 bare_soil_evap=this%bare_soil_evap( indx ), &
3204 taw=this%total_available_water_taw( indx ), &
3205 raw=this%readily_available_water_raw( indx ), &
3206 fraction_exposed_and_wetted_soil=this%fraction_exposed_and_wetted_soil( indx ), &
3207 kr=this%evap_reduction_coef_kr( indx ), &
3208 ke=this%surf_evap_coef_ke( indx ), &
3209 ks=this%plant_stress_coef_ks( indx ), &
3210 adjusted_depletion_fraction_p=this%adjusted_depletion_fraction_p( indx ), &
3211 soil_moisture_deficit=this%soil_moisture_deficit( indx ), &
3212 current_plant_height=this%current_plant_height( indx ), &
3213 evaporable_water_storage=this%evaporable_water_storage( indx ), &
3214 evaporable_water_deficit=this%evaporable_water_deficit( indx ), &
3215 it_is_growing_season=this%it_is_growing_season( indx ), &
3216 kcb=this%crop_coefficient_kcb( indx ), &
3217 landuse_index=this%landuse_index( indx ), &
3218 soil_group=this%soil_group( indx ), &
3219 awc=this%awc( indx ), &
3220 current_rooting_depth=this%current_rooting_depth( indx ), &
3221 soil_storage=this%soil_storage( indx ), &
3222 soil_storage_max=this%soil_storage_max( indx ), &
3223 reference_et0=max(this%reference_et0( indx ) &
3224 - this%actual_et_interception( indx ), 0.0), &
3225 infiltration=this%infiltration( indx ) )
3242 integer ( c_int ),
intent(in) :: indx
3255 landuse_index=this%landuse_index )
3266 integer ( c_int ),
intent(in) :: indx
3270 is_cell_active=this%active, &
3271 nodata_fill_value=this%nodata_fill_value )
3288 integer ( c_int ),
intent(in) :: indx
3301 landuse_index=this%landuse_index )
3312 integer ( c_int ),
intent(in) :: indx
3316 is_cell_active=this%active )
3333 integer ( c_int ),
intent(in) :: indx
3346 landuse_index=this%landuse_index )
3357 integer ( c_int ),
intent(in) :: indx
3360 rejected_net_infiltration = this%rejected_net_infiltration( indx ), &
3403 zr_i=this%current_rooting_depth, &
3404 zr_max=this%rooting_depth_max, &
3405 landuse_index=this%landuse_index, &
3406 kcb=this%crop_coefficient_kcb )
3416 this%crop_coefficient_kcb = 1.0_c_float
3451 integer (c_int) :: indx
3455 do indx=1,ubound(this%number_of_days_since_planting,1)
3457 this%number_of_days_since_planting(indx) = sim_dt%curr &
3464 landuse_index=this%landuse_index )
3475 this%fog = 0.0_c_float
3530 ilanduse_index=this%landuse_index, lactive=this%active, &
3531 nodata_fill_value=this%nodata_fill_value )
3541 this%tmean = ( this%tmin + this%tmax ) / 2.0_c_float
3551 this%tmax_minus_tmin = this%tmax - this%tmin
3560 integer (c_int),
intent(in) :: cell_index
3562 if (this%reference_et0(cell_index) > this%actual_et(cell_index))
then
3563 this%climatic_deficit(cell_index) = this%reference_et0(cell_index) - this%actual_et(cell_index)
3565 this%climatic_deficit(cell_index) = 0.0_c_float
3576 type (DATA_CATALOG_ENTRY_T),
pointer :: pTMAX
3578 ptmax => dat%find(
"TMAX")
3579 if ( .not.
associated(ptmax) ) &
3580 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3582 associate( dt => sim_dt%curr )
3584 call ptmax%getvalues( dt )
3588 if (.not.
associated(ptmax%pGrdBase) ) &
3589 call die(
"INTERNAL PROGRAMMING ERROR: Call to NULL pointer.", __file__, __line__)
3591 this%tmax = pack( ptmax%pGrdBase%rData, this%active )
3602 real (kind=c_float) :: tmax_value
3604 associate( dt => sim_dt%curr )
3610 if (.not.
allocated(this%tmax))
allocate(this%tmax(count(this%active)))
3612 this%tmax = tmax_value
3622 type (DATA_CATALOG_ENTRY_T),
pointer :: pTMIN
3624 ptmin => dat%find(
"TMIN")
3625 if ( .not.
associated(ptmin) ) &
3626 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3628 associate( dt => sim_dt%curr )
3630 call ptmin%getvalues( dt )
3634 if (.not.
associated(ptmin%pGrdBase) ) &
3635 call die(
"INTERNAL PROGRAMMING ERROR: Call to NULL pointer.", __file__, __line__)
3637 this%tmin = pack( ptmin%pGrdBase%rData, this%active )
3648 real (kind=c_float) :: tmin_value
3650 associate( dt => sim_dt%curr )
3656 if (.not.
allocated(this%tmin))
allocate(this%tmin(count(this%active)))
3658 this%tmin = tmin_value
3670 type (DATA_CATALOG_ENTRY_T),
pointer :: pPRCP
3672 pprcp => dat%find(
"PRECIPITATION")
3673 if ( .not.
associated(pprcp) ) &
3674 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3676 associate( dt => sim_dt%curr )
3678 call pprcp%getvalues( dt )
3682 if (.not.
associated(pprcp%pGrdBase) ) &
3683 call die(
"INTERNAL PROGRAMMING ERROR: Call to NULL pointer.", __file__, __line__)
3685 this%gross_precip = pack( pprcp%pGrdBase%rData, this%active )
3696 real (kind=c_float) :: precip_value
3698 associate( dt => sim_dt%curr )
3704 if (.not.
allocated(this%gross_precip))
allocate(this%gross_precip(count(this%active)))
3705 this%gross_precip = precip_value
3718 integer (c_int) :: status
3720 allocate( this%monthly_gross_precip( count( this%active ) ), stat=status)
3721 call assert( status==0,
"Problem allocating memory", __file__, __line__ )
3737 type (DATA_CATALOG_ENTRY_T),
pointer :: pPRCP
3738 integer (c_int) :: targetindex
3739 integer (c_int) :: indexval
3743 pprcp => dat%find(
"PRECIPITATION")
3744 if ( .not.
associated(pprcp) ) &
3745 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer", __file__, __line__)
3747 associate( dt => sim_dt%curr )
3751 call pprcp%getvalues( dt )
3755 if (.not.
associated(pprcp%pGrdBase) ) &
3756 call die(
"INTERNAL PROGRAMMING ERROR: attempted use of NULL pointer.", __file__, __line__)
3758 call precipitation_method_of_fragments_calculate( this%active )
3760 this%gross_precip = pack( pprcp%pGrdBase%rData, this%active ) * fragment_value * rainfall_adjust_factor
3761 this%monthly_gross_precip = pack( pprcp%pGrdBase%rData, this%active ) * rainfall_adjust_factor
3791 real (c_float),
dimension(:) :: variable
3792 character (len=*),
intent(in) :: varname
3793 logical,
dimension(:),
optional :: active_cells
3796 integer (c_int) :: iCount
3797 character (len=20) :: sVarname
3798 character (len=14) :: sMin
3799 character (len=14) :: sMax
3800 character (len=14) :: sMean
3801 character (len=10) :: sCount
3803 write (svarname, fmt=
"(a20)") adjustl(varname)
3805 if (
present( active_cells ) )
then
3807 if (count( active_cells ) > 0 )
then
3808 write (smin, fmt=
"(g14.3)") minval(variable, active_cells )
3809 write (smax, fmt=
"(g14.3)") maxval(variable, active_cells )
3810 write (smean, fmt=
"(g14.3)") sum(variable, active_cells ) / count( active_cells )
3811 write (scount, fmt=
"(i10)") count( active_cells )
3813 write (smin, fmt=
"(g14.3)") -9999.
3814 write (smax, fmt=
"(g14.3)") -9999.
3815 write (smean, fmt=
"(g14.3)") -9999.
3816 write (scount, fmt=
"(i10)") 0
3821 if (
size( variable, 1) > 0 )
then
3822 write (smin, fmt=
"(g14.3)") minval(variable)
3823 write (smax, fmt=
"(g14.3)") maxval(variable)
3824 write (smean, fmt=
"(g14.3)") sum(variable) /
size(variable,1)
3825 write (scount, fmt=
"(i10)")
size(variable,1)
3827 write (smin, fmt=
"(g14.3)") -9999.
3828 write (smax, fmt=
"(g14.3)") -9999.
3829 write (smean, fmt=
"(g14.3)") -9999.
3830 write (scount, fmt=
"(i10)") 0
3835 call logs%write( adjustl(svarname)//
" | "//adjustl(smin)//
" | "//adjustl(smax) &
3836 //
" | "//adjustl(smean)//
" | "//adjustl(scount), iloglevel=log_all, lecho=true )
3844 integer (c_int),
dimension(:) :: variable
3845 character (len=*),
intent(in) :: varname
3846 logical,
dimension(:),
optional :: active_cells
3849 integer (c_int) :: iCount
3850 character (len=20) :: sVarname
3851 character (len=14) :: sMin
3852 character (len=14) :: sMax
3853 character (len=14) :: sMean
3854 character (len=10) :: sCount
3856 write (svarname, fmt=
"(a20)") adjustl(varname)
3858 if (
present( active_cells ) )
then
3860 if (count( active_cells ) > 0 )
then
3861 write (smin, fmt=
"(i14)") minval(variable, active_cells )
3862 write (smax, fmt=
"(i14)") maxval(variable, active_cells )
3863 write (smean, fmt=
"(i14)") sum(variable, active_cells ) / count( active_cells )
3864 write (scount, fmt=
"(i10)") count( active_cells )
3866 write (smin, fmt=
"(i14)") -9999
3867 write (smax, fmt=
"(i14)") -9999
3868 write (smean, fmt=
"(i14)") -9999
3869 write (scount, fmt=
"(i10)") 0
3874 if (
size( variable, 1) > 0 )
then
3875 write (smin, fmt=
"(i14)") minval(variable)
3876 write (smax, fmt=
"(i14)") maxval(variable)
3877 write (smean, fmt=
"(i14)") sum(variable) /
size(variable,1)
3878 write (scount, fmt=
"(i10)")
size(variable,1)
3880 write (smin, fmt=
"(i14)") -9999
3881 write (smax, fmt=
"(i14)") -9999
3882 write (smean, fmt=
"(i14)") -9999
3883 write (scount, fmt=
"(i10)") 0
3888 call logs%write( adjustl(svarname)//
" | "//adjustl(smin)//
" | "//adjustl(smax) &
3889 //
" | "//adjustl(smean)//
" | "//adjustl(scount), iloglevel=log_all, lecho=true )
3897 call logs%write(
"variable name | min | max | mean | count ")
3898 call logs%write(
"-------------------- | -------------- | -------------- | -------------- | --------------")
3901 call minmaxmean( this%landuse_index,
"LULC_index")
3903 call minmaxmean( this%num_upslope_connections,
"upslope")
3904 call minmaxmean( this%sum_upslope_cells,
"sum_upslope")
3909 call minmaxmean( real(this%reference_ET0, c_float),
"ET0")
3910 call minmaxmean( real( this%actual_ET, c_float),
"actET")
3915 call minmaxmean( this%infiltration,
"infilt")
3918 call minmaxmean( this%interception,
"intercept")
3921 call minmaxmean( this%interception_storage,
"intcp_stor")
3922 call minmaxmean( this%snow_storage,
"snow_stor")
3923 call minmaxmean( real(this%soil_storage, c_float),
"soil_stor")
3924 call minmaxmean( this%soil_storage_max,
"soil_stor_max")
3925 call minmaxmean( this%net_infiltration,
"net_infiltration")
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)
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
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
type(general_grid_t), pointer, public pgrd
integer(c_int), parameter, public dynamic_grid
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.
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_be_calculate(gdd, tmean, tmin, tmax, order)
subroutine, public growing_degree_day_be_initialize(is_cell_active, landuse_index)
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)
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)