/**************************************************************************************/
/**                                                                                \n**/
/**                   l  p  j  m  l  .  c  o  n  f                                 \n**/
/**                                                                                \n**/
/** Default configuration file for LPJmL C Version 4.0.001                         \n**/
/**                                                                                \n**/
/** Configuration file is divided into five sections:                              \n**/
/**                                                                                \n**/
/**  I.   Simulation description and type section                                  \n**/
/**  II.  Input parameter section                                                  \n**/
/**  III. Input data section                                                       \n**/
/**  IV.  Output data section                                                      \n**/
/**  V.   Run settings section                                                     \n**/
/**                                                                                \n**/
/** (C) Potsdam Institute for Climate Impact Research (PIK), see COPYRIGHT file    \n**/
/** authors, and contributors see AUTHORS file                                     \n**/
/** This file is part of LPJmL and licensed under GNU AGPL Version 3               \n**/
/** or later. See LICENSE file or go to http://www.gnu.org/licenses/               \n**/
/** Contact: https://gitlab.pik-potsdam.de/lpjml                                   \n**/
/**                                                                                \n**/
/**************************************************************************************/

#include "include/conf.h" /* include constant definitions */

#define RIVER_ROUTING /*river routing enabled; exclude this line to disable river routing */
#define ISRANDOM      /* random generation of daily precipitation */
//#define BENCHMARK_LAI 5 /* also set value here directly (1 to 7), not in /par/param.par */
#define WITH_LAIMAX_CFT
#define PERMAFROST
#define USE_RADIATION
#define GSI_PHENOLOGY
#ifdef FROM_RESTART
#define WITH_RESERVOIRS
#define WITH_WATERUSE
#define WITH_LANDUSE LANDUSE /* landuse options: NO_LANDUSE (natural vegetation), LANDUSE (cropfracs from input), CONST_LANDUSE (landuse extent fixed, year specified in param.par), ALL_CROPS (all crops cultivated in all cells, requires POT_IRRIGATION) */
#endif
#define IRRIGATION LIM_IRRIGATION /* irrigation options: NO_IRRIGATION (irrigated cropfracs added to rain-fed), LIM_IRRIGATION (requires #define RIVER_ROUTING), POT_IRRIGATION, ALL_IRRIGATION (rain-fed cropfracs added to irrigation) */
#define FIX_SDATES
/* #define WITH_SPITFIRE */
/* #define WITH_FIREWOOD */
/* #define WITH_GRIDBASED grid based PFT output_SPITFIRE-optpar enabled */
/* #define WITH_FIXED_GRASS_PFT */
/* #define WITH_GRASS_SCENARIOS */
/* #define DAILY_OUTPUT */

/*===================================================================*/
/*  I. Simulation description and type section                       */
/*===================================================================*/

"LPJmL Run" /* Simulation description */
LPJML                    /*LPJML Simulation type with managed land use */
#ifdef ISRANDOM
RANDOM_PREC /* Random weather generator for precipitation enabled */
2 /* seed for random number generator */
#else
INTERPOLATE_PREC
#endif
#ifdef USE_RADIATION
RADIATION
#else
CLOUDINESS
#endif
#ifdef WITH_SPITFIRE
SPITFIRE
#else
FIRE                 /* fire disturbance enabled */
#endif
#ifdef WITH_FIREWOOD
FIREWOOD
#ifndef WITH_LANDUSE
#define WITH_LANDUSE 0
#endif
#else
NO_FIREWOOD
#endif
#if defined(WITH_SPITFIRE) || defined(WITH_FIREWOOD)
#ifndef FROM_RESTART
NO_POPULATION
#  else
POPULATION
#  endif
#else
NO_POPULATION
#endif
#ifdef USE_BURNTAREA
PRESCRIBE_BURNTAREA
#else
NO_PRESCRIBE_BURNTAREA
#endif
#ifdef USE_LANDCOVER
LANDCOVERFPC /* LANDCOVEREST to prescribe establishment or LANDCOVERFPC to prescribe maximum FPC */
#else
NO_LANDCOVER
#endif
#ifdef GSI_PHENOLOGY
NEW_PHENOLOGY
#else
OLD_PHENOLOGY
#endif
#ifdef RIVER_ROUTING
DRAINAGE
#else
NO_DRAINAGE
#endif
#ifdef PERMAFROST
PERM
#else
NO_PERM
#endif
#ifdef WITH_LANDUSE
#if WITH_LANDUSE == CONST_LANDUSE
CONST_LANDUSE
#elif WITH_LANDUSE == ALL_CROPS
ALL_CROPS
#elif WITH_LANDUSE == NO_LANDUSE
NO_LANDUSE
#undef WITH_LANDUSE
#else
LANDUSE
#endif
#else
NO_LANDUSE
#endif /* WITH_LANDUSE is no longer defined, if WITH_LANDUSE NO_LANDUSE was set above */
#ifdef WITH_LANDUSE
#if defined(FIX_SDATES)
FIXED_SDATE
#elif defined(READ_SDATES)
PRESCRIBED_SDATE
#else
NO_FIXED_SDATE
#endif
IRRIGATION /* NO_IRRIGATION, LIM_IRRIGATION, POT_IRRIGATION, ALL_IRRIGATION */
#ifdef BENCHMARK_LAI
CONST_LAI_MAX
#undef WITH_LAIMAX_CFT
#else
#ifdef WITH_LAIMAX_CFT
LAIMAX_CFT /* laimax values from manage parameter file */
#else
LAIMAX_INTERPOLATE
#endif
#endif
#ifdef RIVER_ROUTING
#ifdef WITH_RESERVOIRS
RESERVOIR
#else
NO_RESERVOIR
#endif
#endif
#ifdef WITH_FIXED_GRASS_PFT
GRASS_FIXED_PFT
#else
NO_GRASS_FIXED_PFT
#endif
#endif
#if defined(WITH_WATERUSE) && defined(WITH_LANDUSE)
WATERUSE
#else
NO_WATERUSE
#endif

/*===================================================================*/
/*  II. Input parameter section                                      */
/*===================================================================*/

#include "param.conf"    /* Input parameter file */

/*===================================================================*/
/*  III. Input data section                                          */
/*===================================================================*/

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

#if defined(WITH_WATERUSE) && defined(WITH_LANDUSE)
CLM2 /p/projects/lpjml/input/historical/input_VERSION2/wateruse_1900_2000.bin /* water consumption for industry,household and livestock */
#endif

/*===================================================================*/
/*  IV. Output data section                                          */
/*===================================================================*/

#ifdef WITH_GRIDBASED
GRIDBASED
#define SUFFIX grid.bin
#else
PFTBASED
#define SUFFIX pft.bin
#endif

#ifndef FROM_RESTART

END            /* no output_SPITFIRE-optpar files */

#else

/*
ID                  Fmt filename
------------------- --- ----------------------------- */
GRID                RAW output/grid.bin
FPC                 RAW output/fpc.bin
MNPP                RAW output/mnpp.bin
MGPP                RAW output/mgpp.bin
MRH                 RAW output/mrh.bin
MFAPAR              RAW output/mfapar.bin
MTRANSP             RAW output/mtransp.bin
MRUNOFF             RAW output/mrunoff.bin
MEVAP               RAW output/mevap.bin
MINTERC             RAW output/minterc.bin
MSWC1               RAW output/mswc1.bin
MSWC2               RAW output/mswc2.bin
FIREC               RAW output/firec.bin
FIREF               RAW output/firef.bin
VEGC                RAW output/vegc.bin
SOILC               RAW output/soilc.bin
LITC                RAW output/litc.bin
FLUX_ESTAB          RAW output/flux_estab.bin
#ifdef GSI_PHENOLOGY
MPHEN_TMIN          RAW output/mphen_tmin.bin
MPHEN_TMAX          RAW output/mphen_tmax.bin
MPHEN_LIGHT         RAW output/mphen_light.bin
MPHEN_WATER         RAW output/mphen_water.bin
#endif
#ifdef WITH_SPITFIRE
MFIREC              RAW output/mfirec.bin
MNFIRE              RAW output/mnfire.bin
MBURNTAREA          RAW output/mburnt_area.bin
#endif
#ifdef RIVER_ROUTING
MDISCHARGE          RAW output/mdischarge.bin
MWATERAMOUNT        RAW output/mwateramount.bin
#endif
#ifdef WITH_LANDUSE
HARVEST             RAW output/flux_harvest.bin
SDATE               RAW output/sdate.bin
PFT_HARVEST         RAW output/pft_harvest.SUFFIX
CFTFRAC             RAW output/cftfrac.bin
SEASONALITY         RAW output/seasonality.bin
#endif
#ifdef DAILY_OUTPUT
D_NPP               RAW output/d_npp.bin
D_GPP               RAW output/d_gpp.bin
D_RH                RAW output/d_rh.bin
D_TRANS             RAW output/d_trans.bin
D_INTERC            RAW output/d_interc.bin
D_EVAP              RAW output/d_evap.bin
#endif
MPET                RAW output/mpet.bin
MALBEDO             RAW output/malbedo.bin
MAXTHAW_DEPTH       RAW output/maxthaw_depth.bin
MSOILTEMP1          RAW output/msoiltemp1.bin
MSOILTEMP2          RAW output/msoiltemp2.bin
MSOILTEMP3          RAW output/msoiltemp3.bin
SOILC_LAYER         RAW output/soilc_layer.bin
AGB                 RAW output/agb.bin
MRETURN_FLOW_B      RAW output/mreturn_flow_b.bin
MTRANSP_B           RAW output/mtransp_b.bin
MEVAP_B             RAW output/mevap_b.bin
MINTERC_B           RAW output/mintec_b.bin
ACONV_LOSS_EVAP     RAW output/aconv_loss_evap.bin
ACONV_LOSS_DRAIN    RAW output/aconv_loss_drain.bin

/*----------------- --- ------------------------------- */
END
#ifdef DAILY_OUTPUT
TEMPERATE_CEREALS  /* CFT for daily output_SPITFIRE-optpar */
DAILY_RAINFED      /* irrigation flag for daily output_SPITFIRE-optpar */
#endif
#endif

/*===================================================================*/
/*  V. Run settings section                                          */
/*===================================================================*/

ALL  /* 27410 67208 60400 all grid cells */

#ifndef FROM_RESTART

5000  /* 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 */
restart/restart_1840_nv_stdfire.lpj /* filename of restart file */
1840 /* write restart at year; exclude line in case of no restart to be written */

#else

390  /* spinup years */
/* exclude next line in case of 0 spinup years */
30 /*cycle length during spinup (yr)*/
1901 /* first year of simulation */
2011 /* last year of simulation */
RESTART /* start from restart file */
restart/restart_1840_nv_stdfire.lpj /* filename of restart file */
RESTART /* create restart file */
restart/restart_1900_crop_stdfire.lpj /* filename of restart file */
1900 /* write restart at year; exclude line in case of no restart to be written */

#endif
