Cantera
Loading...
Searching...
No Matches
ctthermo.cpp
Go to the documentation of this file.
1/**
2 * CTTHERMO - Generated CLib %Cantera interface library.
3 *
4 * @file ctthermo.cpp
5 *
6 * Generated CLib API for Cantera's ThermoPhase class.
7 *
8 * This file was generated by sourcegen. It will be re-generated by the
9 * %Cantera build process. Do not manually edit.
10 *
11 * @warning This module is an experimental part of the %Cantera API and
12 * may be changed without notice.
13 */
14
15// This file is part of Cantera. See License.txt in the top-level directory or
16// at https://cantera.org/license.txt for license and copyright information.
17
18#include "clib_utils.h"
20
24
25using namespace Cantera;
26
27//! @cond
28//! Cabinet type definitions will be ignored by Doxygen
29
30// Define Cabinet<ThermoPhase> (single-instance object)
31typedef Cabinet<ThermoPhase> ThermoPhaseCabinet;
32template<> ThermoPhaseCabinet* ThermoPhaseCabinet::s_storage = 0; // initialized here
33
34//! @endcond
35
36extern "C" {
37
38 int32_t thermo_name(int32_t handle, int32_t bufLen, char* buf)
39 {
40 // getter: string Phase::name()
41 try {
42 string out = ThermoPhaseCabinet::as<Phase>(handle)->name();
43 copyString(out, buf, bufLen);
44 return int(out.size()) + 1;
45 } catch (...) {
46 return handleAllExceptions(-1, ERR);
47 }
48 }
49
50 int32_t thermo_setName(int32_t handle, const char* nm)
51 {
52 // setter: void Phase::setName(const string&)
53 try {
54 ThermoPhaseCabinet::as<Phase>(handle)->setName(nm);
55 return 0;
56 } catch (...) {
57 return handleAllExceptions(-1, ERR);
58 }
59 }
60
61 int32_t thermo_type(int32_t handle, int32_t bufLen, char* buf)
62 {
63 // getter: string ThermoPhase::type()
64 try {
65 string out = ThermoPhaseCabinet::at(handle)->type();
66 copyString(out, buf, bufLen);
67 return int(out.size()) + 1;
68 } catch (...) {
69 return handleAllExceptions(-1, ERR);
70 }
71 }
72
73 int32_t thermo_nElements(int32_t handle)
74 {
75 // size getter: size_t Phase::nElements()
76 try {
77 return static_cast<int32_t>(ThermoPhaseCabinet::as<Phase>(handle)->nElements());
78 } catch (...) {
79 return handleAllExceptions(ERR, ERR);
80 }
81 }
82
83 int32_t thermo_nSpecies(int32_t handle)
84 {
85 // size getter: size_t Phase::nSpecies()
86 try {
87 return static_cast<int32_t>(ThermoPhaseCabinet::as<Phase>(handle)->nSpecies());
88 } catch (...) {
89 return handleAllExceptions(ERR, ERR);
90 }
91 }
92
93 double thermo_temperature(int32_t handle)
94 {
95 // getter: double Phase::temperature()
96 try {
97 return ThermoPhaseCabinet::as<Phase>(handle)->temperature();
98 } catch (...) {
99 return handleAllExceptions(DERR, DERR);
100 }
101 }
102
103 int32_t thermo_setTemperature(int32_t handle, double temp)
104 {
105 // setter: virtual void Phase::setTemperature(double)
106 try {
107 ThermoPhaseCabinet::as<Phase>(handle)->setTemperature(temp);
108 return 0;
109 } catch (...) {
110 return handleAllExceptions(-1, ERR);
111 }
112 }
113
114 double thermo_pressure(int32_t handle)
115 {
116 // getter: virtual double Phase::pressure()
117 try {
118 return ThermoPhaseCabinet::as<Phase>(handle)->pressure();
119 } catch (...) {
120 return handleAllExceptions(DERR, DERR);
121 }
122 }
123
124 int32_t thermo_setPressure(int32_t handle, double p)
125 {
126 // setter: virtual void Phase::setPressure(double)
127 try {
128 ThermoPhaseCabinet::as<Phase>(handle)->setPressure(p);
129 return 0;
130 } catch (...) {
131 return handleAllExceptions(-1, ERR);
132 }
133 }
134
135 double thermo_density(int32_t handle)
136 {
137 // getter: virtual double Phase::density()
138 try {
139 return ThermoPhaseCabinet::as<Phase>(handle)->density();
140 } catch (...) {
141 return handleAllExceptions(DERR, DERR);
142 }
143 }
144
145 int32_t thermo_setDensity(int32_t handle, const double density_)
146 {
147 // setter: virtual void Phase::setDensity(const double)
148 try {
149 ThermoPhaseCabinet::as<Phase>(handle)->setDensity(density_);
150 return 0;
151 } catch (...) {
152 return handleAllExceptions(-1, ERR);
153 }
154 }
155
156 double thermo_molarDensity(int32_t handle)
157 {
158 // getter: virtual double Phase::molarDensity()
159 try {
160 return ThermoPhaseCabinet::as<Phase>(handle)->molarDensity();
161 } catch (...) {
162 return handleAllExceptions(DERR, DERR);
163 }
164 }
165
166 double thermo_meanMolecularWeight(int32_t handle)
167 {
168 // getter: double Phase::meanMolecularWeight()
169 try {
170 return ThermoPhaseCabinet::as<Phase>(handle)->meanMolecularWeight();
171 } catch (...) {
172 return handleAllExceptions(DERR, DERR);
173 }
174 }
175
176 double thermo_moleFraction(int32_t handle, int32_t k)
177 {
178 // method: double Phase::moleFraction(size_t)
179 try {
180 return ThermoPhaseCabinet::as<Phase>(handle)->moleFraction(k);
181 } catch (...) {
182 return handleAllExceptions(DERR, DERR);
183 }
184 }
185
186 double thermo_massFraction(int32_t handle, int32_t k)
187 {
188 // method: double Phase::massFraction(size_t)
189 try {
190 return ThermoPhaseCabinet::as<Phase>(handle)->massFraction(k);
191 } catch (...) {
192 return handleAllExceptions(DERR, DERR);
193 }
194 }
195
196 int32_t thermo_getMoleFractions(int32_t handle, int32_t xLen, double* x)
197 {
198 // array getter: void Phase::getMoleFractions(span<double>)
199 try {
200 auto obj = ThermoPhaseCabinet::as<Phase>(handle);
201 if (static_cast<size_t>(xLen) < obj->nSpecies()) {
202 throw ArraySizeError("thermo_getMoleFractions", xLen, obj->nSpecies());
203 }
204 span<double> x_(x, xLen);
205 obj->getMoleFractions(x_);
206 return 0;
207 } catch (...) {
208 return handleAllExceptions(-1, ERR);
209 }
210 }
211
212 int32_t thermo_getMassFractions(int32_t handle, int32_t yLen, double* y)
213 {
214 // array getter: void Phase::getMassFractions(span<double>)
215 try {
216 auto obj = ThermoPhaseCabinet::as<Phase>(handle);
217 if (static_cast<size_t>(yLen) < obj->nSpecies()) {
218 throw ArraySizeError("thermo_getMassFractions", yLen, obj->nSpecies());
219 }
220 span<double> y_(y, yLen);
221 obj->getMassFractions(y_);
222 return 0;
223 } catch (...) {
224 return handleAllExceptions(-1, ERR);
225 }
226 }
227
228 int32_t thermo_setMoleFractions(int32_t handle, int32_t xLen, const double* x)
229 {
230 // setter: virtual void Phase::setMoleFractions(span<const double>)
231 try {
232 span<const double> x_(x, xLen);
233 ThermoPhaseCabinet::as<Phase>(handle)->setMoleFractions(x_);
234 return 0;
235 } catch (...) {
236 return handleAllExceptions(-1, ERR);
237 }
238 }
239
240 int32_t thermo_setMassFractions(int32_t handle, int32_t yLen, const double* y)
241 {
242 // setter: virtual void Phase::setMassFractions(span<const double>)
243 try {
244 span<const double> y_(y, yLen);
245 ThermoPhaseCabinet::as<Phase>(handle)->setMassFractions(y_);
246 return 0;
247 } catch (...) {
248 return handleAllExceptions(-1, ERR);
249 }
250 }
251
252 int32_t thermo_setMoleFractionsByName(int32_t handle, const char* x)
253 {
254 // setter: void Phase::setMoleFractionsByName(const string&)
255 try {
256 ThermoPhaseCabinet::as<Phase>(handle)->setMoleFractionsByName(x);
257 return 0;
258 } catch (...) {
259 return handleAllExceptions(-1, ERR);
260 }
261 }
262
263 int32_t thermo_setMassFractionsByName(int32_t handle, const char* x)
264 {
265 // setter: void Phase::setMassFractionsByName(const string&)
266 try {
267 ThermoPhaseCabinet::as<Phase>(handle)->setMassFractionsByName(x);
268 return 0;
269 } catch (...) {
270 return handleAllExceptions(-1, ERR);
271 }
272 }
273
274 int32_t thermo_atomicWeights(int32_t handle, int32_t bufLen, double* buf)
275 {
276 // array getter: span<const double> Phase::atomicWeights()
277 try {
278 auto obj = ThermoPhaseCabinet::as<Phase>(handle);
279 if (static_cast<size_t>(bufLen) < obj->nElements()) {
280 throw ArraySizeError("thermo_atomicWeights", bufLen, obj->nElements());
281 }
282 span<const double> out = obj->atomicWeights();
283 std::copy(out.begin(), out.end(), buf);
284 return int(out.size());
285 } catch (...) {
286 return handleAllExceptions(-1, ERR);
287 }
288 }
289
290 double thermo_atomicWeight(int32_t handle, int32_t m)
291 {
292 // method: double Phase::atomicWeight(size_t)
293 try {
294 return ThermoPhaseCabinet::as<Phase>(handle)->atomicWeight(m);
295 } catch (...) {
296 return handleAllExceptions(DERR, DERR);
297 }
298 }
299
300 double thermo_elementalMassFraction(int32_t handle, const int32_t m)
301 {
302 // method: double Phase::elementalMassFraction(const size_t)
303 try {
304 return ThermoPhaseCabinet::as<Phase>(handle)->elementalMassFraction(m);
305 } catch (...) {
306 return handleAllExceptions(DERR, DERR);
307 }
308 }
309
310 double thermo_elementalMoleFraction(int32_t handle, const int32_t m)
311 {
312 // method: double Phase::elementalMoleFraction(const size_t)
313 try {
314 return ThermoPhaseCabinet::as<Phase>(handle)->elementalMoleFraction(m);
315 } catch (...) {
316 return handleAllExceptions(DERR, DERR);
317 }
318 }
319
320 int32_t thermo_getMolecularWeights(int32_t handle, int32_t weightsLen, double* weights)
321 {
322 // array getter: void Phase::getMolecularWeights(span<double>)
323 try {
324 auto obj = ThermoPhaseCabinet::as<Phase>(handle);
325 if (static_cast<size_t>(weightsLen) < obj->nSpecies()) {
326 throw ArraySizeError("thermo_getMolecularWeights", weightsLen, obj->nSpecies());
327 }
328 span<double> weights_(weights, weightsLen);
329 obj->getMolecularWeights(weights_);
330 return 0;
331 } catch (...) {
332 return handleAllExceptions(-1, ERR);
333 }
334 }
335
336 int32_t thermo_getCharges(int32_t handle, int32_t chargesLen, double* charges)
337 {
338 // array getter: void Phase::getCharges(span<double>)
339 try {
340 auto obj = ThermoPhaseCabinet::as<Phase>(handle);
341 if (static_cast<size_t>(chargesLen) < obj->nElements()) {
342 throw ArraySizeError("thermo_getCharges", chargesLen, obj->nElements());
343 }
344 span<double> charges_(charges, chargesLen);
345 obj->getCharges(charges_);
346 return 0;
347 } catch (...) {
348 return handleAllExceptions(-1, ERR);
349 }
350 }
351
352 int32_t thermo_elementName(int32_t handle, int32_t m, int32_t bufLen, char* buf)
353 {
354 // method: string Phase::elementName(size_t)
355 try {
356 string out = ThermoPhaseCabinet::as<Phase>(handle)->elementName(m);
357 copyString(out, buf, bufLen);
358 return int(out.size()) + 1;
359 } catch (...) {
360 return handleAllExceptions(-1, ERR);
361 }
362 }
363
364 int32_t thermo_speciesName(int32_t handle, int32_t k, int32_t bufLen, char* buf)
365 {
366 // method: string Phase::speciesName(size_t)
367 try {
368 string out = ThermoPhaseCabinet::as<Phase>(handle)->speciesName(k);
369 copyString(out, buf, bufLen);
370 return int(out.size()) + 1;
371 } catch (...) {
372 return handleAllExceptions(-1, ERR);
373 }
374 }
375
376 int32_t thermo_elementIndex(int32_t handle, const char* name)
377 {
378 // method: custom code
379 try {
380 // *************** begin custom code ***************
381 return static_cast<int32_t>(ThermoPhaseCabinet::as<Phase>(handle)->elementIndex(name, true));
382 // **************** end custom code ****************
383 } catch (...) {
384 return handleAllExceptions(-1, ERR);
385 }
386 }
387
388 int32_t thermo_speciesIndex(int32_t handle, const char* name)
389 {
390 // method: custom code
391 try {
392 // *************** begin custom code ***************
393 return static_cast<int32_t>(ThermoPhaseCabinet::as<Phase>(handle)->speciesIndex(name, true));
394 // **************** end custom code ****************
395 } catch (...) {
396 return handleAllExceptions(-1, ERR);
397 }
398 }
399
400 double thermo_nAtoms(int32_t handle, int32_t k, int32_t m)
401 {
402 // method: double Phase::nAtoms(size_t, size_t)
403 try {
404 return ThermoPhaseCabinet::as<Phase>(handle)->nAtoms(k, m);
405 } catch (...) {
406 return handleAllExceptions(DERR, DERR);
407 }
408 }
409
410 int32_t thermo_addElement(int32_t handle, const char* symbol, double weight, int32_t atomicNumber, double entropy298, int32_t elem_type)
411 {
412 // size getter: size_t Phase::addElement(const string&, double, int, double, int)
413 try {
414 return static_cast<int32_t>(ThermoPhaseCabinet::as<Phase>(handle)->addElement(symbol, weight, atomicNumber, entropy298, elem_type));
415 } catch (...) {
416 return handleAllExceptions(ERR, ERR);
417 }
418 }
419
420 double thermo_refPressure(int32_t handle)
421 {
422 // getter: virtual double ThermoPhase::refPressure()
423 try {
424 return ThermoPhaseCabinet::at(handle)->refPressure();
425 } catch (...) {
426 return handleAllExceptions(DERR, DERR);
427 }
428 }
429
430 double thermo_minTemp(int32_t handle, int32_t k)
431 {
432 // method: virtual double ThermoPhase::minTemp(size_t)
433 try {
434 return ThermoPhaseCabinet::at(handle)->minTemp(k);
435 } catch (...) {
436 return handleAllExceptions(DERR, DERR);
437 }
438 }
439
440 double thermo_maxTemp(int32_t handle, int32_t k)
441 {
442 // method: virtual double ThermoPhase::maxTemp(size_t)
443 try {
444 return ThermoPhaseCabinet::at(handle)->maxTemp(k);
445 } catch (...) {
446 return handleAllExceptions(DERR, DERR);
447 }
448 }
449
450 double thermo_enthalpy_mole(int32_t handle)
451 {
452 // getter: virtual double ThermoPhase::enthalpy_mole()
453 try {
454 return ThermoPhaseCabinet::at(handle)->enthalpy_mole();
455 } catch (...) {
456 return handleAllExceptions(DERR, DERR);
457 }
458 }
459
460 double thermo_enthalpy_mass(int32_t handle)
461 {
462 // getter: double ThermoPhase::enthalpy_mass()
463 try {
464 return ThermoPhaseCabinet::at(handle)->enthalpy_mass();
465 } catch (...) {
466 return handleAllExceptions(DERR, DERR);
467 }
468 }
469
470 double thermo_entropy_mole(int32_t handle)
471 {
472 // getter: virtual double ThermoPhase::entropy_mole()
473 try {
474 return ThermoPhaseCabinet::at(handle)->entropy_mole();
475 } catch (...) {
476 return handleAllExceptions(DERR, DERR);
477 }
478 }
479
480 double thermo_entropy_mass(int32_t handle)
481 {
482 // getter: double ThermoPhase::entropy_mass()
483 try {
484 return ThermoPhaseCabinet::at(handle)->entropy_mass();
485 } catch (...) {
486 return handleAllExceptions(DERR, DERR);
487 }
488 }
489
490 double thermo_intEnergy_mole(int32_t handle)
491 {
492 // getter: virtual double ThermoPhase::intEnergy_mole()
493 try {
494 return ThermoPhaseCabinet::at(handle)->intEnergy_mole();
495 } catch (...) {
496 return handleAllExceptions(DERR, DERR);
497 }
498 }
499
500 double thermo_intEnergy_mass(int32_t handle)
501 {
502 // getter: double ThermoPhase::intEnergy_mass()
503 try {
504 return ThermoPhaseCabinet::at(handle)->intEnergy_mass();
505 } catch (...) {
506 return handleAllExceptions(DERR, DERR);
507 }
508 }
509
510 double thermo_gibbs_mole(int32_t handle)
511 {
512 // getter: virtual double ThermoPhase::gibbs_mole()
513 try {
514 return ThermoPhaseCabinet::at(handle)->gibbs_mole();
515 } catch (...) {
516 return handleAllExceptions(DERR, DERR);
517 }
518 }
519
520 double thermo_gibbs_mass(int32_t handle)
521 {
522 // getter: double ThermoPhase::gibbs_mass()
523 try {
524 return ThermoPhaseCabinet::at(handle)->gibbs_mass();
525 } catch (...) {
526 return handleAllExceptions(DERR, DERR);
527 }
528 }
529
530 double thermo_cp_mole(int32_t handle)
531 {
532 // getter: virtual double ThermoPhase::cp_mole()
533 try {
534 return ThermoPhaseCabinet::at(handle)->cp_mole();
535 } catch (...) {
536 return handleAllExceptions(DERR, DERR);
537 }
538 }
539
540 double thermo_cp_mass(int32_t handle)
541 {
542 // getter: double ThermoPhase::cp_mass()
543 try {
544 return ThermoPhaseCabinet::at(handle)->cp_mass();
545 } catch (...) {
546 return handleAllExceptions(DERR, DERR);
547 }
548 }
549
550 double thermo_cv_mole(int32_t handle)
551 {
552 // getter: virtual double ThermoPhase::cv_mole()
553 try {
554 return ThermoPhaseCabinet::at(handle)->cv_mole();
555 } catch (...) {
556 return handleAllExceptions(DERR, DERR);
557 }
558 }
559
560 double thermo_cv_mass(int32_t handle)
561 {
562 // getter: double ThermoPhase::cv_mass()
563 try {
564 return ThermoPhaseCabinet::at(handle)->cv_mass();
565 } catch (...) {
566 return handleAllExceptions(DERR, DERR);
567 }
568 }
569
570 int32_t thermo_getChemPotentials(int32_t handle, int32_t muLen, double* mu)
571 {
572 // array getter: virtual void ThermoPhase::getChemPotentials(span<double>)
573 try {
574 auto& obj = ThermoPhaseCabinet::at(handle);
575 // no size checking specified
576 span<double> mu_(mu, muLen);
577 obj->getChemPotentials(mu_);
578 return 0;
579 } catch (...) {
580 return handleAllExceptions(-1, ERR);
581 }
582 }
583
584 int32_t thermo_getElectrochemPotentials(int32_t handle, int32_t muLen, double* mu)
585 {
586 // array getter: void ThermoPhase::getElectrochemPotentials(span<double>)
587 try {
588 auto& obj = ThermoPhaseCabinet::at(handle);
589 // no size checking specified
590 span<double> mu_(mu, muLen);
591 obj->getElectrochemPotentials(mu_);
592 return 0;
593 } catch (...) {
594 return handleAllExceptions(-1, ERR);
595 }
596 }
597
598 double thermo_electricPotential(int32_t handle)
599 {
600 // getter: double ThermoPhase::electricPotential()
601 try {
602 return ThermoPhaseCabinet::at(handle)->electricPotential();
603 } catch (...) {
604 return handleAllExceptions(DERR, DERR);
605 }
606 }
607
608 int32_t thermo_setElectricPotential(int32_t handle, double v)
609 {
610 // setter: void ThermoPhase::setElectricPotential(double)
611 try {
612 ThermoPhaseCabinet::at(handle)->setElectricPotential(v);
613 return 0;
614 } catch (...) {
615 return handleAllExceptions(-1, ERR);
616 }
617 }
618
619 double thermo_thermalExpansionCoeff(int32_t handle)
620 {
621 // getter: virtual double ThermoPhase::thermalExpansionCoeff()
622 try {
623 return ThermoPhaseCabinet::at(handle)->thermalExpansionCoeff();
624 } catch (...) {
625 return handleAllExceptions(DERR, DERR);
626 }
627 }
628
629 double thermo_isothermalCompressibility(int32_t handle)
630 {
631 // getter: virtual double ThermoPhase::isothermalCompressibility()
632 try {
633 return ThermoPhaseCabinet::at(handle)->isothermalCompressibility();
634 } catch (...) {
635 return handleAllExceptions(DERR, DERR);
636 }
637 }
638
639 double thermo_internalPressure(int32_t handle)
640 {
641 // getter: virtual double ThermoPhase::internalPressure()
642 try {
643 return ThermoPhaseCabinet::at(handle)->internalPressure();
644 } catch (...) {
645 return handleAllExceptions(DERR, DERR);
646 }
647 }
648
649 int32_t thermo_getPartialMolarEnthalpies(int32_t handle, int32_t hbarLen, double* hbar)
650 {
651 // array getter: virtual void ThermoPhase::getPartialMolarEnthalpies(span<double>)
652 try {
653 auto& obj = ThermoPhaseCabinet::at(handle);
654 // no size checking specified
655 span<double> hbar_(hbar, hbarLen);
656 obj->getPartialMolarEnthalpies(hbar_);
657 return 0;
658 } catch (...) {
659 return handleAllExceptions(-1, ERR);
660 }
661 }
662
663 int32_t thermo_getPartialMolarEntropies(int32_t handle, int32_t sbarLen, double* sbar)
664 {
665 // array getter: virtual void ThermoPhase::getPartialMolarEntropies(span<double>)
666 try {
667 auto& obj = ThermoPhaseCabinet::at(handle);
668 // no size checking specified
669 span<double> sbar_(sbar, sbarLen);
670 obj->getPartialMolarEntropies(sbar_);
671 return 0;
672 } catch (...) {
673 return handleAllExceptions(-1, ERR);
674 }
675 }
676
677 int32_t thermo_getPartialMolarIntEnergies(int32_t handle, int32_t ubarLen, double* ubar)
678 {
679 // array getter: virtual void ThermoPhase::getPartialMolarIntEnergies(span<double>)
680 try {
681 auto& obj = ThermoPhaseCabinet::at(handle);
682 // no size checking specified
683 span<double> ubar_(ubar, ubarLen);
684 obj->getPartialMolarIntEnergies(ubar_);
685 return 0;
686 } catch (...) {
687 return handleAllExceptions(-1, ERR);
688 }
689 }
690
691 int32_t thermo_getPartialMolarIntEnergies_TV(int32_t handle, int32_t utildeLen, double* utilde)
692 {
693 // array getter: virtual void ThermoPhase::getPartialMolarIntEnergies_TV(span<double>)
694 try {
695 auto& obj = ThermoPhaseCabinet::at(handle);
696 // no size checking specified
697 span<double> utilde_(utilde, utildeLen);
698 obj->getPartialMolarIntEnergies_TV(utilde_);
699 return 0;
700 } catch (...) {
701 return handleAllExceptions(-1, ERR);
702 }
703 }
704
705 int32_t thermo_getPartialMolarCp(int32_t handle, int32_t cpbarLen, double* cpbar)
706 {
707 // array getter: virtual void ThermoPhase::getPartialMolarCp(span<double>)
708 try {
709 auto& obj = ThermoPhaseCabinet::at(handle);
710 // no size checking specified
711 span<double> cpbar_(cpbar, cpbarLen);
712 obj->getPartialMolarCp(cpbar_);
713 return 0;
714 } catch (...) {
715 return handleAllExceptions(-1, ERR);
716 }
717 }
718
719 int32_t thermo_getPartialMolarCv_TV(int32_t handle, int32_t cvtildeLen, double* cvtilde)
720 {
721 // array getter: virtual void ThermoPhase::getPartialMolarCv_TV(span<double>)
722 try {
723 auto& obj = ThermoPhaseCabinet::at(handle);
724 // no size checking specified
725 span<double> cvtilde_(cvtilde, cvtildeLen);
726 obj->getPartialMolarCv_TV(cvtilde_);
727 return 0;
728 } catch (...) {
729 return handleAllExceptions(-1, ERR);
730 }
731 }
732
733 int32_t thermo_getPartialMolarVolumes(int32_t handle, int32_t vbarLen, double* vbar)
734 {
735 // array getter: virtual void ThermoPhase::getPartialMolarVolumes(span<double>)
736 try {
737 auto& obj = ThermoPhaseCabinet::at(handle);
738 // no size checking specified
739 span<double> vbar_(vbar, vbarLen);
740 obj->getPartialMolarVolumes(vbar_);
741 return 0;
742 } catch (...) {
743 return handleAllExceptions(-1, ERR);
744 }
745 }
746
747 int32_t thermo_getEnthalpy_RT(int32_t handle, int32_t hrtLen, double* hrt)
748 {
749 // array getter: virtual void ThermoPhase::getEnthalpy_RT(span<double>)
750 try {
751 auto& obj = ThermoPhaseCabinet::at(handle);
752 // no size checking specified
753 span<double> hrt_(hrt, hrtLen);
754 obj->getEnthalpy_RT(hrt_);
755 return 0;
756 } catch (...) {
757 return handleAllExceptions(-1, ERR);
758 }
759 }
760
761 int32_t thermo_getEntropy_R(int32_t handle, int32_t srLen, double* sr)
762 {
763 // array getter: virtual void ThermoPhase::getEntropy_R(span<double>)
764 try {
765 auto& obj = ThermoPhaseCabinet::at(handle);
766 // no size checking specified
767 span<double> sr_(sr, srLen);
768 obj->getEntropy_R(sr_);
769 return 0;
770 } catch (...) {
771 return handleAllExceptions(-1, ERR);
772 }
773 }
774
775 int32_t thermo_getGibbs_RT(int32_t handle, int32_t grtLen, double* grt)
776 {
777 // array getter: virtual void ThermoPhase::getGibbs_RT(span<double>)
778 try {
779 auto& obj = ThermoPhaseCabinet::at(handle);
780 // no size checking specified
781 span<double> grt_(grt, grtLen);
782 obj->getGibbs_RT(grt_);
783 return 0;
784 } catch (...) {
785 return handleAllExceptions(-1, ERR);
786 }
787 }
788
789 int32_t thermo_getIntEnergy_RT(int32_t handle, int32_t urtLen, double* urt)
790 {
791 // array getter: virtual void ThermoPhase::getIntEnergy_RT(span<double>)
792 try {
793 auto& obj = ThermoPhaseCabinet::at(handle);
794 // no size checking specified
795 span<double> urt_(urt, urtLen);
796 obj->getIntEnergy_RT(urt_);
797 return 0;
798 } catch (...) {
799 return handleAllExceptions(-1, ERR);
800 }
801 }
802
803 int32_t thermo_getCp_R(int32_t handle, int32_t cprLen, double* cpr)
804 {
805 // array getter: virtual void ThermoPhase::getCp_R(span<double>)
806 try {
807 auto& obj = ThermoPhaseCabinet::at(handle);
808 // no size checking specified
809 span<double> cpr_(cpr, cprLen);
810 obj->getCp_R(cpr_);
811 return 0;
812 } catch (...) {
813 return handleAllExceptions(-1, ERR);
814 }
815 }
816
817 int32_t thermo_setState_TPX(int32_t handle, double t, double p, int32_t xLen, const double* x)
818 {
819 // method: virtual void ThermoPhase::setState_TPX(double, double, span<const double>)
820 try {
821 span<const double> x_(x, xLen);
822 ThermoPhaseCabinet::at(handle)->setState_TPX(t, p, x_);
823 return 0;
824 } catch (...) {
825 return handleAllExceptions(-1, ERR);
826 }
827 }
828
829 int32_t thermo_setState_TPX_byName(int32_t handle, double t, double p, const char* x)
830 {
831 // method: virtual void ThermoPhase::setState_TPX(double, double, const string&)
832 try {
833 ThermoPhaseCabinet::at(handle)->setState_TPX(t, p, x);
834 return 0;
835 } catch (...) {
836 return handleAllExceptions(-1, ERR);
837 }
838 }
839
840 int32_t thermo_setState_TPY(int32_t handle, double t, double p, int32_t yLen, const double* y)
841 {
842 // method: virtual void ThermoPhase::setState_TPY(double, double, span<const double>)
843 try {
844 span<const double> y_(y, yLen);
845 ThermoPhaseCabinet::at(handle)->setState_TPY(t, p, y_);
846 return 0;
847 } catch (...) {
848 return handleAllExceptions(-1, ERR);
849 }
850 }
851
852 int32_t thermo_setState_TPY_byName(int32_t handle, double t, double p, const char* y)
853 {
854 // method: virtual void ThermoPhase::setState_TPY(double, double, const string&)
855 try {
856 ThermoPhaseCabinet::at(handle)->setState_TPY(t, p, y);
857 return 0;
858 } catch (...) {
859 return handleAllExceptions(-1, ERR);
860 }
861 }
862
863 int32_t thermo_setState_TP(int32_t handle, double t, double p)
864 {
865 // method: virtual void ThermoPhase::setState_TP(double, double)
866 try {
867 ThermoPhaseCabinet::at(handle)->setState_TP(t, p);
868 return 0;
869 } catch (...) {
870 return handleAllExceptions(-1, ERR);
871 }
872 }
873
874 int32_t thermo_setState_TD(int32_t handle, double t, double rho)
875 {
876 // method: virtual void Phase::setState_TD(double, double)
877 try {
878 ThermoPhaseCabinet::as<Phase>(handle)->setState_TD(t, rho);
879 return 0;
880 } catch (...) {
881 return handleAllExceptions(-1, ERR);
882 }
883 }
884
885 int32_t thermo_setState_DP(int32_t handle, double rho, double p)
886 {
887 // method: virtual void ThermoPhase::setState_DP(double, double)
888 try {
889 ThermoPhaseCabinet::at(handle)->setState_DP(rho, p);
890 return 0;
891 } catch (...) {
892 return handleAllExceptions(-1, ERR);
893 }
894 }
895
896 int32_t thermo_setState_HP(int32_t handle, double h, double p)
897 {
898 // method: virtual void ThermoPhase::setState_HP(double, double)
899 try {
900 ThermoPhaseCabinet::at(handle)->setState_HP(h, p);
901 return 0;
902 } catch (...) {
903 return handleAllExceptions(-1, ERR);
904 }
905 }
906
907 int32_t thermo_setState_UV(int32_t handle, double u, double v)
908 {
909 // method: virtual void ThermoPhase::setState_UV(double, double)
910 try {
911 ThermoPhaseCabinet::at(handle)->setState_UV(u, v);
912 return 0;
913 } catch (...) {
914 return handleAllExceptions(-1, ERR);
915 }
916 }
917
918 int32_t thermo_setState_SV(int32_t handle, double s, double v)
919 {
920 // method: virtual void ThermoPhase::setState_SV(double, double)
921 try {
922 ThermoPhaseCabinet::at(handle)->setState_SV(s, v);
923 return 0;
924 } catch (...) {
925 return handleAllExceptions(-1, ERR);
926 }
927 }
928
929 int32_t thermo_setState_SP(int32_t handle, double s, double p)
930 {
931 // method: virtual void ThermoPhase::setState_SP(double, double)
932 try {
933 ThermoPhaseCabinet::at(handle)->setState_SP(s, p);
934 return 0;
935 } catch (...) {
936 return handleAllExceptions(-1, ERR);
937 }
938 }
939
940 int32_t thermo_setState_ST(int32_t handle, double s, double t)
941 {
942 // method: virtual void ThermoPhase::setState_ST(double, double)
943 try {
944 ThermoPhaseCabinet::at(handle)->setState_ST(s, t);
945 return 0;
946 } catch (...) {
947 return handleAllExceptions(-1, ERR);
948 }
949 }
950
951 int32_t thermo_setState_TV(int32_t handle, double t, double v)
952 {
953 // method: virtual void ThermoPhase::setState_TV(double, double)
954 try {
955 ThermoPhaseCabinet::at(handle)->setState_TV(t, v);
956 return 0;
957 } catch (...) {
958 return handleAllExceptions(-1, ERR);
959 }
960 }
961
962 int32_t thermo_setState_PV(int32_t handle, double p, double v)
963 {
964 // method: virtual void ThermoPhase::setState_PV(double, double)
965 try {
966 ThermoPhaseCabinet::at(handle)->setState_PV(p, v);
967 return 0;
968 } catch (...) {
969 return handleAllExceptions(-1, ERR);
970 }
971 }
972
973 int32_t thermo_setState_UP(int32_t handle, double u, double p)
974 {
975 // method: virtual void ThermoPhase::setState_UP(double, double)
976 try {
977 ThermoPhaseCabinet::at(handle)->setState_UP(u, p);
978 return 0;
979 } catch (...) {
980 return handleAllExceptions(-1, ERR);
981 }
982 }
983
984 int32_t thermo_setState_VH(int32_t handle, double v, double h)
985 {
986 // method: virtual void ThermoPhase::setState_VH(double, double)
987 try {
988 ThermoPhaseCabinet::at(handle)->setState_VH(v, h);
989 return 0;
990 } catch (...) {
991 return handleAllExceptions(-1, ERR);
992 }
993 }
994
995 int32_t thermo_setState_TH(int32_t handle, double t, double h)
996 {
997 // method: virtual void ThermoPhase::setState_TH(double, double)
998 try {
999 ThermoPhaseCabinet::at(handle)->setState_TH(t, h);
1000 return 0;
1001 } catch (...) {
1002 return handleAllExceptions(-1, ERR);
1003 }
1004 }
1005
1006 int32_t thermo_setState_SH(int32_t handle, double s, double h)
1007 {
1008 // method: virtual void ThermoPhase::setState_SH(double, double)
1009 try {
1010 ThermoPhaseCabinet::at(handle)->setState_SH(s, h);
1011 return 0;
1012 } catch (...) {
1013 return handleAllExceptions(-1, ERR);
1014 }
1015 }
1016
1017 int32_t thermo_equilibrate(int32_t handle, const char* XY, const char* solver, double rtol, int32_t max_steps, int32_t max_iter, int32_t estimate_equil)
1018 {
1019 // method: void ThermoPhase::equilibrate(const string&, const string&, double, int, int, int)
1020 try {
1021 ThermoPhaseCabinet::at(handle)->equilibrate(XY, solver, rtol, max_steps, max_iter, estimate_equil);
1022 return 0;
1023 } catch (...) {
1024 return handleAllExceptions(-1, ERR);
1025 }
1026 }
1027
1028 double thermo_critTemperature(int32_t handle)
1029 {
1030 // getter: virtual double ThermoPhase::critTemperature()
1031 try {
1032 return ThermoPhaseCabinet::at(handle)->critTemperature();
1033 } catch (...) {
1034 return handleAllExceptions(DERR, DERR);
1035 }
1036 }
1037
1038 double thermo_critPressure(int32_t handle)
1039 {
1040 // getter: virtual double ThermoPhase::critPressure()
1041 try {
1042 return ThermoPhaseCabinet::at(handle)->critPressure();
1043 } catch (...) {
1044 return handleAllExceptions(DERR, DERR);
1045 }
1046 }
1047
1048 double thermo_critDensity(int32_t handle)
1049 {
1050 // getter: virtual double ThermoPhase::critDensity()
1051 try {
1052 return ThermoPhaseCabinet::at(handle)->critDensity();
1053 } catch (...) {
1054 return handleAllExceptions(DERR, DERR);
1055 }
1056 }
1057
1058 double thermo_vaporFraction(int32_t handle)
1059 {
1060 // getter: virtual double ThermoPhase::vaporFraction()
1061 try {
1062 return ThermoPhaseCabinet::at(handle)->vaporFraction();
1063 } catch (...) {
1064 return handleAllExceptions(DERR, DERR);
1065 }
1066 }
1067
1068 double thermo_satTemperature(int32_t handle, double p)
1069 {
1070 // method: virtual double ThermoPhase::satTemperature(double)
1071 try {
1072 return ThermoPhaseCabinet::at(handle)->satTemperature(p);
1073 } catch (...) {
1074 return handleAllExceptions(DERR, DERR);
1075 }
1076 }
1077
1078 double thermo_satPressure(int32_t handle, double t)
1079 {
1080 // method: virtual double ThermoPhase::satPressure(double)
1081 try {
1082 return ThermoPhaseCabinet::at(handle)->satPressure(t);
1083 } catch (...) {
1084 return handleAllExceptions(DERR, DERR);
1085 }
1086 }
1087
1088 int32_t thermo_setState_Psat(int32_t handle, double p, double x)
1089 {
1090 // method: virtual void ThermoPhase::setState_Psat(double, double)
1091 try {
1092 ThermoPhaseCabinet::at(handle)->setState_Psat(p, x);
1093 return 0;
1094 } catch (...) {
1095 return handleAllExceptions(-1, ERR);
1096 }
1097 }
1098
1099 int32_t thermo_setState_Tsat(int32_t handle, double t, double x)
1100 {
1101 // method: virtual void ThermoPhase::setState_Tsat(double, double)
1102 try {
1103 ThermoPhaseCabinet::at(handle)->setState_Tsat(t, x);
1104 return 0;
1105 } catch (...) {
1106 return handleAllExceptions(-1, ERR);
1107 }
1108 }
1109
1110 int32_t surf_getCoverages(int32_t handle, int32_t thetaLen, double* theta)
1111 {
1112 // array getter: void SurfPhase::getCoverages(span<double>)
1113 try {
1114 auto obj = ThermoPhaseCabinet::as<SurfPhase>(handle);
1115 // no size checking specified
1116 span<double> theta_(theta, thetaLen);
1117 obj->getCoverages(theta_);
1118 return 0;
1119 } catch (...) {
1120 return handleAllExceptions(-1, ERR);
1121 }
1122 }
1123
1124 int32_t surf_setCoverages(int32_t handle, int32_t thetaLen, const double* theta)
1125 {
1126 // setter: void SurfPhase::setCoverages(span<const double>)
1127 try {
1128 span<const double> theta_(theta, thetaLen);
1129 ThermoPhaseCabinet::as<SurfPhase>(handle)->setCoverages(theta_);
1130 return 0;
1131 } catch (...) {
1132 return handleAllExceptions(-1, ERR);
1133 }
1134 }
1135
1136 int32_t surf_setCoveragesNoNorm(int32_t handle, int32_t thetaLen, const double* theta)
1137 {
1138 // setter: void SurfPhase::setCoveragesNoNorm(span<const double>)
1139 try {
1140 span<const double> theta_(theta, thetaLen);
1141 ThermoPhaseCabinet::as<SurfPhase>(handle)->setCoveragesNoNorm(theta_);
1142 return 0;
1143 } catch (...) {
1144 return handleAllExceptions(-1, ERR);
1145 }
1146 }
1147
1148 int32_t thermo_getConcentrations(int32_t handle, int32_t cLen, double* c)
1149 {
1150 // array getter: virtual void Phase::getConcentrations(span<double>)
1151 try {
1152 auto obj = ThermoPhaseCabinet::as<Phase>(handle);
1153 // no size checking specified
1154 span<double> c_(c, cLen);
1155 obj->getConcentrations(c_);
1156 return 0;
1157 } catch (...) {
1158 return handleAllExceptions(-1, ERR);
1159 }
1160 }
1161
1162 int32_t thermo_setConcentrations(int32_t handle, int32_t concLen, const double* conc)
1163 {
1164 // setter: virtual void Phase::setConcentrations(span<const double>)
1165 try {
1166 span<const double> conc_(conc, concLen);
1167 ThermoPhaseCabinet::as<Phase>(handle)->setConcentrations(conc_);
1168 return 0;
1169 } catch (...) {
1170 return handleAllExceptions(-1, ERR);
1171 }
1172 }
1173
1174 double surf_siteDensity(int32_t handle)
1175 {
1176 // getter: double SurfPhase::siteDensity()
1177 try {
1178 return ThermoPhaseCabinet::as<SurfPhase>(handle)->siteDensity();
1179 } catch (...) {
1180 return handleAllExceptions(DERR, DERR);
1181 }
1182 }
1183
1184 int32_t surf_setSiteDensity(int32_t handle, double n0)
1185 {
1186 // setter: void SurfPhase::setSiteDensity(double)
1187 try {
1188 ThermoPhaseCabinet::as<SurfPhase>(handle)->setSiteDensity(n0);
1189 return 0;
1190 } catch (...) {
1191 return handleAllExceptions(-1, ERR);
1192 }
1193 }
1194
1195 int32_t surf_setCoveragesByName(int32_t handle, const char* cov)
1196 {
1197 // setter: void SurfPhase::setCoveragesByName(const string&)
1198 try {
1199 ThermoPhaseCabinet::as<SurfPhase>(handle)->setCoveragesByName(cov);
1200 return 0;
1201 } catch (...) {
1202 return handleAllExceptions(-1, ERR);
1203 }
1204 }
1205
1206 int32_t thermo_setEquivalenceRatio(int32_t handle, double phi, const char* fuelComp, const char* oxComp)
1207 {
1208 // method: void ThermoPhase::setEquivalenceRatio(double, const string&, const string&)
1209 try {
1210 ThermoPhaseCabinet::at(handle)->setEquivalenceRatio(phi, fuelComp, oxComp);
1211 return 0;
1212 } catch (...) {
1213 return handleAllExceptions(-1, ERR);
1214 }
1215 }
1216
1217 double thermo_equivalenceRatio(int32_t handle)
1218 {
1219 // getter: double ThermoPhase::equivalenceRatio()
1220 try {
1221 return ThermoPhaseCabinet::at(handle)->equivalenceRatio();
1222 } catch (...) {
1223 return handleAllExceptions(DERR, DERR);
1224 }
1225 }
1226
1227 int32_t thermo_report(int32_t handle, int32_t show_thermo, double threshold, int32_t bufLen, char* buf)
1228 {
1229 // method: virtual string ThermoPhase::report(bool, double)
1230 try {
1231 bool show_thermo_ = (show_thermo != 0);
1232 string out = ThermoPhaseCabinet::at(handle)->report(show_thermo_, threshold);
1233 copyString(out, buf, bufLen);
1234 return int(out.size()) + 1;
1235 } catch (...) {
1236 return handleAllExceptions(-1, ERR);
1237 }
1238 }
1239
1240 int32_t thermo_print(int32_t handle, int32_t showThermo, double threshold)
1241 {
1242 // method: custom code
1243 try {
1244 // *************** begin custom code ***************
1245 bool show = (showThermo != 0);
1246 writelog(ThermoPhaseCabinet::at(handle)->report(show, threshold));
1247 return 0;
1248 // **************** end custom code ****************
1249 } catch (...) {
1250 return handleAllExceptions(-1, ERR);
1251 }
1252 }
1253
1254 int32_t thermo_del(int32_t handle)
1255 {
1256 // destructor
1257 try {
1258 ThermoPhaseCabinet::del(handle);
1259 return 0;
1260 } catch (...) {
1261 return handleAllExceptions(-1, ERR);
1262 }
1263 }
1264
1266 {
1267 // reserved CLib function: custom code
1268 try {
1269 // *************** begin custom code ***************
1270 return ThermoPhaseCabinet::size();
1271 // **************** end custom code ****************
1272 } catch (...) {
1273 return handleAllExceptions(-1, ERR);
1274 }
1275 }
1276
1277} // extern "C"
Header for a simple thermodynamics model of a surface phase derived from ThermoPhase,...
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Array size error.
Template for classes to hold pointers to objects.
Definition Cabinet.h:51
CTTHERMO - Generated CLib Cantera interface library.
double thermo_satTemperature(int32_t handle, double p)
Return the saturation temperature given the pressure.
int32_t thermo_setState_VH(int32_t handle, double v, double h)
Set the specific volume (m^3/kg) and the specific enthalpy (J/kg).
Definition ctthermo.cpp:984
double thermo_elementalMoleFraction(int32_t handle, const int32_t m)
Elemental mole fraction of element m.
Definition ctthermo.cpp:310
int32_t thermo_getGibbs_RT(int32_t handle, int32_t grtLen, double *grt)
Get the nondimensional Gibbs functions for the species in their standard states at the current T and ...
Definition ctthermo.cpp:775
int32_t surf_setCoveragesByName(int32_t handle, const char *cov)
Set the coverages from a string of colon-separated name:value pairs.
int32_t thermo_getPartialMolarCv_TV(int32_t handle, int32_t cvtildeLen, double *cvtilde)
Return an array of species molar heat capacities associated with the constant-volume partial molar in...
Definition ctthermo.cpp:719
int32_t thermo_speciesIndex(int32_t handle, const char *name)
Returns the index of a species named 'name' within the Phase object.
Definition ctthermo.cpp:388
int32_t thermo_speciesName(int32_t handle, int32_t k, int32_t bufLen, char *buf)
Name of the species with index k.
Definition ctthermo.cpp:364
int32_t thermo_getEntropy_R(int32_t handle, int32_t srLen, double *sr)
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition ctthermo.cpp:761
double thermo_cv_mole(int32_t handle)
Molar heat capacity at constant volume and composition [J/kmol/K].
Definition ctthermo.cpp:550
int32_t thermo_setState_TD(int32_t handle, double t, double rho)
Set the internally stored temperature (K) and density (kg/m^3).
Definition ctthermo.cpp:874
double thermo_intEnergy_mass(int32_t handle)
Specific internal energy.
Definition ctthermo.cpp:500
int32_t thermo_getConcentrations(int32_t handle, int32_t cLen, double *c)
Get the species concentrations (kmol/m^3).
int32_t thermo_getMoleFractions(int32_t handle, int32_t xLen, double *x)
Get the species mole fraction vector.
Definition ctthermo.cpp:196
int32_t surf_setCoverages(int32_t handle, int32_t thetaLen, const double *theta)
Set the surface site fractions to a specified state.
int32_t thermo_print(int32_t handle, int32_t showThermo, double threshold)
Print a summary of the state of the phase to the logger.
double thermo_cp_mass(int32_t handle)
Specific heat at constant pressure and composition [J/kg/K].
Definition ctthermo.cpp:540
int32_t thermo_setMassFractions(int32_t handle, int32_t yLen, const double *y)
Set the mass fractions to the specified values and normalize them.
Definition ctthermo.cpp:240
int32_t thermo_setState_ST(int32_t handle, double s, double t)
Set the specific entropy (J/kg/K) and temperature (K).
Definition ctthermo.cpp:940
double thermo_internalPressure(int32_t handle)
Return the internal pressure [Pa].
Definition ctthermo.cpp:639
int32_t thermo_setTemperature(int32_t handle, double temp)
Set the internally stored temperature of the phase (K).
Definition ctthermo.cpp:103
double thermo_maxTemp(int32_t handle, int32_t k)
Maximum temperature for which the thermodynamic data for the species are valid.
Definition ctthermo.cpp:440
double thermo_pressure(int32_t handle)
Return the thermodynamic pressure (Pa).
Definition ctthermo.cpp:114
double thermo_density(int32_t handle)
Density (kg/m^3).
Definition ctthermo.cpp:135
int32_t thermo_getElectrochemPotentials(int32_t handle, int32_t muLen, double *mu)
Get the species electrochemical potentials.
Definition ctthermo.cpp:584
double thermo_enthalpy_mole(int32_t handle)
Molar enthalpy.
Definition ctthermo.cpp:450
int32_t thermo_setState_SH(int32_t handle, double s, double h)
Set the specific entropy (J/kg/K) and the specific enthalpy (J/kg).
int32_t thermo_setMoleFractionsByName(int32_t handle, const char *x)
Set the mole fractions of a group of species by name.
Definition ctthermo.cpp:252
double thermo_cv_mass(int32_t handle)
Specific heat at constant volume and composition [J/kg/K].
Definition ctthermo.cpp:560
int32_t thermo_report(int32_t handle, int32_t show_thermo, double threshold, int32_t bufLen, char *buf)
returns a summary of the state of the phase as a string
int32_t thermo_setState_TH(int32_t handle, double t, double h)
Set the temperature (K) and the specific enthalpy (J/kg).
Definition ctthermo.cpp:995
int32_t thermo_del(int32_t handle)
Delete ThermoPhase object.
int32_t thermo_setState_SP(int32_t handle, double s, double p)
Set the specific entropy (J/kg/K) and pressure (Pa).
Definition ctthermo.cpp:929
int32_t thermo_getIntEnergy_RT(int32_t handle, int32_t urtLen, double *urt)
Returns the vector of nondimensional Internal Energies of the standard state species at the current T...
Definition ctthermo.cpp:789
int32_t thermo_setState_TV(int32_t handle, double t, double v)
Set the temperature (K) and specific volume (m^3/kg).
Definition ctthermo.cpp:951
double thermo_vaporFraction(int32_t handle)
Return the fraction of vapor at the current conditions.
int32_t thermo_addElement(int32_t handle, const char *symbol, double weight, int32_t atomicNumber, double entropy298, int32_t elem_type)
Add an element.
Definition ctthermo.cpp:410
int32_t thermo_getPartialMolarIntEnergies(int32_t handle, int32_t ubarLen, double *ubar)
Return an array of partial molar internal energies for the species in the mixture.
Definition ctthermo.cpp:677
double thermo_massFraction(int32_t handle, int32_t k)
Return the mass fraction of a single species.
Definition ctthermo.cpp:186
double thermo_gibbs_mole(int32_t handle)
Molar Gibbs function.
Definition ctthermo.cpp:510
int32_t surf_setCoveragesNoNorm(int32_t handle, int32_t thetaLen, const double *theta)
Set the surface site fractions to a specified state.
int32_t surf_getCoverages(int32_t handle, int32_t thetaLen, double *theta)
Return a vector of surface coverages.
int32_t thermo_setState_TPX_byName(int32_t handle, double t, double p, const char *x)
Set the temperature (K), pressure (Pa), and mole fractions.
Definition ctthermo.cpp:829
double thermo_critDensity(int32_t handle)
Critical density (kg/m3).
int32_t thermo_nElements(int32_t handle)
Number of elements.
Definition ctthermo.cpp:73
double thermo_meanMolecularWeight(int32_t handle)
The mean molecular weight.
Definition ctthermo.cpp:166
int32_t thermo_setState_Tsat(int32_t handle, double t, double x)
Set the state to a saturated system at a particular temperature.
int32_t thermo_setState_PV(int32_t handle, double p, double v)
Set the pressure (Pa) and specific volume (m^3/kg).
Definition ctthermo.cpp:962
double thermo_enthalpy_mass(int32_t handle)
Specific enthalpy.
Definition ctthermo.cpp:460
int32_t thermo_elementIndex(int32_t handle, const char *name)
Return the index of element named 'name'.
Definition ctthermo.cpp:376
int32_t thermo_type(int32_t handle, int32_t bufLen, char *buf)
String indicating the thermodynamic model implemented.
Definition ctthermo.cpp:61
int32_t thermo_nSpecies(int32_t handle)
Returns the number of species in the phase.
Definition ctthermo.cpp:83
double surf_siteDensity(int32_t handle)
Returns the site density.
double thermo_entropy_mass(int32_t handle)
Specific entropy.
Definition ctthermo.cpp:480
int32_t thermo_setName(int32_t handle, const char *nm)
Sets the string name for the phase.
Definition ctthermo.cpp:50
int32_t thermo_getCharges(int32_t handle, int32_t chargesLen, double *charges)
Copy the vector of species charges into array charges.
Definition ctthermo.cpp:336
int32_t thermo_setState_HP(int32_t handle, double h, double p)
Set the internally stored specific enthalpy (J/kg) and pressure (Pa) of the phase.
Definition ctthermo.cpp:896
int32_t thermo_setState_TPY(int32_t handle, double t, double p, int32_t yLen, const double *y)
Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase.
Definition ctthermo.cpp:840
int32_t thermo_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.
double thermo_elementalMassFraction(int32_t handle, const int32_t m)
Elemental mass fraction of element m.
Definition ctthermo.cpp:300
double thermo_intEnergy_mole(int32_t handle)
Molar internal energy.
Definition ctthermo.cpp:490
double thermo_critTemperature(int32_t handle)
Critical temperature (K).
int32_t thermo_name(int32_t handle, int32_t bufLen, char *buf)
Return the name of the phase.
Definition ctthermo.cpp:38
int32_t thermo_setState_TPX(int32_t handle, double t, double p, int32_t xLen, const double *x)
Set the temperature (K), pressure (Pa), and mole fractions.
Definition ctthermo.cpp:817
int32_t thermo_getChemPotentials(int32_t handle, int32_t muLen, double *mu)
Get the species chemical potentials.
Definition ctthermo.cpp:570
double thermo_electricPotential(int32_t handle)
Returns the electric potential of this phase (V).
Definition ctthermo.cpp:598
int32_t thermo_getPartialMolarEnthalpies(int32_t handle, int32_t hbarLen, double *hbar)
Returns an array of partial molar enthalpies for the species in the mixture.
Definition ctthermo.cpp:649
int32_t thermo_setState_Psat(int32_t handle, double p, double x)
Set the state to a saturated system at a particular pressure.
double thermo_refPressure(int32_t handle)
Returns the reference pressure in Pa.
Definition ctthermo.cpp:420
int32_t thermo_cabinetSize()
Return size of ThermoPhase storage.
double thermo_atomicWeight(int32_t handle, int32_t m)
Atomic weight of element m.
Definition ctthermo.cpp:290
double thermo_isothermalCompressibility(int32_t handle)
Returns the isothermal compressibility.
Definition ctthermo.cpp:629
int32_t thermo_getEnthalpy_RT(int32_t handle, int32_t hrtLen, double *hrt)
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition ctthermo.cpp:747
int32_t thermo_setPressure(int32_t handle, double p)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition ctthermo.cpp:124
double thermo_gibbs_mass(int32_t handle)
Specific Gibbs function.
Definition ctthermo.cpp:520
double thermo_moleFraction(int32_t handle, int32_t k)
Return the mole fraction of a single species.
Definition ctthermo.cpp:176
int32_t thermo_getPartialMolarCp(int32_t handle, int32_t cpbarLen, double *cpbar)
Return an array of partial molar heat capacities for the species in the mixture.
Definition ctthermo.cpp:705
int32_t thermo_setState_UP(int32_t handle, double u, double p)
Set the specific internal energy (J/kg) and pressure (Pa).
Definition ctthermo.cpp:973
int32_t thermo_getPartialMolarIntEnergies_TV(int32_t handle, int32_t utildeLen, double *utilde)
Return an array of partial molar internal energies at constant temperature and volume [J/kmol].
Definition ctthermo.cpp:691
double thermo_molarDensity(int32_t handle)
Molar density (kmol/m^3).
Definition ctthermo.cpp:156
double thermo_minTemp(int32_t handle, int32_t k)
Minimum temperature for which the thermodynamic data for the species or phase are valid.
Definition ctthermo.cpp:430
double thermo_equivalenceRatio(int32_t handle)
Compute the equivalence ratio for the current mixture from available oxygen and required oxygen.
int32_t thermo_setEquivalenceRatio(int32_t handle, double phi, const char *fuelComp, const char *oxComp)
Set the mixture composition according to the equivalence ratio.
int32_t thermo_setMassFractionsByName(int32_t handle, const char *x)
Set the species mass fractions by name.
Definition ctthermo.cpp:263
double thermo_satPressure(int32_t handle, double t)
Return the saturation pressure given the temperature.
int32_t thermo_getPartialMolarVolumes(int32_t handle, int32_t vbarLen, double *vbar)
Return an array of partial molar volumes for the species in the mixture.
Definition ctthermo.cpp:733
double thermo_thermalExpansionCoeff(int32_t handle)
Return the volumetric thermal expansion coefficient.
Definition ctthermo.cpp:619
int32_t thermo_setState_DP(int32_t handle, double rho, double p)
Set the density (kg/m**3) and pressure (Pa) at constant composition.
Definition ctthermo.cpp:885
int32_t thermo_setState_TP(int32_t handle, double t, double p)
Set the temperature (K) and pressure (Pa).
Definition ctthermo.cpp:863
double thermo_critPressure(int32_t handle)
Critical pressure (Pa).
int32_t thermo_atomicWeights(int32_t handle, int32_t bufLen, double *buf)
Return a read-only reference to the vector of atomic weights.
Definition ctthermo.cpp:274
int32_t thermo_setState_TPY_byName(int32_t handle, double t, double p, const char *y)
Set the internally stored temperature (K), pressure (Pa), and mass fractions of the phase.
Definition ctthermo.cpp:852
int32_t thermo_setMoleFractions(int32_t handle, int32_t xLen, const double *x)
Set the mole fractions to the specified values.
Definition ctthermo.cpp:228
int32_t thermo_getMassFractions(int32_t handle, int32_t yLen, double *y)
Get the species mass fractions.
Definition ctthermo.cpp:212
int32_t thermo_elementName(int32_t handle, int32_t m, int32_t bufLen, char *buf)
Name of the element with index m.
Definition ctthermo.cpp:352
double thermo_temperature(int32_t handle)
Temperature (K).
Definition ctthermo.cpp:93
double thermo_cp_mole(int32_t handle)
Molar heat capacity at constant pressure and composition [J/kmol/K].
Definition ctthermo.cpp:530
int32_t thermo_setDensity(int32_t handle, const double density_)
Set the internally stored density (kg/m^3) of the phase.
Definition ctthermo.cpp:145
int32_t thermo_getCp_R(int32_t handle, int32_t cprLen, double *cpr)
Get the nondimensional Heat Capacities at constant pressure for the species standard states at the cu...
Definition ctthermo.cpp:803
int32_t thermo_getMolecularWeights(int32_t handle, int32_t weightsLen, double *weights)
Copy the vector of molecular weights into array weights.
Definition ctthermo.cpp:320
int32_t surf_setSiteDensity(int32_t handle, double n0)
Set the site density of the surface phase (kmol m-2).
int32_t thermo_getPartialMolarEntropies(int32_t handle, int32_t sbarLen, double *sbar)
Returns an array of partial molar entropies of the species in the solution.
Definition ctthermo.cpp:663
double thermo_entropy_mole(int32_t handle)
Molar entropy.
Definition ctthermo.cpp:470
int32_t thermo_setElectricPotential(int32_t handle, double v)
Set the electric potential of this phase (V).
Definition ctthermo.cpp:608
int32_t thermo_setState_UV(int32_t handle, double u, double v)
Set the specific internal energy (J/kg) and specific volume (m^3/kg).
Definition ctthermo.cpp:907
int32_t thermo_setConcentrations(int32_t handle, int32_t concLen, const double *conc)
Set the concentrations to the specified values within the phase.
int32_t thermo_setState_SV(int32_t handle, double s, double v)
Set the specific entropy (J/kg/K) and specific volume (m^3/kg).
Definition ctthermo.cpp:918
double thermo_nAtoms(int32_t handle, int32_t k, int32_t m)
Number of atoms of element m in species k.
Definition ctthermo.cpp:400
size_t copyString(const string &source, char *dest, size_t length)
Copy the contents of a string into a char array of a given length.
void writelog(const string &fmt, const Args &... args)
Write a formatted message to the screen.
Definition global.h:171
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
Exception handler used at language interface boundaries.
Definition clib_utils.h:32
Contains declarations for string manipulation functions within Cantera.