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 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
913 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
916 if ( cbm::flt_less( wc_.wc_sl[sl], 0.9 * sc_.poro_sl[sl]))
928 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
929 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
932 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
934 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
939 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
941 if ( m_eventflood.have_unlimited_water())
943 wc_.accumulated_irrigation_automatic += water_supply;
947 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
949 wc_.irrigation_reservoir -= water_supply;
953 water_supply = wc_.irrigation_reservoir;
954 wc_.irrigation_reservoir = 0.0;
956 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
958 m_wc.irrigation += water_supply;
964 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
966 double water_supply( 0.0);
967 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
969 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
970 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
972 double const scale( cbm::flt_less( sc_.depth_sl[sl] - sc_.h_sl[sl], -m_eventflood.get_water_table()) ?
973 (-m_eventflood.get_water_table() - (sc_.depth_sl[sl] - sc_.h_sl[sl])) / sc_.h_sl[sl] :
976 water_supply += scale * (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
981 water_supply = cbm::bound( 0.0, water_supply - m_mc.precipitation, wc_.sks_sl[0]);
984 if ( cbm::flt_greater_equal( wc_.surface_water, water_supply))
986 wc_.accumulated_runoff += wc_.surface_water - water_supply;
987 wc_.surface_water = water_supply;
990 else if ( cbm::flt_greater_zero( wc_.surface_water))
992 water_supply -= wc_.surface_water;
995 if ( m_eventflood.have_unlimited_water())
997 wc_.accumulated_irrigation_automatic += water_supply;
1001 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1003 wc_.irrigation_reservoir -= water_supply;
1007 water_supply = wc_.irrigation_reservoir;
1008 wc_.irrigation_reservoir = 0.0;
1010 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1013 m_wc.irrigation += water_supply;
1018 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
1022 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
1025 unsigned long no_layers(3);
1026 if( no_layers > m_soillayers->soil_layer_cnt())
1028 no_layers = m_soillayers->soil_layer_cnt();
1031 for (
size_t sl = 0; sl < no_layers; ++sl)
1033 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
1037 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
1039 if ( m_eventflood.have_unlimited_water())
1041 wc_.accumulated_irrigation_automatic += water_supply;
1045 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1047 wc_.irrigation_reservoir -= water_supply;
1051 water_supply = wc_.irrigation_reservoir;
1052 wc_.irrigation_reservoir = 0.0;
1054 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1056 m_wc.irrigation += water_supply;
1064 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
1068 m_wc.irrigation += irrigation_scheduled / 24.0;
1069 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
1071 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
1074 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
1078 m_wc.irrigation += irrigation_scheduled;
1079 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:115