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

Yaml duplicate reaction issue #1278

Closed
abimren opened this issue May 6, 2022 · 4 comments
Closed

Yaml duplicate reaction issue #1278

abimren opened this issue May 6, 2022 · 4 comments
Labels
Input Input parsing and conversion (for example, ck2yaml)

Comments

@abimren
Copy link

abimren commented May 6, 2022

As I reported in 1092, some reactions are needed to be declared as duplicates in the latest stable release (2.6.0) to make mechanism work, though they are not.

Example reactions:
ELEMENTS
H O C N
END
SPECIES
CH3CO CH3 CO OH
END
REACTIONS
CH3CO + M = CH3 + CO + M 4.37E+15 0.0 10500.0
CH3CO + OH = CH3 + CO + OH 3.000E+13 0.0 0.
END

@ischoegl ischoegl added the Input Input parsing and conversion (for example, ck2yaml) label May 6, 2022
@ischoegl
Copy link
Member

ischoegl commented May 6, 2022

See #1251 - as of Cantera 2.6, both reactions are of the same type, and OH in the second version is just a special case of a third-body collider.

@abimren
Copy link
Author

abimren commented May 6, 2022

In the first reaction, M is total concentration.

Second one's third body is only OH.

If I declare DUP, is each reaction going to calculate a distinct third body? That's my confusion.

@ischoegl
Copy link
Member

ischoegl commented May 6, 2022

Looking at the source code, there is a check that ensures that collision efficiency definitions should be mutually exclusive. In this case, this check fails based on the way it is implemented. While the logic is unchanged from earlier versions, it now flags duplicates where there wasn't a conflict before as the reaction type was different.

The code section in question is

} else if (R.type() == "three-body") {
ThirdBody& tb1 = *(dynamic_cast<ThreeBodyReaction3&>(R).thirdBody());
ThirdBody& tb2 = *(dynamic_cast<ThreeBodyReaction3&>(other).thirdBody());
bool thirdBodyOk = true;
for (size_t k = 0; k < nTotalSpecies(); k++) {
string s = kineticsSpeciesName(k);
if (tb1.efficiency(s) * tb2.efficiency(s) != 0.0) {
// non-zero third body efficiencies for species `s` in
// both reactions
thirdBodyOk = false;
break;
}
}

The reason here is that the default efficiency for M is unity, and thus the check fails for OH.

The workaround is to declare DUP which will work as expected. As an aside, there is a discussion that goes beyond, see Cantera/enhancements#132.

PS: There's also this discussion #1193

@ischoegl
Copy link
Member

ischoegl commented May 6, 2022

Per discussion in #1193, the recommended resolution is to mark these reactions as duplicates. Please feel free to comment on Cantera/enhancements#132. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Input Input parsing and conversion (for example, ck2yaml)
Projects
None yet
Development

No branches or pull requests

2 participants