Adding Stoichiometric Coefficients #514
Merged
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.
I have looked into adding stoichiometric coefficients following discussions in #513. It turns out there was already a coefficient assigned in
src/inputFunctions.f90
for each species in each reaction, it was just being set to 1 every time. This coefficient of 1 was then already included in calculations in theresid
subroutine insrc/solverFunctions.f90
. This made it fairly easy to modify the code to have variable coefficients!I have made the following adjustments:
build/mech_converter.py
. If no coefficient is given then assign a coefficient of 1.mechanism.reac
andmechanism.prod
.src/inputFunctions.f90
instead of assigning a value of 1 for all species.I've run some models to test this and it seems to be behaving well. I've compared against the previous version with species duplicated and the results are identical. I've also tested some edge-cases like setting the coefficient to 0 and non-integer reactant coefficients, which also work as intended.
Let me know if there's any more changes I need to make, otherwise this resolves #513.