/**************************************************************************************/
/**                                                                                \n**/
/**           l  p  j  m  l  _  i  m  a  g  e  .  c  o  n  f                       \n**/
/**                                                                                \n**/
/** Configuration file for LPJmL C Version 4.0.001 coupled to IMAGE                \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 WITH_LAIMAX_CFT
/*#define WITH_GRIDBASED*/  /* grid based PFT output enabled */
#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 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) */ 

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

"LPJmL-IMAGE run" /* Simulation description */
LPJML_IMAGE       /* Simulation type with managed land and IMAGE coupling */
#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
#else
NO_FIREWOOD
#endif
#if defined(WITH_SPITFIRE) || defined(WITH_FIREWOOD)
POPULATION
#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 */
#else
LANDUSE                        /* land use enabled */
#endif
NO_FIXED_SDATE
IRRIGATION
#ifdef WITH_LAIMAX_CFT
LAIMAX_CFT /* laimax values from manage parameter file */
#else
LAIMAX_INTERPOLATE
#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.conf"    /* Input files of CRU dataset */
CLM /data/biosx/LPJ/input_new/temp_var.clm
CLM /data/biosx/LPJ/input_new/prec_var.clm
CLM /data/biosx/LPJ/input_new/prodinit.clm

#ifdef WITH_WATERUSE
CLM /data/biosx/LPJ/input_new/wateruse1901_2003.bin /* water consumption for industry,
                               household and livestock */
#endif

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

#ifdef WITH_GRIDBASED
GRIDBASED
#else
PFTBASED
#endif

#ifndef FROM_RESTART

END            /* no output files */

#else

/*
ID                  fmt filename
------------------- --- -------------------------------------------------*/
GRID                RAW output/grid.bin
FPC                 RAW output/fpc.bin
MNPP                RAW output/mnpp.bin
MRH                 RAW output/mrh.bin
MTRANSP             RAW output/mtransp.bin
MRUNOFF             RAW output/mrunoff.bin
MDISCHARGE          RAW output/mdischarge.bin
MEVAP               RAW output/mevap.bin
MINTERC             RAW output/minterc.bin
MSWC1               RAW output/mswc1.bin
MSWC2               RAW output/mswc2.bin
MIRRIG              RAW output/mirrig.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
PFT_GCGP            RAW output/waterstress.bin
#ifdef WITH_GRIDBASED
PFT_NPP             RAW output/pft_npp.grid.bin
#else
PFT_NPP             RAW output/pft_npp.pft.bin
#endif
#ifdef WITH_LANDUSE
FLUX_ESTAB          RAW output/flux_estab.bin
HARVEST             RAW output/flux_harvest.bin
SDATE               RAW output/sdate.bin
#ifdef WITH_GRIDBASED
PFT_HARVEST         RAW output/pft_harvest.grid.bin
PFT_RHARVEST        RAW output/pft_rharvest.grid.bin
#else
PFT_HARVEST         RAW output/pft_harvest.pft.bin
PFT_RHARVEST        RAW output/pft_rharvest.pft.bin
#endif
CFTFRAC             RAW output/cftfrac.bin
CFT_CONSUMP_WATER_G RAW output/cft_consump_water_g.bin
CFT_CONSUMP_WATER_B RAW output/cft_consump_water_b.bin
MRETURN_FLOW_B      RAW output/mreturn_flow_b.bin
#endif
APREC               RAW output/aprec.bin
#ifdef RIVER_ROUTING
INPUT_LAKE          RAW output/input_lake.bin
MEVAP_LAKE          RAW output/mevap_lake.bin
ADISCHARGE          RAW output/adischarge.bin
#endif
PROD_TURNOVER       RAW output/prod_turnover.bin
DEFOREST_EMIS       RAW output/deforest_emis.bin
#ifdef DAILY_OUTPUT
D_LAI               RAW output/d_lai.bin
D_PHEN              RAW output/d_phen.bin
D_CLEAF             RAW output/d_cleaf.bin
D_CROOT             RAW output/d_croot.bin
D_CSO               RAW output/d_cso.bin
D_CPOOL             RAW output/d_cpool.bin
D_WDF               RAW output/d_wdf.bin
D_GROWINGDAY        RAW output/d_growingday.bin
D_PVD               RAW output/d_pvd.bin
D_PHU               RAW output/d_phu.bin
D_FPHU              RAW output/d_fphu.bin
D_LAIMAXAD          RAW output/d_laimax_adjusted.bin
D_LAINPPDEF         RAW output/d_laimaxnppdeficit.bin
D_HUSUM             RAW output/d_husum.bin
D_VDSUM             RAW output/d_vdsum.bin
D_WSCAL             RAW output/d_wscal.bin
D_NPP               RAW output/d_npp.bin
D_GPP               RAW output/d_gpp.bin
D_RD                RAW output/d_rd.bin
D_RROOT             RAW output/d_rroot.bin
D_RSO               RAW output/d_rso.bin
D_RPOOL             RAW output/d_rpool.bin
D_GRESP             RAW output/d_gresp.bin
D_TRANS             RAW output/d_trans.bin
D_EVAP              RAW output/d_evap.bin
D_PREC              RAW output/d_prec.bin
D_PERC              RAW output/d_perc.bin
D_IRRIG             RAW output/d_irrig.bin
D_W0                RAW output/d_w0.bin
D_W1                RAW output/d_w1.bin
D_WEVAP             RAW output/d_wevap.bin
D_HI                RAW output/d_hi.bin
D_FHIOPT            RAW output/d_fhiopt.bin
D_HIMIND            RAW output/d_himind.bin
D_FROOT             RAW output/d_froot.bin
D_TEMP              RAW output/d_temp.bin
D_SUN               RAW output/d_sun.bin
D_PAR               RAW output/d_par.bin
D_PET               RAW output/d_pet.bin
#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

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 */
2000 /* Start of IMAGE coupling */
NO_RESTART /* do not start from restart file */
RESTART /* create restart file */
restart/restart.lpj /* filename of restart file */
1900 /* write restart at year; exclude line in case of no restart to
        be written */

#else

0    /* no spinup years */
/* exclude next line in case of 0 spinup years */
/*30    cycle length during spinup (yr) */
1901 /* first year of simulation */
2003 /* last year of simulation */
2000 /* Start of IMAGE coupling */
RESTART /* start from restart file */
restart/restart.lpj /* filename of restart file */
RESTART /* create restart file */
restart/restart_final.lpj /* filename of restart file */
2000 /* write restart at year; exclude line in case of no restart to
        be written */

#endif
