Software tools for management of conjunctive use of surface-and ground-water in the rural environment: integration of the Farm Process and the Crop Growth Module in the FREEWAT platform

The coordinated use of surface-and ground-water over time and space as two components of a single irrigation system is of outmost importance in many rural areas of the world, in order to assure crop production sustainability, to restore ongoing and to prevent future issues related to freshwater quality and quantity mismanagement/deterioration. New technological solutions, such as GIS-integrated simulation models, may provide reliable tools in order to evaluate impacts in space and time and to properly manage conjunctive use of surface water and groundwater and water-constrained agricultural production. After presenting the common open source simulation programs for dealing with conjunctive use, we discuss and present the integration of the Farm Process (FMP; embedded in the USGS’s MODFLOW One-Water Hydrologic Model) coupled to a Crop Growth Module (CGM) within the open source and public domain QGIS-integrated FREEWAT platform. Using FMP in FREEWAT gains the benefit of the spatial environment and data management tools of a GIS solution, and to perform proper analysis of dynamically integrated terms of the hydrological cycle, to effectively balance crop water demand and supply from different sources of water. A simple hypothetic, yet realistic, application of the proposed approach with FMP and CGM is presented, simulating the yield of irrigated sunflower at harvest in a Mediterranean area. Results provide an insight on the potential exploitation of the developed solution, including, but not limited, to: quantitative temporal analysis of irrigation water sources, detailed analysis of evaporation and transpiration terms (from irrigation, groundwater or rainfall). The coupling of FMP with CGM to estimate crop yield at harvest provides further management tools when dealing with crop productivity. In the simulated case study, the analysis of the water balance terms allowed identifying the relevance of the groundwater contribution to ET c-act , highlighting the role of natural root uptake. The proposed solution is thought to be deployed by water authorities, large farms and public/private companies managing irrigation areas. The use of these tools calls for dedicated capacity building to boost digitalization in the agricultural water sector in order to achieve data-based agricultural water management.


Introduction
During the last decades, freshwater resources have been facing growing pressure, due to both human impacts and climate changes (Anandhi and Kannan, 2018;Azhoni et al., 2018;Deligios et al., 2018;Ehsani et al., 2017;Shukla et al., 2018;Vrzel et al., 2018).This holds especially true in the rural environment, where the bulk of water abstraction takes place (Gruère et al., 2018;Li et al., 2016;Sun et al., 2017).However, it must be noticed that less attention is paid to strategies for water resource management in the rural sector than in any other (i.e., "smart cities").
For many types of crops (e.g., wheat, oil seed rape, faba bean), rainfall is usually the main source of water.When rainfall rate and distribution do not fulfill crop growth requirements (e.g., maize in the Mediterranean area), the irrigation system is usually organized around a single source of water (Bouarfa and Kuper, 2012).This may be from surface water in the form of diversion from natural channels or coming from artificial reservoirs (Guyennon et al., 2017;Hogeboom et al., 2018;Mekonnen and Hoekstra, 2016;Zhou et al., 2016).In many other cases, agricultural production needs to rely not only on surface water, but also in large part on groundwater (Elias et al., 2016;Grogan et al., 2015;Zaveri et al., 2016) or non-conventional sources such as treated/ untreated wastewater (Libutti et al., 2018;Pedrero et al., 2010).Smart management and planning of conjunctive use of surface-and groundwater (the coordinated use of surface-and ground-water over time and space as two components of a single system; Blomquist et al., 2001), which is common in many rural areas worldwide (Hamamouche et al., 2017;Foster and van Steenbergen, 2011;Ortega-Reig et al., 2014), is then needed, in order to assure crop production sustainability and eventually restore critical environmental situations.
Geographical Information System (GIS)-integrated numerical models are valuable tools to support planning, management and monitoring activities of groundwater bodies and their interaction with surface ones, as they allow a thorough representation of hydrological systems and related processes, thus providing a full characterization of the involved flow terms (Anderson et al., 2015;Bhatt et al., 2014;Ferré, 2017).Moreover, thanks to GIS's capability to store, manage/analyze and visualize large spatial datasets, then including the spatial and the temporal components, they are perfect candidates for facilitating the management of conjunctive use of surface-and ground-water in the rural environment.
Within the H2020 FREEWAT project (FREE and open source software tools for WATer resource management; Rossetto et al., 2015), stakeholders and partners involved in water resource management confirmed that water management in rural areas is a major priority for which new software tools are needed (FREEWAT Consortium, 2016).In this paper, we describe the capabilities and modeling tools to assess and evaluate conjunctive management of water in rural areas that are made available through the coupling of FMP with CGM and their integration into the FREEWAT platform (a dedicated free and open source GISintegrated solution for planning and management of surface-and ground-water resources; Criollo et al., 2019;De Filippis et al., 2017;Foglia et al., 2018;Rossetto et al., 2018).

