## 2 Materials and Methods
### Methods
#### 2.2.1 Flow Calibration  
Model and Software Description  
SWAT Model description  
SWAT is a semi-distributed agro-hydrological model [32] with a daily time step. SWAT is used for evaluating water quality and quantity, agricultural practices management, surface and subsurface water management, and sediment, nutrient, and pesticide transfer. SWAT is used worldwide by a large scientific community. This model is based on the water balance equation, which is as follows [32]:  
\[\text{SWt}=\text{SWo}+\Sigma\ (\text{Rday}+\text{IRR}-\text{Qsurf}-\text{Ea}- \text{Wseep}), \tag{1}\]  
where SWt is the final soil water content (mm) of the day, SWo is the in-soil initial water content (mm), Rday is the daily rainfall (mm), IRR is irrigation volume added to the soil (mm), Qsurf is the surface runoff volume (mm), Ea is the actual evapotranspiration (mm), and Wseep is percolation loss from the soil profile into the shallow aquifer (mm). * SWAT-CUP and SUFI-2 algorithm Uncertainties may occur while setting up and running the model. Uncertainties come either from measurement errors or from the model itself [33; 34; 35]. To be used efficiently, the model's performance must be tested. This study tested the correlation between observed data and simulated outputs statistically and graphically. Thus, Swat-cup (SWAT Calibration Uncertainty Program) was used to optimize the flow model. The program is the most widely used tool by the SWAT community. SWAT-CUP allows to perform calibration, uncertainty, and global sensitivity analysis automatically (Table 1). Several methods are integrated into the SWAT-CUP program. We have Sequential Uncertainty Fitting version 2 (SUFI-2) [36; 37], Generalized Likelihood Uncertainty Estimation (GLUE) [38], Particle Swarm Optimization (PSO) [39], Parameter Solution (PARASOL) [40] and Markov Chain Monte Carlo (MCMC) [41]. For this study, the SUFI 2 method was used because it permits concomitantly to perform global parameter sensitivity analysis, uncertainty analysis, and calibration [42]. * Global sensitivity analysis The analysis of global sensitivity begins with the definition of the objective function. Objective functions within SUFI2 include R\({}^{2}\), Chi2, NS, and R\({}^{2}\) multiplied by the line regression coefficient b, bR\({}^{2}\), and SSQR (sum of squared errors) coefficients. However, for this study, NS and R\({}^{2}\) coefficients were the objective functions used. NS is used to analyze the strength of the model predictions and while R\({}^{2}\) coefficient is related to the correlation between simulations and observed values. Then, the values of the parameters to be optimized, are chosen based on Equation (2) [43]: \[\text{b}_{\text{jabs\_min}}\leq\text{b}_{\text{j}}\leq\text{b}_{\text{jabs\_max}}, \text{j}=1\ldots\text{m}\] (2) where b\({}_{\text{j}}\) is the jth parameter and m is the number of parameters to be estimated. The parameter global sensitivity in each simulation is factored in using the sensitivity matrix J, of g (b\({}_{\text{j}}\)) [43]: \[\text{J}_{\text{ij}}=\Delta_{\text{gi}}/\Delta\text{b}_{\text{j}}\text{I}=1 \ldots\text{C}_{2}{}^{n}\] (3) where b\({}_{\text{j}}\) is the parameter, g is global sensitivity, i is all possible combinations of two simulations, and j is the number of columns (number of parameters).