mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
fix tests and update unit examples
This commit is contained in:
parent
a299ab7824
commit
f5076248f5
@ -144,8 +144,8 @@ getter_template = Template("""
|
||||
getter_properties = [
|
||||
"density_mass", "density_mole", "enthalpy_mass", "enthalpy_mole", "entropy_mass",
|
||||
"entropy_mole", "int_energy_mass", "int_energy_mole", "volume_mass", "volume_mole",
|
||||
"gibbs_mass", "gibbs_mole", "cp_mass", "cp_mole", "P", "P_sat", "T", "T_sat",
|
||||
"atomic_weight", "chemical_potentials", "concentrations", "critical_pressure",
|
||||
"gibbs_mass", "gibbs_mole", "cp_mass", "cp_mole", "cv_mass", "cv_mole", "P", "P_sat", "T",
|
||||
"T_sat", "atomic_weight", "chemical_potentials", "concentrations", "critical_pressure",
|
||||
"critical_temperature", "electric_potential", "electrochemical_potentials",
|
||||
"isothermal_compressibility", "max_temp", "mean_molecular_weight", "min_temp",
|
||||
"molecular_weights", "partial_molar_cp", "partial_molar_enthalpies",
|
||||
@ -157,7 +157,6 @@ getter_properties = [
|
||||
getter_string = "".join(
|
||||
getter_template.substitute(name=name, units=UNITS[name]) for name in getter_properties
|
||||
)
|
||||
pf_getter_string = getter_template.substitute(name="Q", units=UNITS["Q"])
|
||||
|
||||
setter_template = Template("""
|
||||
@property
|
||||
@ -216,7 +215,7 @@ pf_setter1_string = "".join(
|
||||
)
|
||||
|
||||
solution_properties = "".join([getter_string, setter_string, setter1_string])
|
||||
pf_properties = "".join([pf_getter_string, pf_setter_string, pf_setter1_string])
|
||||
pf_properties = "".join([pf_setter_string, pf_setter1_string])
|
||||
|
||||
localenv["solution_properties"] = solution_properties.strip()
|
||||
localenv["purefluid_properties"] = pf_properties.strip()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,6 +65,22 @@ class PureFluid(Solution):
|
||||
def __init__(self, infile, phasename=""):
|
||||
self._phase = _PureFluid(infile, phasename)
|
||||
|
||||
@property
|
||||
def Q(self):
|
||||
Q = self._phase.Q
|
||||
return Q_(Q, "dimensionless")
|
||||
|
||||
@Q.setter
|
||||
def Q(self, value):
|
||||
if value is not None:
|
||||
try:
|
||||
Q = value.to("dimensionless").magnitude
|
||||
except AttributeError:
|
||||
Q = value
|
||||
else:
|
||||
Q = self.Q.magnitude
|
||||
self._phase.Q = Q
|
||||
|
||||
@purefluid_properties@
|
||||
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
"""
|
||||
Isentropic, adiabatic flow example - calculate area ratio vs. Mach number curve
|
||||
|
||||
Requires: cantera >= 2.5.0, matplotlib >= 2.0
|
||||
Requires: cantera >= 2.6.0
|
||||
"""
|
||||
|
||||
import cantera.units as ct
|
||||
import math
|
||||
import numpy as np
|
||||
ct.units.default_format = ".2F~P"
|
||||
label_string = "area ratio\tMach number\ttemperature\tpressure ratio"
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""
|
||||
A Rankine vapor power cycle
|
||||
|
||||
Requires: Cantera >= 2.5.0
|
||||
Requires: Cantera >= 2.6.0
|
||||
"""
|
||||
|
||||
import cantera.units as ct
|
||||
|
@ -1,12 +1,11 @@
|
||||
"""
|
||||
Compute the "equilibrium" and "frozen" sound speeds for a gas
|
||||
|
||||
Requires: cantera >= 2.5.0
|
||||
Requires: cantera >= 2.6.0
|
||||
"""
|
||||
|
||||
import cantera.units as ct
|
||||
import numpy as np
|
||||
import math
|
||||
|
||||
ct.units.default_format = ".2F~P"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user