Software for simulation of conjunctive use of surface-and ground-water in the rural environment
While several computer programs deal with surface water use management at watershed and farm scales (e.g., WAM, Condon and Maxwell, 2013;AquaCrop-OS, Foster et al., 2017;EPIC, Gerik et al., 2015;SWAP, Kroes et al., 2017;ISAREG, Pereira et al., 2003;BUDGET, Raes, 2002;SALTMED, Ragab, 2015;APEX, Steglich et al., 2016; further references can be found in Singh and Frevert, 2005;Barthel and Banzhaf, 2016), few efforts have been dedicated to produce tools taking into account the management of conjunctive use of surface -and ground-water.
In this section, characteristics and pros and cons of some of the most popular conjunctive use modeling tools are presented.We then discuss the criteria used to integrate a proper tool into the FREEWAT platform for joint management of conjunctive use and crop growth.Such criteria took into account the approach used to represent the spatial and temporal dimension of the groundwater component, including the unsaturated zone, but also the availability of detailed documentation, and the free and open source characteristics of the code.This is a cornerstone for making available to the scientific and professional community a robust, well-tested and relatively easy-to-use tool to plan and to manage the water resource and for raising awareness on the importance of rural water management.
To the Authors' knowledge, among the most recent and widely used codes for water resource management in rural environments, the best known is SWAT (Soil and Water Assessment Tool; Neitsch et al., 2002).It is a public domain, physically-based, lumped code developed to simulate a number of different physical processes (hydrology, erosion and sediment yield, crop growth, nutrient cycling), in order to predict the impact of land management practices even in large, complex watersheds with varying soils, land-use and management conditions over long periods of time.Using SWAT, the whole catchment is divided into several sub-basins connected through the surface water network.Each sub-basin, in turn, is further divided into Hydrologic Response Units (HRUs), according to land-use, soil type and the occurrence of specific agricultural practices.Based on meteorological data and information related to soil and crop properties, the model computes water budget components separately for each HRU: these components include rain infiltration through the unsaturated zone, surface runoff and evapotranspiration, along with crop water storage, based on the Leaf Area Index (LAI) of a specific crop type.HRUs are discrete entities introduced to approximate the system's behavior, where all the budget terms are computed at the outlet of a HRU.The results cannot provide information on water abstraction and use within the spatial domain of the HRU.Water budgets evaluated for each HRU are then simply summed to get a water balance at the scale of the whole catchment.
SWAT conceives groundwater sources and sinks by means of a shallow and a deep aquifer.The shallow aquifer is unconfined and it contributes to flow in the main channels of the HRU, while the deep aquifer is confined and water entering the deep aquifer is assumed to contribute to streamflow somewhere outside the watershed (Neitsch et al., 2002).As a consequence, the deep aquifer does not contribute to the streamflow within the watershed.For this reason, non-linearities related to groundwater processes cannot be adequately reproduced, as only one active groundwater storage (i.e., the shallow aquifer) is considered (Pfannerstill et al., 2014).This may result in a very high recharge of the shallow aquifer, so that overestimation of discharge may occur causing improper representation of low-flow periods (see, e.g., Guse et al., 2013;Koch et al., 2013).Groundwater recharge to both shallow and deep aquifers is calculated using an exponential decay function, representing the delay time of recharge due to geologic formations.Groundwater discharge from the shallow aquifer to surface streams is estimated depending on an empirical parameter, the base flow recession constant, which measures groundwater flow response to changes in recharge.However, use of this empirical parameter is made without consideration of the governing physical processes, hydraulic conductivity parameter and hydraulic gradient.Finally, as all the calculations are performed at the outlet of each HRU, analysis on potential impacts of groundwater abstractions on groundwater head, due to large withdrawal, and then groundwater availability, are not feasible.
In order to better account for the groundwater component, a further extension of SWAT resulted in multiple attempts to couple the SWAT and MODFLOW (McDonald and Harbaugh, 1984;Harbaugh, 2005) models for a more comprehensive watershed simulation (Galbiati et al., 2006;Kim et al., 2008;Menking et al., 2003;Perkins and Sophocleus, 1999).MODFLOW is a public domain code widely used for dealing with groundwater management issues at different scales (see, e.g., Davison and Lerner, 2000;Ebraheem et al., 2004).It is a physically-based, spatially-distributed code which allows simulating three-dimensional groundwater flow through a saturated porous medium by using a finitedifference method.These SWAT/MODFLOW coupling efforts (not usually available to the general public) are typically monthly-based with spatial restrictions for the two models (Wible, 2014).As further example of coupling, Bailey (2015) presented the SWAT-MODFLOW model, where the link between SWAT and MODFLOW is guaranteed through an approach consisting of downscaling HRUs in MODFLOW cells.In the SWAT-MODFLOW code, each SWAT HRU is intersected with the MODFLOW grid and MODFLOW is called as a subroutine, thus replacing the original SWAT groundwater subroutines, to compute cumulative cell-by-cell evapotranspiration from shallow aquifers, ET gw .However, even for cell-by-cell downscaled HRUs, a scale incompatibility issue remains that uniform root-zone or crop-type parameters used over an HRU to calculate distributed ET gw , while uniform percolation is applied to a distributed groundwater table.Examples of applications of the newly developed SWAT-MODFLOW model can be found in Bailey et al. (2016;2017), Chunn et al. (2019)); Sith et al. (2019); Wei and Bailey (2017;2018).Research in this area is however ongoing as shown in Bieger et al. (2017).
Another program resulting from the combination of existing physically-based, spatially-distributed models is SIMGRO (SIMulation of GROundwater; van Walsum et al., 2010), an ArcGIS-based model integrating metaSWAP (van Walsum and Groenendijk, 2008) for the unsaturated zone and MODFLOW for the regional groundwater flow.SIMGRO links these different compartments by means of flux and storativity exchanges.Its model input needs various hydrological data, such as meteorological data, land-use, soil types, watercourse trajectories, and weirs.Similarly to SWAT, in SIMGRO a catchment is divided in sub-catchments, according to land-use and soil units.Such schematization is then combined with MODFLOW discretization (grid cells), and each sub-catchment is connected with surface water through a network of watercourse trajectories.Soil-atmosphere interactions are the drivers of the regional water system and are guaranteed through estimation of infiltration and evapotranspiration.Simulation of soil water dynamics is assumed to occur in the vertical direction only and it is estimated by discretizing the unsaturated zone in three "control boxes": the root zone, the shallow subsoil, and the deep subsoil, whose boundary with groundwater is represented by the phreatic level.SIMGRO further includes several flexible options for simulating the impact of water management, also in areas other than rural ones, but it is especially suited for modeling contexts with shallow groundwater levels in relatively flat areas, like in delta regions (van Walsum et al., 2010).
The GIS-integrated WEAP (Water Evaluation and Planning; Yates et al., 2005) node-based code allows to calculate crop demand and water supply under different hydrogeological and political scenarios, dynamically integrating infiltration and runoff components.A Graphical User Interface (GUI) allows for import/export of GIS layers.In the WEAP code, upper and lower irrigation thresholds are assigned to irrigated land cover fractions in a sub-catchment.Such thresholds are used to dictate both the timing and quantity of water for irrigation, as crop evapotranspiration and percolation deplete the available water from the upper zone storage.Surface-and ground-water are dynamically linked through a stream-aquifer interaction module.
A program mainly resulting from the combination of existing simulation codes is the GIS-integrated SID&GRID platform (Rossetto et al., 2010(Rossetto et al., , 2013)), developed within the GIS gvSIG (Anguix and Díaz, 2008).The SID&GRID is a fully distributed and physically-based hydrological model, coupling 3D existing and newly developed codes for simulating surface-and ground-water and flow through the unsaturated zone.It allows the calculation of hydrological variables (such as surface runoff, hydraulic head, soil moisture, evapotranspiration rate, interception rate) in space and time.In SID&GRID, the MODFLOW Local Grid Refinement capability (LGR; Mehl and Hill, 2005) was extended to the MODFLOW Variably Saturated Flow (VSF) process (Thoms et al., 2006), which solves the 3D Richards' equation, in order to allow detailed analysis of the unsaturated zone in irrigation areas (Borsi et al., 2013).Within these areas, the VSF package can be applied to precisely describe the boundaries, so that also specific processes like roots uptake, ponding events and seepage flows can be successfully considered.It must be however noticed that in applying VSF, a large number of parameters, not always available, has to be input.
A further tool for analyzing conjunctive water use in rural areas is the Farm Process (FMP; Schmid et al., 2006;Schmid and Hanson, 2009b) embedded in MODFLOW-One-Water Hydrologic Flow Model (MODFLOW-OWHM; Hanson et al., 2014).The latter is a fully-coupled, hydrologic model to dynamically estimate the integrated supply-anddemand components of irrigated agriculture as part of the simulation of surface-and ground-water flow, including head-dependent inflows and outflows, such as canal losses and gains, surface runoff, surface water return flows, evaporation, transpiration, and deep percolation of excess water.Landscape water balances calculated by FMP involve basic units of water consumption, i.e., model sub-regions initially called "farms" (Schmid, 2004;Schmid et al., 2006;Schmid andHanson, 2009a, 2009b), while maintaining the grid spatial discretization, for which irrigation water demand, surface-and ground-water supply, runoff and deep percolation are dynamically integrated.After integration of FMP into OWHM, this definition advanced to water budget sub-regions (WBS) that include regions other than irrigated agricultural farms (Hanson et al., 2014), which can include non-irrigated farms, natural vegetation, urban areas, or Managed Aquifer Recharge (MAR) systems.
In FMP, root uptake is simulated for groundwater levels above the bottom of the root zone under unsaturated or variably-saturated conditions.Demand and supply components of water use are analysed under demand-driven and supply-constrained conditions.This means that, for irrigated conditions, the irrigation delivery requirements (crop irrigation demand increased sufficiently to compensate for inefficient losses), and for non-irrigated conditions, urban water demands or MAR percolation requirements, drive the supply from various components (non-routed deliveries, surface water deliveries and supplemental groundwater abstraction), which, in turn, can be constrained by natural, engineering, or water-policy constraints.Similarly to SWAT and SWAT-MODFLOW, FMP includes the possibility to route water supplies towards water accounting units through surface irrigation channels.FMP also takes into account optimal allocations of water from an economic point of view, when demand exceeds supply, and possible limits to groundwater supply, due to groundwater rights.
FMP has been successfully applied to a series of case studies.A small-scale hydrological model of the southern Rincon Valley (New Mexico, USA) illustrated for the first time how FMP can simulate unmetered historic pumpage for real-world family farms driven crop consumptive use, impacts of surface-and ground-water abstraction on the Lower Rio Grande (LRG) stream and return flow, and scenarios of changing allotments influence deliveries and downstream stream gains/ losses (Schmid et al., 2009).A regional integrated hydrologic model using FMP was developed for the LRG as part of the US-Mexico Transboundary Aquifer Assessment Program of the USGS using MOD-FLOW-FMP (Hanson et al., 2013) and further developed to include nonagricultural land use, to extend into Mexico, and the model's boundary conditions to be informed by a Transboundary Rio Grande Watershed Model (Rio Grande Transboundary Integrated Hydrologic Model using OWHM (RGTIHM, Hanson et al., 2018).
MODFLOW-OWHM and FMP have been also applied for a detailed assessment of groundwater availability of the Central Valley aquifer system, developing a hydrological model coupled with forecasts from global climate models and including efficient updates using remotely sensed data and GIS tools (Faunt et al., 2009).A regional hydrological flow model was also developed for the Cuyama Valley to quantify groundwater availability under varying cropping systems and climatic scenarios to inform regional stakeholders about potential constraints on water-supply availability (Hanson et al., 2015).For these models, the water demand and use of each WBS was driven by the potential crop evapotranspiration of 'virtual crop types,' i.e., groups of similar crops from land-use maps, calculated internally as products of associated virtual, composite crop coefficients and reference evapotranspiration.
In conclusion, among the various conjunctive-use software package, MODFLOW-OWHM and FMP were chosen to be integrated within the FREEWAT platform.MODFLOW-OWHM and FMP were found most suitable to simulate and manage conjunctive management of surface  water and groundwater for irrigation purposes in combination with a fully explicit spatially-distributed representation of the groundwater and unsaturated zone components.
After the successful integration of MODFLOW-OWHM and FMP into FREEWAT, the remaining component for the management of water in agriculture is a Crop Growth Module (CGM) that is linked to the water cycle.Among the above-mentioned codes, only SWAT and SIMGRO integrate a crop module in order to estimate crop water uptake.The SWAT code and its derivations use a crop module based on the EPIC plant growth model (Williams et al., 1989), a generic model which simulates radiation interception and conversion into biomass, aboveground biomass accumulation and economic yield, root growth, water use and nutrient uptake.SIMGRO uses instead the WOFOST crop growth model (van Diepen et al., 1989), which has similar features than EPIC although some plant processes are described in more detail.On one hand, this latter approach represents an increase in model robustness, but on the other, the number of parameters required to simulate a crop is much higher.This can constitute a limit, along with increased computational cost to simulate a high number of parameters, to its use in the context of water-basin or regional simulations with many different crops.
The WEAP does not incorporate any crop growth model and FMP (prior to CGM-linkage) was very limited.FMP calculates actual crop consumptive use based on a reduction of potential crop evapotranspiration by conditions of wilting and anoxia and evaporative losses, but makes assumptions, such as a steady-state soil moisture over each MODFLOW time step, depths of the effective root zone to be constant over a MODFLOW time step, and does not calculate biomass.FMP can indeed calculate yield based on water production functions, but does not relate yield to biomass accumulation.Time-variable root depths can be calculated in FMP from time series of climate data (T min , T max ) and crop-specific coefficients (coefficients for growing degree day calculation, polynomial coefficients, and coefficients for root depth calculation) (Schmid et al., 2006).However, the issue with this approach is that this option only allows to read time-variable, but spatially lumped climate data and crop-specific coefficients.That is, this approach can only be used for small-scale models, where spatial variability can be ignored.
A comparison of the discussed conjunctive use models is given in Table 1, which is in part based on a water resources software review of the World Bank (WB; Borden et al., 2016).However, as the objective was to include such code into the open source FREEWAT platform, we only included open source codes into our comparison table.Alongside with two proprietary software packages (GSSHA (WMS), Aquaveo, 2019; MIKE SHE, DHI, 2019), MODFLOW-OWHM was ranked by the WB as the only open source code as among the three most suitable for integrated surface-and ground-water simulations required for conjunctive management.
MODFLOW-OWHM was found to be most suitable for integration into FREEWAT for the simulation and management of conjunctive use.However, a specific module for crop growth modeling had yet be coupled to FMP in FREEWAT, with the goal of connecting the simulation of processes related to water availability to those related to crop water demand and yield.The purpose is to perform predictions about crop yield at farm and basin scale, under different climatic and water supply constraints.A review of existing codes for crop growth modeling was performed according to criteria such as availability of detailed software documentation, general usability characteristics, technical capabilities and simulation features.The CGM, based on the EPIC family models (Gassman et al., 2005(Gassman et al., , 2007(Gassman et al., , 2009;;Williams and Singh, 1995;Williams et al., 1989), was considered to be the most suitable choice among free and open available models to simulate crop growth.Code availability and model documentation were considered as fundamental requirements while carrying out this review.Since both requirements were not fully fulfilled for AQUACROP (FAO, 2012), STICS (Brisson et al., 1998) and APSIM (McCown et al., 1996), at the time of code integration, these models were not taken into account.WOFOST (Boogaard et al., 2014) and SWAP (Kroes et al., 2008) showed to have three important drawbacks: a) they need a high number of crop specific parameters, b) they require hourly radiation data and c) crop water uptake refers to the whole root zone, thus differences in soil moisture at different depths are ignored, leading to potential overestimation or underestimation of readily available soil water for crop growth.Based on the above, the EPIC model (and specifically the CGM) seemed to be the most preferable choice to simulate crop growth.This coupling approach is also detailed in this paper.

Coupling of FMP with CGM and integration in FREEWAT
The QGIS-integrated FREEWAT platform constitutes an effort to support and improve watershed research and decision-making in water resource management.It allows the simulation of the whole hydrological cycle, using open source numerical codes mainly belonging to the USGS MODFLOW family, such as MODFLOW-2005 (Harbaugh, 2005) and OWHM (Hanson et al., 2014).As such, the FREEWAT platform is conceived as a canvas, where many simulation codes based on the hydrological cycle might be virtually integrated.As shown in Fig. 1, the FREEWAT platform is implemented as a composite plugin in QGIS (QGIS Development Team, 2009) and it takes advantage of Spatialite (SpatiaLite Development Team, 2011) as a geodatabase management system, pre-processing tools and FloPy (Flopy, 2016) as reference Python library to connect the GUI to native MODFLOW-based hydrological codes and to post-process models results.Data processing and simulation capabilities are described in details in Criollo et al. (2019) and Rossetto et al. (2018).
Among the simulation codes, FMP is integrated in the FREEWAT platform in order to deal with conjunctive use of surface-and groundwater in the rural environment.As FMP along with other OWHM-specific packages are not considered in FloPy, a specific Python object has been developed for the FloPy library, compliant with format and standard of the existing library.Furthermore, in coupling CGM to FMP and integrating them in FREEWAT, emphasis was placed on the development of simple, but robust, tools to be used in regional-scale studies, thus keeping low the number of parameters needed.The coupling of CGM to FMP within FREEWAT was coded in Python, independently on the FloPy library.
The GUI window to set up an FMP scenario is shown in Fig. 2 and the available sub-menus are organized so the User can easily follow the workflow reported in Fig. 3.Such workflow is briefly explained in the following.A detailed description of FMP conceptualization can be found in Hanson et al. (2014).
The basic concept in FMP is the "farm" or, more in general, what the FREEWAT GUI calls the Water Demand Unit (WDU), namely a model sub-region, made by a cluster of grid cells of the top model layer, requiring water (for cropping systems, rural areas, natural vegetation areas, etc.).Thus, the entire finite-difference grid is classified in one or more WDUs by assigning to each cell a farm ID.Such classification can be made by means of polygon shapefiles previously created, taking advantage of GIS selection tools.
The User then defines parameters for each WDU (e.g., soil characteristics, crop parameters) and a total water demand is input or computed, according to the terms listed below: • crop water demand is computed as evapotranspiration, representing the target crop consumptive use to meet.In FMP "crop" is also used to represent any non-irrigated water-consumptive land-use types (urban environment, natural vegetation, riparian areas, water bodies, etc., then defined as "virtual crops"; Hanson et al., 2014); • municipal and industrial urban water demand can be specified as "negative supplies" (specified as negative non-routed deliveries, see later on).
With reference to Fig. 3, at first, crop water demand is attempted to be met by precipitation and natural uptake from groundwater.Any unfulfilled, residual crop water demand is calculated as Crop Irrigation Requirement (CIR) and increased by the on-farm inefficiency losses (OFE, specific to the irrigation method or the farm operation), which results in a Total Farm Delivery Requirement (TFDR).For each WDU, at each stress period, FMP attempts to satisfy the TFDR with one or more supply components, according to the following ranking: • 1 st priority, by water transfer to a WDU from known types of water sources, e.g.canal/pipeline transfers, trucked/shipped in water (e.g., for islands), aquifer-storage and recovery wellfields, recycled waste water (without simulating the process of conveyance, i.e., non-routed deliveries); • 2 nd priority, by water transfer to a WDU directly from an irrigation canal or lateral directly to an automatically detected farm head-gate (fully-routed deliveries -mainly for small-scale applications with simulation of routing to the farm) or through a surface water network specifying diversion points from the main channel (semi-routed deliveries -mainly for regional-scale models that do not simulate routing to farms).The streamflow-routing network (i.e., the main irrigation canal and the surface water network) is simulated through the Streamflow Routing package (SFR) of MODFLOW (Niswonger and Prudic, 2005).Diversion points from a channel belonging to the streamflow-routing network to a specific WDU need to be defined as part of FMP data input.
The User also has the possibility to specify constraints on surface water and groundwater withdrawals, e.g., surface water or groundwater allotments or maximum well capacities.
Once the model is run, water demand and supply components are computed (for each time step) and the code compares the two terms.A deficit scenario can occur, if the demand is greater than supply (Fig. 3).In this case, the code allows estimating optimal distributions of supply components (either from surface-or ground-water bodies) to cope with this deficit.At the end of the simulation, a specific budget for each WDU is produced in addition to the global budget for the entire model.
CGM is a radiation-based model, meaning that the growth process is driven by intercepted radiation converted into above ground biomass using a radiation use efficiency (RUE) coefficient.Other processes involved in simulating biomass accumulation are crop phenology and canopy development.These processes are affected by weather variables (i.e., air temperature, solar radiation) and crop-specific characteristics.Water uptake is not estimated by CGM as it is computed by FMP.Thus, CGM estimates potential plant growth, based on solar radiation only.
The following section illustrates how CGM and FMP are coupled, in order to estimate the actual crop growth as affected by water availability in the unsaturated zone.

Coupling rural water management (FMP) and crop-growth modeling (CGM)
Fig. 4 shows the conceptual coupling between FMP and CGM.CGM requires few input data (crop-specific parameters, time series of air temperature and solar radiation; right side of Fig. 4), in order to get potential crop yield at harvest (Potential crop yield in Fig. 4).
On the other hand, input data needed to run FMP (left side of Fig. 4) are crop-dependent parameters (basically related to assess the water uptake), soil-related hydrologic parameters (depth of the capillary fringe), climate data (precipitation and reference evapotranspiration).Starting from time series of reference evapotranspiration (ET 0 in Fig. 4), such data are used to compute time series of potential crop evapotranspiration (ET c in Fig. 4), using crop coefficients as proportionality constants (Allen et al., 1998).Fractions of transpiration and evaporation split the ET c into time series of potential crop transpiration, T c-pot , and evaporation, E c-pot .The actual transpiration would equal the potential transpiration if the entire root zone was active, but it is reduced if the active root zone is restricted by wilting or anoxia (WATER STRESS DATA in Fig. 4).Wilting is caused by conditions of intolerably dry conditions for certain crops (Water deficit in Fig. 4).Anoxia is caused by conditions of near-saturation resulting in the lack of oxygen (Water excess in Fig. 4).Note that this is related to deficit or to excess in relation to water in the root zone and not to 'deficit irrigation scenarios' or 'excess non-routed deliveries' in FMP (not discussed here), which address the supply components insufficient to satisfy or in-excess of the irrigation delivery requirement, respectively.
The maximum possible actual transpiration (T c-act-max in Fig. 4) in FMP is defined as the transpiration from the entire root zone only reduced by the anoxia fringe on top of the groundwater level, when coinciding with the bottom of the root zone.Soil-column experiments conducted with HYDRUS (Schmid et al., 2006) indicate that indeed the entire root zone is never 100% active and full T c-pot can never be reached.This T c-act-max can then be further reduced to the actual transpiration (T c-act in Fig. 4) by conditions of wilting in the top soil or when the groundwater level rises into the root zone eventually eliminating the entire active root zone.
The coupling between CGM and FMP is guaranteed through variables T c-act and T c-act-max (Schmid et al., 2006), needed as input data to CGM to adjust Potential crop yield and to get the actual crop yield at harvest (Actual crop yield in Fig. 4).
CGM is run sequentially after FMP and all over the growing season of the crop, from seeding to harvest.This is done for one or more crops defined in FMP scenario previously set and run.For each crop, the User has to input the seeding and harvesting dates, and parameters related to crop phenology.Climate data (air temperature and solar radiation) are further needed on a daily basis, in order to properly represent all the growing stages for each crop type (Table 2).As such, the requirement to run CGM is that the length of the MODFLOW simulation must cover at least the growing periods of each crop type and that daily stress periods must be defined.Also, CGM is not grid-based, as all the needed input data (Table 2, except from crop_ID and crop_name) are time-dependent only.As such, values for T c-act and T c-act-max , which are calculated by FMP at each grid cell and at the end of each stress period, are averaged over the area where each crop is cultivated, in order to get a time series for each crop type.
The complete set of algebraic equations solved by CGM is reported in De Filippis et al. ( 2019).Such equations are divided in two sets.The first set of equations is related to estimate potential crop yield at harvest (i.e., provided that optimal conditions of water sufficiency occur).To this aim, the role of temperature on crop growth rate is assessed through evaluating the daily accumulation of heat based on temperature data.This is then used to calculate the potential Leaf Area Index.The potential Leaf Area Index is needed, along with solar radiation, to get a daily amount of crop-intercepted photosynthetically active radiation, which is finally converted into a potential Above-Ground Biomass (AGB pot ) under optimal water conditions.AGB pot is a time-dependent variable, whose value at the end of the simulation (i.e., at harvest) is needed to get the crop Yield at Harvest (Y H ).
In a second set of algebraic equations, variables T c-act (the actual crop transpiration requirement) and T c-act-max (the maximum actual crop transpiration) are used to get the actual Above-Ground Biomass (AGB act ) and the actual crop Yield at harvest (Y act ), which are nothing but AGB pot and Y H limited by the amount of water uptake by introducing a daily water stress factor.

