809 m_wc.irrigation = 0.0;
814 if ( cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
816 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
819 double const wc_target( wc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (wc_.wc_fc_sl[l] - wc_.wc_wp_sl[l]));
820 if ( cbm::flt_less( wc_.wc_sl[l], wc_target))
823 double const irrigate_layer( (wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
824 m_wc.irrigation += irrigate_layer;
825 wc_.accumulated_irrigation_automatic += irrigate_layer;
830 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
831 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
832 cbm::is_valid( m_eventflood.get_soil_depth()))
835 double wc_fc_sum( 0.0);
836 double wc_wp_sum( 0.0);
837 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
839 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
840 wc_fc_sum += wc_.wc_fc_sl[l] * sc_.h_sl[l];
841 wc_wp_sum += wc_.wc_wp_sl[l] * sc_.h_sl[l];
843 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
850 double const wc_target( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_sum));
851 if ( cbm::flt_less( wc_sum, wc_target))
853 m_wc.irrigation += m_eventflood.get_irrigation_height();
854 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
865 if ( m_cfg.ggcmi_irrigation)
867 if( (lclock()->subday() == 1) && (_i == 0))
869 if( m_veg->size() > 0 )
871 double water_supply( 0.0);
872 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
874 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
876 if( cbm::flt_less( wc_.wc_sl[l], wc_.wc_fc_sl[l]) &&
877 cbm::flt_equal_zero( wc_.ice_sl[l]))
879 water_supply += (wc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
880 wc_.wc_sl[l] = wc_.wc_fc_sl[l];
884 wc_.accumulated_irrigation_ggcmi += water_supply;
892 if ( cbm::is_valid( m_eventflood.get_water_table()))
895 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
897 bool irrigate(
false);
900 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
902 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
909 if ( !cbm::flt_greater_zero( wc_.surface_water))
911 double water_tot_sum( 0.0);
912 double water_fc_sum( 0.0);
913 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
915 water_tot_sum += wc_.wc_sl[sl] * sc_.h_sl[sl];
916 water_fc_sum += wc_.wc_fc_sl[sl] * sc_.h_sl[sl];
917 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
927 if ( cbm::flt_less( water_tot_sum, 0.9 * water_fc_sum))
936 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
937 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
940 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
942 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
947 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
949 if ( m_eventflood.have_unlimited_water())
951 wc_.accumulated_irrigation_automatic += water_supply;
955 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
957 wc_.irrigation_reservoir -= water_supply;
961 water_supply = wc_.irrigation_reservoir;
962 wc_.irrigation_reservoir = 0.0;
964 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
966 m_wc.irrigation += water_supply;
972 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
974 double water_supply( 0.0);
975 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
977 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
978 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
980 double const scale( cbm::flt_less( sc_.depth_sl[sl] - sc_.h_sl[sl], -m_eventflood.get_water_table()) ?
981 (-m_eventflood.get_water_table() - (sc_.depth_sl[sl] - sc_.h_sl[sl])) / sc_.h_sl[sl] :
984 water_supply += scale * (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
989 water_supply = cbm::bound( 0.0, water_supply - m_mc.precipitation, wc_.sks_sl[0]);
992 if ( cbm::flt_greater_equal( wc_.surface_water, water_supply))
994 wc_.accumulated_runoff += wc_.surface_water - water_supply;
995 wc_.surface_water = water_supply;
998 else if ( cbm::flt_greater_zero( wc_.surface_water))
1000 water_supply -= wc_.surface_water;
1003 if ( m_eventflood.have_unlimited_water())
1005 wc_.accumulated_irrigation_automatic += water_supply;
1009 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1011 wc_.irrigation_reservoir -= water_supply;
1015 water_supply = wc_.irrigation_reservoir;
1016 wc_.irrigation_reservoir = 0.0;
1018 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1021 m_wc.irrigation += water_supply;
1026 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
1030 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
1033 unsigned long no_layers(3);
1034 if( no_layers > m_soillayers->soil_layer_cnt())
1036 no_layers = m_soillayers->soil_layer_cnt();
1039 for (
size_t sl = 0; sl < no_layers; ++sl)
1041 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
1045 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
1047 if ( m_eventflood.have_unlimited_water())
1049 wc_.accumulated_irrigation_automatic += water_supply;
1053 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1055 wc_.irrigation_reservoir -= water_supply;
1059 water_supply = wc_.irrigation_reservoir;
1060 wc_.irrigation_reservoir = 0.0;
1062 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1064 m_wc.irrigation += water_supply;
1072 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
1076 m_wc.irrigation += irrigation_scheduled / 24.0;
1077 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
1079 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
1082 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
1086 m_wc.irrigation += irrigation_scheduled;
1087 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:115