Cantera
2.0
|
Advances the surface coverages of the associated set of SurfacePhase objects in time. More...
#include <ImplicitSurfChem.h>
Public Member Functions | |
ImplicitSurfChem (std::vector< InterfaceKinetics * > k) | |
Constructor for multiple surfaces. | |
virtual | ~ImplicitSurfChem () |
Destructor. | |
virtual void | initialize (doublereal t0=0.0) |
Overloads the virtual function declared in FuncEval. | |
void | integrate (doublereal t0, doublereal t1) |
Integrate from t0 to t1. The integrator is reinitialized first. | |
void | integrate0 (doublereal t0, doublereal t1) |
Integrate from t0 to t1 without reinitializing the integrator. | |
void | solvePseudoSteadyStateProblem (int ifuncOverride=-1, doublereal timeScaleOverride=1.0) |
Solve for the pseudo steady-state of the surface problem. | |
virtual size_t | neq () |
Return the number of equations. | |
virtual void | eval (doublereal t, doublereal *y, doublereal *ydot, doublereal *p) |
Evaluate the value of ydot[k] at the current conditions. | |
virtual void | getInitialConditions (doublereal t0, size_t leny, doublereal *y) |
Set the initial conditions for the solution vector. | |
void | getConcSpecies (doublereal *const vecConcSpecies) const |
void | setConcSpecies (const doublereal *const vecConcSpecies) |
Sets the concentrations within phases that are unknowns in the surface problem. | |
void | setCommonState_TP (doublereal TKelvin, doublereal PresPa) |
Sets the state variable in all thermodynamic phases (surface and surrounding bulk phases) to the input temperature and pressure. | |
std::vector< InterfaceKinetics * > & | getObjects () |
Returns a reference to the vector of pointers to the InterfaceKinetics objects. | |
int | checkMatch (std::vector< ThermoPhase * > m_vec, ThermoPhase *thPtr) |
void | setIOFlag (int ioFlag) |
virtual size_t | nparams () |
Number of parameters. | |
Protected Member Functions | |
void | updateState (doublereal *y) |
Set the mixture to a state consistent with solution vector y. | |
Protected Attributes | |
std::vector< SurfPhase * > | m_surf |
vector of pointers to surface phases. | |
std::vector< ThermoPhase * > | m_bulkPhases |
Vector of pointers to bulk phases. | |
std::vector< InterfaceKinetics * > | m_vecKinPtrs |
vector of pointers to InterfaceKinetics objects | |
std::vector< size_t > | m_nsp |
Vector of number of species in each Surface Phase. | |
std::vector< size_t > | m_surfindex |
index of the surface phase in each InterfaceKinetics object | |
std::vector< size_t > | m_specStartIndex |
size_t | m_nsurf |
Total number of surface phases. | |
size_t | m_nv |
Total number of surface species in all surface phases. | |
size_t | m_numBulkPhases |
std::vector< size_t > | m_nspBulkPhases |
size_t | m_numTotalBulkSpecies |
size_t | m_numTotalSpecies |
std::vector< vector_int > | pLocVec |
Integrator * | m_integ |
Pointer to the cvode integrator. | |
doublereal | m_atol |
doublereal | m_rtol |
doublereal | m_maxstep |
vector_fp | m_work |
vector_fp | m_concSpecies |
Temporary vector - length num species in the Kinetics object. | |
vector_fp | m_concSpeciesSave |
int | m_mediumSpeciesStart |
Index into the species vector of the kinetics manager, pointing to the first species from the surrounding medium. | |
int | m_bulkSpeciesStart |
Index into the species vector of the kinetics manager, pointing to the first species from the condensed phase of the particles. | |
int | m_surfSpeciesStart |
Index into the species vector of the kinetics manager, pointing to the first species from the surface of the particles. | |
solveSP * | m_surfSolver |
Pointer to the helper method, Placid, which solves the surface problem. | |
bool | m_commonTempPressForPhases |
If true, a common temperature and pressure for all surface and bulk phases associated with the surface problem is imposed. | |
Private Attributes | |
int | m_ioFlag |
Controls the amount of printing from this routine and underlying routines. | |
Friends | |
class | solveSS |
We make the solveSS class a friend because we need to access all of the above information directly. | |
Advances the surface coverages of the associated set of SurfacePhase objects in time.
This function advances a set of SurfacePhase objects, each associated with one InterfaceKinetics object, in time. The following equation is used for each surface phase, i.
\[ \dot \theta_k = \dot s_k (\sigma_k / s_0) \]
In this equation, \( \theta_k \) is the site coverage for the kth species. \( \dot s_k \) is the source term for the kth species \( \sigma_k \) is the number of surface sites covered by each species k. \( s_0 \) is the total site density of the interfacial phase.
Additionally, the 0'th equation in the set is discarded. Instead the alternate equation is solved for
\[ \sum_{k=0}^{N-1} \dot \theta_k = 0 \]
This last equation serves to ensure that sum of the \( \theta_k \) values stays constant.
The object uses the CVODE software to advance the surface equations.
The solution vector used by this object is as follows. For each surface phase with \( N_s \) surface sites, it consists of the surface coverages \( \theta_k \) for \( k = 0, N_s - 1 \)
Definition at line 62 of file ImplicitSurfChem.h.
ImplicitSurfChem | ( | std::vector< InterfaceKinetics * > | k | ) |
Constructor for multiple surfaces.
k | Vector of pointers to InterfaceKinetics objects Each object consists of a surface or an edge containing internal degrees of freedom representing the concentration of surface adsorbates. |
Definition at line 19 of file ImplicitSurfChem.cpp.
References Cantera::BDF_Method, ImplicitSurfChem::m_bulkPhases, ImplicitSurfChem::m_concSpecies, ImplicitSurfChem::m_integ, ImplicitSurfChem::m_nsp, ImplicitSurfChem::m_nsurf, ImplicitSurfChem::m_nv, ImplicitSurfChem::m_surf, ImplicitSurfChem::m_surfindex, ImplicitSurfChem::m_vecKinPtrs, Cantera::Newton_Iter, Kinetics::nPhases(), Cantera::npos, Phase::nSpecies(), Integrator::setIterator(), Integrator::setMethod(), Integrator::setProblemType(), and Kinetics::thermo().
|
virtual |
Destructor.
Deletes the integrator.
Definition at line 115 of file ImplicitSurfChem.cpp.
References ImplicitSurfChem::m_integ, and ImplicitSurfChem::m_surfSolver.
|
virtual |
Overloads the virtual function declared in FuncEval.
Definition at line 141 of file ImplicitSurfChem.cpp.
References Integrator::initialize(), ImplicitSurfChem::m_integ, and Integrator::setTolerances().
Referenced by InterfaceKinetics::advanceCoverages(), and InterfaceKinetics::solvePseudoSteadyStateProblem().
void integrate | ( | doublereal | t0, |
doublereal | t1 | ||
) |
Integrate from t0 to t1. The integrator is reinitialized first.
This routine does a time accurate solve from t = t0 to t = t1. of the surface problem.
t0 | Initial Time -> this is an input |
t1 | Final Time -> This is an input |
Definition at line 155 of file ImplicitSurfChem.cpp.
References Integrator::initialize(), Integrator::integrate(), ImplicitSurfChem::m_integ, Integrator::setMaxStepSize(), Integrator::solution(), and ImplicitSurfChem::updateState().
Referenced by InterfaceKinetics::advanceCoverages().
void integrate0 | ( | doublereal | t0, |
doublereal | t1 | ||
) |
Integrate from t0 to t1 without reinitializing the integrator.
Use when the coverages have not changed from their values on return from the last call to integrate or integrate0.
t0 | Initial Time -> this is an input |
t1 | Final Time -> This is an input |
Definition at line 172 of file ImplicitSurfChem.cpp.
References Integrator::integrate(), ImplicitSurfChem::m_integ, Integrator::solution(), and ImplicitSurfChem::updateState().
void solvePseudoSteadyStateProblem | ( | int | ifuncOverride = -1 , |
doublereal | timeScaleOverride = 1.0 |
||
) |
Solve for the pseudo steady-state of the surface problem.
Solve for the steady state of the surface problem. This is the same thing as the advanceCoverages() function, but at infinite times.
Note, a direct solve is carried out under the hood here, to reduce the computational time.
ifuncOverride | 4 values are possible 1 SFLUX_INITIALIZE 2 SFLUX_RESIDUAL 3 SFLUX_JACOBIAN 4 SFLUX_TRANSIENT The default is -1, which means that the program will decide. |
timeScaleOverride | When a pseudo transient is selected this value can be used to override the default time scale for integration which is one. When SFLUX_TRANSIENT is used, this is equal to the time over which the equations are integrated. When SFLUX_INITIALIZE is used, this is equal to the time used in the initial transient algorithm, before the equation system is solved directly. |
Definition at line 220 of file ImplicitSurfChem.cpp.
References DATA_PTR, ImplicitSurfChem::m_commonTempPressForPhases, ImplicitSurfChem::m_concSpecies, ImplicitSurfChem::m_ioFlag, ImplicitSurfChem::m_nv, ImplicitSurfChem::m_surfSolver, ImplicitSurfChem::m_vecKinPtrs, ThermoPhase::pressure(), ImplicitSurfChem::setCommonState_TP(), ImplicitSurfChem::setConcSpecies(), SFLUX_INITIALIZE, solveSP::solveSurfProb(), Phase::temperature(), and Kinetics::thermo().
Referenced by InterfaceKinetics::solvePseudoSteadyStateProblem().
|
inlinevirtual |
Return the number of equations.
Implements FuncEval.
Definition at line 145 of file ImplicitSurfChem.h.
References ImplicitSurfChem::m_nv.
|
virtual |
Evaluate the value of ydot[k] at the current conditions.
t | Time (seconds) |
y | Vector containing the current solution vector |
ydot | Output vector containing the value of the derivative of the surface coverages. |
p | Unused parameter pass-through parameter vector |
Implements FuncEval.
Definition at line 190 of file ImplicitSurfChem.cpp.
References DATA_PTR, ImplicitSurfChem::m_nsp, ImplicitSurfChem::m_nsurf, ImplicitSurfChem::m_surf, ImplicitSurfChem::m_surfindex, ImplicitSurfChem::m_vecKinPtrs, and ImplicitSurfChem::updateState().
|
virtual |
Set the initial conditions for the solution vector.
t0 | Initial time |
leny | Length of the solution vector |
y | Value of the solution vector to be used. On output, this contains the initial value of the solution. |
Implements FuncEval.
Definition at line 127 of file ImplicitSurfChem.cpp.
References ImplicitSurfChem::m_nsp, ImplicitSurfChem::m_nsurf, and ImplicitSurfChem::m_surf.
void setConcSpecies | ( | const doublereal *const | vecConcSpecies | ) |
Sets the concentrations within phases that are unknowns in the surface problem.
Fills the local concentration vector for all of the species in all of the phases that are unknowns in the surface problem.
vecConcSpecies | Vector of concentrations. The phase concentration vectors are contiguous within the object, in the same order as the unknown vector. |
Definition at line 349 of file ImplicitSurfChem.cpp.
References ImplicitSurfChem::m_bulkPhases, ImplicitSurfChem::m_nsurf, ImplicitSurfChem::m_nv, ImplicitSurfChem::m_surf, Phase::nSpecies(), and Phase::setConcentrations().
Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().
void setCommonState_TP | ( | doublereal | TKelvin, |
doublereal | PresPa | ||
) |
Sets the state variable in all thermodynamic phases (surface and surrounding bulk phases) to the input temperature and pressure.
TKelvin | input temperature (kelvin) |
PresPa | input pressure in pascal. |
Definition at line 375 of file ImplicitSurfChem.cpp.
References ImplicitSurfChem::m_bulkPhases, ImplicitSurfChem::m_nsurf, ImplicitSurfChem::m_surf, and ThermoPhase::setState_TP().
Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().
|
inline |
Returns a reference to the vector of pointers to the InterfaceKinetics objects.
This should probably go away in the future, as it opens up the class.
Definition at line 215 of file ImplicitSurfChem.h.
References ImplicitSurfChem::m_vecKinPtrs.
|
protected |
Set the mixture to a state consistent with solution vector y.
This function will set the surface site factions in the underlying SurfPhase objects to the current value of the solution vector.
y | Current value of the solution vector. The lenth is equal to the sum of the number of surface sites in all the surface phases |
Definition at line 178 of file ImplicitSurfChem.cpp.
References ImplicitSurfChem::m_nsp, ImplicitSurfChem::m_nsurf, and ImplicitSurfChem::m_surf.
Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::integrate(), and ImplicitSurfChem::integrate0().
|
inlinevirtualinherited |
Number of parameters.
Definition at line 56 of file FuncEval.h.
|
friend |
We make the solveSS class a friend because we need to access all of the above information directly.
Adding the members into the class is also a possibility.
Definition at line 327 of file ImplicitSurfChem.h.
|
protected |
vector of pointers to surface phases.
Definition at line 242 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::getInitialConditions(), ImplicitSurfChem::ImplicitSurfChem(), ImplicitSurfChem::setCommonState_TP(), ImplicitSurfChem::setConcSpecies(), and ImplicitSurfChem::updateState().
|
protected |
Vector of pointers to bulk phases.
Definition at line 245 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::ImplicitSurfChem(), ImplicitSurfChem::setCommonState_TP(), and ImplicitSurfChem::setConcSpecies().
|
protected |
vector of pointers to InterfaceKinetics objects
Definition at line 248 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::getObjects(), ImplicitSurfChem::ImplicitSurfChem(), and ImplicitSurfChem::solvePseudoSteadyStateProblem().
|
protected |
Vector of number of species in each Surface Phase.
Definition at line 251 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::getInitialConditions(), ImplicitSurfChem::ImplicitSurfChem(), and ImplicitSurfChem::updateState().
|
protected |
index of the surface phase in each InterfaceKinetics object
Definition at line 254 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::eval(), and ImplicitSurfChem::ImplicitSurfChem().
|
protected |
Total number of surface phases.
This is also equal to the number of InterfaceKinetics objects as there is a 1-1 correspondence between InterfaceKinetics objects and surface phases.
Definition at line 264 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::getInitialConditions(), ImplicitSurfChem::ImplicitSurfChem(), ImplicitSurfChem::setCommonState_TP(), ImplicitSurfChem::setConcSpecies(), and ImplicitSurfChem::updateState().
|
protected |
Total number of surface species in all surface phases.
This is the total number of unknowns in m_mode 0 problem
Definition at line 270 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::ImplicitSurfChem(), ImplicitSurfChem::neq(), ImplicitSurfChem::setConcSpecies(), and ImplicitSurfChem::solvePseudoSteadyStateProblem().
|
protected |
Pointer to the cvode integrator.
Definition at line 279 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::ImplicitSurfChem(), ImplicitSurfChem::initialize(), ImplicitSurfChem::integrate(), ImplicitSurfChem::integrate0(), and ImplicitSurfChem::~ImplicitSurfChem().
|
protected |
Temporary vector - length num species in the Kinetics object.
This is the sum of the number of species in each phase included in the kinetics object.
Definition at line 291 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::ImplicitSurfChem(), and ImplicitSurfChem::solvePseudoSteadyStateProblem().
|
protected |
Index into the species vector of the kinetics manager, pointing to the first species from the surrounding medium.
Definition at line 300 of file ImplicitSurfChem.h.
|
protected |
Index into the species vector of the kinetics manager, pointing to the first species from the condensed phase of the particles.
Definition at line 306 of file ImplicitSurfChem.h.
|
protected |
Index into the species vector of the kinetics manager, pointing to the first species from the surface of the particles.
Definition at line 312 of file ImplicitSurfChem.h.
|
protected |
Pointer to the helper method, Placid, which solves the surface problem.
Definition at line 317 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem(), and ImplicitSurfChem::~ImplicitSurfChem().
|
protected |
If true, a common temperature and pressure for all surface and bulk phases associated with the surface problem is imposed.
Definition at line 322 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().
|
private |
Controls the amount of printing from this routine and underlying routines.
Definition at line 333 of file ImplicitSurfChem.h.
Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().