OasisCoupler.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. #include <iostream>
  2. #include "config.h"
  3. #include "shell.h"
  4. #include "oasis-cpp-interface.h"
  5. #include "OasisCoupler.h"
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. using namespace std;
  9. char OasisCoupler::modelName[] = "lpjg";
  10. // *** Received FROM IFS ***
  11. // 1
  12. char OasisCoupler::fieldTempName[] = "T2M_LPJG";
  13. int OasisCoupler::fieldTempId = 0;
  14. // 2
  15. char OasisCoupler::fieldPrecipName[] = "TPRE_LPJ";
  16. int OasisCoupler::fieldPrecipId = 0;
  17. // 3
  18. char OasisCoupler::fieldSnowCName[] = "SNOC_LPJ";
  19. int OasisCoupler::fieldSnowCId = 0;
  20. // 4
  21. char OasisCoupler::fieldSnowDName[] = "SNOD_LPJ";
  22. int OasisCoupler::fieldSnowDId = 0;
  23. // 5
  24. char OasisCoupler::fieldST1LName[] = "ST1L_LPJ";
  25. int OasisCoupler::fieldST1LId = 0;
  26. // 6
  27. char OasisCoupler::fieldST2LName[] = "ST2L_LPJ";
  28. int OasisCoupler::fieldST2LId = 0;
  29. // 7
  30. char OasisCoupler::fieldST3LName[] = "ST3L_LPJ";
  31. int OasisCoupler::fieldST3LId = 0;
  32. // 8
  33. char OasisCoupler::fieldST4LName[] = "ST4L_LPJ";
  34. int OasisCoupler::fieldST4LId = 0;
  35. // 9
  36. char OasisCoupler::fieldSM1LName[] = "SM1L_LPJ";
  37. int OasisCoupler::fieldSM1LId = 0;
  38. // 10
  39. char OasisCoupler::fieldSM2LName[] = "SM2L_LPJ";
  40. int OasisCoupler::fieldSM2LId = 0;
  41. // 11
  42. char OasisCoupler::fieldSM3LName[] = "SM3L_LPJ";
  43. int OasisCoupler::fieldSM3LId = 0;
  44. // 12
  45. char OasisCoupler::fieldSM4LName[] = "SM4L_LPJ";
  46. int OasisCoupler::fieldSM4LId = 0;
  47. // 13
  48. char OasisCoupler::fieldSWRadName[] = "SWNR_LPJ";
  49. int OasisCoupler::fieldSWRadId = 0;
  50. // 14
  51. char OasisCoupler::fieldLWRadName[] = "LWNR_LPJ";
  52. int OasisCoupler::fieldLWRadId = 0;
  53. // *** Send TO IFS ***
  54. // 16
  55. char OasisCoupler::fieldLowlaiName[] = "GUE_LLAI";
  56. int OasisCoupler::fieldLowlaiId = 0;
  57. // 17
  58. char OasisCoupler::fieldHighlaiName[] = "GUE_HLAI";
  59. int OasisCoupler::fieldHighlaiId = 0;
  60. // 18
  61. char OasisCoupler::fieldTypeHName[] = "GUE_TYPH";
  62. int OasisCoupler::fieldTypeHId = 0;
  63. // 19
  64. char OasisCoupler::fieldFracHName[] = "GUE_FRAH";
  65. int OasisCoupler::fieldFracHId = 0;
  66. // 20
  67. char OasisCoupler::fieldTypeLName[] = "GUE_TYPL";
  68. int OasisCoupler::fieldTypeLId = 0;
  69. // 21
  70. char OasisCoupler::fieldFracLName[] = "GUE_FRAL";
  71. int OasisCoupler::fieldFracLId = 0;
  72. // *** Received FROM TM5 ***
  73. // 22
  74. char OasisCoupler::fieldCO2Name[] = "CO2_LPJG";
  75. int OasisCoupler::fieldCO2Id = 0;
  76. // *** Sent TO TM5 ***
  77. // 23
  78. char OasisCoupler::fieldCfluxNatName[] = "GUE_CNAT";
  79. int OasisCoupler::fieldCfluxNatId = 0;
  80. // 24
  81. char OasisCoupler::fieldCfluxAntName[] = "GUE_CANT";
  82. int OasisCoupler::fieldCfluxAntId = 0;
  83. // 25
  84. char OasisCoupler::fieldNPPName[] = "GUE_CNPP";
  85. int OasisCoupler::fieldNPPId = 0;
  86. // ecev3 - returns localcomm
  87. int OasisCoupler::init(int &localcomm)
  88. {
  89. int ierror;
  90. int componentId = -99;
  91. dprintf("OasisCoupler::init init_comp \n");
  92. ierror = OASISMCT::init_comp(&componentId,modelName);
  93. if (ierror != OASISMCT::OASIS_Ok) {
  94. dprintf("OasisCoupler::init init_comp ERROR!!\n");
  95. return ierror;
  96. }
  97. // ecev3 - for internal parallelisation
  98. int localCommId = -99;
  99. ierror = OASISMCT::get_localcomm(localCommId);
  100. if (ierror != OASISMCT::OASIS_Ok) {
  101. dprintf("OasisCoupler::get_localcomm ERROR - %i\n", ierror);
  102. OASISMCT::terminate();
  103. return ierror;
  104. }
  105. // Save the local comm index
  106. localcomm = localCommId;
  107. return OASISMCT::OASIS_Ok;
  108. };
  109. // ecev3 - returns couplcomm
  110. int OasisCoupler::create_couplcomm(int myrank, int lcomm, int& ccomm) {
  111. int ierror;
  112. dprintf("OasisCoupler::create_couplcomm \n");
  113. int cplcomm = -99;
  114. ierror = OASISMCT::create_couplcomm(myrank, lcomm, &cplcomm);
  115. if ( ierror != OASISMCT::OASIS_Ok )
  116. return ierror;
  117. else
  118. ccomm = cplcomm;
  119. return OASISMCT::OASIS_Ok;
  120. };
  121. // ecev3
  122. int OasisCoupler::init_part_defvar(int nx, int ny, bool TM5coupled, int rank) {
  123. int ierror;
  124. int partitionId = -99;
  125. int partitionDescr[] = {0,0,nx*ny};
  126. // ecev3 - see OASIS-MCT documentation
  127. if (rank != 0)
  128. partitionDescr[2] = 0;
  129. dprintf("OasisCoupler::init_part_defvar def_partition for rank %i\n", rank);
  130. ierror = OASISMCT::def_partition(&partitionId,partitionDescr,3);
  131. // Bug in OASISMCT: def_partition doesn't return a valid return value
  132. if ( ierror != OASISMCT::OASIS_Ok ) {
  133. dprintf("OasisCoupler::init_part_defvar: def_partition returned %i\n", ierror);
  134. return ierror;
  135. }
  136. dprintf("OasisCoupler::init_part_defvar: rank %i partitionId is %i\n", rank, partitionId);
  137. int varNumDims[] = {2,1};
  138. int varShape[] = {1,nx,1,ny};
  139. dprintf("OasisCoupler::init_part_defvar def_var statements for rank %i \n", rank);
  140. // *** Received FROM IFS (Currently 14) ***
  141. ierror = OASISMCT::def_var(&fieldTempId,fieldTempName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  142. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  143. ierror = OASISMCT::def_var(&fieldPrecipId,fieldPrecipName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  144. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  145. ierror = OASISMCT::def_var(&fieldSnowCId,fieldSnowCName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  146. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  147. ierror = OASISMCT::def_var(&fieldSnowDId,fieldSnowDName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  148. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  149. ierror = OASISMCT::def_var(&fieldST1LId,fieldST1LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  150. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  151. ierror = OASISMCT::def_var(&fieldST2LId,fieldST2LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  152. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  153. ierror = OASISMCT::def_var(&fieldST3LId,fieldST3LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  154. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  155. ierror = OASISMCT::def_var(&fieldST4LId,fieldST4LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  156. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  157. ierror = OASISMCT::def_var(&fieldSM1LId,fieldSM1LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  158. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  159. ierror = OASISMCT::def_var(&fieldSM2LId,fieldSM2LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  160. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  161. ierror = OASISMCT::def_var(&fieldSM3LId,fieldSM3LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  162. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  163. ierror = OASISMCT::def_var(&fieldSM4LId,fieldSM4LName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  164. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  165. ierror = OASISMCT::def_var(&fieldSWRadId,fieldSWRadName,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  166. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  167. ierror = OASISMCT::def_var(&fieldLWRadId,fieldLWRadName,partitionId,varNumDims,OASISMCT::OASIS_In, varShape, OASISMCT::OASIS_Real);
  168. if (ierror != OASISMCT::OASIS_Ok) return ierror;
  169. // *** Sent TO IFS (Currently 6) ***
  170. ierror = OASISMCT::def_var(&fieldLowlaiId,fieldLowlaiName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  171. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  172. ierror = OASISMCT::def_var(&fieldHighlaiId,fieldHighlaiName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  173. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  174. ierror = OASISMCT::def_var(&fieldTypeHId,fieldTypeHName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  175. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  176. ierror = OASISMCT::def_var(&fieldFracHId,fieldFracHName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  177. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  178. ierror = OASISMCT::def_var(&fieldTypeLId,fieldTypeLName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  179. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  180. ierror = OASISMCT::def_var(&fieldFracLId,fieldFracLName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  181. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  182. // *** TM5 Coupling (Currently 4 fields) ***
  183. if (TM5coupled) {
  184. dprintf("OasisCoupler::init_part_defvar - initialising TM5 coupling\n");
  185. // FROM TM5
  186. ierror = OASISMCT::def_var(&fieldCO2Id,fieldCO2Name,partitionId,varNumDims,OASISMCT::OASIS_In,varShape,OASISMCT::OASIS_Real);
  187. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  188. // TO TM5
  189. ierror = OASISMCT::def_var(&fieldCfluxNatId,fieldCfluxNatName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  190. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  191. // TO TM5
  192. ierror = OASISMCT::def_var(&fieldCfluxAntId,fieldCfluxAntName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  193. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  194. // TO TM5
  195. ierror = OASISMCT::def_var(&fieldNPPId,fieldNPPName,partitionId,varNumDims,OASISMCT::OASIS_Out,varShape,OASISMCT::OASIS_Real);
  196. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  197. }
  198. dprintf("OasisCoupler::init_part_defvar - calling OASISMCT::enddef on rank %i\n",rank);
  199. ierror = OASISMCT::enddef();
  200. dprintf("OasisCoupler::init_part_defvar - OASISMCT::enddef returned ierror %i on rank %i\n",ierror, rank);
  201. if (ierror != OASISMCT::OASIS_Ok) return ierror;
  202. return OASISMCT::OASIS_Ok;
  203. };
  204. int OasisCoupler::abort(int compid, std::string routine_name, std::string abort_message, int return_code)
  205. {
  206. //dprintf("OasisCoupler::abort %s\n",(char)abort_message);
  207. int ierror = OASISMCT::abort(compid, routine_name, abort_message, return_code);
  208. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  209. return 0;
  210. };
  211. int OasisCoupler::finalize(void)
  212. {
  213. dprintf("OasisCoupler::finalize\n");
  214. int ierror = OASISMCT::terminate();
  215. if ( ierror != OASISMCT::OASIS_Ok ) return ierror;
  216. return 0;
  217. };
  218. // Up to 18 fields (17 from IFS + 1 from TM5 if TM5coupled == true)
  219. int OasisCoupler::couple_get(int time, int nx, int ny, bool TM5coupled, double * fieldTempData, double * fieldPrecipData,
  220. double * fieldSnowCData, double * fieldSnowDData,
  221. double * fieldST1LData, double * fieldST2LData, double * fieldST3LData, double * fieldST4LData,
  222. double * fieldSM1LData, double * fieldSM2LData, double * fieldSM3LData, double * fieldSM4LData,
  223. double * fieldSWRadData, double * fieldLWRadData, double * fieldCO2Data) {
  224. int ierror = 0;
  225. try {
  226. // printf(" OasisCoupler::couple_get -- for time %i\n",time);
  227. ierror = OASISMCT::get_2d(OasisCoupler::fieldTempId,time,fieldTempData,nx,ny);
  228. // printf(" OasisCoupler::couple_get -- got T2m\n");
  229. }
  230. catch(...) {
  231. switch (ierror)
  232. {
  233. case OASISMCT::OASIS_Recvd:
  234. dprintf(" T2M received from other model: %i \n", ierror);
  235. break;
  236. case OASISMCT::OASIS_FromRest:
  237. dprintf(" Read from restart file only: %i \n", ierror);
  238. break;
  239. case OASISMCT::OASIS_Input:
  240. dprintf(" Read from input file only: %i \n", ierror);
  241. break;
  242. case OASISMCT::OASIS_RecvOut:
  243. dprintf(" Received from other model and written to an output file: %i \n", ierror);
  244. break;
  245. case OASISMCT::OASIS_FromRestOut:
  246. dprintf(" Read from restart file and written to output file: %i \n", ierror);
  247. break;
  248. case OASISMCT::OASIS_Ok:
  249. dprintf(" OASIS_Ok, no error. T2M received OK, continue: %i \n", ierror);
  250. break;
  251. default:
  252. dprintf(" OasisCoupler::couple_get - unknown ierror reported from OASIS_GET: %i \n", ierror);
  253. break;
  254. }
  255. }
  256. ierror = OASISMCT::get_2d(OasisCoupler::fieldSWRadId, time, fieldSWRadData, nx, ny);
  257. //printf(" OasisCoupler::couple -- got Rad\n");
  258. ierror = OASISMCT::get_2d(OasisCoupler::fieldLWRadId, time, fieldLWRadData, nx, ny);
  259. //printf(" OasisCoupler::couple -- got Rad\n");
  260. ierror = OASISMCT::get_2d(OasisCoupler::fieldSM1LId,time,fieldSM1LData,nx,ny);
  261. // printf(" OasisCoupler::couple -- got SM1\n");
  262. ierror = OASISMCT::get_2d(OasisCoupler::fieldSM2LId,time,fieldSM2LData,nx,ny);
  263. // printf(" OasisCoupler::couple -- got SM2\n");
  264. ierror = OASISMCT::get_2d(OasisCoupler::fieldSM3LId,time,fieldSM3LData,nx,ny);
  265. // printf(" OasisCoupler::couple -- got SM3\n");
  266. ierror = OASISMCT::get_2d(OasisCoupler::fieldSM4LId,time,fieldSM4LData,nx,ny);
  267. // printf(" OasisCoupler::couple -- got SM4\n");
  268. ierror = OASISMCT::get_2d(OasisCoupler::fieldST1LId,time,fieldST1LData,nx,ny);
  269. // printf(" OasisCoupler::couple -- got ST1\n");
  270. ierror = OASISMCT::get_2d(OasisCoupler::fieldST2LId,time,fieldST2LData,nx,ny);
  271. // printf(" OasisCoupler::couple -- got ST2\n");
  272. ierror = OASISMCT::get_2d(OasisCoupler::fieldST3LId,time,fieldST3LData,nx,ny);
  273. // printf(" OasisCoupler::couple -- got ST3\n");
  274. ierror = OASISMCT::get_2d(OasisCoupler::fieldST4LId,time,fieldST4LData,nx,ny);
  275. // printf(" OasisCoupler::couple -- got ST4\n");
  276. ierror = OASISMCT::get_2d(OasisCoupler::fieldSnowCId,time,fieldSnowCData,nx,ny);
  277. //printf(" OasisCoupler::couple -- got SnowC\n");
  278. ierror = OASISMCT::get_2d(OasisCoupler::fieldSnowDId,time,fieldSnowDData,nx,ny);
  279. // printf(" OasisCoupler::couple -- got SnowD\n");
  280. ierror = OASISMCT::get_2d(OasisCoupler::fieldPrecipId,time,fieldPrecipData,nx,ny);
  281. // printf(" OasisCoupler::couple -- got Prec\n");
  282. // ecev3 - only receive CO2 fields from TM5 if we're coupled
  283. if (TM5coupled) {
  284. ierror = OASISMCT::get_2d(OasisCoupler::fieldCO2Id,time,fieldCO2Data,nx,ny);
  285. dprintf(" OasisCoupler::couple -- got CO2 -- cell 5000 value is %f\n",fieldCO2Data[5000]);
  286. }
  287. return 0;
  288. };
  289. // Up to 8 fields (6 to IFS + 2 to TM5 if TM5coupled == true)
  290. int OasisCoupler::couple_put(int time, int nx, int ny, bool TM5coupled, double * fieldLowlaiData, double * fieldHighlaiData,
  291. double * fieldLPJGtypeHData, double * fieldLPJGfracHData,
  292. double * fieldLPJGtypeLData, double * fieldLPJGfracLData,
  293. double * fieldLPJGCfluxNatData, double * fieldLPJGCfluxAntData,
  294. double * fieldLPJGNPPData) {
  295. int ierror = 0;
  296. try {
  297. // printf(" OasisCoupler::couple_put -- for time %i\n",time);
  298. ierror = OASISMCT::put_2d(OasisCoupler::fieldLowlaiId,time,fieldLowlaiData,nx,ny);
  299. }
  300. catch (...) {
  301. switch (ierror)
  302. {
  303. case OASISMCT::OASIS_Sent:
  304. dprintf(" LLAI field sent to the other model: %i \n",ierror);
  305. break;
  306. case OASISMCT::OASIS_LocTrans:
  307. dprintf(" OASIS_LocTrans: %i \n",ierror);
  308. break;
  309. case OASISMCT::OASIS_Output:
  310. dprintf(" Output file only: %i \n",ierror);
  311. break;
  312. case OASISMCT::OASIS_ToRest:
  313. dprintf(" Written to restart file only: %i \n",ierror);
  314. break;
  315. case OASISMCT::OASIS_ToRestOut:
  316. dprintf(" Written to restart file and written to output file: %i \n",ierror);
  317. break;
  318. case OASISMCT::OASIS_SentOut:
  319. dprintf(" OASIS_SentOut: %i \n",ierror);
  320. break;
  321. case OASISMCT::OASIS_Ok:
  322. dprintf(" OASIS_Ok, LLAI sent, no error: %i - continue\n",ierror);
  323. break;
  324. default:
  325. dprintf(" OasisCoupler::couple_put - unknown ierror %i reported from OASIS_PUT for field %i \n",ierror,OasisCoupler::fieldLowlaiId);
  326. break;
  327. }
  328. }
  329. // ecev3 - always send fields to IFS
  330. ierror = OASISMCT::put_2d(OasisCoupler::fieldHighlaiId,time,fieldHighlaiData,nx,ny);
  331. if (ierror != OASISMCT::OASIS_Ok)
  332. dprintf(" OasisCoupler::couple_put HLAI - ierror: %i\n",ierror);
  333. ierror = OASISMCT::put_2d(OasisCoupler::fieldTypeHId,time,fieldLPJGtypeHData,nx,ny);
  334. if (ierror != OASISMCT::OASIS_Ok)
  335. dprintf(" OasisCoupler::couple_put TYPH - ierror: %i\n",ierror);
  336. ierror = OASISMCT::put_2d(OasisCoupler::fieldFracHId,time,fieldLPJGfracHData,nx,ny);
  337. if (ierror != OASISMCT::OASIS_Ok)
  338. dprintf(" OasisCoupler::couple_put FRACH - ierror: %i\n",ierror);
  339. ierror = OASISMCT::put_2d(OasisCoupler::fieldTypeLId,time,fieldLPJGtypeLData,nx,ny);
  340. if (ierror != OASISMCT::OASIS_Ok)
  341. dprintf(" OasisCoupler::couple_put TYPL - ierror: %i\n",ierror);
  342. ierror = OASISMCT::put_2d(OasisCoupler::fieldFracLId,time,fieldLPJGfracLData,nx,ny);
  343. if (ierror != OASISMCT::OASIS_Ok)
  344. dprintf(" OasisCoupler::couple_put FRACL - ierror: %i\n",ierror);
  345. // ecev3 - only send CO2 fluxes to TM5 if we are coupled
  346. if (TM5coupled) {
  347. ierror = OASISMCT::put_2d(OasisCoupler::fieldCfluxNatId,time,fieldLPJGCfluxNatData,nx,ny);
  348. if (ierror != OASISMCT::OASIS_Ok)
  349. dprintf(" OasisCoupler::couple_put CFLUXNAT - ierror: %i\n",ierror);
  350. ierror = OASISMCT::put_2d(OasisCoupler::fieldCfluxAntId,time,fieldLPJGCfluxAntData,nx,ny);
  351. if (ierror != OASISMCT::OASIS_Ok)
  352. dprintf(" OasisCoupler::couple_put CFLUXANT - ierror: %i\n",ierror);
  353. ierror = OASISMCT::put_2d(OasisCoupler::fieldNPPId,time,fieldLPJGNPPData,nx,ny);
  354. if (ierror != OASISMCT::OASIS_Ok)
  355. dprintf(" OasisCoupler::couple_put NPP - ierror: %i\n",ierror);
  356. }
  357. return 0;
  358. };