MCPcopy Create free account
hub / github.com/Cantera/cantera / setContext

Method setContext

src/kinetics/InterfaceRate.cpp:279–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void InterfaceRateBase::setContext(const Reaction& rxn, const Kinetics& kin)
280{
281 setSpecies(kin.thermo().speciesNames());
282
283 m_chargeTransfer = rxn.usesElectrochemistry(kin);
284 if (!m_chargeTransfer) {
285 return;
286 }
287
288 m_stoichCoeffs.clear();
289 for (const auto& [name, stoich] : rxn.reactants) {
290 m_stoichCoeffs.emplace_back(kin.kineticsSpeciesIndex(name), -stoich);
291 }
292 for (const auto& [name, stoich] : rxn.products) {
293 m_stoichCoeffs.emplace_back(kin.kineticsSpeciesIndex(name), stoich);
294 }
295
296 m_netCharges.clear();
297 for (const auto& [k, stoich] : m_stoichCoeffs) {
298 size_t n = kin.speciesPhaseIndex(k);
299 size_t start = kin.kineticsSpeciesIndex(0, n);
300 double charge = kin.thermo(n).charge(k - start);
301 m_netCharges.emplace_back(n, Faraday * charge * stoich);
302 }
303}
304
305StickingCoverage::StickingCoverage()
306 : m_motzWise(false)

Callers 4

addReactionMethod · 0.45
modifyReactionMethod · 0.45
addReactionMethod · 0.45
modifyReactionMethod · 0.45

Calls 15

InputFileErrorClass · 0.85
getBoolMethod · 0.80
thermoMethod · 0.45
usesElectrochemistryMethod · 0.45
clearMethod · 0.45
kineticsSpeciesIndexMethod · 0.45
speciesPhaseIndexMethod · 0.45
chargeMethod · 0.45
siteDensityMethod · 0.45
phaseOfMatterMethod · 0.45
sizeMethod · 0.45
equationMethod · 0.45

Tested by

no test coverage detected