MCPcopy Create free account
hub / github.com/Cantera/cantera / main

Function main

test_problems/surfSolverTest/surfaceSolver2.cpp:135–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135int main(int argc, char** argv)
136{
137 string infile = "haca2.yaml";
138 string gasPhaseName = "gas";
139 string bulkParticlePhaseName = "soot";
140 string surfParticlePhaseName = "soot_interface";
141 int ioflag = 1;
142
143 try {
144 auto gasTP = newThermo(infile, gasPhaseName);
145 size_t nspGas = gasTP->nSpecies();
146 cout << "Number of species = " << nspGas << endl;
147
148 auto bulkPhaseTP = newThermo(infile, bulkParticlePhaseName);
149 size_t nspBulk = bulkPhaseTP->nSpecies();
150 cout << "Number of species in bulk phase named " <<
151 bulkParticlePhaseName << " = " << nspBulk << endl;
152
153 auto surfPhaseTP = newThermo(infile, surfParticlePhaseName);
154 size_t nsp_d100 = surfPhaseTP->nSpecies();
155 cout << "Number of species in surface phase, " << surfParticlePhaseName
156 << " = " << nsp_d100 << endl;
157
158 auto kin = newKinetics({surfPhaseTP, gasTP, bulkPhaseTP}, infile);
159 auto iKin_ptr = dynamic_pointer_cast<InterfaceKinetics>(kin);
160 size_t nr = iKin_ptr->nReactions();
161 cout << "Number of reactions = " << nr << endl;
162
163 ofstream ofile("results2.txt");
164
165 // create a second copy of the same surface phase
166 // (this is a made up problem btw to check the software capability)
167 auto surfPhaseTP2 = newThermo(infile, surfParticlePhaseName);
168 size_t nsp2 = surfPhaseTP2->nSpecies();
169 string pname = surfPhaseTP2->name();
170 cout << "Number of species in 2nd surface phase, " << pname
171 << " = " << nsp2 << endl;
172
173 // create the second InterfaceKinetics object based on the
174 // second surface phase.
175 auto kin2 = newKinetics({surfPhaseTP2, gasTP, bulkPhaseTP}, infile);
176 auto iKin2_ptr = dynamic_pointer_cast<InterfaceKinetics>(kin2);
177 nr = iKin_ptr->nReactions();
178 cout << "Number of reactions = " << nr << endl;
179
180 double x[MSSIZE];
181
182 /*
183 * Set-up the Surface Problem
184 * This problem will consist of 2 identical InterfaceKinetics objects
185 */
186 vector<InterfaceKinetics*> vecKinPtrs { iKin_ptr.get(), iKin2_ptr.get() };
187
188 // Create the ImplicitSurfChem problem
189 // Initialize it and call the pseudo steadystate capability.
190 ImplicitSurfChem* surfaceProb = new ImplicitSurfChem(vecKinPtrs);
191 surfaceProb->initialize();
192 surfaceProb->setIOFlag(ioflag);

Callers

nothing calls this directly

Calls 15

newThermoFunction · 0.85
newKineticsFunction · 0.85
appdeleteFunction · 0.85
getNetProductionRatesMethod · 0.80
whatMethod · 0.80
printGasFunction · 0.70
printBulkFunction · 0.70
printSurfFunction · 0.70
nSpeciesMethod · 0.45
nReactionsMethod · 0.45
nameMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected