10# include <pybind11/pybind11.h>
11# include <pybind11/stl.h>
12namespace py = pybind11;
18void init_CoolProp(py::module& m) {
21 py::class_<SimpleState>(m,
"SimpleState")
23 .def_readwrite(
"T", &SimpleState::T)
24 .def_readwrite(
"p", &SimpleState::p)
25 .def_readwrite(
"rhomolar", &SimpleState::rhomolar);
27 py::class_<GuessesStructure>(m,
"GuessesStructure")
29 .def_readwrite(
"T", &GuessesStructure::T)
30 .def_readwrite(
"p", &GuessesStructure::p)
31 .def_readwrite(
"rhomolar", &GuessesStructure::rhomolar)
32 .def_readwrite(
"hmolar", &GuessesStructure::hmolar)
33 .def_readwrite(
"smolar", &GuessesStructure::smolar)
34 .def_readwrite(
"rhomolar_liq", &GuessesStructure::rhomolar_liq)
35 .def_readwrite(
"rhomolar_vap", &GuessesStructure::rhomolar_vap)
36 .def_readwrite(
"x", &GuessesStructure::x)
37 .def_readwrite(
"y", &GuessesStructure::y)
38 .def(
"clear", &GuessesStructure::clear);
40 py::class_<CriticalState, SimpleState>(m,
"CriticalState").def_readwrite(
"stable", &CriticalState::stable);
42 py::class_<PhaseEnvelopeData>(m,
"PhaseEnvelopeData")
43 .def_readwrite(
"K", &PhaseEnvelopeData::K)
44 .def_readwrite(
"lnK", &PhaseEnvelopeData::lnK)
45 .def_readwrite(
"x", &PhaseEnvelopeData::x)
46 .def_readwrite(
"y", &PhaseEnvelopeData::y)
47 .def_readwrite(
"T", &PhaseEnvelopeData::T)
48 .def_readwrite(
"p", &PhaseEnvelopeData::p)
49 .def_readwrite(
"lnT", &PhaseEnvelopeData::lnT)
50 .def_readwrite(
"lnp", &PhaseEnvelopeData::lnp)
51 .def_readwrite(
"rhomolar_liq", &PhaseEnvelopeData::rhomolar_liq)
52 .def_readwrite(
"rhomolar_vap", &PhaseEnvelopeData::rhomolar_vap)
53 .def_readwrite(
"lnrhomolar_liq", &PhaseEnvelopeData::lnrhomolar_liq)
54 .def_readwrite(
"lnrhomolar_vap", &PhaseEnvelopeData::lnrhomolar_vap)
55 .def_readwrite(
"hmolar_liq", &PhaseEnvelopeData::hmolar_liq)
56 .def_readwrite(
"hmolar_vap", &PhaseEnvelopeData::hmolar_vap)
57 .def_readwrite(
"smolar_liq", &PhaseEnvelopeData::smolar_liq)
58 .def_readwrite(
"smolar_vap", &PhaseEnvelopeData::smolar_vap)
59 .def_readwrite(
"Q", &PhaseEnvelopeData::Q)
60 .def_readwrite(
"cpmolar_liq", &PhaseEnvelopeData::cpmolar_liq)
61 .def_readwrite(
"cpmolar_vap", &PhaseEnvelopeData::cpmolar_vap)
62 .def_readwrite(
"cvmolar_liq", &PhaseEnvelopeData::cvmolar_liq)
63 .def_readwrite(
"cvmolar_vap", &PhaseEnvelopeData::cvmolar_vap)
64 .def_readwrite(
"viscosity_liq", &PhaseEnvelopeData::viscosity_liq)
65 .def_readwrite(
"viscosity_vap", &PhaseEnvelopeData::viscosity_vap)
66 .def_readwrite(
"conductivity_liq", &PhaseEnvelopeData::conductivity_liq)
67 .def_readwrite(
"conductivity_vap", &PhaseEnvelopeData::conductivity_vap)
68 .def_readwrite(
"speed_sound_vap", &PhaseEnvelopeData::speed_sound_vap);
71 py::enum_<configuration_keys>(m,
"configuration_keys")
72# define X(Enum, String, Default, Desc) .value(String, configuration_keys::Enum)
77 py::enum_<parameters>(m,
"parameters")
153 py::enum_<input_pairs>(m,
"input_pairs")
191 py::enum_<phases>(m,
"phases")
202 py::class_<AbstractState>(m,
"_AbstractState")
203 .def(
"set_T", &AbstractState::set_T)
204 .def(
"backend_name", &AbstractState::backend_name)
205 .def(
"using_mole_fractions", &AbstractState::using_mole_fractions)
206 .def(
"using_mass_fractions", &AbstractState::using_mass_fractions)
207 .def(
"using_volu_fractions", &AbstractState::using_volu_fractions)
208 .def(
"set_mole_fractions", &AbstractState::set_mole_fractions)
209 .def(
"set_mass_fractions", &AbstractState::set_mass_fractions)
210 .def(
"set_volu_fractions", &AbstractState::set_volu_fractions)
211 .def(
"mole_fractions_liquid", &AbstractState::mole_fractions_liquid)
212 .def(
"mole_fractions_liquid_double", &AbstractState::mole_fractions_liquid_double)
213 .def(
"mole_fractions_vapor", &AbstractState::mole_fractions_vapor)
214 .def(
"mole_fractions_vapor_double", &AbstractState::mole_fractions_vapor_double)
215 .def(
"get_mole_fractions", &AbstractState::get_mole_fractions)
216 .def(
"get_mass_fractions", &AbstractState::get_mass_fractions)
217 .def(
"update", &AbstractState::update)
218 .def(
"update_with_guesses", &AbstractState::update_with_guesses)
219 .def(
"available_in_high_level", &AbstractState::available_in_high_level)
220 .def(
"fluid_param_string", &AbstractState::fluid_param_string)
221 .def(
"fluid_names", &AbstractState::fluid_names)
222 .def(
"set_binary_interaction_double", (
void (
AbstractState::*)(
const std::string&,
const std::string&,
const std::string&,
const double))
223 & AbstractState::set_binary_interaction_double)
224 .def(
"set_binary_interaction_double", (
void (
AbstractState::*)(
const std::size_t,
const std::size_t,
const std::string&,
const double))
225 & AbstractState::set_binary_interaction_double)
226 .def(
"set_binary_interaction_string", (
void (
AbstractState::*)(
const std::string&,
const std::string&,
const std::string&,
const std::string&))
227 & AbstractState::set_binary_interaction_string)
228 .def(
"set_binary_interaction_string", (
void (
AbstractState::*)(
const std::size_t,
const std::size_t,
const std::string&,
const std::string&))
229 & AbstractState::set_binary_interaction_string)
230 .def(
"get_binary_interaction_double",
231 (
double (
AbstractState::*)(
const std::string&,
const std::string&,
const std::string&)) & AbstractState::get_binary_interaction_double)
232 .def(
"get_binary_interaction_double",
233 (
double (
AbstractState::*)(
const std::size_t,
const std::size_t,
const std::string&)) & AbstractState::get_binary_interaction_double)
234 .def(
"get_binary_interaction_string", &AbstractState::get_binary_interaction_string)
236 .def(
"set_fluid_parameter_double", &AbstractState::set_fluid_parameter_double)
237 .def(
"clear", &AbstractState::clear)
238 .def(
"get_reducing_state", &AbstractState::get_reducing_state)
239 .def(
"get_state", &AbstractState::get_state)
240 .def(
"Tmin", &AbstractState::Tmin)
241 .def(
"Tmax", &AbstractState::Tmax)
242 .def(
"pmax", &AbstractState::pmax)
243 .def(
"Ttriple", &AbstractState::Ttriple)
244 .def(
"phase", &AbstractState::phase)
245 .def(
"specify_phase", &AbstractState::specify_phase)
246 .def(
"unspecify_phase", &AbstractState::unspecify_phase)
247 .def(
"T_critical", &AbstractState::T_critical)
248 .def(
"p_critical", &AbstractState::p_critical)
249 .def(
"rhomolar_critical", &AbstractState::rhomolar_critical)
250 .def(
"rhomass_critical", &AbstractState::rhomass_critical)
251 .def(
"all_critical_points", &AbstractState::all_critical_points)
252 .def(
"build_spinodal", &AbstractState::build_spinodal)
253 .def(
"get_spinodal_data", &AbstractState::get_spinodal_data)
254 .def(
"criticality_contour_values",
258 return py::make_tuple(L, M);
260 .def(
"tangent_plane_distance", &AbstractState::tangent_plane_distance)
261 .def(
"T_reducing", &AbstractState::T_reducing)
262 .def(
"rhomolar_reducing", &AbstractState::rhomolar_reducing)
263 .def(
"rhomass_reducing", &AbstractState::rhomass_reducing)
264 .def(
"p_triple", &AbstractState::p_triple)
265 .def(
"name", &AbstractState::name)
266 .def(
"dipole_moment", &AbstractState::dipole_moment)
267 .def(
"keyed_output", &AbstractState::keyed_output)
268 .def(
"trivial_keyed_output", &AbstractState::trivial_keyed_output)
269 .def(
"saturated_liquid_keyed_output", &AbstractState::saturated_liquid_keyed_output)
270 .def(
"saturated_vapor_keyed_output", &AbstractState::saturated_vapor_keyed_output)
271 .def(
"T", &AbstractState::T)
272 .def(
"rhomolar", &AbstractState::rhomolar)
273 .def(
"rhomass", &AbstractState::rhomass)
274 .def(
"p", &AbstractState::p)
275 .def(
"Q", &AbstractState::Q)
276 .def(
"tau", &AbstractState::tau)
277 .def(
"delta", &AbstractState::delta)
278 .def(
"molar_mass", &AbstractState::molar_mass)
279 .def(
"acentric_factor", &AbstractState::acentric_factor)
280 .def(
"gas_constant", &AbstractState::gas_constant)
281 .def(
"Bvirial", &AbstractState::Bvirial)
282 .def(
"dBvirial_dT", &AbstractState::dBvirial_dT)
283 .def(
"Cvirial", &AbstractState::Cvirial)
284 .def(
"dCvirial_dT", &AbstractState::dCvirial_dT)
285 .def(
"compressibility_factor", &AbstractState::compressibility_factor)
286 .def(
"hmolar", &AbstractState::hmolar)
287 .def(
"hmass", &AbstractState::hmass)
288 .def(
"hmolar_excess", &AbstractState::hmolar_excess)
289 .def(
"hmass_excess", &AbstractState::hmass_excess)
290 .def(
"smolar", &AbstractState::smolar)
291 .def(
"smass", &AbstractState::smass)
292 .def(
"smolar_excess", &AbstractState::smolar_excess)
293 .def(
"smass_excess", &AbstractState::smass_excess)
294 .def(
"umolar", &AbstractState::umolar)
295 .def(
"umass", &AbstractState::umass)
296 .def(
"umolar_excess", &AbstractState::umolar_excess)
297 .def(
"umass_excess", &AbstractState::umass_excess)
298 .def(
"cpmolar", &AbstractState::cpmolar)
299 .def(
"cpmass", &AbstractState::cpmass)
300 .def(
"cp0molar", &AbstractState::cp0molar)
301 .def(
"cp0mass", &AbstractState::cp0mass)
302 .def(
"cvmolar", &AbstractState::cvmolar)
303 .def(
"cvmass", &AbstractState::cvmass)
304 .def(
"gibbsmolar", &AbstractState::gibbsmolar)
305 .def(
"gibbsmass", &AbstractState::gibbsmass)
306 .def(
"gibbsmolar_excess", &AbstractState::gibbsmolar_excess)
307 .def(
"gibbsmass_excess", &AbstractState::gibbsmass_excess)
308 .def(
"helmholtzmolar", &AbstractState::helmholtzmolar)
309 .def(
"helmholtzmass", &AbstractState::helmholtzmass)
310 .def(
"helmholtzmolar_excess", &AbstractState::helmholtzmolar_excess)
311 .def(
"helmholtzmass_excess", &AbstractState::helmholtzmass_excess)
312 .def(
"volumemolar_excess", &AbstractState::volumemolar_excess)
313 .def(
"volumemass_excess", &AbstractState::volumemass_excess)
314 .def(
"speed_sound", &AbstractState::speed_sound)
316 .def(
"isobaric_expansion_coefficient", &AbstractState::isobaric_expansion_coefficient)
317 .def(
"fugacity_coefficient", &AbstractState::fugacity_coefficient)
318 .def(
"fugacity", &AbstractState::fugacity)
319 .def(
"chemical_potential", &AbstractState::chemical_potential)
320 .def(
"fundamental_derivative_of_gas_dynamics", &AbstractState::fundamental_derivative_of_gas_dynamics)
321 .def(
"PIP", &AbstractState::PIP)
322 .def(
"true_critical_point", &AbstractState::true_critical_point)
325 std::vector<double> T, p;
327 return py::make_tuple(T, p);
329 .def(
"first_partial_deriv", &AbstractState::first_partial_deriv)
330 .def(
"second_partial_deriv", &AbstractState::second_partial_deriv)
331 .def(
"first_saturation_deriv", &AbstractState::first_saturation_deriv)
332 .def(
"second_saturation_deriv", &AbstractState::second_saturation_deriv)
333 .def(
"first_two_phase_deriv", &AbstractState::first_two_phase_deriv)
334 .def(
"second_two_phase_deriv", &AbstractState::second_two_phase_deriv)
335 .def(
"first_two_phase_deriv_splined", &AbstractState::first_two_phase_deriv_splined)
336 .def(
"build_phase_envelope", &AbstractState::build_phase_envelope)
337 .def(
"get_phase_envelope_data", &AbstractState::get_phase_envelope_data)
338 .def(
"has_melting_line", &AbstractState::has_melting_line)
339 .def(
"melting_line", &AbstractState::melting_line)
341 .def(
"viscosity", &AbstractState::viscosity)
342 .def(
"viscosity_contributions", &AbstractState::viscosity_contributions)
343 .def(
"conductivity", &AbstractState::conductivity)
344 .def(
"conductivity_contributions", &AbstractState::conductivity_contributions)
345 .def(
"surface_tension", &AbstractState::surface_tension)
346 .def(
"Prandtl", &AbstractState::Prandtl)
347 .def(
"conformal_state", &AbstractState::conformal_state)
348 .def(
"change_EOS", &AbstractState::change_EOS)
349 .def(
"alpha0", &AbstractState::alpha0)
350 .def(
"dalpha0_dDelta", &AbstractState::dalpha0_dDelta)
351 .def(
"dalpha0_dTau", &AbstractState::dalpha0_dTau)
352 .def(
"d2alpha0_dDelta2", &AbstractState::d2alpha0_dDelta2)
353 .def(
"d2alpha0_dDelta_dTau", &AbstractState::d2alpha0_dDelta_dTau)
354 .def(
"d2alpha0_dTau2", &AbstractState::d2alpha0_dTau2)
355 .def(
"d3alpha0_dTau3", &AbstractState::d3alpha0_dTau3)
356 .def(
"d3alpha0_dDelta_dTau2", &AbstractState::d3alpha0_dDelta_dTau2)
357 .def(
"d3alpha0_dDelta2_dTau", &AbstractState::d3alpha0_dDelta2_dTau)
358 .def(
"d3alpha0_dDelta3", &AbstractState::d3alpha0_dDelta3)
359 .def(
"alphar", &AbstractState::alphar)
360 .def(
"dalphar_dDelta", &AbstractState::dalphar_dDelta)
361 .def(
"dalphar_dTau", &AbstractState::dalphar_dTau)
362 .def(
"d2alphar_dDelta2", &AbstractState::d2alphar_dDelta2)
363 .def(
"d2alphar_dDelta_dTau", &AbstractState::d2alphar_dDelta_dTau)
364 .def(
"d2alphar_dTau2", &AbstractState::d2alphar_dTau2)
365 .def(
"d3alphar_dDelta3", &AbstractState::d3alphar_dDelta3)
366 .def(
"d3alphar_dDelta2_dTau", &AbstractState::d3alphar_dDelta2_dTau)
367 .def(
"d3alphar_dDelta_dTau2", &AbstractState::d3alphar_dDelta_dTau2)
368 .def(
"d3alphar_dTau3", &AbstractState::d3alphar_dTau3)
369 .def(
"d4alphar_dDelta4", &AbstractState::d4alphar_dDelta4)
370 .def(
"d4alphar_dDelta3_dTau", &AbstractState::d4alphar_dDelta3_dTau)
371 .def(
"d4alphar_dDelta2_dTau2", &AbstractState::d4alphar_dDelta2_dTau2)
372 .def(
"d4alphar_dDelta_dTau3", &AbstractState::d4alphar_dDelta_dTau3)
373 .def(
"d4alphar_dTau4", &AbstractState::d4alphar_dTau4);
375 m.def(
"AbstractState", &factory);
392 m.def(
"generate_update_pair", &generate_update_pair<double>);
409 m.def(
"HAProps_Aux", [](std::string out_string,
double T,
double p,
double psi_w) {
412 return py::make_tuple(out, std::string(units));
420# if defined(COOLPROP_PYBIND11_MODULE)
422 py::module m(
"CoolProp",
"CoolProp module");