Configuration_files - PIK-LPJmL/LPJmL GitHub Wiki

Configuration files

LPJmL needs a configuration file called lpjml.conf -- lpjml.js. The default setup is already in your LPJmL copy that you downloaded from the master branch in the git repository.
You will have to adjust this file to your needs. Note that the *.conf files need to be specified in their specific order, which makes them very error-prone. The new *.js files are more flexible with respect to the order of specifiers.

The lpjml.[conf|js] includes two other configuration files, one for general parameters param.[conf|js], and another one for region-specific input files called input.[conf|js]. You will also have to adjust the input.[conf|js] to your needs.

The default setup of LPJmL runs on the entire global grid which makes it hard to post-process and view the very large output files on your local machine. Let’s assume you only want to run simulations for a specific country (Mexico in this example). You will have to “cut” the global grid down to the country of interest and also re-sample all other associated input files to the new grid topology.
Read here how to create these country-specific input files.

If you have established all your required input files, you can rename the default lpjml.[conf|js] and input.[conf|js] to something else according to your specific simulation setup. In this example, we assume Mexico-specific input files in a simulation with landuse (no river routing, no fire).

It is important to set the variable

#define WITH_LANDUSE 1 /*NO_LANDUSE: land use disabled; WITH_LANDUSE: land use enabled */

correctly for each model run, so that the model runs with (1) or without (0) landuse according to your preferences (also see below: “running settings”).

Likewise, you can set or comment out the variable

#define FROM_RESTART /* exclude when doing spin-up time */

which is only included if you have already generated a restart file (also see below: “running settings”).

In the input section, you read in the Mexico-specific input file, let's assume it's called inputMexicoLanduse.conf:

#include "inputMexicoLanduse.conf"    /* Input files of CRU dataset */

You should also check out this file to see how the country-specific input files you have generated before are read. Their sequence is important, so do not change their order without thinking! Or switch to the js file format.

Further below in the configuration file is the output section, where you can define your output files. The output is binary and you can read them into the statistical software R later on. Examples for important output files are vegc.bin, mnpp.bin, and fpc.bin. Read this to find out more about available Output files in LPJmL.

The last section of the lpjml.conf defines the running settings. Here, it is important to set

ALL /* all grid cells */

because you have already cut your grid, you want to run the simulation across the entire grid.

If you run your model for the first time, you will want to do a spin-up with natural vegetation. In this case, you have to set

#define WITH_LANDUSE 0 /*NO_LANDUSE: land use disabled; WITH_LANDUSE: land use enabled */

and comment out the lines

/* #define FROM_RESTART */ /* exclude when doing spin-up time */

Now, the parses of the configuration script will enter this if clause:

#ifndef FROM_RESTART    
1000  /* spinup years */
/* exclude next line in case of 0 spinup years */
30   /* cycle length during spinup (yr) */
1901 /* first year of simulation */
1901 /* last year of simulation */
NO_RESTART /* do not start from restart file */
RESTART /* create restart file: the last year of simulation=restart-year */
restartMexico/restart_1000a_spinup.lpj  /* filename of restart file */
1901 /* write restart at year; exclude line in case of no restart to be written */

This will create a new restart file restart_1000a_spinup.lpj for a 1000-year spin-up with natural vegetation. The equilibrium state is saved at the year 1901. From this restart file, you can now restart your simulation with landuse. To do this, set

#define WITH_LANDUSE 1 /*NO_LANDUSE: land use disabled; WITH_LANDUSE: land use enabled */

and comment in the lines

#define FROM_RESTART /* exclude when doing spin-up time */

or call the model with the argument -DFROM_RESTART just before the name of the configuration file (e.g. lpjml -DFROM_RESTART lpjml.conf).

If you run the model (see Step 2 below how to do that), the parser will enter the running settings and read the “else” condition because this time you have defined a restart file:

#else    
390  /* spinup years */
30 /* cycle length during spinup (yr) */
1901 /* first year of simulation */
2005 /* last year of simulation */
RESTART /* start from restart file */
restartMexico/restart_1000a_spinup.lpj /* name of restart file */
RESTART /* create another restart file */
restartMexicoLanduse/restart_390a_spinup.lpj
1901

This configuration will start with the restart file (1000 years of natural vegetation) you have generated before, and then continue with another, shorter spin-up of 390 years with landuse and a transient simulation with landuse from 1901 until 2005. It writes out another restart file restart_390a_spinup.lpj which you might want to use later in a different simulation.

⚠️ **GitHub.com Fallback** ⚠️