config.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file config.h
  3. /// \brief Configuration header file, accessible throughout the model code.
  4. ///
  5. /// This header file contains preprocessor definitions accessible throughout the
  6. /// model code. Each implementation file (.cpp file) in LPJ-GUESS should include
  7. /// this header before anything else. Definitions should be placed here if they
  8. /// are of interest when configuring how to build LPJ-GUESS, for instance
  9. /// definitions for enabling/disabling a module, or changing a behaviour which
  10. /// for some reason isn't configurable from the instruction file.
  11. ///
  12. /// This file may also contain non-model related code for working around platform
  13. /// specific issues, such as non-standard conforming compilers.
  14. ///
  15. /// \author Joe Siltberg
  16. /// $Date: 2020-03-24 14:59:33 +0100 (mar, 24 mar 2020) $
  17. ///
  18. ///////////////////////////////////////////////////////////////////////////////////////
  19. #ifndef LPJ_GUESS_CONFIG_H
  20. #define LPJ_GUESS_CONFIG_H
  21. // Compiler specific checks, for instance for disabling specific warnings
  22. // All versions of Microsoft's compiler
  23. #ifdef _MSC_VER
  24. // 'this' : used in base member initializer list
  25. #pragma warning (disable: 4355)
  26. // long name
  27. #pragma warning (disable: 4786)
  28. #endif
  29. // min and max functions for MS Visual C++ 6.0
  30. #if defined(_MSC_VER) && _MSC_VER == 1200
  31. namespace std {
  32. template <class T> inline T max(const T& a, const T& b) {
  33. return (a > b) ? a : b;
  34. }
  35. template <class T> inline T min(const T& a, const T& b) {
  36. return (a < b) ? a : b;
  37. }
  38. }
  39. #else
  40. // modern compilers define min and max in <algorithm>
  41. #include <algorithm>
  42. #endif
  43. // ecev3 - so the model knows it's a coupled run, and when the CMIP6 forcing data (LULC & N dep.) starts
  44. const bool ECEARTH = true;
  45. const int CMIP6STARTYEAR = 1850;
  46. const int CMIP6ENDYEAR = 2100;
  47. // Whether to print monthly LAI and annual vegetation type and fraction to file in eceframework.cpp
  48. const bool printOutputToFile = true;
  49. // Whether to spinup using IFS, ERA20C/GSWP3 output in eceframework.cpp
  50. const bool ERA20CSPINUP = true; //this is also for GSWP3
  51. const bool ECEARTHWITHCRUNCEP = false;
  52. const bool PLUS200PPM = false; // CRESCENDO S3a experiment. Plus 200 ppm from year 1996
  53. const bool PLUS5SOILT = false; // CRESCENDO S3b experiment. Plus 5K soil temp from year 1996
  54. const bool PLUS50KGN = false; // CRESCENDO S3c experiment. Plus 50kg N/ha/year from year 1996
  55. const int PLUSYEAR = 1996;
  56. using std::min;
  57. using std::max;
  58. // platform independent function for changing working directory
  59. // we'll call our new function change_directory
  60. #ifdef _MSC_VER
  61. // The Microsoft way
  62. #include <direct.h>
  63. #define change_directory _chdir
  64. #else
  65. // The POSIX way
  66. #include <unistd.h>
  67. #define change_directory chdir
  68. #endif
  69. #endif // LPJ_GUESS_CONFIG_H