mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
fix setContext check for reactants
This commit is contained in:
parent
82e139011e
commit
5aefaef5cd
@ -122,37 +122,15 @@ void ElectronCollisionPlasmaRate::setContext(const Reaction& rxn, const Kinetics
|
||||
"ElectronCollisionPlasmaRate requires plasma phase");
|
||||
}
|
||||
|
||||
// Check rxn.reactantString (rxn.reactants gives reduced reactants)
|
||||
std::istringstream iss(rxn.reactantString());
|
||||
string token;
|
||||
int nElectron = 0;
|
||||
int nReactants = 0;
|
||||
|
||||
// Count number of electron and reactants
|
||||
// Since the reactants are one electron and one molecule,
|
||||
// no token can be a number.
|
||||
while (iss >> token) {
|
||||
if (isdigit(token[0])) {
|
||||
throw InputFileError("ElectronCollisionPlasmaRate::setContext", rxn.input,
|
||||
"ElectronCollisionPlasmaRate requires one electron and one molecule as reactants");
|
||||
}
|
||||
if (token == electronName) {
|
||||
nElectron++;
|
||||
}
|
||||
if (token != "+") {
|
||||
nReactants++;
|
||||
}
|
||||
}
|
||||
|
||||
// Number of reactants needs to be two
|
||||
if (nReactants != 2) {
|
||||
if (rxn.reactants.size() != 2) {
|
||||
throw InputFileError("ElectronCollisionPlasmaRate::setContext", rxn.input,
|
||||
"ElectronCollisionPlasmaRate requires exactly two reactants");
|
||||
}
|
||||
|
||||
// Must have only one electron
|
||||
// @todo add electron-electron collision rate
|
||||
if (nElectron != 1) {
|
||||
if (rxn.reactants.at(electronName) != 1) {
|
||||
throw InputFileError("ElectronCollisionPlasmaRate::setContext", rxn.input,
|
||||
"ElectronCollisionPlasmaRate requires one and only one electron");
|
||||
}
|
||||
|
@ -366,6 +366,9 @@ void Reaction::setEquation(const string& equation, const Kinetics* kin)
|
||||
} else if (kin && kin->thermo(0).nDim() != 3) {
|
||||
// interface reactions
|
||||
return;
|
||||
} else if (rate_type == "electron-collision-plasma") {
|
||||
// does not support third body
|
||||
return;
|
||||
}
|
||||
|
||||
string third_body;
|
||||
|
Loading…
Reference in New Issue
Block a user