646 m_wc.irrigation = 0.0;
651 if ( cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
653 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
656 double const wc_target( sc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (sc_.wc_fc_sl[l] - sc_.wc_wp_sl[l]));
657 if ( cbm::flt_less( wc_.wc_sl[l], wc_target))
660 double const irrigate_layer( (wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
661 m_wc.irrigation += irrigate_layer;
662 wc_.accumulated_irrigation_automatic += irrigate_layer;
667 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
668 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
669 cbm::is_valid( m_eventflood.get_soil_depth()))
672 double wc_fc_sum( 0.0);
673 double wc_wp_sum( 0.0);
674 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
676 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
677 wc_fc_sum += sc_.wc_fc_sl[l] * sc_.h_sl[l];
678 wc_wp_sum += sc_.wc_wp_sl[l] * sc_.h_sl[l];
680 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
687 double const wc_target( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_sum));
688 if ( cbm::flt_less( wc_sum, wc_target))
690 m_wc.irrigation += m_eventflood.get_irrigation_height();
691 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
702 if ( m_cfg.ggcmi_irrigation)
704 if( (lclock()->subday() == 1) && (_i == 0))
706 if( m_veg->size() > 0 )
708 double water_supply( 0.0);
709 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
711 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
713 if( cbm::flt_less( wc_.wc_sl[l], sc_.wc_fc_sl[l]) &&
714 cbm::flt_equal_zero( wc_.ice_sl[l]))
716 water_supply += (sc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
717 wc_.wc_sl[l] = sc_.wc_fc_sl[l];
721 wc_.accumulated_irrigation_ggcmi += water_supply;
729 if ( cbm::is_valid( m_eventflood.get_water_table()))
732 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
734 bool irrigate(
false);
737 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
739 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
746 if ( !cbm::flt_greater_zero( wc_.surface_water))
748 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
750 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
753 if ( cbm::flt_less( wc_.wc_sl[sl], 0.9 * sc_.poro_sl[sl]))
765 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
766 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
769 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
771 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
776 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
778 if ( m_eventflood.have_unlimited_water())
780 wc_.accumulated_irrigation_automatic += water_supply;
784 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
786 wc_.irrigation_reservoir -= water_supply;
790 water_supply = wc_.irrigation_reservoir;
791 wc_.irrigation_reservoir = 0.0;
793 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
795 m_wc.irrigation += water_supply;
801 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
803 double water_supply( 0.0);
804 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
806 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
807 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
809 water_supply += (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
814 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
817 if ( cbm::flt_greater( wc_.surface_water, water_supply))
819 wc_.accumulated_runoff += wc_.surface_water - water_supply;
820 wc_.surface_water = water_supply;
823 if ( m_eventflood.have_unlimited_water())
825 wc_.accumulated_irrigation_automatic += water_supply;
829 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
831 wc_.irrigation_reservoir -= water_supply;
835 water_supply = wc_.irrigation_reservoir;
836 wc_.irrigation_reservoir = 0.0;
838 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
840 m_wc.irrigation += water_supply;
845 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
849 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
852 unsigned long no_layers(3);
853 if( no_layers > m_soillayers->soil_layer_cnt())
855 no_layers = m_soillayers->soil_layer_cnt();
858 for (
size_t sl = 0; sl < no_layers; ++sl)
860 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
864 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
866 if ( m_eventflood.have_unlimited_water())
868 wc_.accumulated_irrigation_automatic += water_supply;
872 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
874 wc_.irrigation_reservoir -= water_supply;
878 water_supply = wc_.irrigation_reservoir;
879 wc_.irrigation_reservoir = 0.0;
881 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
883 m_wc.irrigation += water_supply;
891 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
895 m_wc.irrigation += irrigation_scheduled / 24.0;
896 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
898 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
901 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
905 m_wc.irrigation += irrigation_scheduled;
906 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:114