Cantera/Surface Coverage
From charlesreid1
In Cantera, the surface coverage is equivalent to a mole fraction of a surface species.
The surface coverage shows up in a lot of different places, so let's start somewhere and follow a backtrace to see where it leads us.
Getting Coverages
Reactor::updateState()
Starting from the Reactor class, we see in the updateState method that we're looping over each Wall object associated with the Reactor, and we set the surface coverages for the wall.
// set the first component to the total internal
// energy
y[0] = m_thermo->intEnergy_mass() * mass;
// set the second component to the total volume
y[1] = m_vol;
// set the remaining components to the surface species
// coverages on the walls
size_t loc = m_nsp + 2;
SurfPhase* surf;
for (size_t m = 0; m < m_nwalls; m++) {
surf = m_wall[m]->surface(m_lr[m]);
if (surf) {
m_wall[m]->getCoverages(m_lr[m], y + loc);
loc += surf->nSpecies();
}
}This piece of code is going to the Wall class and calling getCoverages. The arguments it passes are m_lr[m], which indicates whether the wall is left-sided or right-sided, and y+loc, which is a pointer to an array. The code y+loc means (apparently) the array y indexed at loc, which is set to the number of species plus two (the two being mass and volume).
Now, looking around more at the y array and the role that it plays in the updateState method, we can see that y is the solution vector - it holds all the solutions. Which means that when we call the getCoverages() method on the Wall object, we're passing it a pointer to our solution vector, and telling the Wall object to populate our solution vector with the coverages - that is, with the mole fractions of the surface species associated with the Wall object.
Wall::getCoverages()
The Wall::getCoverages method is not particularly interesting: it just copies data into an array.
void Wall::getCoverages(int leftright, doublereal* cov)
{
if (leftright == 0) {
copy(m_leftcov.begin(), m_leftcov.end(), cov);
} else {
copy(m_rightcov.begin(), m_rightcov.end(), cov);
}
}The m_leftcov and m_rightcov are C++ float vectors that hold the coverages of surface species on the left and right sides of the Wall.