814 m_wc.irrigation = 0.0;
819 if (cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
821 if (m_veg->size() > 0)
823 if (cbm::flt_greater(mc_.nd_airtemperature,10.0))
825 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
827 if (cbm::flt_greater_zero(m_veg->mfrt_sl(l)))
830 double const wc_target(wc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (wc_.wc_fc_sl[l] - wc_.wc_wp_sl[l]));
831 if (cbm::flt_less(wc_.wc_sl[l], wc_target) &&
832 cbm::flt_equal_zero(wc_.ice_sl[l]))
835 double const irrigate_layer((wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
836 m_wc.irrigation += irrigate_layer;
837 wc_.accumulated_irrigation_automatic += irrigate_layer;
850 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
851 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
852 cbm::is_valid( m_eventflood.get_soil_depth()))
855 double wc_fc_sum( 0.0);
856 double wc_wp_sum( 0.0);
857 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
859 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
860 wc_fc_sum += wc_.wc_fc_sl[l] * sc_.h_sl[l];
861 wc_wp_sum += wc_.wc_wp_sl[l] * sc_.h_sl[l];
863 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
870 double const wc_target( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_sum));
871 if ( cbm::flt_less( wc_sum, wc_target))
873 m_wc.irrigation += m_eventflood.get_irrigation_height();
874 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
885 if ( m_cfg.ggcmi_irrigation)
887 if( (lclock()->subday() == 1) && (_i == 0))
889 if( m_veg->size() > 0 )
891 double water_supply( 0.0);
892 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
894 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
896 if( cbm::flt_less( wc_.wc_sl[l], wc_.wc_fc_sl[l]) &&
897 cbm::flt_equal_zero( wc_.ice_sl[l]))
899 water_supply += (wc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
900 wc_.wc_sl[l] = wc_.wc_fc_sl[l];
904 wc_.accumulated_irrigation_ggcmi += water_supply;
912 if ( cbm::is_valid( m_eventflood.get_water_table()))
915 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
917 bool irrigate(
false);
920 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
922 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
929 if ( !cbm::flt_greater_zero( wc_.surface_water))
931 double water_tot_sum( 0.0);
932 double water_fc_sum( 0.0);
933 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
935 water_tot_sum += wc_.wc_sl[sl] * sc_.h_sl[sl];
936 water_fc_sum += wc_.wc_fc_sl[sl] * sc_.h_sl[sl];
937 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
947 if ( cbm::flt_less( water_tot_sum, 0.9 * water_fc_sum))
956 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
957 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
960 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
962 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
967 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
969 if ( m_eventflood.have_unlimited_water())
971 wc_.accumulated_irrigation_automatic += water_supply;
975 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
977 wc_.irrigation_reservoir -= water_supply;
981 water_supply = wc_.irrigation_reservoir;
982 wc_.irrigation_reservoir = 0.0;
984 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
986 m_wc.irrigation += water_supply;
992 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
994 double water_supply( 0.0);
995 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
997 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
998 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
1000 double const scale( cbm::flt_less( sc_.depth_sl[sl] - sc_.h_sl[sl], -m_eventflood.get_water_table()) ?
1001 (-m_eventflood.get_water_table() - (sc_.depth_sl[sl] - sc_.h_sl[sl])) / sc_.h_sl[sl] :
1004 water_supply += scale * (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
1009 water_supply = cbm::bound( 0.0, water_supply - m_mc.precipitation, wc_.sks_sl[0]);
1012 if ( cbm::flt_greater_equal( wc_.surface_water, water_supply))
1014 wc_.accumulated_runoff += wc_.surface_water - water_supply;
1015 wc_.surface_water = water_supply;
1018 else if ( cbm::flt_greater_zero( wc_.surface_water))
1020 water_supply -= wc_.surface_water;
1023 if ( m_eventflood.have_unlimited_water())
1025 wc_.accumulated_irrigation_automatic += water_supply;
1029 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1031 wc_.irrigation_reservoir -= water_supply;
1035 water_supply = wc_.irrigation_reservoir;
1036 wc_.irrigation_reservoir = 0.0;
1038 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1041 m_wc.irrigation += water_supply;
1046 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
1050 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
1053 unsigned long no_layers(3);
1054 if( no_layers > m_soillayers->soil_layer_cnt())
1056 no_layers = m_soillayers->soil_layer_cnt();
1059 for (
size_t sl = 0; sl < no_layers; ++sl)
1061 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
1065 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
1067 if ( m_eventflood.have_unlimited_water())
1069 wc_.accumulated_irrigation_automatic += water_supply;
1073 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1075 wc_.irrigation_reservoir -= water_supply;
1079 water_supply = wc_.irrigation_reservoir;
1080 wc_.irrigation_reservoir = 0.0;
1082 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1084 m_wc.irrigation += water_supply;
1092 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
1096 m_wc.irrigation += irrigation_scheduled / 24.0;
1097 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
1099 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
1102 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
1106 m_wc.irrigation += irrigation_scheduled;
1107 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:116