Cantera  2.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
ImplicitSurfChem Class Reference

Advances the surface coverages of the associated set of SurfacePhase objects in time. More...

#include <ImplicitSurfChem.h>

Inheritance diagram for ImplicitSurfChem:
[legend]
Collaboration diagram for ImplicitSurfChem:
[legend]

Public Member Functions

 ImplicitSurfChem (std::vector< InterfaceKinetics *> k)
 Constructor for multiple surfaces. More...
 
virtual void initialize (doublereal t0=0.0)
 
void integrate (doublereal t0, doublereal t1)
 Integrate from t0 to t1. The integrator is reinitialized first. More...
 
void integrate0 (doublereal t0, doublereal t1)
 Integrate from t0 to t1 without reinitializing the integrator. More...
 
void solvePseudoSteadyStateProblem (int ifuncOverride=-1, doublereal timeScaleOverride=1.0)
 Solve for the pseudo steady-state of the surface problem. More...
 
virtual size_t neq ()
 Return the number of equations. More...
 
virtual void eval (doublereal t, doublereal *y, doublereal *ydot, doublereal *p)
 Evaluate the value of ydot[k] at the current conditions. More...
 
virtual void getState (doublereal *y)
 Get the current state of the solution vector. More...
 
void getConcSpecies (doublereal *const vecConcSpecies) const
 
void setConcSpecies (const doublereal *const vecConcSpecies)
 Sets the concentrations within phases that are unknowns in the surface problem. More...
 
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. More...
 
std::vector< InterfaceKinetics * > & getObjects ()
 Returns a reference to the vector of pointers to the InterfaceKinetics objects. More...
 
int checkMatch (std::vector< ThermoPhase *> m_vec, ThermoPhase *thPtr)
 
void setIOFlag (int ioFlag)
 
- Public Member Functions inherited from FuncEval
int eval_nothrow (double t, double *y, double *ydot)
 Evaluate the right-hand side using return code to indicate status. More...
 
virtual size_t nparams ()
 Number of sensitivity parameters. More...
 
void suppressErrors (bool suppress)
 Enable or disable suppression of errors when calling eval() More...
 
bool suppressErrors () const
 Get current state of error suppression. More...
 
std::string getErrors () const
 Return a string containing the text of any suppressed errors. More...
 
void clearErrors ()
 Clear any previously-stored suppressed errors. More...
 

Protected Member Functions

void updateState (doublereal *y)
 Set the mixture to a state consistent with solution vector y. More...
 

Protected Attributes

std::vector< SurfPhase * > m_surf
 vector of pointers to surface phases. More...
 
std::vector< ThermoPhase * > m_bulkPhases
 Vector of pointers to bulk phases. More...
 
std::vector< InterfaceKinetics * > m_vecKinPtrs
 vector of pointers to InterfaceKinetics objects More...
 
std::vector< size_t > m_nsp
 Vector of number of species in each Surface Phase. More...
 
std::vector< size_t > m_surfindex
 index of the surface phase in each InterfaceKinetics object More...
 
std::vector< size_t > m_specStartIndex
 
size_t m_nv
 Total number of surface species in all surface phases. More...
 
size_t m_numTotalBulkSpecies
 
size_t m_numTotalSpecies
 
std::vector< vector_intpLocVec
 
std::unique_ptr< Integratorm_integ
 Pointer to the CVODE integrator. More...
 
doublereal m_atol
 
doublereal m_rtol
 
doublereal m_maxstep
 max step size More...
 
vector_fp m_work
 
vector_fp m_concSpecies
 Temporary vector - length num species in the Kinetics object. More...
 
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. More...
 
int m_bulkSpeciesStart
 Index into the species vector of the kinetics manager, pointing to the first species from the condensed phase of the particles. More...
 
int m_surfSpeciesStart
 Index into the species vector of the kinetics manager, pointing to the first species from the surface of the particles. More...
 
std::unique_ptr< solveSPm_surfSolver
 Pointer to the helper method, Placid, which solves the surface problem. More...
 
bool m_commonTempPressForPhases
 If true, a common temperature and pressure for all surface and bulk phases associated with the surface problem is imposed. More...
 
- Protected Attributes inherited from FuncEval
bool m_suppress_errors
 
std::vector< std::string > m_errors
 Errors occuring during function evaluations. More...
 

Private Attributes

int m_ioFlag
 Controls the amount of printing from this routine and underlying routines. More...
 

Friends

class solveSS
 We make the solveSS class a friend because we need to access all of the above information directly. More...
 

Additional Inherited Members

- Public Attributes inherited from FuncEval
vector_fp m_sens_params
 Values for the problem parameters for which sensitivities are computed This is the array which is perturbed and passed back as the fourth argument to eval(). More...
 
vector_fp m_paramScales
 Scaling factors for each sensitivity parameter. More...
 

Detailed Description

Advances the surface coverages of the associated set of SurfacePhase objects in time.

This function advances a set of SurfPhase 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,

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 56 of file ImplicitSurfChem.h.

Constructor & Destructor Documentation

◆ ImplicitSurfChem()

ImplicitSurfChem ( std::vector< InterfaceKinetics *>  k)

Constructor for multiple surfaces.

Parameters
kVector 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 20 of file ImplicitSurfChem.cpp.

Member Function Documentation

◆ initialize()

void initialize ( doublereal  t0 = 0.0)
virtual

Must be called before calling method 'advance'

Definition at line 107 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_integ.

Referenced by InterfaceKinetics::advanceCoverages(), and InterfaceKinetics::solvePseudoSteadyStateProblem().

◆ integrate()

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.

Parameters
t0Initial Time -> this is an input
t1Final Time -> This is an input

Definition at line 113 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_integ, and ImplicitSurfChem::updateState().

Referenced by InterfaceKinetics::advanceCoverages().

◆ integrate0()

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.

Parameters
t0Initial Time -> this is an input
t1Final Time -> This is an input

Definition at line 121 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_integ, and ImplicitSurfChem::updateState().

◆ solvePseudoSteadyStateProblem()

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.

Parameters
ifuncOverrideOne of the values defined in Surface Problem Solver Methods. The default is -1, which means that the program will decide.
timeScaleOverrideWhen 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 155 of file ImplicitSurfChem.cpp.

References BULK_ETCH, ImplicitSurfChem::getConcSpecies(), 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, SFLUX_RESIDUAL, and Phase::temperature().

Referenced by InterfaceKinetics::solvePseudoSteadyStateProblem().

◆ neq()

virtual size_t neq ( )
inlinevirtual

Return the number of equations.

Implements FuncEval.

Definition at line 119 of file ImplicitSurfChem.h.

References ImplicitSurfChem::m_nv.

◆ eval()

void eval ( doublereal  t,
doublereal *  y,
doublereal *  ydot,
doublereal *  p 
)
virtual

Evaluate the value of ydot[k] at the current conditions.

Parameters
tTime (seconds)
yVector containing the current solution vector
ydotOutput vector containing the value of the derivative of the surface coverages.
pUnused parameter pass-through parameter vector

Implements FuncEval.

Definition at line 136 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_nsp, ImplicitSurfChem::m_surf, ImplicitSurfChem::m_surfindex, ImplicitSurfChem::m_vecKinPtrs, and ImplicitSurfChem::updateState().

◆ getState()

void getState ( doublereal *  y)
virtual

Get the current state of the solution vector.

Parameters
yValue of the solution vector to be used. On output, this contains the initial value of the solution.

Reimplemented from FuncEval.

Definition at line 98 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_nsp, and ImplicitSurfChem::m_surf.

◆ getConcSpecies()

void getConcSpecies ( doublereal *const  vecConcSpecies) const

Get the specifications for the problem from the values in the ThermoPhase objects for all phases.

  1. concentrations of all species in all phases, m_concSpecies
  2. Temperature and pressure
Parameters
vecConcSpeciesVector of concentrations. The phase concentration vectors are contiguous within the object, in the same order as the unknown vector.

Definition at line 231 of file ImplicitSurfChem.cpp.

References Phase::getConcentrations(), ImplicitSurfChem::m_bulkPhases, ImplicitSurfChem::m_nv, ImplicitSurfChem::m_surf, and Phase::nSpecies().

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ setConcSpecies()

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.

Parameters
vecConcSpeciesVector of concentrations. The phase concentration vectors are contiguous within the object, in the same order as the unknown vector.

Definition at line 247 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_bulkPhases, ImplicitSurfChem::m_nv, ImplicitSurfChem::m_surf, Phase::nSpecies(), and Phase::setConcentrations().

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ setCommonState_TP()

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.

Parameters
TKelvininput temperature (kelvin)
PresPainput pressure in pascal.

Definition at line 263 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_bulkPhases, ImplicitSurfChem::m_surf, and ThermoPhase::setState_TP().

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ getObjects()

std::vector<InterfaceKinetics*>& getObjects ( )
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 180 of file ImplicitSurfChem.h.

References ImplicitSurfChem::m_vecKinPtrs.

◆ updateState()

void updateState ( doublereal *  y)
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.

Parameters
yCurrent 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 127 of file ImplicitSurfChem.cpp.

References ImplicitSurfChem::m_nsp, and ImplicitSurfChem::m_surf.

Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::integrate(), and ImplicitSurfChem::integrate0().

Friends And Related Function Documentation

◆ solveSS

friend class solveSS
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 270 of file ImplicitSurfChem.h.

Member Data Documentation

◆ m_surf

std::vector<SurfPhase*> m_surf
protected

◆ m_bulkPhases

std::vector<ThermoPhase*> m_bulkPhases
protected

Vector of pointers to bulk phases.

Definition at line 206 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::getConcSpecies(), ImplicitSurfChem::setCommonState_TP(), and ImplicitSurfChem::setConcSpecies().

◆ m_vecKinPtrs

std::vector<InterfaceKinetics*> m_vecKinPtrs
protected

◆ m_nsp

std::vector<size_t> m_nsp
protected

Vector of number of species in each Surface Phase.

Definition at line 212 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::eval(), ImplicitSurfChem::getState(), and ImplicitSurfChem::updateState().

◆ m_surfindex

std::vector<size_t> m_surfindex
protected

index of the surface phase in each InterfaceKinetics object

Definition at line 215 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::eval().

◆ m_nv

size_t m_nv
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 223 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::getConcSpecies(), ImplicitSurfChem::neq(), ImplicitSurfChem::setConcSpecies(), and ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ m_integ

std::unique_ptr<Integrator> m_integ
protected

Pointer to the CVODE integrator.

Definition at line 230 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::initialize(), ImplicitSurfChem::integrate(), and ImplicitSurfChem::integrate0().

◆ m_maxstep

doublereal m_maxstep
protected

max step size

Definition at line 232 of file ImplicitSurfChem.h.

◆ m_concSpecies

vector_fp m_concSpecies
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 240 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ m_mediumSpeciesStart

int m_mediumSpeciesStart
protected

Index into the species vector of the kinetics manager, pointing to the first species from the surrounding medium.

Definition at line 247 of file ImplicitSurfChem.h.

◆ m_bulkSpeciesStart

int m_bulkSpeciesStart
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 252 of file ImplicitSurfChem.h.

◆ m_surfSpeciesStart

int m_surfSpeciesStart
protected

Index into the species vector of the kinetics manager, pointing to the first species from the surface of the particles.

Definition at line 257 of file ImplicitSurfChem.h.

◆ m_surfSolver

std::unique_ptr<solveSP> m_surfSolver
protected

Pointer to the helper method, Placid, which solves the surface problem.

Definition at line 261 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ m_commonTempPressForPhases

bool m_commonTempPressForPhases
protected

If true, a common temperature and pressure for all surface and bulk phases associated with the surface problem is imposed.

Definition at line 265 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().

◆ m_ioFlag

int m_ioFlag
private

Controls the amount of printing from this routine and underlying routines.

Definition at line 275 of file ImplicitSurfChem.h.

Referenced by ImplicitSurfChem::solvePseudoSteadyStateProblem().


The documentation for this class was generated from the following files: