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

Method updateFromStruct

src/kinetics/InterfaceRate.cpp:228–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void InterfaceRateBase::updateFromStruct(const InterfaceData& shared_data) {
229 if (shared_data.ready) {
230 m_siteDensity = shared_data.density;
231 }
232
233 if (m_indices.size() != m_cov.size()) {
234 // object is not set up correctly (setSpecies needs to be run)
235 m_acov = NAN;
236 m_ecov = NAN;
237 m_mcov = NAN;
238 return;
239 }
240 m_acov = 0.0;
241 m_ecov = 0.0;
242 m_mcov = 0.0;
243 for (auto& [iCov, iKin] : m_indices) {
244 m_acov += m_ac[iCov] * shared_data.coverages[iKin];
245 if (m_lindep[iCov]) {
246 m_ecov += m_ec[iCov][1] * shared_data.coverages[iKin];
247 } else {
248 m_ecov += poly4(shared_data.coverages[iKin], m_ec[iCov].data());
249 }
250 m_mcov += m_mc[iCov] * shared_data.logCoverages[iKin];
251 }
252
253 // Update change in electrical potential energy
254 if (m_chargeTransfer) {
255 m_deltaPotential_RT = 0.;
256 for (const auto& [iPhase, netCharge] : m_netCharges) {
257 m_deltaPotential_RT +=
258 shared_data.electricPotentials[iPhase] * netCharge;
259 }
260 m_deltaPotential_RT /= GasConstant * shared_data.temperature;
261 }
262
263 // Update quantities used for exchange current density formulation
264 if (m_exchangeCurrentDensityFormulation) {
265 m_deltaGibbs0_RT = 0.;
266 m_prodStandardConcentrations = 1.;
267 for (const auto& [k, stoich] : m_stoichCoeffs) {
268 m_deltaGibbs0_RT +=
269 shared_data.standardChemPotentials[k] * stoich;
270 if (stoich > 0.) {
271 m_prodStandardConcentrations *=
272 shared_data.standardConcentrations[k];
273 }
274 }
275 m_deltaGibbs0_RT /= GasConstant * shared_data.temperature;
276 }
277}
278
279void InterfaceRateBase::setContext(const Reaction& rxn, const Kinetics& kin)
280{

Callers 2

evalPlogRateMethod · 0.45
evalChebyshevRateMethod · 0.45

Calls 2

poly4Function · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected