/**************************************************************************************/
/**                                                                                \n**/
/**           l  p  j  m  l  _  n  e  t  c  d  f  .  c  o  n  f                    \n**/
/**                                                                                \n**/
/** Configuration file for LPJmL C Version 4.0.001 coupled                         \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
/*#define WITH_LAIMAX_CFT*/
#define PERMAFROST
#ifdef FROM_RESTART
#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) */
#define IRRIGATION POT_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) */ 
#endif
/*#define WITH_SPITFIRE*/
/*#define WITH_FIREWOOD*/
/*#define WITH_GRIDBASED   grid based PFT output enabled */

/*===================================================================*/
/*  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 */
RANDOM_SEED /* 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                  /* constant land use */
#elif WITH_LANDUSE == ALL_CROPS
ALL_CROPS                    /* all crops everywhere */
#else
LANDUSE                        /* land use enabled */
#endif
#if defined(FIX_SDATES)
FIXED_SDATE
#elif defined(READ_SDATES)
PRESCRIBED_SDATE
#else
NO_FIXED_SDATE
#endif
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
#else
NO_LANDUSE
#endif
#ifdef WITH_WATERUSE
WATERUSE
#else
NO_WATERUSE
#endif

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

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

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

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

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

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

#ifndef FROM_RESTART

END	            /* no output files */

#else

/*
ID                  Fmt filename
------------------- --- ----------------------------- */
FPC                 CDF output/fpc.nc
MNPP                CDF output/mnpp.nc
MGPP                CDF output/mgpp.nc
MRH                 CDF output/mrh.nc
MFPAR               CDF output/mfpar.nc
MTRANSP             CDF output/mtransp.nc
MRUNOFF             CDF output/mrunoff.nc
MEVAP               CDF output/mevap.nc
MINTERC             CDF output/minterc.nc
MSWC1               CDF output/mswc1.nc
MSWC2               CDF output/mswc2.nc
FIREC               CDF output/firec.nc
FIREF               CDF output/firef.nc
VEGC                CDF output/vegc.nc
SOILC               CDF output/soilc.nc
LITC                CDF output/litc.nc
FLUX_ESTAB          CDF output/flux_estab.nc
#ifdef WITH_SPITFIRE
MFIREC              CDF output/mfirec.nc
MNFIRE              CDF output/mnfire.nc
MBURNTAREA          CDF output/mburnt_area.nc
#endif
#ifdef RIVER_ROUTING
MDISCHARGE          CDF output/mdischarge.nc
#endif
#ifdef WITH_LANDUSE
HARVEST             CDF output/flux_harvest.nc
SDATE               CDF output/sdate.nc
PFT_HARVEST         CDF output/pft_harvest.SUFFIX
CFTFRAC             CDF output/cftfrac.nc
#endif
/*----------------- --- ------------------------------- */
END
#ifdef DAILY_OUTPUT
TEMPERATE_CEREALS  /* CFT for daily output */
DAILY_RAINFED      /* irrigation flag for daily output */
#endif
#endif

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

ALL /* 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_1900_natural.lpj /* filename of restart file */
1900 /* 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 */
2009 /* last year of simulation */
RESTART /* start from restart file */
restart/restart_1900_natural.lpj /* filename of restart file */
NO_RESTART /* do not create  restart file */

#endif
