Cantera  2.5.1
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members

Method to solve a pseudo steady state surface problem. More...

#include <solveSP.h>

Collaboration diagram for solveSP:
[legend]

Public Member Functions

 solveSP (ImplicitSurfChem *surfChemPtr, int bulkFunc=BULK_ETCH)
 Constructor for the object. More...
 
 ~solveSP ()
 Destructor. Deletes the integrator. More...
 
int solveSurfProb (int ifunc, doublereal time_scale, doublereal TKelvin, doublereal PGas, doublereal reltol, doublereal abstol)
 Main routine that actually calculates the pseudo steady state of the surface problem. More...
 

Public Attributes

int m_ioflag
 

Private Member Functions

 solveSP (const solveSP &right)
 Unimplemented private copy constructor. More...
 
solveSPoperator= (const solveSP &right)
 Unimplemented private assignment operator. More...
 
void print_header (int ioflag, int ifunc, doublereal time_scale, int damping, doublereal reltol, doublereal abstol)
 Printing routine that optionally gets called at the start of every invocation. More...
 
void printIteration (int ioflag, doublereal damp, int label_d, int label_t, doublereal inv_t, doublereal t_real, size_t iter, doublereal update_norm, doublereal resid_norm, bool do_time, bool final=false)
 Printing routine that gets called after every iteration. More...
 
doublereal calc_t (doublereal netProdRateSolnSP[], doublereal XMolSolnSP[], int *label, int *label_old, doublereal *label_factor, int ioflag)
 Calculate a conservative delta T to use in a pseudo-steady state algorithm. More...
 
void calcWeights (doublereal wtSpecies[], doublereal wtResid[], const Array2D &Jac, const doublereal CSolnSP[], const doublereal abstol, const doublereal reltol)
 Calculate the solution and residual weights. More...
 
void updateState (const doublereal *cSurfSpec)
 Update the surface states of the surface phases. More...
 
void updateMFSolnSP (doublereal *XMolSolnSP)
 Update mole fraction vector consisting of unknowns in surface problem. More...
 
void updateMFKinSpecies (doublereal *XMolKinSp, int isp)
 Update the mole fraction vector for a specific kinetic species vector corresponding to one InterfaceKinetics object. More...
 
void evalSurfLarge (const doublereal *CSolnSP)
 Update the vector that keeps track of the largest species in each surface phase. More...
 
void fun_eval (doublereal *resid, const doublereal *CSolnSP, const doublereal *CSolnOldSP, const bool do_time, const doublereal deltaT)
 Main Function evaluation. More...
 
void resjac_eval (DenseMatrix &jac, doublereal *resid, doublereal *CSolnSP, const doublereal *CSolnSPOld, const bool do_time, const doublereal deltaT)
 Main routine that calculates the current residual and Jacobian. More...
 

Private Attributes

ImplicitSurfChemm_SurfChemPtr
 Pointer to the manager of the implicit surface chemistry problem. More...
 
std::vector< InterfaceKinetics * > & m_objects
 Vector of interface kinetics objects. More...
 
size_t m_neq
 Total number of equations to solve in the implicit problem. More...
 
int m_bulkFunc
 This variable determines how the bulk phases are to be handled. More...
 
size_t m_numSurfPhases
 Number of surface phases in the surface problem. More...
 
size_t m_numTotSurfSpecies
 Total number of surface species in all surface phases. More...
 
std::vector< size_t > m_indexKinObjSurfPhase
 Mapping between the surface phases and the InterfaceKinetics objects. More...
 
std::vector< size_t > m_nSpeciesSurfPhase
 Vector of length number of surface phases containing the number of surface species in each phase. More...
 
std::vector< SurfPhase * > m_ptrsSurfPhase
 Vector of surface phase pointers. More...
 
std::vector< size_t > m_eqnIndexStartSolnPhase
 Index of the start of the unknowns for each solution phase. More...
 
std::vector< size_t > m_kinObjPhaseIDSurfPhase
 Phase ID in the InterfaceKinetics object of the surface phase. More...
 
size_t m_numBulkPhasesSS
 Total number of volumetric condensed phases included in the steady state problem handled by this routine. More...
 
std::vector< size_t > m_numBulkSpecies
 Vector of number of species in the m_numBulkPhases phases. More...
 
size_t m_numTotBulkSpeciesSS
 Total number of species in all bulk phases. More...
 
