645 m_wc.irrigation = 0.0;
650 if ( cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
652 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
655 double const wc_target( sc_.wcmin_sl[l] + m_cfg.automaticirrigation * (sc_.wcmax_sl[l] - sc_.wcmin_sl[l]));
656 if ( cbm::flt_less( wc_.wc_sl[l], wc_target))
659 double const irrigate_layer( (wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
660 m_wc.irrigation += irrigate_layer;
661 wc_.accumulated_irrigation_automatic += irrigate_layer;
666 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
667 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
668 cbm::is_valid( m_eventflood.get_soil_depth()))
671 double wcmax_sum( 0.0);
672 double wcmin_sum( 0.0);
673 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
675 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
676 wcmax_sum += sc_.wcmax_sl[l] * sc_.h_sl[l];
677 wcmin_sum += sc_.wcmin_sl[l] * sc_.h_sl[l];
679 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
686 double const wc_target( wcmin_sum + m_eventflood.get_saturation_level() * (wcmax_sum - wcmin_sum));
687 if ( cbm::flt_less( wc_sum, wc_target))
689 m_wc.irrigation += m_eventflood.get_irrigation_height();
690 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
701 if ( m_cfg.ggcmi_irrigation)
703 if( (lclock()->subday() == 1) && (_i == 0))
705 if( m_veg->size() > 0 )
707 double water_supply( 0.0);
708 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
710 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
712 if( cbm::flt_less( wc_.wc_sl[l], sc_.wcmax_sl[l]) &&
713 cbm::flt_equal_zero( wc_.ice_sl[l]))
715 water_supply += (sc_.wcmax_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
716 wc_.wc_sl[l] = sc_.wcmax_sl[l];
720 wc_.accumulated_irrigation_ggcmi += water_supply;
728 if ( cbm::is_valid( m_eventflood.get_water_table()))
731 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
733 bool irrigate(
false);
736 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
738 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
745 if ( !cbm::flt_greater_zero( wc_.surface_water))
747 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
749 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
752 if ( cbm::flt_less( wc_.wc_sl[sl], 0.9 * sc_.poro_sl[sl]))
764 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
765 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
768 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
770 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
775 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
777 if ( m_eventflood.have_unlimited_water())
779 wc_.accumulated_irrigation_automatic += water_supply;
783 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
785 wc_.irrigation_reservoir -= water_supply;
789 water_supply = wc_.irrigation_reservoir;
790 wc_.irrigation_reservoir = 0.0;
792 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
794 m_wc.irrigation += water_supply;
800 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
802 double water_supply( 0.0);
803 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
805 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
806 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
808 water_supply += (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
813 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
816 if ( cbm::flt_greater( wc_.surface_water, water_supply))
818 wc_.accumulated_runoff += wc_.surface_water - water_supply;
819 wc_.surface_water = water_supply;
822 if ( m_eventflood.have_unlimited_water())
824 wc_.accumulated_irrigation_automatic += water_supply;
828 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
830 wc_.irrigation_reservoir -= water_supply;
834 water_supply = wc_.irrigation_reservoir;
835 wc_.irrigation_reservoir = 0.0;
837 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
839 m_wc.irrigation += water_supply;
844 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
848 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
851 unsigned long no_layers(3);
852 if( no_layers > m_soillayers->soil_layer_cnt())
854 no_layers = m_soillayers->soil_layer_cnt();
857 for (
size_t sl = 0; sl < no_layers; ++sl)
859 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
863 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
865 if ( m_eventflood.have_unlimited_water())
867 wc_.accumulated_irrigation_automatic += water_supply;
871 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
873 wc_.irrigation_reservoir -= water_supply;
877 water_supply = wc_.irrigation_reservoir;
878 wc_.irrigation_reservoir = 0.0;
880 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
882 m_wc.irrigation += water_supply;
890 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
894 m_wc.irrigation += irrigation_scheduled / 24.0;
895 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
897 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
900 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
904 m_wc.irrigation += irrigation_scheduled;
905 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:114