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

Validation checks #318

Merged
merged 2 commits into from
Oct 18, 2023
Merged

Conversation

K20shores
Copy link
Collaborator

@K20shores K20shores commented Oct 18, 2023

Closes #165

  • Adds a test to ensure surface reaction rates aren't created with more than one reactant

#Issues

  • First order loss and emissions reaction emissions also should only accept one reactant. However, both of these are represented as a UserDefinedRateConstant which can be first order loss, emission, or photolysis, and photolysis reactions can have more than one reactant. There is no clean way to ensure that first order loss reactions and emission reactions have exactly one reactant.
    • This actually isn't a problem. Our json parsing code has a check for these conditions implicitly. It's only in the construction of a process by hand that someone could make a rate constant process for loss or emission with more than one reactant. That's a bug, but it's a user error. Unless we remove the the user defined process and specialize for each case, or switch to using tagged unions for our rate constants, we can't reasonably make a check for this.

I can't think of any more checks to make. Let me know if any of you can think of some.

@K20shores K20shores linked an issue Oct 18, 2023 that may be closed by this pull request
3 tasks
@codecov-commenter
Copy link

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (7cb394d) 96.94% compared to head (3bffc5d) 96.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #318   +/-   ##
=======================================
  Coverage   96.94%   96.95%           
=======================================
  Files          34       34           
  Lines        2622     2627    +5     
=======================================
+ Hits         2542     2547    +5     
  Misses         80       80           
Files Coverage Δ
include/micm/process/process.hpp 91.78% <100.00%> (+0.60%) ⬆️
include/micm/system/species.hpp 92.85% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@K20shores K20shores changed the title surface rate constants can only have one reactant Validation checks Oct 18, 2023
@K20shores K20shores marked this pull request as ready for review October 18, 2023 16:26
@K20shores K20shores merged commit de6b8e1 into main Oct 18, 2023
58 checks passed
@K20shores K20shores deleted the 165-add-validation-checks-to-class-constructors branch October 18, 2023 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add validation checks to class constructors
4 participants