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( wc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (wc_.wc_fc_sl[l] - wc_.wc_wp_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 wc_fc_sum( 0.0);
672 double wc_wp_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 wc_fc_sum += wc_.wc_fc_sl[l] * sc_.h_sl[l];
677 wc_wp_sum += wc_.wc_wp_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( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_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], wc_.wc_fc_sl[l]) &&
713 cbm::flt_equal_zero( wc_.ice_sl[l]))
715 water_supply += (wc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
716 wc_.wc_sl[l] = wc_.wc_fc_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 double const scale( cbm::flt_less( sc_.depth_sl[sl] - sc_.h_sl[sl], -m_eventflood.get_water_table()) ?
809 (-m_eventflood.get_water_table() - (sc_.depth_sl[sl] - sc_.h_sl[sl])) / sc_.h_sl[sl] :
812 water_supply += scale * (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
817 water_supply = cbm::bound( 0.0, water_supply - m_mc.rainfall, wc_.sks_sl[0]);
820 if ( cbm::flt_greater_equal( wc_.surface_water, water_supply))
822 wc_.accumulated_runoff += wc_.surface_water - water_supply;
823 wc_.surface_water = water_supply;
826 else if ( cbm::flt_greater_zero( wc_.surface_water))
828 water_supply -= wc_.surface_water;
831 if ( m_eventflood.have_unlimited_water())
833 wc_.accumulated_irrigation_automatic += water_supply;
837 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
839 wc_.irrigation_reservoir -= water_supply;
843 water_supply = wc_.irrigation_reservoir;
844 wc_.irrigation_reservoir = 0.0;
846 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
849 m_wc.irrigation += water_supply;
854 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
858 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
861 unsigned long no_layers(3);
862 if( no_layers > m_soillayers->soil_layer_cnt())
864 no_layers = m_soillayers->soil_layer_cnt();
867 for (
size_t sl = 0; sl < no_layers; ++sl)
869 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
873 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
875 if ( m_eventflood.have_unlimited_water())
877 wc_.accumulated_irrigation_automatic += water_supply;
881 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
883 wc_.irrigation_reservoir -= water_supply;
887 water_supply = wc_.irrigation_reservoir;
888 wc_.irrigation_reservoir = 0.0;
890 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
892 m_wc.irrigation += water_supply;
900 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
904 m_wc.irrigation += irrigation_scheduled / 24.0;
905 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
907 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
910 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
914 m_wc.irrigation += irrigation_scheduled;
915 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:115