ccp.State
Contents
ccp.State#
- class ccp.State(*args, **kwargs)#
A thermodynamic state.
This class is inherited from CP.AbstractState. Some extra functionality has been added.
Creates a state from fluid composition and two properties. Properties can be floats (SI units are considered) or pint quantities.
- Parameters:
- pfloat, pint.Quantity
Pressure
- Tfloat, pint.Quantity
Temperature
- hfloat, pint.Quantity
Enthalpy
- sfloat, pint.Quantity
Entropy
- rhofloat, pint.Quantity
Specific mass
- fluiddict
Dictionary with constituent and composition (mole fraction). (e.g.: fluid={‘Oxygen’: 0.2096, ‘Nitrogen’: 0.7812, ‘Argon’: 0.0092})
- EOSstr, optional
String with REFPROP, HEOS, PR or SRK. Default is set in ccp.config.EOS
- phasestr, optional
String with phase information. Options are: - “liquid” - “gas” - “two_phase” - “supercritical_liquid” - “supercritical_gas” - “supercritical” Default is None, in this case REFPROP/CoolProp will determine the phase. The phase calculation may require a non-trivial flash calculation which can be computationally expensive.
- Returns:
- stateccp.State
Examples
>>> import ccp >>> Q_ = ccp.Q_ >>> fluid = {'Oxygen': 0.2096, 'Nitrogen': 0.7812, 'Argon': 0.0092} >>> s = ccp.State(p=101008, T=273, fluid=fluid) >>> s.rho() <Quantity(1.28939426, 'kilogram / meter ** 3')> >>> # Using pint quantities >>> s = ccp.State(fluid=fluid, p=Q_(1, 'atm'), T=Q_(0, 'degC')) >>> s.h() <Quantity(273291.7, 'joule / kilogram')>
Methods
- T(units=None)#
Temperature in Kelvin.
- Returns:
- Tpint.Quantity
Temperature (Kelvin).
- T_critical(units=None)#
Critical Temperature in K.
- Returns:
- T_criticalpint.Quantity
Critical temperature (degK).
- __init__(self, arg0: str, arg1: str, /) None#
- conductivity(units=None)#
Thermal conductivity (W/m/K).
- Returns:
- conductivitypint.Quantity
Thermal conductivity (W/m/K).
- cp(units=None)#
Specific heat at constant pressure joule/(kilogram kelvin).
- Returns:
- cppint.Quantity
Specific heat at constant pressure joule/(kilogram kelvin).
- cv(units=None)#
Specific heat at constant volume joule/(kilogram kelvin).
- Returns:
- cvpint.Quantity
Specific heat at constant volume joule/(kilogram kelvin).
- dTdp_s(units=None)#
(dT / dp)s
First partial derivative of temperature related to pressure with constant entropy.
- classmethod define(p=None, T=None, h=None, s=None, rho=None, fluid=None, EOS=None, **kwargs)#
Constructor for state.
Creates a state from fluid composition and two properties. Properties can be floats (SI units are considered) or pint quantities.
- Parameters:
- pfloat, pint.Quantity
Pressure
- Tfloat, pint.Quantity
Temperature
- hfloat, pint.Quantity
Enthalpy
- sfloat, pint.Quantity
Entropy
- rhofloat, pint.Quantity
Specific mass
- fluiddict
Dictionary with constituent and composition. (e.g.: fluid={‘Oxygen’: 0.2096, ‘Nitrogen’: 0.7812, ‘Argon’: 0.0092}) String with REFPROP, HEOS, PR or SRK. Default is set in ccp.config.EOS
- Returns:
- stateccp.State
Examples
>>> import ccp >>> Q_ = ccp.Q_ >>> fluid = {'Oxygen': 0.2096, 'Nitrogen': 0.7812, 'Argon': 0.0092} >>> s = ccp.State.define(p=101008, T=273, fluid=fluid) >>> s.rho() <Quantity(1.28939426, 'kilogram / meter ** 3')> >>> # Using pint quantities >>> s = ccp.State.define(fluid=fluid, p=Q_(1, 'atm'), T=Q_(0, 'degC')) >>> s.h() <Quantity(273291.7, 'joule / kilogram')>
- dpdv_s(units=None)#
Partial derivative of pressure to spec. volume with const. entropy.
- gas_constant(units=None)#
Gas constant in joule / (mol kelvin).
- Returns:
- gas_constantpint.Quantity
Gas constant (joule / (mol kelvin).
- get_coolprop_state()#
Return a CoolProp state object.
- h(units=None)#
Specific Enthalpy (joule/kilogram).
- Returns:
- hpint.Quantity
Enthalpy (joule/kilogram).
- kT()#
Isentropic temperature exponent (dimensionless).
- Returns:
- kTpint.Quantity
Isentropic temperature exponent (dimensionless).
- kinematic_viscosity(units=None)#
Kinematic viscosity in m²/s.
- Returns:
- kinematic_viscositypint.Quantity
Kinematic viscosity (m²/s)
- kv()#
Isentropic volume exponent (dimensionless).
- Returns:
- kvpint.Quantity
Isentropic volume exponent (dimensionless).
- molar_mass(units=None)#
Molar mass in kg/mol.
- Returns:
- molar_masspint.Quantity
Molar mass (kg/mol).
- p(units=None)#
Pressure in Pascal.
- Returns:
- ppint.Quantity
Pressure (pascal).
- p_critical(units=None)#
Critical Pressure in Pa.
- Returns:
- p_criticalpint.Quantity
Critical pressure (Pa).
- plot_envelope(T_units='degK', p_units='Pa', dew_point_margin=20, fig=None, **kwargs)#
Plot phase envelope.
Plots the phase envelope and dew point limit.
- Parameters:
- T_unitsstr
Temperature units. Default is ‘degK’.
- p_unitsstr
Pressure units. Default is ‘Pa’.
- dew_point_marginfloat
Dew point margin. Default is 20 degK (from API). Unit is the same as T_units.
- figplotly.graph_objects.Figure, optional
The figure object with the rotor representation.
- Returns:
- figplotly.graph_objects.Figure
The figure object with the rotor representation.
- plot_point(T_units='degK', p_units='Pa', fig=None, **kwargs)#
Plot point.
Plot point in the given figure. Function will check for axis units and plot the point accordingly.
- Parameters:
- T_unitsstr
Temperature units. Default is ‘degK’.
- p_unitsstr
Pressure units. Default is ‘Pa’.
- figplotly.graph_objects.Figure, optional
The figure object with the rotor representation.
- kwargsdict
Dictionary that will be passed to go.Scatter method.
- Returns:
- figplotly.graph_objects.Figure
The figure object with the rotor representation.
- rho(units=None)#
Specific mass (kilogram/m**3).
- Returns:
- rhopint.Quantity
Specific mass (kilogram/m**3).
- s(units=None)#
Specific entropy (per unit of mass).
- Returns:
- spint.Quantity
Entropy (joule/(kelvin kilogram)).
- speed_sound(units=None)#
Speed of sound - Eq. 8.1 from P. Nederstigt - Real Gas Thermodynamics.
- Returns:
- speed_soundpint.Quantity
Speed of sound (m/s).
- update(p=None, T=None, rho=None, h=None, s=None, phase=None, **kwargs)#
Update the state.
This method simplifies the state update. Only keyword arguments are required to update.
- Parameters:
- pfloat, pint.Quantity
Pressure (Pa).
- Tfloat, pint.Quantity
Temperature (degK).
- rhofloat, pint.Quantity
Specific mass (kg/m**3).
- hfloat, pint.Quantity
Enthalpy (J/kg).
- sfloat, pint.Quantity
Entropy (J/(kg*degK)).
- phasestr, optional
String with phase information. Options are: - “liquid” - “gas” - “two_phase” - “supercritical_liquid” - “supercritical_gas” - “supercritical” Default is the phase defined in the state initialization.
- v(units=None)#
Specific volume (m**3/kilogram).
- Returns:
- vpint.Quantity
Specific volume (m**3/kilogram).
- viscosity(units=None)#
Viscosity in pascal second.
- Returns:
- viscositypint.Quantity
Viscosity (pascal second)
- z(units=None)#
Compressibility (dimensionless).
- Returns:
- zpint.Quantity
Compressibility (dimensionless).
Attributes
BvirialCvirialPIPPrandtlQQmassT_reducingTmaxTminTtripleacentric_factorall_critical_pointsalpha0alpharapply_simple_mixing_ruleavailable_in_high_levelbackend_namebuild_options_jsonbuild_phase_envelopebuild_spinodalchange_EOSchemical_potentialclearcompressibility_factorconductivity_contributionsconformal_statecp0masscp0molarcpmasscpmolarcriticality_contour_valuescvmasscvmolard2alpha0_dDelta2d2alpha0_dDelta_dTaud2alpha0_dTau2d2alphar_dDelta2d2alphar_dDelta_dTaud2alphar_dTau2d3alpha0_dDelta2_dTaud3alpha0_dDelta3d3alpha0_dDelta_dTau2d3alpha0_dTau3d3alphar_dDelta2_dTaud3alphar_dDelta3d3alphar_dDelta_dTau2d3alphar_dTau3d4alphar_dDelta2_dTau2d4alphar_dDelta3_dTaud4alphar_dDelta4d4alphar_dDelta_dTau3d4alphar_dTau4dBvirial_dTdCvirial_dTdalpha0_dDeltadalpha0_dTaudalphar_dDeltadalphar_dTaudeltadipole_momentfast_evaluatefirst_partial_derivfirst_saturation_derivfirst_two_phase_derivfirst_two_phase_deriv_splinedfluid_namesfluid_param_stringfugacityfugacity_coefficientfundamental_derivative_of_gas_dynamicsget_binary_interaction_doubleget_binary_interaction_stringget_fluid_constantget_fluid_parameter_doubleget_mass_fractionsget_mole_fractionsget_phase_envelope_dataget_reducing_stateget_spinodal_dataget_stategibbsmassgibbsmass_excessgibbsmolargibbsmolar_excessgibbsmolar_residualhas_melting_linehelmholtzmasshelmholtzmass_excesshelmholtzmolarhelmholtzmolar_excesshmasshmass_excesshmass_idealgashmolarhmolar_excesshmolar_idealgashmolar_residualideal_curveisobaric_expansion_coefficientisothermal_compressibilitykeyed_outputmelting_linemole_fractions_liquidmole_fractions_liquid_doublemole_fractions_vapormole_fractions_vapor_doublenameneffp_triplephasepmaxrhomassrhomass_criticalrhomass_reducingrhomolarrhomolar_criticalrhomolar_reducingsaturated_liquid_keyed_outputsaturated_vapor_keyed_outputsaturation_ancillarysecond_partial_derivsecond_saturation_derivsecond_two_phase_derivset_Tset_binary_interaction_doubleset_binary_interaction_stringset_cubic_alpha_Cset_fluid_parameter_doubleset_mass_fractionsset_mole_fractionsset_volu_fractionssmasssmass_excesssmass_idealgassmolarsmolar_excesssmolar_idealgassmolar_residualspecify_phasesurface_tensiontangent_plane_distancetautrivial_keyed_outputtrue_critical_pointumassumass_excessumass_idealgasumolarumolar_excessumolar_idealgasunspecify_phaseupdate_QT_pure_superancupdate_with_guessesusing_mass_fractionsusing_mole_fractionsusing_volu_fractionsviscosity_contributionsvolumemass_excessvolumemolar_excess