810 m_wc.irrigation = 0.0;
815 if (cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
817 if (m_veg->size() > 0)
819 if (cbm::flt_greater(mc_.nd_airtemperature,10.0))
821 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
823 if (cbm::flt_greater_zero(m_veg->mfrt_sl(l)))
826 double const wc_target(wc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (wc_.wc_fc_sl[l] - wc_.wc_wp_sl[l]));
827 if (cbm::flt_less(wc_.wc_sl[l], wc_target) &&
828 cbm::flt_equal_zero(wc_.ice_sl[l]))
831 double const irrigate_layer((wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
832 m_wc.irrigation += irrigate_layer;
833 wc_.accumulated_irrigation_automatic += irrigate_layer;
846 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
847 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
848 cbm::is_valid( m_eventflood.get_soil_depth()))
851 double wc_fc_sum( 0.0);
852 double wc_wp_sum( 0.0);
853 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
855 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
856 wc_fc_sum += wc_.wc_fc_sl[l] * sc_.h_sl[l];
857 wc_wp_sum += wc_.wc_wp_sl[l] * sc_.h_sl[l];
859 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
866 double const wc_target( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_sum));
867 if ( cbm::flt_less( wc_sum, wc_target))
869 m_wc.irrigation += m_eventflood.get_irrigation_height();
870 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
881 if ( m_cfg.ggcmi_irrigation)
883 if( (lclock()->subday() == 1) && (_i == 0))
885 if( m_veg->size() > 0 )
887 double water_supply( 0.0);
888 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
890 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
892 if( cbm::flt_less( wc_.wc_sl[l], wc_.wc_fc_sl[l]) &&
893 cbm::flt_equal_zero( wc_.ice_sl[l]))
895 water_supply += (wc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
896 wc_.wc_sl[l] = wc_.wc_fc_sl[l];
900 wc_.accumulated_irrigation_ggcmi += water_supply;
908 if ( cbm::is_valid( m_eventflood.get_water_table()))
911 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
913 bool irrigate(
false);
916 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
918 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
925 if ( !cbm::flt_greater_zero( wc_.surface_water))
927 double water_tot_sum( 0.0);
928 double water_fc_sum( 0.0);
929 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
931 water_tot_sum += wc_.wc_sl[sl] * sc_.h_sl[sl];
932 water_fc_sum += wc_.wc_fc_sl[sl] * sc_.h_sl[sl];
933 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
943 if ( cbm::flt_less( water_tot_sum, 0.9 * water_fc_sum))
952 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
953 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
956 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
958 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
963 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
965 if ( m_eventflood.have_unlimited_water())
967 wc_.accumulated_irrigation_automatic += water_supply;
971 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
973 wc_.irrigation_reservoir -= water_supply;
977 water_supply = wc_.irrigation_reservoir;
978 wc_.irrigation_reservoir = 0.0;
980 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
982 m_wc.irrigation += water_supply;
988 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
990 double water_supply( 0.0);
991 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
993 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
994 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
996 double const scale( cbm::flt_less( sc_.depth_sl[sl] - sc_.h_sl[sl], -m_eventflood.get_water_table()) ?
997 (-m_eventflood.get_water_table() - (sc_.depth_sl[sl] - sc_.h_sl[sl])) / sc_.h_sl[sl] :
1000 water_supply += scale * (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
1005 water_supply = cbm::bound( 0.0, water_supply - m_mc.precipitation, wc_.sks_sl[0]);
1008 if ( cbm::flt_greater_equal( wc_.surface_water, water_supply))
1010 wc_.accumulated_runoff += wc_.surface_water - water_supply;
1011 wc_.surface_water = water_supply;
1014 else if ( cbm::flt_greater_zero( wc_.surface_water))
1016 water_supply -= wc_.surface_water;
1019 if ( m_eventflood.have_unlimited_water())
1021 wc_.accumulated_irrigation_automatic += water_supply;
1025 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1027 wc_.irrigation_reservoir -= water_supply;
1031 water_supply = wc_.irrigation_reservoir;
1032 wc_.irrigation_reservoir = 0.0;
1034 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1037 m_wc.irrigation += water_supply;
1042 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
1046 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
1049 unsigned long no_layers(3);
1050 if( no_layers > m_soillayers->soil_layer_cnt())
1052 no_layers = m_soillayers->soil_layer_cnt();
1055 for (
size_t sl = 0; sl < no_layers; ++sl)
1057 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
1061 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.precipitation);
1063 if ( m_eventflood.have_unlimited_water())
1065 wc_.accumulated_irrigation_automatic += water_supply;
1069 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
1071 wc_.irrigation_reservoir -= water_supply;
1075 water_supply = wc_.irrigation_reservoir;
1076 wc_.irrigation_reservoir = 0.0;
1078 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
1080 m_wc.irrigation += water_supply;
1088 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
1092 m_wc.irrigation += irrigation_scheduled / 24.0;
1093 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
1095 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
1098 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
1102 m_wc.irrigation += irrigation_scheduled;
1103 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:116