Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @rdname carboncycle
NULL

#' @describeIn msgtype Message type for retrieving data from a component
#' @keywords internal
GETDATA <- function() {
Expand Down Expand Up @@ -1292,6 +1295,10 @@ RH <- function() {
.Call('_hector_RH', PACKAGE = 'hector')
}

RH_DETRITU <- function() {
.Call('_hector_RH_DETRITU', PACKAGE = 'hector')
}

#' @describeIn parameters Preindustrial CO2 concentration (\code{"ppmv CO2"})
#' @export
PREINDUSTRIAL_CO2 <- function() {
Expand Down
7 changes: 6 additions & 1 deletion inst/include/simpleNbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class SimpleNbox : public CarbonCycleModel {
final_npp; //!< final NPP after any NBP constraint accounted for, Pg C/yr
fluxpool_stringmap
final_rh; //!< final RH after any NBP constraint accounted for, Pg C/yr
fluxpool_stringmap
final_rh_detritus; //!< final RH detritus after any NBP constraint accounted for, Pg C/yr

// Other state variables
unitval Ca_residual; //!< residual (when constraining [CO2]), Pg C
Expand Down Expand Up @@ -175,7 +177,10 @@ class SimpleNbox : public CarbonCycleModel {
final_npp_tv; //!< Time series of biome-specific final NPP
tvector<fluxpool_stringmap>
final_rh_tv; //!< Time series of biome-specific final RH

tvector<fluxpool_stringmap>
final_rh_detritus_tv; //!< Time series of biome-specific final detritus RH


tseries<unitval> Ca_residual_ts; //!< Time series of residual flux values

tvector<double_stringmap> tempfertd_tv,
Expand Down
11 changes: 11 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2170,6 +2170,16 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// RH_DETRITU
String RH_DETRITU();
RcppExport SEXP _hector_RH_DETRITU() {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
rcpp_result_gen = Rcpp::wrap(RH_DETRITU());
return rcpp_result_gen;
END_RCPP
}
// PREINDUSTRIAL_CO2
String PREINDUSTRIAL_CO2();
RcppExport SEXP _hector_PREINDUSTRIAL_CO2() {
Expand Down Expand Up @@ -2971,6 +2981,7 @@ static const R_CallMethodDef CallEntries[] = {
{"_hector_CONCENTRATIONS_CO2", (DL_FUNC) &_hector_CONCENTRATIONS_CO2, 0},
{"_hector_NPP", (DL_FUNC) &_hector_NPP, 0},
{"_hector_RH", (DL_FUNC) &_hector_RH, 0},
{"_hector_RH_DETRITU", (DL_FUNC) &_hector_RH_DETRITU, 0},
{"_hector_PREINDUSTRIAL_CO2", (DL_FUNC) &_hector_PREINDUSTRIAL_CO2, 0},
{"_hector_ATMOSPHERIC_CO2", (DL_FUNC) &_hector_ATMOSPHERIC_CO2, 0},
{"_hector_FFI_EMISSIONS", (DL_FUNC) &_hector_FFI_EMISSIONS, 0},
Expand Down
1 change: 1 addition & 0 deletions src/csv_outputstream_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ void CSVOutputStreamVisitor::visit(SimpleNbox *c) {
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_CH4, c->final_rh[SNBOX_DEFAULT_BIOME]);
STREAM_UNITVAL(csvFile, c, D_RH_DETRITUS, c->final_rh_detritus[SNBOX_DEFAULT_BIOME]);
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);
Expand Down
5 changes: 5 additions & 0 deletions src/rcpp_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,11 @@ String NPP() { return D_NPP; }
// [[Rcpp::export]]
String RH() { return D_RH; }

//' @rdname carboncycle
//' @export
// [[Rcpp::export]]
String RH_DETRITU() { return D_RH_DETRITUS; }

//' @describeIn parameters Preindustrial CO2 concentration (\code{"ppmv CO2"})
//' @export
// [[Rcpp::export]]
Expand Down
3 changes: 3 additions & 0 deletions src/simpleNbox-runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ void SimpleNbox::stashCValues(double t, const double c[]) {
// issue, we track it and adjust in the mass balance check below
cumulative_pf_ch4 += rh_fpa_ch4_flux.value(U_PGC);

final_rh_detritus[biome] = rh_fda_flux;


// Permafrost thaw and refreeze
if (!in_spinup) {
// We pass in the annual fluxes here, because want annual thaw and
Expand Down
4 changes: 4 additions & 0 deletions src/simpleNbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ unitval SimpleNbox::getData(const std::string &varName, const double date) {
} else if (varNameParsed == D_RH) {
returnval =
sum_fluxpool_biome_ts(varName, date, biome, final_rh, final_rh_tv);
} else if (varNameParsed == D_RH_DETRITUS) {
returnval =
sum_fluxpool_biome_ts(varName, date, biome, final_rh_detritus, final_rh_detritus_tv);
} else if (varNameParsed == D_RH_CH4) {
returnval = sum_fluxpool_biome_ts(varName, date, biome, RH_ch4, RH_ch4_tv);
} else {
Expand All @@ -709,6 +712,7 @@ void SimpleNbox::reset(double time) {
thawed_permafrost_c = thawed_permafrost_c_tv.get(time);
final_npp = final_npp_tv.get(time);
final_rh = final_rh_tv.get(time);
final_rh_detritus = final_rh_detritus_tv.get(time);
RH_thawed_permafrost = RH_thawed_permafrost_tv.get(time);
RH_ch4 = RH_ch4_tv.get(time);

Expand Down
Loading