///////////////////////////////////////////////////////////////////////////////////////
/// \file eceframework.h
/// \brief The 'mission control' of LPJ-GUESS when coupled to EC-Earth
///
/// $Date: 2018-02-02 18:01:35 +0100 (ven, 02 fév 2018) $
///
///////////////////////////////////////////////////////////////////////////////////////

#ifndef LPJ_GUESS_ECEFRAMEWORK_H
#define LPJ_GUESS_ECEFRAMEWORK_H

class CommandLineArguments;

/// The 'mission control' of LPJ-GUESS when coupled to EC-Earth
/** 
 *  ecemain initializes LPJ-GUESS and then couples to EC-Earth via the OASIS-MCT coupler
 *
 *  \param args The command line arguments, sent in from main
 *
 */

int ecemain(const CommandLineArguments& args);

// ecev3 - local communicator, initialised by OASIS-MCT
static int localcomm; 

// ecev3 - MPI communicator gathering only component processes participating in the coupling
static int couplcomm; 


//////////////////////////////////////////////////////////////////////////////////////
// ecev3 - HELPER FUNCTIONS

// Interpolate linearly between soil temperatures in the 2nd and 3rd IFS soil layers to get 
// T25. Layer 2 centre: 17cm. Layer 3 centre: 64cm. 
float ifs_to_lpjg_soiltemp(double temp_soil_2, double temp_soil_3);

void ifs_to_lpjg_soilwater(double sm1l, double sm2l, double sm3l, double sm4l, float& lpjg_sw_upper, float& lpjg_sw_lower);


#endif // LPJ_GUESS_ECEFRAMEWORK_H
