820 m_wc.irrigation = 0.0;
825 if (cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
827 if (m_veg->size() > 0)
829 if (cbm::flt_greater(mc_.nd_airtemperature,10.0))
831 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
833 if (cbm::flt_greater_zero(m_veg->mfrt_sl(l)))
836 double const wc_target(wc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (wc_.wc_fc_sl[l] - wc_.wc_wp_sl[l]));
837 if (cbm::flt_less(wc_.wc_sl[l], wc_target) &&
838 cbm::flt_equal_zero(wc_.ice_sl[l]))
841 double const irrigate_layer((wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
842 m_wc.irrigation += irrigate_layer;
843 wc_.accumulated_irrigation_automatic += irrigate_layer;
856 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
857 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
858 cbm::is_valid( m_eventflood.get_soil_depth()))
861 double wc_fc_sum( 0.0);
862 double wc_wp_sum( 0.0);
863 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
865 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
866 wc_fc_sum += wc_.wc_fc_sl[l] * sc_.h_sl[l];
867 wc_wp_sum += wc_.wc_wp_sl[l] * sc_.h_sl[l];
869 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
876 double const wc_target( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_sum));
877 if ( cbm::flt_less( wc_sum, wc_target))
879 m_wc.irrigation += m_eventflood.get_irrigation_height();
880 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
891 if ( m_cfg.ggcmi_irrigation)
893 if( (lclock()->subday() == 1) && (_i == 0))
895 if( m_veg->size() > 0 )
897 double water_supply( 0.0);
898 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
900 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
902 if( cbm::flt_less( wc_.wc_sl[l], wc_.wc_fc_sl[l]) &&
903 cbm::flt_equal_zero( wc_.ice_sl[l]))
905 water_supply += (wc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
906 wc_.wc_sl[l] = wc_.wc_fc_sl[l];
910 wc_.accumulated_irrigation_ggcmi += water_supply;
918 if ( cbm::is_valid( m_eventflood.get_water_table()))
921 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
923 bool irrigate(
false);
926 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
928 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
935 if ( !cbm::flt_greater_zero( wc_.surface_water))
937 double water_tot_sum( 0.0);
938 double water_fc_sum( 0.0);
939 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
941 water_tot_sum += wc_.wc_sl[sl] * sc_.h_sl[sl];
942 water_fc_sum += wc_.wc_fc_sl[sl] * sc_.h_sl[sl];
943 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
953 if ( cbm::flt_less( water_tot_sum, 0.9 * water_fc_sum))
962 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
963 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
966 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
968 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
973 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
975 if ( m_eventflood.have_unlimited_water())
977 wc_.accumulated_irrigation_automatic += water_supply;
981 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
983 wc_.irrigation_reservoir -= water_supply;
987 water_supply = wc_.irrigation_reservoir;
988 wc_.irrigation_reservoir = 0.0;
990 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
992 m_wc.irrigation += water_supply;
998 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
1000 double water_supply( 0.0);
1001 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
1003 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
1004 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
1006 double const scale( cbm::flt_less( sc_.depth_sl[sl] - sc_.h_sl[sl], -m_eventflood.get_water_table()) ?
1007 (-m_eventflood.get_water_table() - (sc_.depth_sl[sl] - sc_.h_sl[sl])) / sc_.h_sl[sl] :
1010 water_supply += scale * (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
1015 water_supply = cbm::bound( 0.0, water_supply - m_mc.precipitation, wc_.sks_sl[0]);
1018 if ( cbm::flt_greater_equal( wc_.surface_water, water_supply))
1020 wc_.accumulated_runoff += wc_.surface_water - water_supply;
1021 wc_.surface_water = water_supply;
1024 else if ( cbm::flt_greater_zero( wc_.surface_water))
1026 water_supply -= wc_.surface_water;
1029 if ( m_eventflood.have_unlimited_water())
1031 wc_.accumulated_irrigation_automatic += water_supply;
1035 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1037 wc_.irrigation_reservoir -= water_supply;
1041 water_supply = wc_.irrigation_reservoir;
1042 wc_.irrigation_reservoir = 0.0;
1044 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1047 m_wc.irrigation += water_supply;
1052 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
1056 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
1059 unsigned long no_layers(3);
1060 if( no_layers > m_soillayers->soil_layer_cnt())
1062 no_layers = m_soillayers->soil_layer_cnt();
1065 for (
size_t sl = 0; sl < no_layers; ++sl)
1067 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
1071 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
1073 if ( m_eventflood.have_unlimited_water())
1075 wc_.accumulated_irrigation_automatic += water_supply;
1079 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1081 wc_.irrigation_reservoir -= water_supply;
1085 water_supply = wc_.irrigation_reservoir;
1086 wc_.irrigation_reservoir = 0.0;
1088 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1090 m_wc.irrigation += water_supply;
1098 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
1102 m_wc.irrigation += irrigation_scheduled / 24.0;
1103 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
1105 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
1108 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
1112 m_wc.irrigation += irrigation_scheduled;
1113 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:116