turbo-design 1.0.9__tar.gz → 1.0.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of turbo-design might be problematic. Click here for more details.

Files changed (32) hide show
  1. {turbo_design-1.0.9 → turbo_design-1.0.11}/PKG-INFO +3 -2
  2. {turbo_design-1.0.9 → turbo_design-1.0.11}/pyproject.toml +1 -1
  3. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/passage.py +2 -2
  4. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/solve_radeq.py +2 -1
  5. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/spool.py +21 -1
  6. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/td_math.py +5 -2
  7. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/turbinespool.py +22 -7
  8. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/__init__.py +0 -0
  9. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/arrayfuncs.py +0 -0
  10. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/bladerow.py +0 -0
  11. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/cantera_gas/co2.yaml +0 -0
  12. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/compressorspool.py +0 -0
  13. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/coolant.py +0 -0
  14. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/enums.py +0 -0
  15. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/inlet.py +0 -0
  16. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/isentropic.py +0 -0
  17. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/__init__.py +0 -0
  18. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/compressor/__init__.py +0 -0
  19. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/losstype.py +0 -0
  20. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/TD2.py +0 -0
  21. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/__init__.py +0 -0
  22. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/ainleymathieson.py +0 -0
  23. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/craigcox.py +0 -0
  24. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/fixedefficiency.py +0 -0
  25. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/fixedpressureloss.py +0 -0
  26. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/kackerokapuu.py +0 -0
  27. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/loss/turbine/traupel.py +0 -0
  28. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/lossinterp.py +0 -0
  29. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/outlet.py +0 -0
  30. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/radeq.py +0 -0
  31. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/rotor.py +0 -0
  32. {turbo_design-1.0.9 → turbo_design-1.0.11}/turbodesign/stage.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: turbo-design
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary: TurboDesign is a library used to design turbines and compressors using radial equilibrium.
5
5
  Author: Paht Juangphanich
6
6
  Author-email: paht.juangphanich@nasa.gov
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
13
14
  Requires-Dist: cantera
14
15
  Requires-Dist: findiff
15
16
  Requires-Dist: matplotlib
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "turbo-design"
3
- version = "1.0.9"
3
+ version = "1.0.11"
4
4
  description = "TurboDesign is a library used to design turbines and compressors using radial equilibrium."
5
5
  authors = ["Paht Juangphanich <paht.juangphanich@nasa.gov>"]
6
6
  packages = [
@@ -59,7 +59,7 @@ class Passage:
59
59
  """Gets the streamline at a certain percent radius
60
60
 
61
61
  Args:
62
- t_radial (float): _description_
62
+ t_radial (float): percent between hub and shroud
63
63
 
64
64
  Returns:
65
65
  Tuple containing:
@@ -186,7 +186,7 @@ class Passage:
186
186
 
187
187
  plt.figure(num=1,clear=True,dpi=150,figsize=(15,10))
188
188
  plt.plot(self.xhub_pts,self.rhub_pts,label='hub',linestyle='solid',linewidth=2,color='black')
189
- plt.plot(self.xshroud_pts,self.rshroud_pts,label='hub',linestyle='solid',linewidth=2,color='black')
189
+ plt.plot(self.xshroud_pts,self.rshroud_pts,label='shroud',linestyle='solid',linewidth=2,color='black')
190
190
  for p in percent_axial:
191
191
  cut,_,_ = self.get_cutting_line(p)
192
192
  x,r = cut.get_point(np.linspace(0,1,10))
@@ -34,4 +34,5 @@ def adjust_streamlines(blade_rows:List[BladeRow],passage:Passage):
34
34
  phi, rm, r = passage.streamline_curvature(x_streamline,r_streamline)
35
35
  row.phi[i] = float(interp1d(t_streamline,phi)(row.axial_location))
36
36
  row.rm[i] = float(interp1d(t_streamline,rm)(row.axial_location))
37
- row.r[i] = float(interp1d(t_streamline,r)(row.axial_location))
37
+ row.r[i] = float(interp1d(t_streamline,r)(row.axial_location))
38
+ row.x[i] = float(interp1d(t_streamline,x_streamline)(row.axial_location))
@@ -28,6 +28,7 @@ class Spool:
28
28
  _fluid: Solution = Solution("air.yaml")
29
29
 
30
30
  massflow_constraint: MassflowConstraint
31
+ _adjust_streamlines:bool = True
31
32
 
32
33
  # Inlet Conditions
33
34
  def __init__(self,passage:Passage,
@@ -86,7 +87,26 @@ class Spool:
86
87
  new_gas (ct.Solution.Solution): New gas mixture
87
88
  """
88
89
  self._fluid = newFluid
90
+ for i in range(len(self.blade_rows)):
91
+ self.blade_rows[i].fluid = self.fluid
92
+
93
+ @property
94
+ def adjust_streamlines(self) -> bool:
95
+ """Variable that determines whether or not to try and adjust the streamlines to balance massflow
96
+ This can be a source of failure. Setting it to false may help with debugging.
89
97
 
98
+ Returns:
99
+ bool: True = streamlines are adjusted after calculation; False = No changes in streamlines
100
+ """
101
+ return self._adjust_streamlines
102
+
103
+ @adjust_streamlines.setter
104
+ def adjust_streamlines(self,val:bool):
105
+ """Variable that determines whether or not to try and adjust the streamlines to balance massflow
106
+ This can be a source of failure. Setting it to false may help with debugging.
107
+ """
108
+ self._adjust_streamlines = val
109
+
90
110
 
91
111
  def set_blade_row_rpm(self,index:int,rpm:float):
92
112
  """sets the rpm of a particular blade row"""
@@ -229,7 +249,7 @@ class Spool:
229
249
  x_start = 0
230
250
  y_max = 0; y_min = 0
231
251
  plt.figure(num=1,clear=True)
232
- for i in range(1,len(self.blade_rows)):
252
+ for i in range(1,len(self.blade_rows)-1): # Don't plot inlet or outlet
233
253
  row = self.blade_rows[i]
234
254
  x_end = x_start + row.Vx.mean()
235
255
  dx = x_end - x_start
@@ -4,6 +4,7 @@ import math
4
4
  import numpy.typing as npt
5
5
  from .bladerow import BladeRow, compute_gas_constants
6
6
  from .enums import RowType, LossType
7
+ from scipy.integrate import trapezoid
7
8
 
8
9
  def T0_coolant_weighted_average(row:BladeRow) -> float:
9
10
  """Calculate the new weighted Total Temperature array considering coolant
@@ -99,7 +100,7 @@ def compute_power(row:BladeRow,upstream:BladeRow) -> None:
99
100
  row.eta_static = row.power/ (row.massflow[-1]*row.Cp*(upstream.T0.mean()-row.T0_is.mean()))
100
101
  row.eta_total = row.power / (row.massflow[-1]*row.Cp * (upstream.T0.mean()-row.T0_is.mean()))
101
102
  row.stage_loading = row.Cp*(upstream.T0.mean() - row.T0.mean())/row.U.mean()**2
102
- row.euler_power = (row.massflow[-1]*((row.U+upstream.U)/2).mean()*(upstream.Vt-row.Vt).mean())
103
+ row.euler_power = row.massflow[-1]* (upstream.U*upstream.Vt - row.U*row.Vt).mean()
103
104
 
104
105
  def compute_quantities(row:BladeRow,upstream:BladeRow):
105
106
  """Calculation of all quantites after radial equilibrium has been solved assuming we know the static pressure at the exit.
@@ -360,8 +361,10 @@ def inlet_calc(row:BladeRow):
360
361
  row (BladeRow): _description_
361
362
  """
362
363
  area = row.Vm.copy()*0
364
+ # Estimate the density
363
365
  row.T = row.T0
364
366
  row.P = row.P0
367
+ row.rho = row.P/(row.T*row.R)
365
368
  total_area = 0
366
369
  for _ in range(5): # Lets converge the Mach and Total and Static pressures
367
370
  for j in range(1,len(row.percent_hub_shroud)):
@@ -381,7 +384,7 @@ def inlet_calc(row:BladeRow):
381
384
  row.Vr = row.Vm*np.sin(row.phi)
382
385
  row.Vt = row.Vm*np.cos(row.phi)*np.tan(row.alpha2)
383
386
  row.V = np.sqrt(row.Vt**2+row.Vm**2)
384
-
387
+ # Fine tune the Temperature and Pressure and density
385
388
  row.M = row.V/np.sqrt(row.gamma*row.R*row.T)
386
389
  row.T = row.T0 * 1/(1+(row.gamma-1)/2*row.M**2)
387
390
  row.P = row.P0 * (row.T/row.T0)**(row.gamma/(row.gamma-1))
@@ -239,7 +239,7 @@ class TurbineSpool(Spool):
239
239
  else:
240
240
  for i in range(1,len(blade_rows)-1):
241
241
  for j in range(self.num_streamlines):
242
- blade_rows[i].P[j] = P[i][j]*x0[(i-1)*self.num_streamlines+j] # x0 size = num_streamlines -1
242
+ blade_rows[i].P[j] = P[j]*x0[(i-1)*self.num_streamlines+j] # x0 size = num_streamlines -1
243
243
 
244
244
  calculate_massflows(blade_rows,True)
245
245
  print(x0)
@@ -247,7 +247,7 @@ class TurbineSpool(Spool):
247
247
  except:
248
248
  for i in range(1,len(blade_rows)-1):
249
249
  for j in range(self.num_streamlines):
250
- blade_rows[i].P[j] = P[i][j]
250
+ blade_rows[i].P[j] = P[j]
251
251
  calculate_massflows(blade_rows,True)
252
252
  return 10
253
253
  # Break apart the rows to stages
@@ -271,11 +271,15 @@ class TurbineSpool(Spool):
271
271
  self.blade_rows[0].massflow = np.linspace(0,1,self.num_streamlines)*self.blade_rows[1].total_massflow_no_coolant
272
272
  inlet_calc(self.blade_rows[0]) # adjust the inlet to match massflow
273
273
 
274
- for _ in range(2):
275
- adjust_streamlines(self.blade_rows[:-1],self.passage)
274
+ if self.adjust_streamlines:
275
+ for _ in range(2):
276
+ adjust_streamlines(self.blade_rows[:-1],self.passage)
277
+ self.blade_rows[-1].transfer_quantities(self.blade_rows[-2])
278
+ self.blade_rows[-1].P = self.blade_rows[-1].get_static_pressure(self.blade_rows[-1].percent_hub_shroud)
279
+ balance_massflows(x,self.blade_rows[:-1],self.blade_rows[0].P0,self.blade_rows[-1].P)
280
+ else:
276
281
  self.blade_rows[-1].transfer_quantities(self.blade_rows[-2])
277
282
  self.blade_rows[-1].P = self.blade_rows[-1].get_static_pressure(self.blade_rows[-1].percent_hub_shroud)
278
- balance_massflows(x,self.blade_rows[:-1],self.blade_rows[0].P0,self.blade_rows[-1].P)
279
283
  err = calculate_error(self.blade_rows[:-1])
280
284
  print(f"Massflow convergenced error:{err}")
281
285
 
@@ -340,7 +344,13 @@ class TurbineSpool(Spool):
340
344
  t,x,r = self.passage.get_streamline(p)
341
345
  x_streamline[j,indx] = float(interp1d(t,x)(row.axial_location))
342
346
  r_streamline[j,indx] = float(interp1d(t,r)(row.axial_location))
343
-
347
+
348
+ Pratio_Total_Total = np.mean(self.blade_rows[0].P0 / self.blade_rows[-2].P0)
349
+ Pratio_Total_Static = np.mean(self.blade_rows[0].P0 / self.blade_rows[-2].P)
350
+ FlowFunction = np.mean(massflow)*np.sqrt(self.blade_rows[0].T0)*self.blade_rows[0].P0/1000 # kg sqrt(K)/(sec kPa)
351
+ CorrectedSpeed = self.rpm * np.pi/30 / np.sqrt(self.blade_rows[0].T0.mean()) # rad/s * 1/sqrt(K)
352
+ EnergyFunction = (self.blade_rows[0].T0 - self.blade_rows[-2].T0) * 0.5* (self.blade_rows[0].Cp + self.blade_rows[-2].Cp) / self.blade_rows[0].T0 # J/(KgK)
353
+ EnergyFunction = np.mean(EnergyFunction)
344
354
  data = {
345
355
  "blade_rows": blade_rows,
346
356
  "massflow":np.mean(massflow),
@@ -355,7 +365,12 @@ class TurbineSpool(Spool):
355
365
  "total-total_efficiency":total_total_efficiency,
356
366
  "total-static_efficiency":total_static_efficiency,
357
367
  "stage_loading":stage_loading,
358
- "degree_of_reaction":degree_of_reaction
368
+ "degree_of_reaction":degree_of_reaction,
369
+ "Pratio_Total_Total":Pratio_Total_Total,
370
+ "Pratio_Total_Static":Pratio_Total_Static,
371
+ "FlowFunction":FlowFunction,
372
+ "CorrectedSpeed":CorrectedSpeed,
373
+ "EnergyFunction":EnergyFunction
359
374
  }
360
375
  # Dump all the Python objects into a single JSON file.
361
376
  class NumpyEncoder(json.JSONEncoder):