-
Notifications
You must be signed in to change notification settings - Fork 47
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 effects on CH4 lifetime #758
Open
kdorheim
wants to merge
5
commits into
dev-h2
Choose a base branch
from
ch4_oh_lifetime_only
base: dev-h2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2203297
use more conservative code to define a constant
kdorheim a46e14e
increase the version index so that it is easier to keep track of erro…
kdorheim ec1511f
implement the H2 coeff for the OH componet as something that can be r…
kdorheim 42479b7
saving wip
kdorheim 8ed3f3e
Correct warning message
kdorheim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Package: hector | ||
Title: The Hector Simple Climate Model | ||
Version: 3.2.0 | ||
Version: 3.3.0.9999999 | ||
Authors@R: c(person("Kalyn", "Dorheim", | ||
email = "[email protected]", | ||
role = c("aut", "cre"), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,12 +57,15 @@ void OHComponent::init(Core *coreptr) { | |
|
||
// Inform core what data we can provide | ||
core->registerCapability(D_LIFETIME_OH, getComponentName()); | ||
core->registerCapability(D_COEFFICENT_H2, getComponentName()); | ||
// Register inputs accepted. Note that more than one component | ||
// can accept an input | ||
core->registerInput(D_EMISSIONS_CO, getComponentName()); | ||
core->registerInput(D_EMISSIONS_NMVOC, getComponentName()); | ||
core->registerInput(D_EMISSIONS_NOX, getComponentName()); | ||
core->registerInput(D_EMISSIONS_H2, getComponentName()); | ||
core->registerInput(D_COEFFICENT_H2, getComponentName()); | ||
|
||
|
||
} | ||
|
||
|
@@ -100,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); | ||
|
@@ -117,6 +120,9 @@ void OHComponent::setData(const string &varName, const message_data &data) { | |
} else if (varName == D_COEFFICENT_NOX) { | ||
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed"); | ||
CNOX = data.getUnitval(U_UNDEFINED); | ||
} else if (varName == D_COEFFICENT_H2) { | ||
H_ASSERT(data.date == Core::undefinedIndex(), "date not allowed"); | ||
CH2 = data.getUnitval(U_UNDEFINED); | ||
} else { | ||
H_THROW("Unknown variable name while parsing " + getComponentName() + | ||
": " + varName); | ||
|
@@ -149,6 +155,8 @@ void OHComponent::run(const double runToDate) { | |
unitval current_nox = NOX_emissions.get(runToDate); | ||
unitval current_co = CO_emissions.get(runToDate); | ||
unitval current_nmvoc = NMVOC_emissions.get(runToDate); | ||
unitval current_h2 = H2_emissions.get(runToDate); | ||
|
||
|
||
// get this from CH4 component, this is last year's value | ||
const double previous_ch4 = | ||
|
@@ -169,7 +177,13 @@ void OHComponent::run(const double runToDate) { | |
CNMVOC * | ||
((1.0 * +current_nmvoc) - | ||
NMVOC_emissions.get(NMVOC_emissions.firstdate()).value(U_TG_NMVOC)); | ||
toh = a + b + c + d; | ||
const double e = | ||
CH2 * | ||
((1.0 * +current_h2) - | ||
H2_emissions.get(H2_emissions.firstdate()).value(U_TG_H2)); | ||
|
||
|
||
toh = a + b + c + d + e; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bpbond do we have strong feelings on the use of e as a variable name? |
||
H_LOG(logger, Logger::DEBUG) | ||
<< "Year " << runToDate << " toh = " << toh << std::endl; | ||
} | ||
|
@@ -201,9 +215,12 @@ unitval OHComponent::getData(const std::string &varName, const double date) { | |
H_ASSERT(date != Core::undefinedIndex(), | ||
"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 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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bpbond is this the correct usage of the const double?