647 m_wc.irrigation = 0.0;
652 if ( cbm::flt_in_range_lu(0.0, m_cfg.automaticirrigation, 1.0))
654 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
657 double const wc_target( sc_.wc_wp_sl[l] + m_cfg.automaticirrigation * (sc_.wc_fc_sl[l] - sc_.wc_wp_sl[l]));
658 if ( cbm::flt_less( wc_.wc_sl[l], wc_target))
661 double const irrigate_layer( (wc_target - wc_.wc_sl[l]) * sc_.h_sl[l]);
662 m_wc.irrigation += irrigate_layer;
663 wc_.accumulated_irrigation_automatic += irrigate_layer;
668 if ( cbm::flt_in_range_lu( 0.0, m_eventflood.get_saturation_level(), 1.0) &&
669 cbm::is_valid( m_eventflood.get_irrigation_height()) &&
670 cbm::is_valid( m_eventflood.get_soil_depth()))
673 double wc_fc_sum( 0.0);
674 double wc_wp_sum( 0.0);
675 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
677 wc_sum += wc_.wc_sl[l] * sc_.h_sl[l];
678 wc_fc_sum += sc_.wc_fc_sl[l] * sc_.h_sl[l];
679 wc_wp_sum += sc_.wc_wp_sl[l] * sc_.h_sl[l];
681 if ( cbm::flt_greater_equal( sc_.depth_sl[l], m_eventflood.get_soil_depth()))
688 double const wc_target( wc_wp_sum + m_eventflood.get_saturation_level() * (wc_fc_sum - wc_wp_sum));
689 if ( cbm::flt_less( wc_sum, wc_target))
691 m_wc.irrigation += m_eventflood.get_irrigation_height();
692 wc_.accumulated_irrigation_automatic += m_eventflood.get_irrigation_height();
703 if ( m_cfg.ggcmi_irrigation)
705 if( (lclock()->subday() == 1) && (_i == 0))
707 if( m_veg->size() > 0 )
709 double water_supply( 0.0);
710 for (
size_t l = 0; l < m_soillayers->soil_layer_cnt(); ++l)
712 if ( cbm::flt_greater_zero( m_veg->mfrt_sl( l)))
714 if( cbm::flt_less( wc_.wc_sl[l], sc_.wc_fc_sl[l]) &&
715 cbm::flt_equal_zero( wc_.ice_sl[l]))
717 water_supply += (sc_.wc_fc_sl[l] - wc_.wc_sl[l]) * sc_.h_sl[l];
718 wc_.wc_sl[l] = sc_.wc_fc_sl[l];
722 wc_.accumulated_irrigation_ggcmi += water_supply;
730 if ( cbm::is_valid( m_eventflood.get_water_table()))
733 if ( cbm::is_valid( m_eventflood.get_irrigation_height()))
735 bool irrigate(
false);
738 if ( cbm::flt_greater_equal_zero( m_eventflood.get_water_table()))
740 if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
747 if ( !cbm::flt_greater_zero( wc_.surface_water))
749 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
751 if ( cbm::flt_greater_equal( sc_.depth_sl[sl], -m_eventflood.get_water_table()))
754 if ( cbm::flt_less( wc_.wc_sl[sl], 0.9 * sc_.poro_sl[sl]))
766 double water_supply( cbm::bound_min( 0.0, m_eventflood.get_irrigation_height() - wc_.surface_water));
767 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
770 if ( cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
772 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
777 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
779 if ( m_eventflood.have_unlimited_water())
781 wc_.accumulated_irrigation_automatic += water_supply;
785 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
787 wc_.irrigation_reservoir -= water_supply;
791 water_supply = wc_.irrigation_reservoir;
792 wc_.irrigation_reservoir = 0.0;
794 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
796 m_wc.irrigation += water_supply;
802 if ( !cbm::flt_greater_zero( m_eventflood.get_water_table()))
804 double water_supply( 0.0);
805 for (
size_t sl = 0; sl < m_soillayers->soil_layer_cnt(); ++sl)
807 if ( cbm::flt_greater( sc_.depth_sl[sl], -m_eventflood.get_water_table()) &&
808 cbm::flt_greater( sc_.poro_sl[sl], wc_.wc_sl[sl]))
810 water_supply += (sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl];
815 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
818 if ( cbm::flt_greater( wc_.surface_water, water_supply))
820 wc_.accumulated_runoff += wc_.surface_water - water_supply;
821 wc_.surface_water = water_supply;
824 if ( m_eventflood.have_unlimited_water())
826 wc_.accumulated_irrigation_automatic += water_supply;
830 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
832 wc_.irrigation_reservoir -= water_supply;
836 water_supply = wc_.irrigation_reservoir;
837 wc_.irrigation_reservoir = 0.0;
839 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
841 m_wc.irrigation += water_supply;
846 else if ( cbm::flt_greater( m_eventflood.get_water_table(), wc_.surface_water))
850 double water_supply( m_eventflood.get_water_table() - wc_.surface_water);
853 unsigned long no_layers(3);
854 if( no_layers > m_soillayers->soil_layer_cnt())
856 no_layers = m_soillayers->soil_layer_cnt();
859 for (
size_t sl = 0; sl < no_layers; ++sl)
861 water_supply += ((sc_.poro_sl[sl] - wc_.wc_sl[sl]) * sc_.h_sl[sl]);
865 water_supply = cbm::bound_min( 0.0, water_supply - m_mc.rainfall);
867 if ( m_eventflood.have_unlimited_water())
869 wc_.accumulated_irrigation_automatic += water_supply;
873 if ( cbm::flt_greater( wc_.irrigation_reservoir, water_supply))
875 wc_.irrigation_reservoir -= water_supply;
879 water_supply = wc_.irrigation_reservoir;
880 wc_.irrigation_reservoir = 0.0;
882 wc_.accumulated_irrigation_reservoir_withdrawal += water_supply;
884 m_wc.irrigation += water_supply;
892 double const irrigation_scheduled( cbm::bound_min( 0.0, wc_.accumulated_irrigation - m_wc.accumulated_irrigation_event_executed));
896 m_wc.irrigation += irrigation_scheduled / 24.0;
897 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled / 24.0;
899 else if ( cbm::flt_greater( irrigation_scheduled, (
double)hours_per_time_step() *
rainfall_intensity()))
902 m_wc.accumulated_irrigation_event_executed += (double)hours_per_time_step() *
rainfall_intensity();
906 m_wc.irrigation += irrigation_scheduled;
907 m_wc.accumulated_irrigation_event_executed += irrigation_scheduled;
double rainfall_intensity()
Definition: watercycle-dndc.cpp:115