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