606 m_wc.irrigation = 0.0;
611 if ( cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
613 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
616 double const wc_target( sc_.wcmin_sl[l] + m_cfg.automaticirrigation * (sc_.wcmax_sl[l] - sc_.wcmin_sl[l]));
617 if ( cbm::flt_less( wc_.wc_sl[l], wc_target))
620 double const irrigate_layer( (wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
621 m_wc.irrigation += irrigate_layer;
622 wc_.accumulated_irrigation_automatic += irrigate_layer;
627 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
628 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
629 cbm::is_valid( m_eventflood.get_soil_depth()))
632 double wcmax_sum( 0.0);
633 double wcmin_sum( 0.0);
634 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
636 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
637 wcmax_sum += sc_.wcmax_sl[l] * sc_.h_sl[l];
638 wcmin_sum += sc_.wcmin_sl[l] * sc_.h_sl[l];
640 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
647 double const wc_target( wcmin_sum + m_eventflood.get_saturation_level() * (wcmax_sum - wcmin_sum));
648 if ( cbm::flt_less( wc_sum, wc_target))
650 m_wc.irrigation += m_eventflood.get_irrigation_height();
651 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
662 if ( m_cfg.ggcmi_irrigation)
664 if( (lclock()->subday() == 1) && (_i == 0))
666 if( m_veg->size() > 0 )
668 double water_supply( 0.0);
669 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
671 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
673 if( cbm::flt_less( wc_.wc_sl[l], sc_.wcmax_sl[l]) &&
674 cbm::flt_equal_zero( wc_.ice_sl[l]))
676 water_supply += (sc_.wcmax_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
677 wc_.wc_sl[l] = sc_.wcmax_sl[l];
681 wc_.accumulated_irrigation_ggcmi += water_supply;
689 if ( cbm::is_valid( m_eventflood.get_water_table()))
692 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
694 bool irrigate(
false);
697 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
699 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
706 if ( !cbm::flt_greater_zero( wc_.surface_water))
708 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
710 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
713 if ( cbm::flt_less( wc_.wc_sl[sl], 0.9 * sc_.poro_sl[sl]))
725 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
726 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
729 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
731 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
736 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
738 if ( m_eventflood.have_unlimited_water())
740 wc_.accumulated_irrigation_automatic += water_supply;
744 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
746 wc_.irrigation_reservoir -= water_supply;
750 water_supply = wc_.irrigation_reservoir;
751 wc_.irrigation_reservoir = 0.0;
753 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
755 m_wc.irrigation += water_supply;
761 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
763 double water_supply( 0.0);
764 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
766 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
767 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
769 water_supply += (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
774 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
777 if ( cbm::flt_greater( wc_.surface_water, water_supply))
779 wc_.accumulated_runoff += wc_.surface_water - water_supply;
780 wc_.surface_water = water_supply;
783 if ( m_eventflood.have_unlimited_water())
785 wc_.accumulated_irrigation_automatic += water_supply;
789 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
791 wc_.irrigation_reservoir -= water_supply;
795 water_supply = wc_.irrigation_reservoir;
796 wc_.irrigation_reservoir = 0.0;
798 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
800 m_wc.irrigation += water_supply;
805 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
809 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
812 unsigned long no_layers(3);
813 if( no_layers > m_soillayers->soil_layer_cnt())
815 no_layers = m_soillayers->soil_layer_cnt();
818 for (
size_t sl = 0; sl < no_layers; ++sl)
820 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
824 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
826 if ( m_eventflood.have_unlimited_water())
828 wc_.accumulated_irrigation_automatic += water_supply;
832 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
834 wc_.irrigation_reservoir -= water_supply;
838 water_supply = wc_.irrigation_reservoir;
839 wc_.irrigation_reservoir = 0.0;
841 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
843 m_wc.irrigation += water_supply;
851 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
855 m_wc.irrigation += irrigation_scheduled / 24.0;
856 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
858 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
861 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
865 m_wc.irrigation += irrigation_scheduled;
866 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:113