diff --git a/data-raw/input_params.csv b/data-raw/input_params.csv index 26bfd6354..c32367e32 100644 --- a/data-raw/input_params.csv +++ b/data-raw/input_params.csv @@ -13,7 +13,6 @@ ocean,twi,n,n,y,1.25E+07,m3 s-1,Ocean warm-intermediate exchange ocean,tid,n,n,y,2.00E+08,m3 s-1,Ocean intermediate-deep exchange ocean,preind_surface_c,n,n,n,900,Pg C,Initial surface ocean carbon ocean,preind_interdeep_c,n,n,n,37100,Pg C,Initial intermediate + deep ocean carbon -simpleNbox,atmos_co2,n,n,y,588.071,Pg C,Initial atmospheric CO2 simpleNbox,C0,n,n,y,277.15,Pg C,Initial atmospheric C pool simpleNbox,pf.veg_c,y,n,n,55,Pg C,Initial vegetation C pool simpleNbox,nonpf.veg_c,y,n,n,495,Pg C,Initial vegetation C pool diff --git a/data/inputstable.rda b/data/inputstable.rda index c7df81fca..454460aca 100644 Binary files a/data/inputstable.rda and b/data/inputstable.rda differ diff --git a/inst/include/csv_table_reader.hpp b/inst/include/csv_table_reader.hpp index b21d89aa5..786495599 100644 --- a/inst/include/csv_table_reader.hpp +++ b/inst/include/csv_table_reader.hpp @@ -56,8 +56,11 @@ class CSVTableReader { //! Current line (that has just been read) int lineNum; - // Helper function to find next non-commented line + //! Helper function to find next non-commented line std::string csv_getline(); + + //! Helper function that reads the header row and returns all column names as a vector + std::vector read_header(); }; } // namespace Hector diff --git a/inst/input/hector_picontrol.ini b/inst/input/hector_picontrol.ini index f43df54d6..11dd564cb 100644 --- a/inst/input/hector_picontrol.ini +++ b/inst/input/hector_picontrol.ini @@ -33,7 +33,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6, CO2 radiative forcing question is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 diff --git a/inst/input/hector_ssp119.ini b/inst/input/hector_ssp119.ini index 38124d6c5..b5db9cad3 100644 --- a/inst/input/hector_ssp119.ini +++ b/inst/input/hector_ssp119.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp126.ini b/inst/input/hector_ssp126.ini index 417a3a6d2..2ded73eb6 100644 --- a/inst/input/hector_ssp126.ini +++ b/inst/input/hector_ssp126.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp245.ini b/inst/input/hector_ssp245.ini index 2bd7259af..2f170eb22 100644 --- a/inst/input/hector_ssp245.ini +++ b/inst/input/hector_ssp245.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp370.ini b/inst/input/hector_ssp370.ini index 2a0782ba3..8df3619ee 100644 --- a/inst/input/hector_ssp370.ini +++ b/inst/input/hector_ssp370.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp434.ini b/inst/input/hector_ssp434.ini index f4fecdf68..dcb3c17a6 100644 --- a/inst/input/hector_ssp434.ini +++ b/inst/input/hector_ssp434.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp460.ini b/inst/input/hector_ssp460.ini index ff0e1ff53..8ffc4ff48 100644 --- a/inst/input/hector_ssp460.ini +++ b/inst/input/hector_ssp460.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp534-over.ini b/inst/input/hector_ssp534-over.ini index a969ad43e..674b1362d 100644 --- a/inst/input/hector_ssp534-over.ini +++ b/inst/input/hector_ssp534-over.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/inst/input/hector_ssp585.ini b/inst/input/hector_ssp585.ini index 75a27fc14..289113367 100644 --- a/inst/input/hector_ssp585.ini +++ b/inst/input/hector_ssp585.ini @@ -34,7 +34,6 @@ preind_interdeep_c=37100 ; intermediate and deep ocean C, IPCC AR6 Figure 5.12 ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=590.33 ; initial atmospheric carbon pool Pg C of CO2 size used in spin up, consistent with C0 C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6; CO2 radiative forcing is calibrated to this value npp_flux0=56.2 ; preindustrial net primary production, Pg C/yr from Ito et al. 2011 ;pf.npp_flux0=5.6 ; cf. Figure 3 in Chen et al. 2017 10.1088/1748-9326/aa8978 @@ -180,7 +179,7 @@ RF_misc[1750]=0 ;------------------------------------------------------------------------ [temperature] S=3.0 ; equilibrium climate sensitivity for 2xCO2 degC (A.4.4 of IPCC AR6) -diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details +diff=1.042 ; ocean heat diffusivity, cm2/s calibrated to historical observations see PR 789 for details qco2=3.75 ; 2×CO2 RF (7.3.2 of IPCC AR6) ; Optional global temperature constraint diff --git a/scripts/leeyabot.Rmd b/scripts/leeyabot.Rmd index dd617380a..1ad9addbb 100644 --- a/scripts/leeyabot.Rmd +++ b/scripts/leeyabot.Rmd @@ -140,14 +140,14 @@ oldnew_commit <- unique(oldnew_data$commit) # Read in the comparison data associated with the official releases minted on Zenodo -read.csv("https://zenodo.org/records/13286176/files/leeyabot-data.csv?download=1") %>% +read.csv("https://zenodo.org/records/17458844/files/leeyabot-data.csv?download=1") %>% filter(variable %in% vars) -> zenodo_data #TODO eventually we will probably need the ability to determine what the most recent # release version is since the zenodo archive might include results from multiple zenodo_data %>% - filter(version == "3.2.0") -> + filter(version == "3.5.0") -> release_data # Save oldnew version and commit tag diff --git a/src/csv_outputstream_visitor.cpp b/src/csv_outputstream_visitor.cpp index 25d05afdd..b4ef32ba9 100644 --- a/src/csv_outputstream_visitor.cpp +++ b/src/csv_outputstream_visitor.cpp @@ -74,6 +74,7 @@ CSVOutputStreamVisitor::CSVOutputStreamVisitor(ostream &outputStream, current_date = 0; datestring = ""; spinupstring = ""; + csvFile.precision(15); } //------------------------------------------------------------------------------ @@ -109,18 +110,6 @@ void CSVOutputStreamVisitor::visit(Core *c) { core = c; } -// TODO: consolidate these macros into the two MESSAGE ones, -// and shift string literals to D_xxxx definitions - -// Macro to send a variable with associated unitval units to some output stream -// Takes s (stream), c (component), xname (variable name), x (output variable) -#define STREAM_UNITVAL(s, c, xname, x) \ - { \ - s << linestamp() << c->getComponentName() << DELIMITER << xname \ - << DELIMITER << x.value(x.units()) << DELIMITER << x.unitsName() \ - << std::endl; \ - } - // Macro to send a variable with associated unitval units to some output stream // This uses new sendMessage interface in imodel_component // Takes s (stream), c (component), xname (variable name) @@ -146,7 +135,6 @@ void CSVOutputStreamVisitor::visit(Core *c) { void CSVOutputStreamVisitor::visit(ForcingComponent *c) { if (!core->outputEnabled(c->getComponentName())) return; - streamsize oldPrecision = csvFile.precision(4); if (c->currentYear < c->baseyear) return; @@ -155,10 +143,9 @@ void CSVOutputStreamVisitor::visit(ForcingComponent *c) { // Walk through the forcings map, outputting everything for (auto f : forcings) { - STREAM_UNITVAL(csvFile, c, f.first, f.second); + STREAM_MESSAGE_DATE(csvFile, c, f.first, current_date); } - csvFile.precision(oldPrecision); } //------------------------------------------------------------------------------ @@ -171,11 +158,11 @@ void CSVOutputStreamVisitor::visit(SimpleNbox *c) { // Note if there are multiple biomes, these values will be totals, summed // across all biomes STREAM_MESSAGE(csvFile, c, D_NBP); - STREAM_UNITVAL(csvFile, c, D_NPP, c->final_npp[SNBOX_DEFAULT_BIOME]); - STREAM_UNITVAL(csvFile, c, D_RH, c->final_rh[SNBOX_DEFAULT_BIOME]); - STREAM_UNITVAL(csvFile, c, D_RH_DETRITUS, c->final_rh_detritus[SNBOX_DEFAULT_BIOME]); - STREAM_UNITVAL(csvFile, c, D_RH_SOIL, c->final_rh_soil[SNBOX_DEFAULT_BIOME]); - STREAM_UNITVAL(csvFile, c, D_RH_CH4, c->final_rh[SNBOX_DEFAULT_BIOME]); + STREAM_MESSAGE(csvFile, c, D_NPP); + STREAM_MESSAGE(csvFile, c, D_RH); + STREAM_MESSAGE(csvFile, c, D_RH_DETRITUS); + STREAM_MESSAGE(csvFile, c, D_RH_SOIL); + STREAM_MESSAGE(csvFile, c, D_RH_CH4); STREAM_MESSAGE_DATE(csvFile, c, D_CO2_CONC, current_date); STREAM_MESSAGE(csvFile, c, D_ATMOSPHERIC_CO2); STREAM_MESSAGE(csvFile, c, D_ATMOSPHERIC_C_RESIDUAL); @@ -192,28 +179,17 @@ void CSVOutputStreamVisitor::visit(SimpleNbox *c) { SimpleNbox::fluxpool_stringmap::const_iterator it; for (auto b : c->veg_c) { std::string biome = b.first; - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_NPP, - c->final_npp[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_RH, - c->final_rh[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_RH_CH4, - c->RH_ch4[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_VEGC, - c->veg_c[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_DETRITUSC, - c->detritus_c[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_SOILC, - c->soil_c[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_PERMAFROSTC, - c->permafrost_c[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_THAWEDPC, - c->thawed_permafrost_c[biome]); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_F_FROZEN, - unitval(c->f_frozen[biome], U_UNITLESS)); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_TEMPFERTD, - unitval(c->tempfertd[biome], U_UNITLESS)); - STREAM_UNITVAL(csvFile, c, biome + SNBOX_PARSECHAR + D_TEMPFERTS, - unitval(c->tempferts[biome], U_UNITLESS)); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_NPP); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_RH); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_RH_CH4); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_VEGC); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_DETRITUSC); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_SOILC); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_PERMAFROSTC); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_THAWEDPC); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_F_FROZEN); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_TEMPFERTD); + STREAM_MESSAGE(csvFile, c, biome + SNBOX_PARSECHAR + D_TEMPFERTS); } } } diff --git a/src/csv_table_reader.cpp b/src/csv_table_reader.cpp index 2d818dcd6..c784571cd 100644 --- a/src/csv_table_reader.cpp +++ b/src/csv_table_reader.cpp @@ -22,6 +22,7 @@ #pragma clang diagnostic pop #include +#include #include #include @@ -32,6 +33,8 @@ namespace Hector { using namespace std; +using CsvTok = boost::tokenizer>; + //------------------------------------------------------------------------------ /*! \brief Constructor @@ -91,6 +94,33 @@ string CSVTableReader::csv_getline() { return s; } +//------------------------------------------------------------------------------ +/*! \brief Helper function + * + * Read in and format the header of a hector input csv table. + */ +std::vector Hector::CSVTableReader::read_header() { + using namespace boost; + + // Skip all the comments at the start of the hector CSV input table + std::string line = csv_getline(); + H_ASSERT(!line.empty(), "Header line is empty"); + + // Parse variable names from the CSV + std::vector headerRow; + CsvTok tok(line); + headerRow.assign(tok.begin(), tok.end()); + + // Tim any whitespace included in the header + for (auto& colName : headerRow) { + trim(colName); + } + + return headerRow; +} + + + //------------------------------------------------------------------------------ /*! \brief Process the CSV file looking for the given varName and route the data * into the core. @@ -129,21 +159,18 @@ void CSVTableReader::process(Core *core, const string &componentName, // read the header line and attempt to find varName. The first column is // not considered because that should be the index column. - line = csv_getline(); - H_ASSERT(!line.empty(), "line empty"); - split(row, line, is_any_of(",")); - // const int headerRowSize = row.size(); - for (size_t col = 1; col < row.size() && columnIndex == 0; ++col) { - // ignore white space before comparing variable names - trim(row[col]); - if (row[col] == varName) { - columnIndex = col; + row = read_header(); + + for (size_t col = 1; col < row.size(); ++col) { + if (row[col] == varName) { + columnIndex = col; + break; + } + } + if (columnIndex == 0) { + H_THROW("Could not find a column for " + varName + + " in " + fileName); } - } - if (columnIndex == 0) { - H_THROW("Could not find a column for " + varName + " in " + fileName + - " header=" + line); - } // we are all set to process the table // note that getline sets the fail bit when it hits eof which is not what diff --git a/src/simpleNbox.cpp b/src/simpleNbox.cpp index 91b9481b8..399b75429 100644 --- a/src/simpleNbox.cpp +++ b/src/simpleNbox.cpp @@ -69,9 +69,9 @@ SimpleNbox::SimpleNbox() : CarbonCycleModel(8), masstot(0.0) { // earth_c keeps track of how much fossil C is pulled out // so that we can do a mass-balance check throughout the run // 2020-02-05 With the introduction of non-negative 'fluxpool' class - // we can't start earth_c at zero. Value of 5500 is set to avoid - // overdrawing in RCP 8.5 - earth_c.set(5500, U_PGC, false, D_EARTHC); + // we can't start earth_c at zero. Value of 6400 is set to avoid + // overdrawing in esm-flat20 + earth_c.set(6400, U_PGC, false, D_EARTHC); // We keep a running total of LUC emissions from (and uptake to) vegetation // This is used in slowparameval() to calculate npp_luc_adjust @@ -246,17 +246,7 @@ void SimpleNbox::setData(const std::string &varName, const message_data &data) { } try { // Initial pools - if (varNameParsed == D_ATMOSPHERIC_CO2) { - // Hector input files specify initial atmospheric CO2 in terms of - // the carbon pool, rather than the CO2 concentration. Since we - // don't have a place to store the initial carbon pool, we convert - // it to initial concentration and store that. It will be converted - // back to carbon content when the state variables are set up in - // prepareToRun. - H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed"); - H_ASSERT(biome == SNBOX_DEFAULT_BIOME, "atmospheric C must be global"); - set_c0(data.getUnitval(U_PGC).value(U_PGC) * PGC_TO_PPMVCO2); - } else if (varNameParsed == D_PREINDUSTRIAL_CO2) { + if (varNameParsed == D_PREINDUSTRIAL_CO2) { H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed"); H_ASSERT(biome == SNBOX_DEFAULT_BIOME, "preindustrial CO2 must be global"); diff --git a/tests/testthat/input/luc_pulse.ini b/tests/testthat/input/luc_pulse.ini index 901ef82d0..e0aea8d30 100644 --- a/tests/testthat/input/luc_pulse.ini +++ b/tests/testthat/input/luc_pulse.ini @@ -30,7 +30,6 @@ tid=200000000 ; 2.0e8 intermediate-deep exchange, m3/s ; - the nppv, nppd, and litterd partitioning parameters ; - beta and q10_rh -atmos_co2=588.071 ; Pg C in CO2, from Murakami et al. (2010) C0=277.15 ; preindustrial CO2 from table 7.SM.1 IPCC AR6 ;boreal.veg_c=100 ; e.g. ;tropical.veg_c=450