Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H2 indirect effects on strat. H2O RF #759

Draft
wants to merge 2 commits into
base: feature/h2_ch4_lifetime
Choose a base branch
from
Draft
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
12 changes: 6 additions & 6 deletions src/oh_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ void OHComponent::setData(const string &varName, const message_data &data) {
H_ASSERT(data.date != Core::undefinedIndex(), "date required");
NMVOC_emissions.set(data.date, data.getUnitval(U_TG_NMVOC));
} else if (varName == D_EMISSIONS_H2) {
H_ASSERT(data.date != Core::undefinedIndex(), "date required");
H2_emissions.set(data.date, data.getUnitval(U_TG_H2));
H_ASSERT(data.date != Core::undefinedIndex(), "date required");
H2_emissions.set(data.date, data.getUnitval(U_TG_H2));
} else if (varName == D_INITIAL_LIFETIME_OH) {
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed");
TOH0 = data.getUnitval(U_YRS);
Expand Down Expand Up @@ -216,11 +216,11 @@ unitval OHComponent::getData(const std::string &varName, const double date) {
"Date required for NMVOC emissions");
returnval = NMVOC_emissions.get(date);
} else if (varName == D_COEFFICENT_H2) {
H_ASSERT(date == Core::undefinedIndex(), "Date not allowed for ECS");
returnval = CH2;
H_ASSERT(date == Core::undefinedIndex(), "Date not allowed for H2 coefficent");
returnval = CH2 ;
} else if (varName == D_EMISSIONS_H2) {
H_ASSERT(date != Core::undefinedIndex(), "Date required for H2 emissions");
returnval = H2_emissions.get(date);
H_ASSERT(date != Core::undefinedIndex(), "Date required for H2 emissions");
returnval = H2_emissions.get(date);
} else {
H_THROW("Caller is requesting unknown variable: " + varName);
}
Expand Down
10 changes: 5 additions & 5 deletions src/simpleNbox-runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void SimpleNbox::prepareToRun() {
H_LOG(logger, Logger::DEBUG) << "prepareToRun " << std::endl;

// If any 'global' settings, there shouldn't also be regional
if ((has_biome(SNBOX_DEFAULT_BIOME)) & (biome_list.size() > 1)) {
if ((has_biome(SNBOX_DEFAULT_BIOME)) && (biome_list.size() > 1)) {
H_THROW("Cannot have both global and biome-specific data! "
"Did you forget to rename the default ('global') biome?")
}
Expand Down Expand Up @@ -157,7 +157,7 @@ void SimpleNbox::prepareToRun() {

// Zero the cumulative tracker of CH4 release from permafrost
cumulative_pf_ch4 = 0.0;

// A flag that lets run() know the very first time it's called
has_been_run_before = false;

Expand Down Expand Up @@ -477,7 +477,7 @@ void SimpleNbox::stashCValues(double t, const double c[]) {
// simpleNbox's point of view). In order not to trigger a mass balance
// issue, we track it and adjust in the mass balance check below
cumulative_pf_ch4 += rh_fpa_ch4_flux.value(U_PGC);

// Permafrost thaw and refreeze
if (!in_spinup) {
// We pass in the annual fluxes here, because want annual thaw and
Expand Down Expand Up @@ -547,7 +547,7 @@ void SimpleNbox::stashCValues(double t, const double c[]) {
}
// Add in C that has exited the system via thawed permafrost CH4 release
sum += cumulative_pf_ch4;

const double diff = fabs(sum - masstot);
H_LOG(logger, Logger::DEBUG) << "masstot = " << masstot << ", sum = " << sum
<< ", diff = " << diff << std::endl;
Expand Down Expand Up @@ -744,7 +744,7 @@ SimpleNbox::compute_pf_thaw_refreeze(string biome, fluxpool rh_co2,
fluxpool rh_ch4) const {

H_ASSERT(!in_spinup, "We should not be here!");

double biome_c_thaw =
permafrost_c.at(biome).value(U_PGC) * f_new_thaw.at(biome);
double pf_refreeze_tp = 0.0;
Expand Down
Loading