Example application
The coupling approach shown in Fig. 4 and so far described is demonstrated through a simple synthetic application.The example reported in Schmid et al. (2006) was adapted to set up a real world case study using climatic data from central Italy, from January 1 st to December 31 st , 2017.The CGM was then coupled to this FMP scenario to get sunflower yield at harvest under the specific water availability conditions.
The study area, 115 km 2 wide, is discretized through 460 square cells with 500 m side length.The simulated domain includes three WDUs (Fig. 5): -an irrigation district with sunflower crops (925 ha, WDU1); -an urban area with irrigated green spaces (amenity grasses, 775 ha, WDU2); -a rainfed grassland WDU is defined at the remaining cells (WDU3).
Groundwater is hosted in a sandy aquifer represented through a single homogeneous, convertible model layer with thickness ranging from 277 m to 300 m.Groundwater flow occurs from west to east (Fig. 6a).
Boundary conditions and source/sink terms are represented in Fig. 6a, where the hydraulic head simulated at the beginning of the sunflower cropping season (April 1 st , 2017) is reported as well.A main canal crosses the area from west to east; water is diverted at two points by means of two secondary irrigation channels running around the irrigation district and the urban area.At WDU1 (the irrigation district) a semi-routed surface water delivery is set from the secondary channel.Drain channels potentially drain high-standing groundwater.Water needs in the domain are related to crop water demand (in WDU1), to the urban water demand (4000 m 3 /day) and irrigation of green spaces in the urban area (WDU2).Through FMP, we simulated the different components of freshwater supply to meet the water needs of the WDUs, that is, in our case, in the order of priority: 1) supply by precipitation and natural root uptake, 2) surface water supply, and 3) groundwater supply.Irrigation of sunflower is simulated between April 1 st and August 31 st , 2017.Irrigation water is provided by means of surface water;  six wells pumping groundwater provide supplementary irrigation.Total licensed groundwater abstraction for WDU1 is represented in Fig. 6b over the sunflower cropping season.For the supply of the water needs of WDU2 only groundwater use (by means of four wells) is foreseen.Three soil types (silt, silty clay, and sandy loam) are assigned (Fig. 6a).
In the following time plots over the whole simulation period, the starting and ending dates for the sunflower cropping season have been highlighted: sunflower seeding and harvesting dates were set at April 1 st and August 31 st 2017, respectively.
Climate data (i.e., precipitation required by FMP, and minimum and maximum air temperature required by CGM) are shown in Fig. 7a, while Fig. 7b reports reference evapotranspiration calculated using the Hargreaves equation (Allen et al., 1998).Fig. 7c shows crop coefficients for each crop type (values for sunflower and grassland from Allen et al., 1998; values for urban vegetation from Meyer et al., 1985).In the simulated period, the rainfall depth during the growing season (April through August 2017) was 99.8 mm, distributed in four main events, representing the rainfall amount of a very dry year.OFE coefficients in irrigation water distribution were set at 0.75 for sunflower and at 0.6 for the green urban spaces.
Root depth for sunflower was input on daily basis, considering a depth at emergence of 0.04 m from soil surface and a maximum root depth of 1.5 m, as linear function of cumulative growing degree days: RD = RGC*CGDD (Schmid et al., 2006), where: RD = Root Depth (m) RCG = Root Growth Coefficient 7.9 x 10 −4 (m/°C) CGDD = Cumulative Growing Degree Days (°C) Growing degree days are accumulated beginning with the day after planting.
Maximum root depth for amenity grasses was set at 0.6 m and 1.6 m for native grasses, respectively; these two values were constant through all the simulation.
Fraction of evapotranspiration (K t : transpiratory fraction of consumptive use; K e i : evaporative fraction of evapotranspiration related to irrigation; K e p : evaporative fraction of evapotranspiration related to precipitation) were defined.For sunflower they vary monthly (Table 3).K e p is set to zero as we assume that all the 925 ha are covered with crops.This is of course an assumption as in real sense, a small percentage of the area will be exposed to soil evaporation.The cumulated sunflower crop potential evapotraspiration (ET c ) amounts to 396 mm (consistent with what reported in Sezen et al., 2011).For the urban green area we set: K t = 0.8, K e i = 0.2 and K e p = 0.4; while K e p = 0.4, K t = 0.6 and K e p = 0.4 for These values are constant through all the simulation.A CGM model was then run to simulate the yield of sunflower at harvest.Parameters values input for sunflower in the CGM scenario are listed in Table 4.

Results and discussion
The simulations run on the analysed case study provide several outputs.Fig. 8 shows groundwater head simulated on June 28 th , 2017.Using this information, the impact of groundwater withdrawal may be tested against local regulations with specific regards to regulated drawdown in case of agricultural areas affected by aquifer overexploitation.In this case, presentation of spatially-distributed results fully benefits from the GIS tools to produce maps.
For the simulated domain, we can then analyse the whole water budget or the budget for each WDU; in this paper, we present the budget for the sunflower crop irrigated district (WDU1).Fig. 9a shows the demand and supply components of the FMP simulation for the sunflower irrigation district over the cropping season.In the graph, we may notice how the TFDR is satisfied by natural uptake and surface water resource up to the end of May; then, in June, when the surface water availability is less than TFDR, with raising of evapotranspiration demand, a supplementary source of water (provided by the six farm groundwater wells) is needed.The demand decreases in July and then falls down abruptly in August (due to a change in sunflower K c ).The simulated input components for WDU1 (a total of 4.87 Mm 3 ; Fig. 9b) are rainfall (0.92 Mm 3 ), irrigation provided via surface-(2.07Mm 3 ) and ground-water as supplementary source (0.11 Mm 3 ), providing 19% and 44% of the irrigation needs respectively, and direct uptake from the  saturated and the capillary zone (1.63 Mm 3 ).Fig. 9c presents the outflow components for the WDU1.While runoff accounts only for 3% (0.13 Mm 3 ), 27% of the budget is water percolating to the aquifer Mm 3 ).The other outflow terms are related to evaporation from irrigation (E i ; 7%, 0.36 Mm 3 ) and from groundwater (E gw ), which in this case is a minor component (3%, 0.14 Mm 3 ).The model allows to get also data on partitioning of transpiration: in this case transpiration from irrigation (T i ) was 1.28 Mm 3 (26%), while transpiration from groundwater (T gw ) was 1.63 Mm 3 (33%).Transpiration from precipitation (T p ) is a small amount (1%, 0.05 Mm 3 ) due to the very dry year simulated.From Fig. 9c, we may derive the value of simulated crop consumptive use (ET c-act ) as: ET c-act = T gw + T p + T i + E gw + E p + E i This value accounts for a total of 373 mm during the whole growing season.Compared to the simulated value of ET c (396 mm), the observed value was lower by 23 mm.This lower simulated value is related to the proportional reduction of maximum possible transpiration due to the reduction of the active root zone from where transpiration is at maximum, when the groundwater table elevation is at the bottom of the root zone, to where it is zero, when the groundwater table elevation is near the surface.Then, the assumption that ET c is equal to ET c-act is only true for conditions when the groundwater table is below the transpiration extinction depth with all transpiration and evaporation components supplied by irrigation and precipitation.
This shed a light on the role of shallow water table in providing direct natural groundwater supply for crops (as also found in other works such as Miao et al., 2016).In fact, in the simulated case, while transpiration from irrigation provides 37% of ET c-act , transpiration from groundwater accounts for 47%.Fig. 9d shows the variation in transpiration from irrigation and transpiration from groundwater with time over the cropping season.
Finally, given the simulated water availability conditions, the CGM model simulation provides a yield of about 4.85 Mg/ha.This value is referred to the dry matter and it is in accordance with the experimental tests reported in Triana Jimeno (2011) for sunflower in central Italy and it is consistent also with data reported in similar works such as Todorovic et al. (2009) and Ion et al. (2015).

Conclusions
The development of FREEWAT, an open source, public domain, GISintegrated, fully distributed and numerically-based suite specifically dedicated to the management of conjunctive use of surface-and ground-water in rural areas, may constitute an advancement for proper agricultural water management at watershed or collective irrigation system scale, given also the present computational capability of computing systems.In this paper, we described the approach followed in coupling the FMP (embedded in MODFLOW-OWHM) to the CGM and then their integration in the FREEWAT platform.With respect to other available codes, FMP is considered the most appropriate as it deals in a more rigorous way with the groundwater component in a fully explicit spatially-distributed approach.The novelty of this approach is based on the fact that all calculations are done in a spatially-distributed way.By this means, real geographical data may be used in the input phase, then boosting the values of gathered real data in monitoring efforts.For each cell of the finite-difference scheme, data on geology, well presence and pumping rate at a specific depth, crop and soil parameters maybe assigned, along with source of water for irrigation.By this authorities, large farms may build dynamic tools to be improved when new data/ information are gathered on the area.Calculated results are geographically distributed and zonal budget may be calculated.
Making FMP available in a free GIS environment, such as QGIS, may allow analysis of dynamically integrated infiltration, surface runoff and deep percolation components, to effectively balance crop water demand and supply from different sources of water.By this means, simulations may be run to gather results in space and time and evaluating the reliability of different supply sources, and the environmental impact (such as large drawdown caused by groundwater overexploitation) caused by their use.Moreover, evaluations may be done on the different components of ET c-act .The coupling of FMP with CGM to estimate crop yield at harvest provides further management tools for assessing on yearly basis the potential impact of climate change, when dealing with crop productivity.
The proposed approach was demonstrated by a simple synthetic application, aimed at providing insight on the role of different water sources in irrigation, and, based on plant transpiration simulated via FMP, the yield of sunflower at harvest.The analysis of the water balance terms in the simulated case study allowed identification of the groundwater contribution to ET c-act , representing 47% of ET c-act .In order to reduce irrigation water use, valuing natural groundwater uptake by roots, soil moisture low-cost sensors gathering high-frequency data, connected to and commanding the irrigation schemes and to the software management platform, may contribute in reducing water abstraction.
Further development of the code will include, among the other, the integration of crop rotation routines in the spatial and temporal domain, nitrate cycle integration in the CGM and its coupling with solute transport code in the saturated and unsaturated zone.The latter may also be helpful, along with the implementation of farming practices, in producing tools for assessing nitrate leaching to groundwater.
The proposed framework is thought to be used by water authorities (e.g., river basin authorities) and public/private companies (i.e., irrigation consortium) managing irrigation areas, in order to achieve databased agricultural water management.In this sense, the presented effort aims at supporting collective irrigation schemes operation with tools for managing conjunctive use, then trying to reduce the often unplanned and unmanaged use of private farm wells.Although the open source and free characteristics of the software may favor widespread use, it is clear that capacity building to boost digitalization in the agricultural water sector will be at the core of improved water management.

Fig. 2 .
Fig. 2. A screenshot of the FREEWAT plugin in QGIS, with FMP tools expanded.

Fig. 4 .
Fig. 4. Conceptual scheme of the coupling between FMP and CGM.

Fig. 5 .
Fig. 5. Spatial distribution of WDUs and crops.The semi-routed surface water delivery to the irrigation district and the pumping wells are displayed as well.

Fig. 6 .
Fig. 6.(a) Representation of the model grid, boundary conditions and source/sink terms.The dotted lines refer to the simulated hydraulic head on April 1 st , 2017 (values in meters above msl).The color scale refers to spatial distribution of soil types.(b) Total licensed groundwater abstraction at WDU1 over the cropping season.

Fig. 7 .
Fig. 7. (a) Climate data input for the FMP and for the CGM models.(b) Reference evapotranspiration calculated with the Hargreaves equation and input for the FMP scenario.(c) K c values input for the three crops for the FMP scenario.The dotted, orange line refers to K c values used to simulate evaporation from bare soil at WDU1 grid cells.

Fig. 9 .
Fig. 9. (a) Demand and supply components for the irrigation district over the cropping season.(b) Inflow terms of the cumulated water balance of WDU1 over the cropping season.(c) Outflow terms of the cumulated water balance of WDU1 over the cropping season.(d) Simulated transpiration values from irrigation and from groundwater over the cropping season.

Table 1
Borden et al., 2016)ource software for conjunctive use (modified and widely extended for open source codes afterBorden et al., 2016).

Table 1
(continued) * Simulates the full hydrologic cycle beyond lumped conceptual rainfall-runoff models.

Table 2
Input data needed to run CGM.* Retrieved from the FMP model.** Calculated by FMP at each grid cell and averaged over the area where the crop is grown.

Table 3
Coefficients used to fraction evapotranspiration in WDU1.