-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Reactor] Add ReactorSurface to simplify use of surface reactions
This separates the handling of interactions between reactors (mediated by Wall objects) and surfaces on which surface reactions occur (handled by ReactorSurface). This simplifies the implementation within reactor, and reduces the complexity of user code involving surface reactions by eliminating the need to set up a Reservoir object for the opposite side of a Wall object that is only being used for surface reactions.
- Loading branch information
Showing
8 changed files
with
321 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
//! @file ReactorSurface.h Header file for class ReactorSurface | ||
|
||
#ifndef CT_REACTOR_SURFACE_H | ||
#define CT_REACTOR_SURFACE_H | ||
|
||
#include "cantera/zeroD/ReactorBase.h" | ||
|
||
namespace Cantera | ||
{ | ||
|
||
class Kinetics; | ||
class SurfPhase; | ||
|
||
class ReactorSurface | ||
{ | ||
public: | ||
ReactorSurface(); | ||
|
||
//! Returns the surface area [m^2] | ||
double area() const; | ||
|
||
//! Set the surface area [m^2] | ||
void setArea(double a); | ||
|
||
//! Accessor for the SurfPhase object | ||
SurfPhase* thermo() { | ||
return m_thermo; | ||
} | ||
|
||
//! Accessor for the InterfaceKinetics object | ||
Kinetics* kinetics() { | ||
return m_kinetics; | ||
} | ||
|
||
//! Set the InterfaceKinetics object for this surface | ||
void setKinetics(Kinetics* kin); | ||
|
||
//! Set the reactor that this Surface interacts with | ||
void setReactor(ReactorBase* reactor); | ||
|
||
//! Number of sensitivity parameters associated with reactions on this | ||
//! surface | ||
size_t nSensParams() const { | ||
return m_params.size(); | ||
} | ||
|
||
//! Set the surface coverages. Array `cov` has length equal to the number of | ||
//! surface species. | ||
void setCoverages(const double* cov); | ||
|
||
//! Set the surface coverages by name | ||
void setCoverages(const Composition& cov); | ||
|
||
//! Set the surface coverages by name | ||
void setCoverages(const std::string& cov); | ||
|
||
//! Get the surface coverages. Array `cov` should have length equal to the | ||
//! number of surface species. | ||
void getCoverages(double* cov) const; | ||
|
||
//! Set the coverages in the surface phase object to the values for this | ||
//! surface. | ||
void syncCoverages(); | ||
|
||
//! Enable calculation of sensitivities with respect to the rate constant | ||
//! for reaction `i`. | ||
void addSensitivityReaction(size_t i); | ||
|
||
//! Set reaction rate multipliers. `params` is the global vector of | ||
//! sensitivity parameters. This function is called within | ||
//! ReactorNet::eval() before the reaction rates are evaluated. | ||
void setSensitivityParameters(const double* params); | ||
|
||
//! Set reaction rate multipliers back to their initial values. This | ||
//! function is called within ReactorNet::eval() after all rates have been | ||
//! evaluated. | ||
void resetSensitivityParameters(); | ||
|
||
protected: | ||
double m_area; | ||
|
||
SurfPhase* m_thermo; | ||
Kinetics* m_kinetics; | ||
ReactorBase* m_reactor; | ||
vector_fp m_cov; | ||
std::vector<SensitivityParameter> m_params; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.