IdrAgra is a distributed-parameter agro-hydrological model that allows the simulation of the irrigation water distribution in agricultural areas and the estimation of the hydrological balance on a daily basis.
prof. Claudio Gandolfi
email: claudio.gandolfi@unimi.it
- Anna Borghi %AB%
- Enrico Antonio Chiaradia %EAC% enrico.chiaradia@unimi.it
- Rachele Riva %RR%
Please refer to the following note for reading the code and apply edits.
- t_* = soil water content, theta, dimensionless [m^3/m^3]
- h_* = water height/depth specific volume always in millimeter [mm]
- v_* = water volume in cubic meter [m^3]
- q_* = discharge in cubic meter per second [m^3/s]
MSYS2 is a collection of tools and libraries providing you with an easy-to-use build system.
- download the installer from https://www.msys2.org
- run the installer, enter the desired installation folder, leave other settings as default
- when installation finished, run MSYS2
- type the following commands in the MSYS2 console:
pacman -Syu
pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-setuptools
/mingw64/bin/pip3 install fortran-language-server
pacman -S mingw-w64-x86_64-lapack
pacman -S git unzip zsh
Note
After step 5, the terminal will be closed and you have to reopen it. Step 7 will install a complete building toolchain, other steps install useful packages
Install Visual Studio Code, VSC, (not Visual Studio!) from https://code.visualstudio.com/
Launch VSC. In the side bar (left), click the “Extensions” icon (in the middle). The following extensions of VSC should be (already) installed:
- C/C++ extension
- Makefile extension
- Code Runner
- Modern Fortran
- Data Preview (to view and analyze csv files, optional)
In the side bar (left), click the "Manage" icon (bottom) , and select "Settings". In the settings, search for "code runner" and set "on" the following three items:
- Code runner: run in terminal -> ON
- Code runner: save all file before run -> ON
- Code runner: save file before run -> ON
- Code runner: ignore selection -> true
Open a new command terminal (Start menu -> cmd)
Go to the desired root folder (where the project folder will be saved):
cd YOUR-ROOT-PATH
Clone your repo with the following git command:
git clone https://github.com/rita-tools/IdrAgra_v2
Change your terminal into that new subdirectory:
cd IdrAgra_v2
Open Visual Studio Code and select File -> Open Folder
In the terminal, type the following:
make cleanall
make
A brand-new idragra executable should be created!
Go to the launch.json file under .vscode folder and replace the path with that to your idragra dataset (where idragra_parameters.txt exists):
"cwd": "YOUR-PATH-TO-IDRAGRA-DATASET",
On the side bar (left), select Run and Debug. Then, click on the green triangle on the top. If necessary, select the debugger (gdb) Launch
Commonly, gfortran (the compiler) is not installed by default. To install it, open the terminal and type:
sudo apt install gfortran
The Ubuntu app center is the easy way to installVisual Studio Code, VSC.
Launch VSC. In the side bar (left), click the “Extensions” icon (in the middle). The following extensions of VSC should be (already) installed:
- C/C++ extension
- Makefile extension
- Code Runner
- Modern Fortran
- Data Preview (to view and analyze csv files, optional)
In the side bar (left), click the "Manage" icon (bottom) , and select "Settings". In the settings, search for "code runner" and set "on" the following three items:
- Code runner: run in terminal -> ON
- Code runner: save all file before run -> ON
- Code runner: save file before run -> ON
- Code runner: ignore selection -> true
From the terminal, install git (if not already available):
sudo apt-get install git
Set up github user credentials:
git config --global user.name "your-user-name"
git config --global user.email "your@email.dummy"
From the terminal (supposing python3 is not installed):
sudo apt install python3-pip
pip install fortls --upgrade
From the terminal (supposing make is not installed):
sudo apt install make
Clone your repo with the following git command:
git clone --branch linux_comp https://github.com/rita-tools/IdrAgra_v2
Change your terminal into that new subdirectory:
cd IdrAgra_v2
Open Visual Studio Code and select File -> Open Folder
In the terminal, type the following:
make cleanall
make
A brand-new idragra executable should be created!
Go to the launch.json file under .vscode folder and replace the path with that to your idragra dataset (where idragra_parameters.txt exists):
"cwd": "YOUR-PATH-TO-IDRAGRA-DATASET",
On the side bar (left), select Run and Debug. Then, click on the green triangle on the top. If necessary, select the debugger (gdb) Launch
Capital letters are meaningful in Linux OS system (i.e. test.txt is different from Test.txt and test.TXT) so pay attention that the following files in your dataset are saved as follow:
from the phenological folder
- CropParam.dat
- CanopyRes.dat
- Kcb.dat
- H.dat
- Sr.dat
- LAI.dat
- CNvalue.dat
- fc.dat (lowercase)
- r_stress.dat (lowercase)
- WPadj.dat
from the spatial data folder
- domain.asc (lowercase)
- ThetaI_FC.asc
- ThetaII_FC.asc
- ThetaI_WP.asc
- ThetaII_WP.asc
- ThetaI_r.asc
- ThetaII_r.asc
- ThetaI_sat.asc
- ThetaII_sat.asc
- slope.asc
- hydr_cond.asc
- hydr_group.asc
- Ksat_I.asc
- Ksat_II.asc
- N_I.asc
- N_II.asc
- IC_thetaI.asc
- IC_thetaII.asc
- FC_thetaI.asc
- FC_thetaII.asc
- rice_soilparam.txt
- appl_eff.asc
- conv_eff.asc
- irr_units.asc
- irr_meth.asc
- waterdepth.asc
- CapRisePar_a3.asc
- CapRisePar_a4.asc
- CapRisePar_b1.asc
- CapRisePar_b2.asc
- CapRisePar_b3.asc
- CapRisePar_b4.asc
- soiluse.asc
- shapearea.asc
- meteo_123.asc