For developers

FABM-PCLake for developers

This page is intended as support to FABM-PCLake developers, or people who are simply interested in looking into the FABM-PCLake code. 

Downloading source codes

The download instructions below are tailored to Windows machines. For an example on how to obtain source code on Linux machines, please see FABM.net.  

 

1. Downloading source codes using Git (recommended option)

To obtain the source codes of GOTM, FABM and FABM-PCLake using Git, you need a git client.

  • First download and install the Windows version of Git itself.
  • Then, for convenience, we also recommend downloading and installing the graphical git client TortoiseGit on top of Git.

After installation of these two software packages you can simply obtain the code by right-clicking in Windows Explorer within a directory where you want the source code directories, and then choose "Git Clone...". In the window that appears, set the URL, check the target directory and click OK.

Do this for the following URLs:

GOTM:

• URL: https://github.com/gotm-model/code.git
• (suggested target directory: gotm-git)

FABM:

• URL: https://github.com/fabm-model/fabm.git
• (suggested target directory: fabm-git)

FABM-PCLake:

• URL: https://gitlab.com/FABM-PCLake/pclake.git
• (suggested target directory: pclake-git)
• Note: for the FABM-PCLake repository, you first need create a free Gitlab account to get access and a login to the source code. Please see these video instructions on how to set up this account.

 

To update any of the codes using Git, you simply have to right-click inside your local code repository, then select “TortoiseGit” and “Pull…". To compile the code, you need CMake and a Fortran compiler.

Please read our compilation instructions for further details.

 

2. Downloading source codes directly from Gitlab and Github webpages

 

GOTM:

• To download GOTM directly through a website (does not require log in), go to https://github.com/gotm-model/code
• Then click “Clone or download” and then “Download as zip”

FABM:

• To download FABM directly through a website (does not require log in), go to https://github.com/fabm-model/fabm
• Then click “Clone or download” and then “Download as zip”

FABM-PCLake:

• To download FABM-PCLake directly through a website, first go to https://wet.au.dk
• Follow the instructional video to first create a free Gitlab account and the download the source code as a zip file through the Gitlab page of FABM-PCLake.

Compilation of source codes

This guide is tailored to Windows machines, and use a build system based on CMake. For an example on how to build on Linux machines, please see FABM.net. CMake generates platform-specific build systems. In the example below, we have used CMake 3.8.0 to generate a build system for MS Visual Studio with an Intel Visual Fortran integration. You may follow the individual steps in the guide below to build a GOTM executable with FABM and FABM-PCLake integration.

 

Open CMake and point to GOTM source code directory

 

Choose build system

 

6. At first, you will get an error (if you get a pop-up with an error message simply click "OK"), as CMake does not know where to find the FABM code repositories (including the FABM base, FABM-PCLake, and ERSEM). We need to point to FABM base, and also FABM-PCLake and/or ERSEM, if we want to include these in our MS Visual Studio solution.

 

Point to FABM directory

7. Expand the CMAKE, FABM and the GOTM menu. Under (8) CMAKE_INSTALL_PREFIX: assign a folder for storing the gotm executable (once this has been compiled); under (9) FABM_BASE: assign the path to your local FABM base repository (not src but main directory); under (10) FABM_PREFIX: delete all text in the “Value” line; under (11) GOTM_EMBED_VERSION tick the box to get code version printed after model execution.

 

Point to FABM-PCLake directory

13. To include FABM-PCLake, expand FABM menu again, and point to the path for your local FABM-PCLake directory. If you want to include ERSEM, also assign the path to your local ERSEM repository. If you do not want to include ERSEM, simply leave the FABM_ERSEM_BASE path/Value blank.

 

Generate build system

When Configuration is completed successfully, no menu items should be highlighted with red. Then you can create the MS Visual Studio solution file, which can be opened and used to compile the GOTM executable including FABM and the FABM-PCLake model. Click Generate to create this solution file.

When Generation of solution file is successful (as seen below), you can locate the MS Visual Studio solution file under your “Build” directory, which you specified in the second step of your CMake configuration (i.e. “Where to build the binaries”). You can also open the solution file by clicking on "Open Project" within CMake. You may now close CMake.

Example of build directory is seen below.

 

Building the GOTM executable

Open the gotm solution in MS Visual Studio. Then click "Build” and “Build Solution” to compile the GOTM executable with FABM (base) and FABM-PCLake support.

 

You can now find the GOTM executable in a subdirectory inside the folder of your MS Visual Studio solution (e.g., in folder called Debug, if you compiled in Debug mode, or Release if you compiled in Release mode). You can also right click on the INSTALL project inside MS Visual Studio (under the Solution Explorer at your right-hand side) and click “Build” – this will copy the gotm executable to the directory you have specified in your CMake configuration (under point 8 of this guide). 

 

Modifying FABM-PCLake source code

Within the GOTM solution, when open in MS Visual Studio, you can find the FABM-PCLake source files under the Solution Explorer (your right-hand side) under fabm\models\fabm_models_pclake\. You can review and change code within these files, and then re-build the gotm executable. Please see FABM.net for further details on how to write FABM compliant code for a biogeochemical model.