From 100d6db87b4b3da940003d87ed5f89ddb0cd976d Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Sat, 15 Oct 2016 19:48:18 -0400 Subject: [PATCH] [clib] Combine "phase_" and "th_" prefixes as "thermo_" --- include/cantera/clib/ct.h | 152 ++++++++++++++++---------------- src/clib/ct.cpp | 162 +++++++++++++++++------------------ src/matlab/phasemethods.cpp | 56 ++++++------ src/matlab/surfmethods.cpp | 4 +- src/matlab/thermomethods.cpp | 96 ++++++++++----------- 5 files changed, 235 insertions(+), 235 deletions(-) diff --git a/include/cantera/clib/ct.h b/include/cantera/clib/ct.h index 38c1b28f32..6c074f14ec 100644 --- a/include/cantera/clib/ct.h +++ b/include/cantera/clib/ct.h @@ -15,92 +15,92 @@ extern "C" { #endif CANTERA_CAPI int ct_appdelete(); - CANTERA_CAPI size_t phase_nElements(int n); - CANTERA_CAPI size_t phase_nSpecies(int n); - CANTERA_CAPI double phase_temperature(int n); - CANTERA_CAPI int phase_setTemperature(int n, double t); - CANTERA_CAPI double phase_density(int n); - CANTERA_CAPI int phase_setDensity(int n, double rho); - CANTERA_CAPI double phase_molarDensity(int n); - CANTERA_CAPI int phase_setMolarDensity(int n, double ndens); - CANTERA_CAPI double phase_meanMolecularWeight(int n); - CANTERA_CAPI double phase_moleFraction(int n, size_t k); - CANTERA_CAPI double phase_massFraction(int n, size_t k); - CANTERA_CAPI int phase_getMoleFractions(int n, size_t lenx, double* x); - CANTERA_CAPI int phase_getMassFractions(int n, size_t leny, double* y); - CANTERA_CAPI int phase_setMoleFractions(int n, size_t lenx, + CANTERA_CAPI size_t thermo_nElements(int n); + CANTERA_CAPI size_t thermo_nSpecies(int n); + CANTERA_CAPI double thermo_temperature(int n); + CANTERA_CAPI int thermo_setTemperature(int n, double t); + CANTERA_CAPI double thermo_density(int n); + CANTERA_CAPI int thermo_setDensity(int n, double rho); + CANTERA_CAPI double thermo_molarDensity(int n); + CANTERA_CAPI int thermo_setMolarDensity(int n, double ndens); + CANTERA_CAPI double thermo_meanMolecularWeight(int n); + CANTERA_CAPI double thermo_moleFraction(int n, size_t k); + CANTERA_CAPI double thermo_massFraction(int n, size_t k); + CANTERA_CAPI int thermo_getMoleFractions(int n, size_t lenx, double* x); + CANTERA_CAPI int thermo_getMassFractions(int n, size_t leny, double* y); + CANTERA_CAPI int thermo_setMoleFractions(int n, size_t lenx, double* x, int norm); - CANTERA_CAPI int phase_setMassFractions(int n, size_t leny, + CANTERA_CAPI int thermo_setMassFractions(int n, size_t leny, double* y, int norm); - CANTERA_CAPI int phase_setMoleFractionsByName(int n, const char* x); - CANTERA_CAPI int phase_setMassFractionsByName(int n, const char* y); - CANTERA_CAPI int phase_getAtomicWeights(int n, size_t lenm, double* atw); - CANTERA_CAPI int phase_getMolecularWeights(int n, size_t lenm, double* mw); - CANTERA_CAPI int phase_getElementName(int n, size_t k, size_t lennm, char* nm); - CANTERA_CAPI int phase_getSpeciesName(int n, size_t m, size_t lennm, char* nm); - CANTERA_CAPI int phase_getName(int n, size_t lennm, char* nm); - CANTERA_CAPI int phase_setName(int n, const char* nm); - CANTERA_CAPI size_t phase_elementIndex(int n, const char* nm); - CANTERA_CAPI size_t phase_speciesIndex(int n, const char* nm); - CANTERA_CAPI int phase_report(int nth, + CANTERA_CAPI int thermo_setMoleFractionsByName(int n, const char* x); + CANTERA_CAPI int thermo_setMassFractionsByName(int n, const char* y); + CANTERA_CAPI int thermo_getAtomicWeights(int n, size_t lenm, double* atw); + CANTERA_CAPI int thermo_getMolecularWeights(int n, size_t lenm, double* mw); + CANTERA_CAPI int thermo_getElementName(int n, size_t k, size_t lennm, char* nm); + CANTERA_CAPI int thermo_getSpeciesName(int n, size_t m, size_t lennm, char* nm); + CANTERA_CAPI int thermo_getName(int n, size_t lennm, char* nm); + CANTERA_CAPI int thermo_setName(int n, const char* nm); + CANTERA_CAPI size_t thermo_elementIndex(int n, const char* nm); + CANTERA_CAPI size_t thermo_speciesIndex(int n, const char* nm); + CANTERA_CAPI int thermo_report(int nth, int ibuf, char* buf, int show_thermo); CANTERA_CAPI int write_phase(int nth, int show_thermo, double threshold); - CANTERA_CAPI double phase_nAtoms(int n, size_t k, size_t m); + CANTERA_CAPI double thermo_nAtoms(int n, size_t k, size_t m); - CANTERA_CAPI int phase_addElement(int n, const char* name, double weight); + CANTERA_CAPI int thermo_addElement(int n, const char* name, double weight); CANTERA_CAPI int newThermoFromXML(int mxml); - CANTERA_CAPI int th_eosType(int n); - CANTERA_CAPI double th_refPressure(int n); - CANTERA_CAPI double th_minTemp(int n, int k); - CANTERA_CAPI double th_maxTemp(int n, int k); - CANTERA_CAPI double th_enthalpy_mole(int n); - CANTERA_CAPI double th_intEnergy_mole(int n); - CANTERA_CAPI double th_entropy_mole(int n); - CANTERA_CAPI double th_gibbs_mole(int n); - CANTERA_CAPI double th_cp_mole(int n); - CANTERA_CAPI double th_cv_mole(int n); - CANTERA_CAPI double th_pressure(int n); - CANTERA_CAPI int th_setPressure(int n, double p); - CANTERA_CAPI double th_enthalpy_mass(int n); - CANTERA_CAPI double th_intEnergy_mass(int n); - CANTERA_CAPI double th_entropy_mass(int n); - CANTERA_CAPI double th_gibbs_mass(int n); - CANTERA_CAPI double th_cp_mass(int n); - CANTERA_CAPI double th_cv_mass(int n); - CANTERA_CAPI double th_electricPotential(int n); - CANTERA_CAPI double th_thermalExpansionCoeff(int n); - CANTERA_CAPI double th_isothermalCompressibility(int n); - CANTERA_CAPI int th_chemPotentials(int n, size_t lenm, double* murt); - CANTERA_CAPI int th_elementPotentials(int n, size_t lenm, double* lambda); - CANTERA_CAPI int th_getEnthalpies_RT(int n, size_t lenm, double* h_rt); - CANTERA_CAPI int th_getEntropies_R(int n, size_t lenm, double* s_r); - CANTERA_CAPI int th_getCp_R(int n, size_t lenm, double* cp_r); - CANTERA_CAPI int th_setElectricPotential(int n, double v); - CANTERA_CAPI int th_set_RP(int n, double* vals); - CANTERA_CAPI int th_set_HP(int n, double* vals); - CANTERA_CAPI int th_set_UV(int n, double* vals); - CANTERA_CAPI int th_set_SV(int n, double* vals); - CANTERA_CAPI int th_set_SP(int n, double* vals); - CANTERA_CAPI int th_set_ST(int n, double* vals); - CANTERA_CAPI int th_set_TV(int n, double* vals); - CANTERA_CAPI int th_set_PV(int n, double* vals); - CANTERA_CAPI int th_set_UP(int n, double* vals); - CANTERA_CAPI int th_set_VH(int n, double* vals); - CANTERA_CAPI int th_set_TH(int n, double* vals); - CANTERA_CAPI int th_set_SH(int n, double* vals); - CANTERA_CAPI int th_equil(int n, const char* XY, int solver, + CANTERA_CAPI int thermo_eosType(int n); + CANTERA_CAPI double thermo_refPressure(int n); + CANTERA_CAPI double thermo_minTemp(int n, int k); + CANTERA_CAPI double thermo_maxTemp(int n, int k); + CANTERA_CAPI double thermo_enthalpy_mole(int n); + CANTERA_CAPI double thermo_intEnergy_mole(int n); + CANTERA_CAPI double thermo_entropy_mole(int n); + CANTERA_CAPI double thermo_gibbs_mole(int n); + CANTERA_CAPI double thermo_cp_mole(int n); + CANTERA_CAPI double thermo_cv_mole(int n); + CANTERA_CAPI double thermo_pressure(int n); + CANTERA_CAPI int thermo_setPressure(int n, double p); + CANTERA_CAPI double thermo_enthalpy_mass(int n); + CANTERA_CAPI double thermo_intEnergy_mass(int n); + CANTERA_CAPI double thermo_entropy_mass(int n); + CANTERA_CAPI double thermo_gibbs_mass(int n); + CANTERA_CAPI double thermo_cp_mass(int n); + CANTERA_CAPI double thermo_cv_mass(int n); + CANTERA_CAPI double thermo_electricPotential(int n); + CANTERA_CAPI double thermo_thermalExpansionCoeff(int n); + CANTERA_CAPI double thermo_isothermalCompressibility(int n); + CANTERA_CAPI int thermo_chemPotentials(int n, size_t lenm, double* murt); + CANTERA_CAPI int thermo_elementPotentials(int n, size_t lenm, double* lambda); + CANTERA_CAPI int thermo_getEnthalpies_RT(int n, size_t lenm, double* h_rt); + CANTERA_CAPI int thermo_getEntropies_R(int n, size_t lenm, double* s_r); + CANTERA_CAPI int thermo_getCp_R(int n, size_t lenm, double* cp_r); + CANTERA_CAPI int thermo_setElectricPotential(int n, double v); + CANTERA_CAPI int thermo_set_RP(int n, double* vals); + CANTERA_CAPI int thermo_set_HP(int n, double* vals); + CANTERA_CAPI int thermo_set_UV(int n, double* vals); + CANTERA_CAPI int thermo_set_SV(int n, double* vals); + CANTERA_CAPI int thermo_set_SP(int n, double* vals); + CANTERA_CAPI int thermo_set_ST(int n, double* vals); + CANTERA_CAPI int thermo_set_TV(int n, double* vals); + CANTERA_CAPI int thermo_set_PV(int n, double* vals); + CANTERA_CAPI int thermo_set_UP(int n, double* vals); + CANTERA_CAPI int thermo_set_VH(int n, double* vals); + CANTERA_CAPI int thermo_set_TH(int n, double* vals); + CANTERA_CAPI int thermo_set_SH(int n, double* vals); + CANTERA_CAPI int thermo_equil(int n, const char* XY, int solver, double rtol, int maxsteps, int maxiter, int loglevel); - CANTERA_CAPI double th_critTemperature(int n); - CANTERA_CAPI double th_critPressure(int n); - CANTERA_CAPI double th_critDensity(int n); - CANTERA_CAPI double th_vaporFraction(int n); - CANTERA_CAPI double th_satTemperature(int n, double p); - CANTERA_CAPI double th_satPressure(int n, double t); - CANTERA_CAPI int th_setState_Psat(int n, double p, double x); - CANTERA_CAPI int th_setState_Tsat(int n, double t, double x); + CANTERA_CAPI double thermo_critTemperature(int n); + CANTERA_CAPI double thermo_critPressure(int n); + CANTERA_CAPI double thermo_critDensity(int n); + CANTERA_CAPI double thermo_vaporFraction(int n); + CANTERA_CAPI double thermo_satTemperature(int n, double p); + CANTERA_CAPI double thermo_satPressure(int n, double t); + CANTERA_CAPI int thermo_setState_Psat(int n, double p, double x); + CANTERA_CAPI int thermo_setState_Tsat(int n, double t, double x); CANTERA_CAPI size_t newKineticsFromXML(int mxml, int iphase, int neighbor1, int neighbor2, int neighbor3, diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index 76ec6417ab..3f216dee52 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -53,7 +53,7 @@ extern "C" { //--------------- Phase ---------------------// - size_t phase_nElements(int n) + size_t thermo_nElements(int n) { try { return ThermoCabinet::item(n).nElements(); @@ -62,7 +62,7 @@ extern "C" { } } - size_t phase_nSpecies(int n) + size_t thermo_nSpecies(int n) { try { return ThermoCabinet::item(n).nSpecies(); @@ -71,7 +71,7 @@ extern "C" { } } - doublereal phase_temperature(int n) + doublereal thermo_temperature(int n) { try { return ThermoCabinet::item(n).temperature(); @@ -80,7 +80,7 @@ extern "C" { } } - int phase_setTemperature(int n, double t) + int thermo_setTemperature(int n, double t) { try { ThermoCabinet::item(n).setTemperature(t); @@ -90,7 +90,7 @@ extern "C" { return 0; } - doublereal phase_density(int n) + doublereal thermo_density(int n) { try { return ThermoCabinet::item(n).density(); @@ -99,7 +99,7 @@ extern "C" { } } - int phase_setDensity(int n, double rho) + int thermo_setDensity(int n, double rho) { if (rho < 0.0) { return -1; @@ -112,7 +112,7 @@ extern "C" { return 0; } - doublereal phase_molarDensity(int n) + doublereal thermo_molarDensity(int n) { try { return ThermoCabinet::item(n).molarDensity(); @@ -121,7 +121,7 @@ extern "C" { } } - int phase_setMolarDensity(int n, double ndens) + int thermo_setMolarDensity(int n, double ndens) { if (ndens < 0.0) { return -1; @@ -134,7 +134,7 @@ extern "C" { return 0; } - doublereal phase_meanMolecularWeight(int n) + doublereal thermo_meanMolecularWeight(int n) { try { return ThermoCabinet::item(n).meanMolecularWeight(); @@ -143,7 +143,7 @@ extern "C" { } } - size_t phase_elementIndex(int n, const char* nm) + size_t thermo_elementIndex(int n, const char* nm) { try { return ThermoCabinet::item(n).elementIndex(nm); @@ -152,7 +152,7 @@ extern "C" { } } - size_t phase_speciesIndex(int n, const char* nm) + size_t thermo_speciesIndex(int n, const char* nm) { try { return ThermoCabinet::item(n).speciesIndex(nm); @@ -161,7 +161,7 @@ extern "C" { } } - int phase_getMoleFractions(int n, size_t lenx, double* x) + int thermo_getMoleFractions(int n, size_t lenx, double* x) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -173,7 +173,7 @@ extern "C" { } } - doublereal phase_moleFraction(int n, size_t k) + doublereal thermo_moleFraction(int n, size_t k) { try { return ThermoCabinet::item(n).moleFraction(k); @@ -182,7 +182,7 @@ extern "C" { } } - int phase_getMassFractions(int n, size_t leny, double* y) + int thermo_getMassFractions(int n, size_t leny, double* y) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -194,7 +194,7 @@ extern "C" { } } - doublereal phase_massFraction(int n, size_t k) + doublereal thermo_massFraction(int n, size_t k) { try { return ThermoCabinet::item(n).massFraction(k); @@ -203,7 +203,7 @@ extern "C" { } } - int phase_setMoleFractions(int n, size_t lenx, double* x, int norm) + int thermo_setMoleFractions(int n, size_t lenx, double* x, int norm) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -219,7 +219,7 @@ extern "C" { } } - int phase_setMoleFractionsByName(int n, const char* x) + int thermo_setMoleFractionsByName(int n, const char* x) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -230,7 +230,7 @@ extern "C" { } } - int phase_setMassFractions(int n, size_t leny, + int thermo_setMassFractions(int n, size_t leny, double* y, int norm) { try { @@ -247,7 +247,7 @@ extern "C" { } } - int phase_setMassFractionsByName(int n, const char* y) + int thermo_setMassFractionsByName(int n, const char* y) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -258,7 +258,7 @@ extern "C" { } } - int phase_getAtomicWeights(int n, size_t lenm, double* atw) + int thermo_getAtomicWeights(int n, size_t lenm, double* atw) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -271,7 +271,7 @@ extern "C" { } } - int phase_getMolecularWeights(int n, size_t lenm, double* mw) + int thermo_getMolecularWeights(int n, size_t lenm, double* mw) { try { ThermoPhase& p = ThermoCabinet::item(n); @@ -284,7 +284,7 @@ extern "C" { } } - int phase_getName(int n, size_t lennm, char* nm) + int thermo_getName(int n, size_t lennm, char* nm) { try { copyString(ThermoCabinet::item(n).name(), nm, lennm); @@ -294,7 +294,7 @@ extern "C" { } } - int phase_setName(int n, const char* nm) + int thermo_setName(int n, const char* nm) { try { ThermoCabinet::item(n).setName(nm); @@ -304,7 +304,7 @@ extern "C" { } } - int phase_getSpeciesName(int n, size_t k, size_t lennm, char* nm) + int thermo_getSpeciesName(int n, size_t k, size_t lennm, char* nm) { try { copyString(ThermoCabinet::item(n).speciesName(k), nm, lennm); @@ -314,7 +314,7 @@ extern "C" { } } - int phase_getElementName(int n, size_t m, size_t lennm, char* nm) + int thermo_getElementName(int n, size_t m, size_t lennm, char* nm) { try { copyString(ThermoCabinet::item(n).elementName(m), nm, lennm); @@ -325,7 +325,7 @@ extern "C" { } - doublereal phase_nAtoms(int n, size_t k, size_t m) + doublereal thermo_nAtoms(int n, size_t k, size_t m) { try { return ThermoCabinet::item(n).nAtoms(k,m); @@ -334,7 +334,7 @@ extern "C" { } } - int phase_addElement(int n, const char* name, doublereal weight) + int thermo_addElement(int n, const char* name, doublereal weight) { try { ThermoCabinet::item(n).addElement(name, weight); @@ -357,7 +357,7 @@ extern "C" { } } - int th_eosType(int n) + int thermo_eosType(int n) { try { return ThermoCabinet::item(n).eosType(); @@ -366,7 +366,7 @@ extern "C" { } } - double th_enthalpy_mole(int n) + double thermo_enthalpy_mole(int n) { try { return ThermoCabinet::item(n).enthalpy_mole(); @@ -375,7 +375,7 @@ extern "C" { } } - double th_intEnergy_mole(int n) + double thermo_intEnergy_mole(int n) { try { return ThermoCabinet::item(n).intEnergy_mole(); @@ -384,7 +384,7 @@ extern "C" { } } - double th_entropy_mole(int n) + double thermo_entropy_mole(int n) { try { return ThermoCabinet::item(n).entropy_mole(); @@ -393,7 +393,7 @@ extern "C" { } } - double th_gibbs_mole(int n) + double thermo_gibbs_mole(int n) { try { return ThermoCabinet::item(n).gibbs_mole(); @@ -402,7 +402,7 @@ extern "C" { } } - double th_cp_mole(int n) + double thermo_cp_mole(int n) { try { return ThermoCabinet::item(n).cp_mole(); @@ -411,7 +411,7 @@ extern "C" { } } - double th_cv_mole(int n) + double thermo_cv_mole(int n) { try { return ThermoCabinet::item(n).cv_mole(); @@ -420,7 +420,7 @@ extern "C" { } } - double th_pressure(int n) + double thermo_pressure(int n) { try { return ThermoCabinet::item(n).pressure(); @@ -429,7 +429,7 @@ extern "C" { } } - double th_enthalpy_mass(int n) + double thermo_enthalpy_mass(int n) { try { return ThermoCabinet::item(n).enthalpy_mass(); @@ -438,7 +438,7 @@ extern "C" { } } - double th_intEnergy_mass(int n) + double thermo_intEnergy_mass(int n) { try { return ThermoCabinet::item(n).intEnergy_mass(); @@ -447,7 +447,7 @@ extern "C" { } } - double th_entropy_mass(int n) + double thermo_entropy_mass(int n) { try { return ThermoCabinet::item(n).entropy_mass(); @@ -456,7 +456,7 @@ extern "C" { } } - double th_gibbs_mass(int n) + double thermo_gibbs_mass(int n) { try { return ThermoCabinet::item(n).gibbs_mass(); @@ -465,7 +465,7 @@ extern "C" { } } - double th_cp_mass(int n) + double thermo_cp_mass(int n) { try { return ThermoCabinet::item(n).cp_mass(); @@ -474,7 +474,7 @@ extern "C" { } } - double th_cv_mass(int n) + double thermo_cv_mass(int n) { try { return ThermoCabinet::item(n).cv_mass(); @@ -483,7 +483,7 @@ extern "C" { } } - double th_electricPotential(int n) + double thermo_electricPotential(int n) { try { return ThermoCabinet::item(n).electricPotential(); @@ -492,7 +492,7 @@ extern "C" { } } - int th_chemPotentials(int n, size_t lenm, double* murt) + int thermo_chemPotentials(int n, size_t lenm, double* murt) { try { ThermoPhase& thrm = ThermoCabinet::item(n); @@ -504,7 +504,7 @@ extern "C" { } } - int th_elementPotentials(int n, size_t lenm, double* lambda) + int thermo_elementPotentials(int n, size_t lenm, double* lambda) { try { ThermoPhase& thrm = ThermoCabinet::item(n); @@ -517,10 +517,10 @@ extern "C" { } } - int th_setPressure(int n, double p) + int thermo_setPressure(int n, double p) { try { - if (p < 0.0) throw CanteraError("th_setPressure", + if (p < 0.0) throw CanteraError("thermo_setPressure", "pressure cannot be negative"); ThermoCabinet::item(n).setPressure(p); return 0; @@ -529,7 +529,7 @@ extern "C" { } } - int th_set_RP(int n, double* vals) + int thermo_set_RP(int n, double* vals) { try{ ThermoCabinet::item(n).setState_RP(vals[0], vals[1]); @@ -539,16 +539,16 @@ extern "C" { } } - int th_set_HP(int n, double* vals) + int thermo_set_HP(int n, double* vals) { try { if (vals[1] < 0.0) { - throw CanteraError("th_set_HP", + throw CanteraError("thermo_set_HP", "pressure cannot be negative"); } ThermoCabinet::item(n).setState_HP(vals[0],vals[1]); if (ThermoCabinet::item(n).temperature() < 0.0) { - throw CanteraError("th_set_HP", + throw CanteraError("thermo_set_HP", "temperature cannot be negative"); } return 0; @@ -557,16 +557,16 @@ extern "C" { } } - int th_set_UV(int n, double* vals) + int thermo_set_UV(int n, double* vals) { try { if (vals[1] < 0.0) { - throw CanteraError("th_set_UV", + throw CanteraError("thermo_set_UV", "specific volume cannot be negative"); } ThermoCabinet::item(n).setState_UV(vals[0],vals[1]); if (ThermoCabinet::item(n).temperature() < 0.0) { - throw CanteraError("th_set_UV", + throw CanteraError("thermo_set_UV", "temperature cannot be negative"); } return 0; @@ -575,7 +575,7 @@ extern "C" { } } - int th_set_SV(int n, double* vals) + int thermo_set_SV(int n, double* vals) { try { ThermoCabinet::item(n).setState_SV(vals[0],vals[1]); @@ -585,7 +585,7 @@ extern "C" { } } - int th_set_SP(int n, double* vals) + int thermo_set_SP(int n, double* vals) { try { ThermoCabinet::item(n).setState_SP(vals[0],vals[1]); @@ -595,7 +595,7 @@ extern "C" { } } - int th_set_ST(int n, double* vals) + int thermo_set_ST(int n, double* vals) { try { ThermoCabinet::item(n).setState_ST(vals[0],vals[1]); @@ -605,7 +605,7 @@ extern "C" { } } - int th_set_TV(int n, double* vals) + int thermo_set_TV(int n, double* vals) { try { ThermoCabinet::item(n).setState_TV(vals[0],vals[1]); @@ -615,7 +615,7 @@ extern "C" { } } - int th_set_PV(int n, double* vals) + int thermo_set_PV(int n, double* vals) { try { ThermoCabinet::item(n).setState_PV(vals[0],vals[1]); @@ -625,7 +625,7 @@ extern "C" { } } - int th_set_UP(int n, double* vals) + int thermo_set_UP(int n, double* vals) { try { ThermoCabinet::item(n).setState_UP(vals[0],vals[1]); @@ -635,7 +635,7 @@ extern "C" { } } - int th_set_VH(int n, double* vals) + int thermo_set_VH(int n, double* vals) { try { ThermoCabinet::item(n).setState_VH(vals[0],vals[1]); @@ -645,7 +645,7 @@ extern "C" { } } - int th_set_TH(int n, double* vals) + int thermo_set_TH(int n, double* vals) { try { ThermoCabinet::item(n).setState_TH(vals[0],vals[1]); @@ -655,7 +655,7 @@ extern "C" { } } - int th_set_SH(int n, double* vals) + int thermo_set_SH(int n, double* vals) { try { ThermoCabinet::item(n).setState_SH(vals[0],vals[1]); @@ -665,7 +665,7 @@ extern "C" { } } - int th_equil(int n, const char* XY, int solver, + int thermo_equil(int n, const char* XY, int solver, double rtol, int maxsteps, int maxiter, int loglevel) { try { @@ -679,7 +679,7 @@ extern "C" { } else if (solver == 2) { ssolver = "vcs"; } else { - throw CanteraError("th_equil", + throw CanteraError("thermo_equil", "Invalid equilibrium solver specified."); } ThermoCabinet::item(n).equilibrate(XY, ssolver, rtol, maxsteps, @@ -690,7 +690,7 @@ extern "C" { } } - doublereal th_refPressure(int n) + doublereal thermo_refPressure(int n) { try { return ThermoCabinet::item(n).refPressure(); @@ -699,7 +699,7 @@ extern "C" { } } - doublereal th_minTemp(int n, int k) + doublereal thermo_minTemp(int n, int k) { try { ThermoPhase& ph = ThermoCabinet::item(n); @@ -714,7 +714,7 @@ extern "C" { } } - doublereal th_maxTemp(int n, int k) + doublereal thermo_maxTemp(int n, int k) { try { ThermoPhase& ph = ThermoCabinet::item(n); @@ -730,7 +730,7 @@ extern "C" { } - int th_getEnthalpies_RT(int n, size_t lenm, double* h_rt) + int thermo_getEnthalpies_RT(int n, size_t lenm, double* h_rt) { try { ThermoPhase& thrm = ThermoCabinet::item(n); @@ -742,7 +742,7 @@ extern "C" { } } - int th_getEntropies_R(int n, size_t lenm, double* s_r) + int thermo_getEntropies_R(int n, size_t lenm, double* s_r) { try { ThermoPhase& thrm = ThermoCabinet::item(n); @@ -754,7 +754,7 @@ extern "C" { } } - int th_getCp_R(int n, size_t lenm, double* cp_r) + int thermo_getCp_R(int n, size_t lenm, double* cp_r) { try { ThermoPhase& thrm = ThermoCabinet::item(n); @@ -766,7 +766,7 @@ extern "C" { } } - int th_setElectricPotential(int n, double v) + int thermo_setElectricPotential(int n, double v) { try { ThermoCabinet::item(n).setElectricPotential(v); @@ -776,7 +776,7 @@ extern "C" { } } - doublereal th_thermalExpansionCoeff(int n) + doublereal thermo_thermalExpansionCoeff(int n) { try { return ThermoCabinet::item(n).thermalExpansionCoeff(); @@ -785,7 +785,7 @@ extern "C" { } } - doublereal th_isothermalCompressibility(int n) + doublereal thermo_isothermalCompressibility(int n) { try { return ThermoCabinet::item(n).isothermalCompressibility(); @@ -796,7 +796,7 @@ extern "C" { //-------------- pure fluids ---------------// - double th_critTemperature(int n) + double thermo_critTemperature(int n) { try { return ThermoCabinet::item(n).critTemperature(); @@ -805,7 +805,7 @@ extern "C" { } } - double th_critPressure(int n) + double thermo_critPressure(int n) { try { return ThermoCabinet::item(n).critPressure(); @@ -814,7 +814,7 @@ extern "C" { } } - double th_critDensity(int n) + double thermo_critDensity(int n) { try { return ThermoCabinet::item(n).critDensity(); @@ -823,7 +823,7 @@ extern "C" { } } - double th_vaporFraction(int n) + double thermo_vaporFraction(int n) { try { return ThermoCabinet::get(n).vaporFraction(); @@ -832,7 +832,7 @@ extern "C" { } } - double th_satTemperature(int n, double p) + double thermo_satTemperature(int n, double p) { try { return ThermoCabinet::item(n).satTemperature(p); @@ -841,7 +841,7 @@ extern "C" { } } - double th_satPressure(int n, double t) + double thermo_satPressure(int n, double t) { try { return ThermoCabinet::item(n).satPressure(t); @@ -850,7 +850,7 @@ extern "C" { } } - int th_setState_Psat(int n, double p, double x) + int thermo_setState_Psat(int n, double p, double x) { try { ThermoCabinet::get(n).setState_Psat(p, x); @@ -860,7 +860,7 @@ extern "C" { } } - int th_setState_Tsat(int n, double t, double x) + int thermo_setState_Tsat(int n, double t, double x) { try { ThermoCabinet::get(n).setState_Tsat(t, x); diff --git a/src/matlab/phasemethods.cpp b/src/matlab/phasemethods.cpp index d166e32773..c24f396c1b 100644 --- a/src/matlab/phasemethods.cpp +++ b/src/matlab/phasemethods.cpp @@ -32,7 +32,7 @@ void phasemethods(int nlhs, mxArray* plhs[], m = mxGetM(prhs[3]); n = mxGetN(prhs[3]); - nsp = phase_nSpecies(ph); + nsp = thermo_nSpecies(ph); // set scalar attributes if (mjob < 10) { @@ -42,10 +42,10 @@ void phasemethods(int nlhs, mxArray* plhs[], switch (mjob) { case 1: - iok = phase_setTemperature(ph,*ptr); + iok = thermo_setTemperature(ph,*ptr); break; case 2: - iok = phase_setDensity(ph,*ptr); + iok = thermo_setDensity(ph,*ptr); break; default: mexErrMsgTxt("Unknown job number"); @@ -56,18 +56,18 @@ void phasemethods(int nlhs, mxArray* plhs[], int norm = 1; switch (mjob) { case 20: - iok = phase_setMoleFractions(ph, nsp, ptr, norm); + iok = thermo_setMoleFractions(ph, nsp, ptr, norm); break; case 21: - iok = phase_setMassFractions(ph, nsp, ptr, norm); + iok = thermo_setMassFractions(ph, nsp, ptr, norm); break; case 22: norm = 0; - iok = phase_setMoleFractions(ph, nsp, ptr, norm); + iok = thermo_setMoleFractions(ph, nsp, ptr, norm); break; case 23: norm = 0; - iok = phase_setMassFractions(ph, nsp, ptr, norm); + iok = thermo_setMassFractions(ph, nsp, ptr, norm); break; default: mexErrMsgTxt("Unknown job number"); @@ -93,13 +93,13 @@ void phasemethods(int nlhs, mxArray* plhs[], switch (mjob) { case 30: - iok = phase_setMoleFractionsByName(ph, input_buf); + iok = thermo_setMoleFractionsByName(ph, input_buf); break; case 31: - iok = phase_setMassFractionsByName(ph, input_buf); + iok = thermo_setMassFractionsByName(ph, input_buf); break; case 32: - iok = phase_setName(ph, input_buf); + iok = thermo_setName(ph, input_buf); break; default: mexErrMsgTxt("Unknown job number"); @@ -116,53 +116,53 @@ void phasemethods(int nlhs, mxArray* plhs[], break; case 1: // floating-point attributes - vv = phase_temperature(ph); + vv = thermo_temperature(ph); if (vv == DERR) { reportError(); } break; case 2: - vv = phase_density(ph); + vv = thermo_density(ph); if (vv == DERR) { reportError(); } break; case 3: - vv = phase_molarDensity(ph); + vv = thermo_molarDensity(ph); if (vv == DERR) { reportError(); } break; case 4: - vv = phase_meanMolecularWeight(ph); + vv = thermo_meanMolecularWeight(ph); if (vv == DERR) { reportError(); } break; case 10: - vv = static_cast(phase_nElements(ph)); + vv = static_cast(thermo_nElements(ph)); if (vv == -1) { reportError(); } break; case 11: - vv = static_cast(phase_nSpecies(ph)); + vv = static_cast(thermo_nSpecies(ph)); if (vv == -1) { reportError(); } break; case 12: input_buf = getString(prhs[3]); - vv = static_cast(phase_speciesIndex(ph, input_buf)) + 1; + vv = static_cast(thermo_speciesIndex(ph, input_buf)) + 1; break; case 13: input_buf = getString(prhs[3]); - vv = static_cast(phase_elementIndex(ph, input_buf)) + 1; + vv = static_cast(thermo_elementIndex(ph, input_buf)) + 1; break; case 14: k = getInt(prhs[3]); m = getInt(prhs[4]); - vv = phase_nAtoms(ph,k-1,m-1); + vv = thermo_nAtoms(ph,k-1,m-1); if (vv == ERR) { reportError(); } @@ -184,17 +184,17 @@ void phasemethods(int nlhs, mxArray* plhs[], return; } else if (job < 30) { iok = 0; - size_t nsp = phase_nSpecies(ph); + size_t nsp = thermo_nSpecies(ph); std::vector x(nsp); switch (job) { case 20: - iok = phase_getMoleFractions(ph,nsp, &x[0]); + iok = thermo_getMoleFractions(ph,nsp, &x[0]); break; case 21: - iok = phase_getMassFractions(ph,nsp, &x[0]); + iok = thermo_getMassFractions(ph,nsp, &x[0]); break; case 22: - iok = phase_getMolecularWeights(ph,nsp, &x[0]); + iok = thermo_getMolecularWeights(ph,nsp, &x[0]); break; default: mexErrMsgTxt("Unknown job number"); @@ -215,11 +215,11 @@ void phasemethods(int nlhs, mxArray* plhs[], } } else if (job < 40) { iok = 0; - size_t nel = phase_nElements(ph); + size_t nel = thermo_nElements(ph); std::vector x(nel); switch (job) { case 30: - iok = phase_getAtomicWeights(ph,nel, &x[0]); + iok = thermo_getAtomicWeights(ph,nel, &x[0]); break; default: ; @@ -248,18 +248,18 @@ void phasemethods(int nlhs, mxArray* plhs[], ksp = getInt(prhs[3]); buflen = 40; output_buf = (char*)mxCalloc(buflen, sizeof(char)); - iok = phase_getSpeciesName(ph, ksp-1, buflen, output_buf); + iok = thermo_getSpeciesName(ph, ksp-1, buflen, output_buf); break; case 41: mel = getInt(prhs[3]); buflen = 40; output_buf = (char*)mxCalloc(buflen, sizeof(char)); - iok = phase_getElementName(ph, mel-1, buflen, output_buf); + iok = thermo_getElementName(ph, mel-1, buflen, output_buf); break; case 42: buflen = 40; output_buf = (char*)mxCalloc(buflen, sizeof(char)); - iok = phase_getName(ph, buflen, output_buf); + iok = thermo_getName(ph, buflen, output_buf); break; default: iok = -1; diff --git a/src/matlab/surfmethods.cpp b/src/matlab/surfmethods.cpp index bac92c3a15..ea7dc28e70 100644 --- a/src/matlab/surfmethods.cpp +++ b/src/matlab/surfmethods.cpp @@ -36,7 +36,7 @@ void surfmethods(int nlhs, mxArray* plhs[], ptr = mxGetPr(prhs[3]); m = mxGetM(prhs[3]); n = mxGetN(prhs[3]); - nsp = phase_nSpecies(surf); + nsp = thermo_nSpecies(surf); norm = getInt(prhs[4]); if ((m == nsp && n == 1) || (m == 1 && n == nsp)) { iok = surf_setcoverages(surf, ptr, norm); @@ -61,7 +61,7 @@ void surfmethods(int nlhs, mxArray* plhs[], return; } else if (job < 200) { // return array parameters - nsp = phase_nSpecies(surf); + nsp = thermo_nSpecies(surf); std::vector x(nsp); iok = -1; switch (job) { diff --git a/src/matlab/thermomethods.cpp b/src/matlab/thermomethods.cpp index 41c4e5a0a3..05d04c9cf1 100644 --- a/src/matlab/thermomethods.cpp +++ b/src/matlab/thermomethods.cpp @@ -32,10 +32,10 @@ static void thermoset(int nlhs, mxArray* plhs[], ierr = delThermo(th); break; case 1: - ierr = th_setPressure(th,*ptr); + ierr = thermo_setPressure(th,*ptr); break; case 2: - ierr = th_setElectricPotential(th, *ptr); + ierr = thermo_setElectricPotential(th, *ptr); break; default: mexErrMsgTxt("unknown attribute."); @@ -45,46 +45,46 @@ static void thermoset(int nlhs, mxArray* plhs[], if ((m == 2 && n == 1) || (m == 1 && n == 2)) { switch (job) { case 20: - ierr = th_set_HP(th,ptr); + ierr = thermo_set_HP(th,ptr); break; case 21: - ierr = th_set_UV(th,ptr); + ierr = thermo_set_UV(th,ptr); break; case 22: - ierr = th_set_SV(th,ptr); + ierr = thermo_set_SV(th,ptr); break; case 23: - ierr = th_set_SP(th,ptr); + ierr = thermo_set_SP(th,ptr); break; case 24: - ierr = th_setState_Psat(th,ptr[0],ptr[1]); + ierr = thermo_setState_Psat(th,ptr[0],ptr[1]); break; case 25: - ierr = th_setState_Tsat(th,ptr[0],ptr[1]); + ierr = thermo_setState_Tsat(th,ptr[0],ptr[1]); break; case 26: - ierr = th_set_RP(th,ptr); + ierr = thermo_set_RP(th,ptr); break; case 27: - ierr = th_set_ST(th,ptr); + ierr = thermo_set_ST(th,ptr); break; case 28: - ierr = th_set_TV(th,ptr); + ierr = thermo_set_TV(th,ptr); break; case 29: - ierr = th_set_PV(th,ptr); + ierr = thermo_set_PV(th,ptr); break; case 30: - ierr = th_set_UP(th,ptr); + ierr = thermo_set_UP(th,ptr); break; case 31: - ierr = th_set_VH(th,ptr); + ierr = thermo_set_VH(th,ptr); break; case 32: - ierr = th_set_TH(th,ptr); + ierr = thermo_set_TH(th,ptr); break; case 33: - ierr = th_set_SH(th,ptr); + ierr = thermo_set_SH(th,ptr); break; default: mexErrMsgTxt("unknown pair attribute."); @@ -100,7 +100,7 @@ static void thermoset(int nlhs, mxArray* plhs[], int maxsteps = getInt(prhs[6]); int maxiter = getInt(prhs[7]); int loglevel = getInt(prhs[8]); - ierr = th_equil(th, xy, solver, rtol, maxsteps, maxiter, loglevel); + ierr = thermo_equil(th, xy, solver, rtol, maxsteps, maxiter, loglevel); } if (ierr < 0) { reportError(); @@ -126,84 +126,84 @@ static void thermoget(int nlhs, mxArray* plhs[], vv = (double) newThermoFromXML(n); break; case 2: - vv = th_enthalpy_mole(n); + vv = thermo_enthalpy_mole(n); break; case 3: - vv = th_intEnergy_mole(n); + vv = thermo_intEnergy_mole(n); break; case 4: - vv = th_entropy_mole(n); + vv = thermo_entropy_mole(n); break; case 5: - vv = th_gibbs_mole(n); + vv = thermo_gibbs_mole(n); break; case 6: - vv = th_cp_mole(n); + vv = thermo_cp_mole(n); break; case 7: - vv = th_cv_mole(n); + vv = thermo_cv_mole(n); break; case 8: - vv = th_pressure(n); + vv = thermo_pressure(n); break; case 9: - vv = th_enthalpy_mass(n); + vv = thermo_enthalpy_mass(n); break; case 10: - vv = th_intEnergy_mass(n); + vv = thermo_intEnergy_mass(n); break; case 11: - vv = th_entropy_mass(n); + vv = thermo_entropy_mass(n); break; case 12: - vv = th_gibbs_mass(n); + vv = thermo_gibbs_mass(n); break; case 13: - vv = th_cp_mass(n); + vv = thermo_cp_mass(n); break; case 14: - vv = th_cv_mass(n); + vv = thermo_cv_mass(n); break; case 15: - vv = th_refPressure(n); + vv = thermo_refPressure(n); break; case 16: - vv = th_minTemp(n, -1); + vv = thermo_minTemp(n, -1); break; case 17: - vv = th_maxTemp(n, -1); + vv = thermo_maxTemp(n, -1); break; case 18: - vv = double(th_eosType(n)); + vv = double(thermo_eosType(n)); break; case 19: - vv = th_critTemperature(n); + vv = thermo_critTemperature(n); break; case 20: - vv = th_critPressure(n); + vv = thermo_critPressure(n); break; case 21: - vv = th_critDensity(n); + vv = thermo_critDensity(n); break; case 22: - vv = th_vaporFraction(n); + vv = thermo_vaporFraction(n); break; case 23: psat = getDouble(prhs[3]); - vv = th_satTemperature(n, psat); + vv = thermo_satTemperature(n, psat); break; case 24: tsat = getDouble(prhs[3]); - vv = th_satPressure(n, tsat); + vv = thermo_satPressure(n, tsat); break; case 25: - vv = th_electricPotential(n); + vv = thermo_electricPotential(n); break; case 26: - vv = th_isothermalCompressibility(n); + vv = thermo_isothermalCompressibility(n); break; case 27: - vv = th_thermalExpansionCoeff(n); + vv = thermo_thermalExpansionCoeff(n); break; default: ok = false; @@ -219,20 +219,20 @@ static void thermoget(int nlhs, mxArray* plhs[], } } else if (job < 50) { int iok = 0; - size_t nsp = phase_nSpecies(n); + size_t nsp = thermo_nSpecies(n); std::vector x(nsp); switch (job) { case 32: - iok = th_getEnthalpies_RT(n, nsp, &x[0]); + iok = thermo_getEnthalpies_RT(n, nsp, &x[0]); break; case 34: - iok = th_chemPotentials(n, nsp, &x[0]); + iok = thermo_chemPotentials(n, nsp, &x[0]); break; case 36: - iok = th_getEntropies_R(n, nsp, &x[0]); + iok = thermo_getEntropies_R(n, nsp, &x[0]); break; case 38: - iok = th_getCp_R(n, nsp, &x[0]); + iok = thermo_getCp_R(n, nsp, &x[0]); break; default: ;