tespy.tools.fluid_properties package¶
tespy.tools.fluid_properties.functions module¶
Module for fluid property functions.
This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/tools/fluid_properties/functions.py
SPDX-License-Identifier: MIT
- tespy.tools.fluid_properties.functions.T_mix_ph(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.T_mix_ps(p, s, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.calc_chemical_exergy(pamb, Tamb, fluid_data, Chem_Ex, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.calc_physical_exergy(h, s, p, pamb, Tamb, fluid_data, mixing_rule=None, T0=None)[source]¶
Calculate specific physical exergy.
Physical exergy is allocated to a thermal and a mechanical share according to [34].
- Parameters:
pamb (float) – Ambient pressure p0 / Pa.
Tamb (float) – Ambient temperature T0 / K.
- Returns:
e_ph (tuple) – Specific thermal and mechanical exergy (\(e^\mathrm{T}\), \(e^\mathrm{M}\)) in J / kg.
\[ \begin{align}\begin{aligned}e^\mathrm{T} = \left( h - h \left( p, T_0 \right) \right) - T_0 \cdot \left(s - s\left(p, T_0\right)\right)\\e^\mathrm{M}=\left(h\left(p,T_0\right)-h\left(p_0,T_0\right)\right) -T_0\cdot\left(s\left(p, T_0\right)-s\left(p_0,T_0\right)\right)\\e^\mathrm{PH} = e^\mathrm{T} + e^\mathrm{M}\end{aligned}\end{align} \]
- tespy.tools.fluid_properties.functions.dT_mix_dph(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.dT_mix_pdh(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.dT_mix_ph_dfluid(p, h, fluid, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.dv_mix_dph(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.dv_mix_pdh(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.isentropic(p_1, h_1, p_2, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.s_mix_ph(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
- tespy.tools.fluid_properties.functions.v_mix_ph(p, h, fluid_data, mixing_rule=None, T0=None)[source]¶
tespy.tools.fluid_properties.helpers module¶
Module for fluid property helper functions.
This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/tools/fluid_properties/helpers.py
SPDX-License-Identifier: MIT
- tespy.tools.fluid_properties.helpers.blasius(re)[source]¶
Calculate friction coefficient according to Blasius.
- Parameters:
re (float) – Reynolds number.
- Returns:
darcy_friction_factor (float) – Darcy friction factor.
- tespy.tools.fluid_properties.helpers.colebrook(reynolds, ks, diameter, darcy_friction_factor, **kwargs)[source]¶
Calculate friction coefficient accroding to Colebrook-White equation.
Applied in transition zone and rough conditions.
- Parameters:
re (float) – Reynolds number.
ks (float) – Equivalent sand roughness.
d (float) – Pipe’s diameter.
darcy_friction_factor (float) – Darcy friction factor.
- Returns:
darcy_friction_factor (float) – Darcy friction factor.
- tespy.tools.fluid_properties.helpers.darcy_friction_factor(re, ks, d)[source]¶
Calculate the Darcy friction factor.
- Parameters:
re (float) – Reynolds number re / 1.
ks (float) – Pipe roughness ks / m.
d (float) – Pipe diameter/characteristic lenght d / m.
- Returns:
darcy_friction_factor (float) – Darcy friction factor \(\lambda\) / 1
Note
Laminar flow (\(re \leq 2320\))
\[\lambda = \frac{64}{re}\]turbulent flow (\(re > 2320\))
hydraulically smooth: \(\frac{re \cdot k_{s}}{d} < 65\)
\[\begin{split}\lambda = \begin{cases} 0.03164 \cdot re^{-0.25} & re \leq 10^4\\ \left(1.8 \cdot \log \left(re\right) -1.5 \right)^{-2} & 10^4 < re < 10^6\\ solve \left(0 = 2 \cdot \log\left(re \cdot \sqrt{\lambda} \right) -0.8 - \frac{1}{\sqrt{\lambda}}\right) & re \geq 10^6\\ \end{cases}\end{split}\]transition zone and hydraulically rough:
\[\lambda = solve \left( 0 = 2 \cdot \log \left( \frac{2.51}{re \cdot \sqrt{\lambda}} + \frac{k_{s}}{d \cdot 3.71} \right) - \frac{1}{\sqrt{\lambda}} \right)\]Reference: [35].
Example
Calculate the Darcy friction factor at different hydraulic states.
>>> from tespy.tools.fluid_properties.helpers import darcy_friction_factor >>> ks = 5e-5 >>> d = 0.05 >>> re_laminar = 2000 >>> re_turb_smooth = 5000 >>> re_turb_trans = 70000 >>> re_high = 1000000 >>> d_high = 0.8 >>> re_very_high = 6000000 >>> d_very_high = 1 >>> ks_low = 1e-5 >>> ks_rough = 1e-3 >>> darcy_friction_factor(re_laminar, ks, d) 0.032 >>> round(darcy_friction_factor(re_turb_smooth, ks, d), 3) 0.038 >>> round(darcy_friction_factor(re_turb_trans, ks, d), 3) 0.023 >>> round(darcy_friction_factor(re_turb_trans, ks_rough, d), 3) 0.049 >>> round(darcy_friction_factor(re_high, ks, d_high), 3) 0.012 >>> round(darcy_friction_factor(re_very_high, ks_low, d_very_high), 3) 0.009
- tespy.tools.fluid_properties.helpers.fluid_structure(fluid)[source]¶
Return the checmical formula of fluid.
- Parameters:
fluid (str) – Name of the fluid.
- Returns:
parts (dict) – Dictionary of the chemical base elements as keys and the number of atoms in a molecule as values.
Example
Get the chemical formula of methane.
>>> from tespy.tools.fluid_properties.helpers import fluid_structure >>> elements = fluid_structure('methane') >>> elements['C'], elements['H'] (1, 4)
- tespy.tools.fluid_properties.helpers.hanakov(re)[source]¶
Calculate friction coefficient according to Hanakov.
- Parameters:
re (float) – Reynolds number.
- Returns:
darcy_friction_factor (float) – Darcy friction factor.
- tespy.tools.fluid_properties.helpers.inverse_temperature_mixture(p=None, target_value=None, fluid_data=None, T0=None, f=None)[source]¶
- tespy.tools.fluid_properties.helpers.prandtl_karman(reynolds, darcy_friction_factor, **kwargs)[source]¶
Calculate friction coefficient according to Prandtl and v. Kármán.
Applied in smooth conditions.
- Parameters:
re (float) – Reynolds number.
darcy_friction_factor (float) – Darcy friction factor.
- Returns:
darcy_friction_factor (float) – Darcy friction factor.
tespy.tools.fluid_properties.mixtures module¶
Module for fluid property mixture routines.
This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/tools/fluid_properties/mixtures.py
SPDX-License-Identifier: MIT
- tespy.tools.fluid_properties.mixtures.cond_check(p, T, fluid_data, water_alias)[source]¶
Check if water is partially condensing in gaseous mixture.
- Parameters:
p (float) – pressure of mixture
T (float) – temperature of mixture
fluid_data (dict) – Dictionary of fluid data:
{fluid_name: {"mass_fraction": float, "wrapper": FluidPropertyWrapper}}water_alias (str) – label of the water in the fluid_data dictionary
- Returns:
tuple – Tuple containing gas phase mass specific and molar specific compositions and overall liquid water mass fraction, as well as saturation pressure of water and partial pressure of water in gas phase
- tespy.tools.fluid_properties.mixtures.exergy_chemical_ideal_cond(pamb, Tamb, fluid_data, Chem_Ex)[source]¶
- tespy.tools.fluid_properties.mixtures.h_mix_pT_ideal(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.h_mix_pT_ideal_cond(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.s_mix_pT_ideal(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.s_mix_pT_ideal_cond(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.s_mix_pT_incompressible(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.v_mix_pT_ideal(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.v_mix_pT_ideal_cond(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.v_mix_pT_incompressible(p=None, T=None, fluid_data=None, **kwargs)[source]¶
- tespy.tools.fluid_properties.mixtures.viscosity_mix_pT_ideal(p=None, T=None, fluid_data=None, **kwargs)[source]¶
Calculate dynamic viscosity from pressure and temperature.
- Parameters:
flow (list) – Fluid property vector containing mass flow, pressure, enthalpy and fluid composition.
T (float) – Temperature T / K.
- Returns:
visc (float) – Dynamic viscosity visc / Pa s.
Note
Calculation for fluid mixtures.
\[\begin{split}\eta_{mix}(p,T)=\frac{\sum_{i} \left( \eta(p,T,fluid_{i}) \cdot y_{i} \cdot \sqrt{M_{i}} \right)} {\sum_{i} \left(y_{i} \cdot \sqrt{M_{i}} \right)}\; \forall i \in \text{fluid components}\\ y: \text{volume fraction}\\ M: \text{molar mass}\end{split}\]Reference: [36].
tespy.tools.fluid_properties.wrappers module¶
Module for fluid property wrappers.
This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/tools/fluid_properties/wrappers.py
SPDX-License-Identifier: MIT
- class tespy.tools.fluid_properties.wrappers.CoolPropWrapper(fluid, back_end=None)[source]¶
Bases:
FluidPropertyWrapper
- class tespy.tools.fluid_properties.wrappers.FluidPropertyWrapper(fluid, back_end=None)[source]¶
Bases:
object
- class tespy.tools.fluid_properties.wrappers.IAPWSWrapper(fluid, back_end=None)[source]¶
Bases:
FluidPropertyWrapper
- class tespy.tools.fluid_properties.wrappers.PyromatWrapper(fluid, back_end=None)[source]¶
Bases:
FluidPropertyWrapper