std::vector< ThermoPhase * > m_bulkPhasePtrs
 Vector of bulk phase pointers, length is equal to m_numBulkPhases. More...
 
std::vector< size_t > m_kinSpecIndex
 Index between the equation index and the position in the kinetic species array for the appropriate kinetics operator. More...
 
std::vector< size_t > m_kinObjIndex
 Index between the equation index and the index of the InterfaceKinetics object. More...
 
std::vector< size_t > m_spSurfLarge
 Vector containing the indices of the largest species in each surface phase. More...
 
doublereal m_atol
 The absolute tolerance in real units. units are (kmol/m2) More...
 
doublereal m_rtol
 The relative error tolerance. More...
 
doublereal m_maxstep
 maximum value of the time step. units = seconds More...
 
size_t m_maxTotSpecies
 Maximum number of species in any single kinetics operator -> also maxed wrt the total # of solution species. More...
 
vector_fp m_netProductionRatesSave
 Temporary vector with length equal to max m_maxTotSpecies. More...
 
vector_fp m_numEqn1
 Temporary vector with length equal to max m_maxTotSpecies. More...
 
vector_fp m_numEqn2
 Temporary vector with length equal to max m_maxTotSpecies. More...
 
vector_fp m_CSolnSave
 Temporary vector with length equal to max m_maxTotSpecies. More...
 
vector_fp m_CSolnSP
 Solution vector. length MAX(1, m_neq) More...
 
vector_fp m_CSolnSPInit
 Saved initial solution vector. length MAX(1, m_neq) More...
 
vector_fp m_CSolnSPOld
 Saved solution vector at the old time step. length MAX(1, m_neq) More...
 
vector_fp m_wtResid
 Weights for the residual norm calculation. length MAX(1, m_neq) More...
 
vector_fp m_wtSpecies
 Weights for the species concentrations norm calculation. More...
 
vector_fp m_resid
 Residual for the surface problem. More...
 
vector_fp m_XMolKinSpecies
 Vector of mole fractions. length m_maxTotSpecies. More...
 
DenseMatrix m_Jac
 Jacobian. More...
 

Detailed Description

Method to solve a pseudo steady state surface problem.

The following class handles solving the surface problem. The calculation uses Newton's method to obtain the surface fractions of the surface and bulk species by requiring that the surface species production rate = 0 and that the either the bulk fractions are proportional to their production rates or they are constants.

Currently, the bulk mole fractions are treated as constants. Implementation of their being added to the unknown solution vector is delayed.

Lets introduce the unknown vector for the "surface problem". The surface problem is defined as the evaluation of the surface site fractions for multiple surface phases. The unknown vector will consist of the vector of surface concentrations for each species in each surface vector. Species are grouped first by their surface phases

The unknown solution vector is defined as follows:

C_i_j kindexSP
C_0_0 0
C_1_0 1
C_2_0 2
. . . ...
C_N0-1_0 N0-1
C_0_1 N0
C_1_1 N0+1
C_2_1 N0+2
. . . ...
C_N1-1_1 NO+N1-1

Note there are a couple of different types of species indices floating around in the formulation of this object.

kindexSP: This is the species index in the contiguous vector of unknowns for the surface problem.

Note, in the future, BULK_DEPOSITION systems will be added, and the solveSP unknown vector will get more complicated. It will include the mole fraction and growth rates of specified bulk phases

Indices which relate to individual kinetics objects use the suffix KSI (kinetics species index).

Solution Method

This routine is typically used within a residual calculation in a large code. It's typically invoked millions of times for large calculations, and it must work every time. Therefore, requirements demand that it be robust but also efficient.

The solution methodology is largely determined by the ifunc parameter, that is input to the solution object. This parameter may have one of the values defined in Surface Problem Solver Methods.

Pseudo time stepping algorithm:

The time step is determined from sdot[], so that the time step doesn't ever change the value of a variable by more than 100%.

This algorithm does use a damped Newton's method to relax the equations. Damping is based on a "delta damping" technique. The solution unknowns are not allowed to vary too much between iterations.

EXTRA_ACCURACY: A constant that is the ratio of the required update norm in this Newton iteration compared to that in the nonlinear solver. A value of 0.1 is used so surface species are safely overconverged.

Functions called:

Definition at line 138 of file solveSP.h.


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