Cantera  3.2.0a2
Loading...
Searching...
No Matches
ctmix.h
Go to the documentation of this file.
1/**
2 * CTMIX - Generated CLib %Cantera interface library.
3 *
4 * @file ctmix.h
5 *
6 * Generated CLib API for %Cantera's MultiPhase class.
7 *
8 * This library of functions is designed to encapsulate %Cantera functionality
9 * and make it available for use in languages and applications other than C++.
10 * A set of library functions is provided that are declared "extern C". All
11 * %Cantera objects are stored and referenced by integers - no pointers are
12 * passed to or from the calling application.
13 *
14 * This file was generated by sourcegen. It will be re-generated by the
15 * %Cantera build process. Do not manually edit.
16 *
17 * @warning This library is an experimental part of the %Cantera API and
18 * may be changed without notice.
19 */
20
21// This file is part of Cantera. See License.txt in the top-level directory or
22// at https://cantera.org/license.txt for license and copyright information.
23
24#ifndef CTMIX_H
25#define CTMIX_H
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31 /**
32 * @defgroup CAPIctmix ctmix Library
33 * Generated CLib API for %Cantera's MultiPhase class.
34 *
35 * @warning This library is an experimental part of the %Cantera API and
36 * may be changed or removed without notice.
37 *
38 * @ingroup CAPIindex
39 */
40
41 /**
42 * @addtogroup CAPIctmix
43 * @{
44 */
45
46 /**
47 * Instantiate MultiPhase object using default constructor.
48 *
49 * Wraps C++ constructor: `undefined`
50 *
51 * @returns Object handle if successful and -1 for exception handling.
52 */
53 int32_t mix_new();
54
55 /**
56 * Add a phase to the mixture.
57 *
58 * Wraps C++ method: `void MultiPhase::addPhase(shared_ptr<ThermoPhase>, double)`
59 *
60 * @param handle Handle to queried MultiPhase object.
61 * @param p Integer handle to ThermoPhase object. pointer to the phase object
62 * @param moles total number of moles of all species in this phase
63 */
64 int32_t mix_addPhase(int32_t handle, int32_t p, double moles);
65
66 /**
67 * Process phases and build atomic composition array.
68 *
69 * Wraps C++ method: `void MultiPhase::init()`
70 *
71 * @param handle Handle to queried MultiPhase object.
72 */
73 int32_t mix_init(int32_t handle);
74
75 /**
76 * Set the states of the phase objects to the locally-stored state within this MultiPhase object.
77 *
78 * Wraps C++ method: `void MultiPhase::updatePhases()`
79 *
80 * @param handle Handle to queried MultiPhase object.
81 */
82 int32_t mix_updatePhases(int32_t handle);
83
84 /**
85 * Number of elements.
86 *
87 * Wraps C++ getter: `size_t MultiPhase::nElements()`
88 *
89 * @param handle Handle to queried MultiPhase object.
90 */
91 int32_t mix_nElements(int32_t handle);
92
93 /**
94 * Returns the index of the element with name
95 *
96 * Wraps C++ method: `size_t MultiPhase::elementIndex(const string&)`
97 *
98 * @param handle Handle to queried MultiPhase object.
99 * @param name String name of the global element
100 */
101 int32_t mix_elementIndex(int32_t handle, const char* name);
102
103 /**
104 * Number of species, summed over all phases.
105 *
106 * Wraps C++ getter: `size_t MultiPhase::nSpecies()`
107 *
108 * @param handle Handle to queried MultiPhase object.
109 */
110 int32_t mix_nSpecies(int32_t handle);
111
112 /**
113 * Return the global index of the species belonging to phase number
114 *
115 * Wraps C++ method: `size_t MultiPhase::speciesIndex(size_t, size_t)`
116 *
117 * @param handle Handle to queried MultiPhase object.
118 * @param k local index of the species within the phase
119 * @param p index of the phase
120 */
121 int32_t mix_speciesIndex(int32_t handle, int32_t k, int32_t p);
122
123 /**
124 * Temperature [K].
125 *
126 * Wraps C++ getter: `double MultiPhase::temperature()`
127 *
128 * @param handle Handle to queried MultiPhase object.
129 */
130 double mix_temperature(int32_t handle);
131
132 /**
133 * Set the temperature [K].
134 *
135 * Wraps C++ setter: `void MultiPhase::setTemperature(const double)`
136 *
137 * @param handle Handle to queried MultiPhase object.
138 * @param T value of the temperature (Kelvin)
139 */
140 int32_t mix_setTemperature(int32_t handle, const double T);
141
142 /**
143 * Minimum temperature for which all solution phases have valid thermo data.
144 *
145 * Wraps C++ getter: `double MultiPhase::minTemp()`
146 *
147 * @param handle Handle to queried MultiPhase object.
148 */
149 double mix_minTemp(int32_t handle);
150
151 /**
152 * Maximum temperature for which all solution phases have valid thermo data.
153 *
154 * Wraps C++ getter: `double MultiPhase::maxTemp()`
155 *
156 * @param handle Handle to queried MultiPhase object.
157 */
158 double mix_maxTemp(int32_t handle);
159
160 /**
161 * Total charge summed over all phases (Coulombs).
162 *
163 * Wraps C++ getter: `double MultiPhase::charge()`
164 *
165 * @param handle Handle to queried MultiPhase object.
166 */
167 double mix_charge(int32_t handle);
168
169 /**
170 * Charge (Coulombs) of phase with index
171 *
172 * Wraps C++ method: `double MultiPhase::phaseCharge(size_t)`
173 *
174 * @param handle Handle to queried MultiPhase object.
175 * @param p index of the phase for which the charge is desired.
176 */
177 double mix_phaseCharge(int32_t handle, int32_t p);
178
179 /**
180 * Pressure [Pa].
181 *
182 * Wraps C++ getter: `double MultiPhase::pressure()`
183 *
184 * @param handle Handle to queried MultiPhase object.
185 */
186 double mix_pressure(int32_t handle);
187
188 /**
189 * Set the pressure [Pa].
190 *
191 * Wraps C++ setter: `void MultiPhase::setPressure(double)`
192 *
193 * @param handle Handle to queried MultiPhase object.
194 * @param P Set the pressure in the MultiPhase object (Pa)
195 */
196 int32_t mix_setPressure(int32_t handle, double P);
197
198 /**
199 * Returns the Number of atoms of global element
200 *
201 * Wraps C++ method: `double MultiPhase::nAtoms(const size_t, const size_t)`
202 *
203 * @param handle Handle to queried MultiPhase object.
204 * @param kGlob global species index
205 * @param mGlob global element index
206 */
207 double mix_nAtoms(int32_t handle, const int32_t kGlob, const int32_t mGlob);
208
209 /**
210 * Number of phases.
211 *
212 * Wraps C++ getter: `size_t MultiPhase::nPhases()`
213 *
214 * @param handle Handle to queried MultiPhase object.
215 */
216 int32_t mix_nPhases(int32_t handle);
217
218 /**
219 * Return the number of moles in phase n.
220 *
221 * Wraps C++ method: `double MultiPhase::phaseMoles(const size_t)`
222 *
223 * @param handle Handle to queried MultiPhase object.
224 * @param n Index of the phase.
225 */
226 double mix_phaseMoles(int32_t handle, const int32_t n);
227
228 /**
229 * Set the number of moles of phase with index n.
230 *
231 * Wraps C++ method: `void MultiPhase::setPhaseMoles(const size_t, const double)`
232 *
233 * @param handle Handle to queried MultiPhase object.
234 * @param n Index of the phase
235 * @param moles Number of moles in the phase (kmol)
236 */
237 int32_t mix_setPhaseMoles(int32_t handle, const int32_t n, const double moles);
238
239 /**
240 * Sets all of the global species mole numbers.
241 *
242 * Wraps C++ setter: `void MultiPhase::setMoles(const double*)`
243 *
244 * @param handle Handle to queried MultiPhase object.
245 * @param[in] nLen Length of array reserved for n.
246 * @param n Vector of doubles of length nSpecies() containing the global mole numbers (kmol).
247 */
248 int32_t mix_setMoles(int32_t handle, int32_t nLen, const double* n);
249
250 /**
251 * Set the moles via a string containing their names.
252 *
253 * Wraps C++ setter: `void MultiPhase::setMolesByName(const string&)`
254 *
255 * @param handle Handle to queried MultiPhase object.
256 * @param x string x in the form of a composition map where values are the moles of the species.
257 */
258 int32_t mix_setMolesByName(int32_t handle, const char* x);
259
260 /**
261 * Returns the moles of global species
262 *
263 * Wraps C++ method: `double MultiPhase::speciesMoles(size_t)`
264 *
265 * @param handle Handle to queried MultiPhase object.
266 * @param kGlob Global species index k
267 */
268 double mix_speciesMoles(int32_t handle, int32_t kGlob);
269
270 /**
271 * Total moles of global element
272 *
273 * Wraps C++ method: `double MultiPhase::elementMoles(size_t)`
274 *
275 * @param handle Handle to queried MultiPhase object.
276 * @param m Index of the global element
277 */
278 double mix_elementMoles(int32_t handle, int32_t m);
279
280 /**
281 * Equilibrate a ThermoPhase object.
282 *
283 * Wraps C++ method: `void MultiPhase::equilibrate(const string&, const string&, double, int, int, int)`
284 *
285 * @param handle Handle to queried MultiPhase object.
286 * @param XY String representation of what two properties are being held constant
287 * @param solver Name of the solver to be used to equilibrate the phase. If solver = 'element_potential', the ChemEquil element potential solver will be used. If solver = 'vcs', the VCS solver will be used. If solver = 'gibbs', the MultiPhaseEquil solver will be used. If solver = 'auto', the solvers will be tried in order if the initial solver(s) fail.
288 * @param rtol Relative tolerance
289 * @param max_steps Maximum number of steps to take to find the solution
290 * @param max_iter For the 'gibbs' and 'vcs' solvers, this is the maximum number of outer temperature or pressure iterations to take when T and/or P is not held fixed.
291 * @param estimate_equil For MultiPhaseEquil solver, an integer indicating whether the solver should estimate its own initial condition. If 0, the initial mole fraction vector in the ThermoPhase object is used as the initial condition. If 1, the initial mole fraction vector is used if the element abundances are satisfied. If -1, the initial mole fraction vector is thrown out, and an estimate is formulated.
292 */
293 int32_t mix_equilibrate(int32_t handle, const char* XY, const char* solver, double rtol, int32_t max_steps, int32_t max_iter, int32_t estimate_equil);
294
295 /**
296 * Returns a vector of Chemical potentials.
297 *
298 * Wraps C++ getter: `void MultiPhase::getChemPotentials(double*)`
299 *
300 * @param handle Handle to queried MultiPhase object.
301 * @param[in] muLen Length of array reserved for mu.
302 * @param mu Chemical potential vector. Length = num global species. Units = J/kmol.
303 */
304 int32_t mix_getChemPotentials(int32_t handle, int32_t muLen, double* mu);
305
306 /**
307 * The enthalpy of the mixture [J].
308 *
309 * Wraps C++ getter: `double MultiPhase::enthalpy()`
310 *
311 * @param handle Handle to queried MultiPhase object.
312 */
313 double mix_enthalpy(int32_t handle);
314
315 /**
316 * The entropy of the mixture [J/K].
317 *
318 * Wraps C++ getter: `double MultiPhase::entropy()`
319 *
320 * @param handle Handle to queried MultiPhase object.
321 */
322 double mix_entropy(int32_t handle);
323
324 /**
325 * The Gibbs function of the mixture [J].
326 *
327 * Wraps C++ getter: `double MultiPhase::gibbs()`
328 *
329 * @param handle Handle to queried MultiPhase object.
330 */
331 double mix_gibbs(int32_t handle);
332
333 /**
334 * Heat capacity at constant pressure [J/K].
335 *
336 * Wraps C++ getter: `double MultiPhase::cp()`
337 *
338 * @param handle Handle to queried MultiPhase object.
339 */
340 double mix_cp(int32_t handle);
341
342 /**
343 * The total mixture volume [m^3].
344 *
345 * Wraps C++ getter: `double MultiPhase::volume()`
346 *
347 * @param handle Handle to queried MultiPhase object.
348 */
349 double mix_volume(int32_t handle);
350
351 /**
352 * Returns the phase index of the Kth "global" species.
353 *
354 * Wraps C++ method: `size_t MultiPhase::speciesPhaseIndex(const size_t)`
355 *
356 * @param handle Handle to queried MultiPhase object.
357 * @param kGlob Global species index.
358 */
359 int32_t mix_speciesPhaseIndex(int32_t handle, const int32_t kGlob);
360
361 /**
362 * Returns the mole fraction of global species k.
363 *
364 * Wraps C++ method: `double MultiPhase::moleFraction(const size_t)`
365 *
366 * @param handle Handle to queried MultiPhase object.
367 * @param kGlob Index of the global species.
368 */
369 double mix_moleFraction(int32_t handle, const int32_t kGlob);
370
371 /**
372 * Delete MultiPhase object.
373 *
374 * Wraps C++ destructor: `undefined`
375 *
376 * @param handle Handle to MultiPhase object.
377 * @returns Zero for success and -1 for exception handling.
378 */
379 int32_t mix_del(int32_t handle);
380
381 /**
382 * Return size of MultiPhase storage.
383 *
384 * Wraps C++ reserved CLib function: `custom code`
385 *
386 * @returns Size or -1 for exception handling.
387 */
388 int32_t mix_cabinetSize();
389
390 /**
391 * Return handle to parent of MultiPhase object.
392 *
393 * Wraps C++ reserved CLib function: `custom code`
394 *
395 * @param handle Handle to queried MultiPhase object.
396 * @returns Parent handle or -1 for exception handling.
397 */
398 int32_t mix_parentHandle(int32_t handle);
399
400 /**
401 * @}
402 */
403
404#ifdef __cplusplus
405}
406#endif
407
408#endif // CTMIX_H
int32_t mix_nElements(int32_t handle)
Number of elements.
Definition ctmix.cpp:85
double mix_moleFraction(int32_t handle, const int32_t kGlob)
Returns the mole fraction of global species k.
Definition ctmix.cpp:376
int32_t mix_setTemperature(int32_t handle, const double T)
Set the temperature [K].
Definition ctmix.cpp:135
double mix_minTemp(int32_t handle)
Minimum temperature for which all solution phases have valid thermo data.
Definition ctmix.cpp:146
int32_t mix_setMoles(int32_t handle, int32_t nLen, const double *n)
Sets all of the global species mole numbers.
Definition ctmix.cpp:248
int32_t mix_del(int32_t handle)
Delete MultiPhase object.
Definition ctmix.cpp:386
int32_t mix_getChemPotentials(int32_t handle, int32_t muLen, double *mu)
Returns a vector of Chemical potentials.
Definition ctmix.cpp:303
double mix_volume(int32_t handle)
The total mixture volume [m^3].
Definition ctmix.cpp:356
int32_t mix_setMolesByName(int32_t handle, const char *x)
Set the moles via a string containing their names.
Definition ctmix.cpp:261
double mix_cp(int32_t handle)
Heat capacity at constant pressure [J/K].
Definition ctmix.cpp:346
double mix_phaseCharge(int32_t handle, int32_t p)
Charge (Coulombs) of phase with index.
Definition ctmix.cpp:176
int32_t mix_updatePhases(int32_t handle)
Set the states of the phase objects to the locally-stored state within this MultiPhase object.
Definition ctmix.cpp:74
int32_t mix_speciesIndex(int32_t handle, int32_t k, int32_t p)
Return the global index of the species belonging to phase number.
Definition ctmix.cpp:115
int32_t mix_init(int32_t handle)
Process phases and build atomic composition array.
Definition ctmix.cpp:63
int32_t mix_nPhases(int32_t handle)
Number of phases.
Definition ctmix.cpp:217
int32_t mix_nSpecies(int32_t handle)
Number of species, summed over all phases.
Definition ctmix.cpp:105
double mix_maxTemp(int32_t handle)
Maximum temperature for which all solution phases have valid thermo data.
Definition ctmix.cpp:156
int32_t mix_cabinetSize()
Return size of MultiPhase storage.
Definition ctmix.cpp:397
double mix_charge(int32_t handle)
Total charge summed over all phases (Coulombs).
Definition ctmix.cpp:166
int32_t mix_speciesPhaseIndex(int32_t handle, const int32_t kGlob)
Returns the phase index of the Kth "global" species.
Definition ctmix.cpp:366
int32_t mix_setPressure(int32_t handle, double P)
Set the pressure [Pa].
Definition ctmix.cpp:196
double mix_gibbs(int32_t handle)
The Gibbs function of the mixture [J].
Definition ctmix.cpp:336
int32_t mix_new()
Instantiate MultiPhase object using default constructor.
Definition ctmix.cpp:42
double mix_nAtoms(int32_t handle, const int32_t kGlob, const int32_t mGlob)
Returns the Number of atoms of global element.
Definition ctmix.cpp:207
int32_t mix_setPhaseMoles(int32_t handle, const int32_t n, const double moles)
Set the number of moles of phase with index n.
Definition ctmix.cpp:237
double mix_pressure(int32_t handle)
Pressure [Pa].
Definition ctmix.cpp:186
double mix_enthalpy(int32_t handle)
The enthalpy of the mixture [J].
Definition ctmix.cpp:316
int32_t mix_parentHandle(int32_t handle)
Return handle to parent of MultiPhase object.
Definition ctmix.cpp:409
int32_t mix_equilibrate(int32_t handle, const char *XY, const char *solver, double rtol, int32_t max_steps, int32_t max_iter, int32_t estimate_equil)
Equilibrate a ThermoPhase object.
Definition ctmix.cpp:292
double mix_speciesMoles(int32_t handle, int32_t kGlob)
Returns the moles of global species.
Definition ctmix.cpp:272
int32_t mix_elementIndex(int32_t handle, const char *name)
Returns the index of the element with name.
Definition ctmix.cpp:95
double mix_entropy(int32_t handle)
The entropy of the mixture [J/K].
Definition ctmix.cpp:326
int32_t mix_addPhase(int32_t handle, int32_t p, double moles)
Add a phase to the mixture.
Definition ctmix.cpp:52
double mix_elementMoles(int32_t handle, int32_t m)
Total moles of global element.
Definition ctmix.cpp:282
double mix_phaseMoles(int32_t handle, const int32_t n)
Return the number of moles in phase n.
Definition ctmix.cpp:227
double mix_temperature(int32_t handle)
Temperature [K].
Definition ctmix.cpp:125