2.1. Download the OSMOSE code

The OSMOSE model is now provided as a R package, which can be downloaded from GitHub as follows:

# using HTTPS:
git clone https://github.com/osmose-model/osmose.git

# using SSH
git clone git@github.com:osmose-model/osmose.git

When a new version of the code is released, it can be updated as follows:

git pull

2.2. Installation

When the code has been downloaded, it must be installed as follows:

R CMD INSTALL osmose

Warning

The code must be reinstalled after each upgrade

Note

The package can be installed by using RStudio. To do so, click on the File –> New Project menu and open the Version Control –> Git menu. Set the package URL (https://github.com/osmose-model/osmose.git). When the project is opened, click on the Build & Reload button to install the package.

2.3. Code architecture

The Osmose directory contains the following folders:

  • The inst/java contains the Osmose Java core, provided as .jar.
  • The java directory contains the Osmose Java source files associated with the .jar files.
  • The R folder contains the R functions (pre/post processing tools, call to the JAVA core, etc.)
  • The inst/extdata/master directory contains input files that can be used to run the model for the first time.

2.4. Installation of the calibration library

The parameters of the Osmose model must be calibrated for each configuration. This is achieved by using the calibrar library. It can be downloaded as follows:

# using HTTPS:
git clone https://github.com/roliveros-ramos/calibrar.git

# using SSH
git clone git@github.com:roliveros-ramos/calibrar.git

The code is installed as follows:

R CMD INSTALL calibrar

Note

The calibrar package can be installed from RStudio, as described above.

2.5. Running the test configuration

To run the test configuration, launch R and type the following:

rm(list=ls())

library(osmose)

# recover the reference configuration file
filename = system.file(package="osmose", "extdata", "master", "osm_all-parameters.csv")

# run the osmose java core
run_osmose(filename)

# read the osmose outputs
data = read_osmose("output")

# plot the outputs
png(file="osmose_ref_conf.png")
plot(data)
This is OSMOSE version 3.3.3
Running: 'java'  -jar /home/nbarrier/Libs/R/osmose/java/osmose_3.3.3.jar /home/nbarrier/Libs/R/osmose/extdata/master/osm_all-parameters.csv output

You should obtain the following figure:

../_images/osmose_ref_conf.png

Fig. 2.1 Outputs of the reference configuration