Skip to content

Commit 3d7ac56

Browse files
committed
fix datatype
1 parent cc670d1 commit 3d7ac56

3 files changed

Lines changed: 27 additions & 8 deletions

File tree

examples/heat_sink_fan_calculation.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
"""Example for a R_th calculation for a given heat sink geometry and a single fan."""
1+
"""Example for an R_th calculation for a given heat sink geometry and a single fan."""
22
# import 3rd party libraries
33
import numpy as np
4+
from matplotlib import pyplot as plt
45

56
# import own libraries
67
import hct
@@ -14,8 +15,25 @@
1415

1516
fan_name = 'orion_od4010m.csv'
1617

17-
volume_flow, pressure = hct.calc_volume_flow(fan_name, geometry, plot=True)
18+
hct.global_plot_settings_font_latex()
19+
hct.global_plot_settings_font_size(12)
20+
figure_size = (80, 60)
1821

22+
volume_flow, pressure = hct.calc_volume_flow(fan_name, geometry, plot=True, figure_size=figure_size)
1923
r_th_sa = hct.calc_final_r_th_s_a(geometry, constants, t_ambient, volume_flow)
20-
2124
print(f"{r_th_sa=}")
25+
26+
27+
r_th_sa_sweep_list = np.array([])
28+
volume_flow_sweep_list = np.linspace(0.002, 0.035)
29+
for volume_flow_sweep in volume_flow_sweep_list:
30+
r_th_sa_sweep = hct.calc_final_r_th_s_a(geometry, constants, t_ambient, volume_flow_sweep)
31+
r_th_sa_sweep_list = np.append(r_th_sa_sweep_list, r_th_sa_sweep)
32+
33+
plt.figure(figsize=[x / 25.4 for x in figure_size] if figure_size is not None else None, dpi=80)
34+
plt.plot(volume_flow_sweep_list, r_th_sa_sweep_list, color=hct.colors()["blue"])
35+
plt.xlabel("Volume flow / (m³/s)")
36+
plt.ylabel(r"$R_\mathrm{th}$ / (K/W)")
37+
plt.grid()
38+
plt.tight_layout()
39+
plt.show()

examples/heat_sink_optimization.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
config = hct.OptimizationParameters(
1313

14-
heat_sink_study_name="trial1_area_1",
14+
heat_sink_study_name="trial1_directions",
1515
heat_sink_optimization_directory=os.path.abspath("example_results"),
1616

1717
height_c_list=[0.02, 0.08],
@@ -22,10 +22,11 @@
2222
thickness_fin_t_list=[1e-3, 5e-3],
2323
fan_list=fan_list,
2424
t_ambient=40,
25-
area_min=0.02 * 0.1
25+
area_min=0.02 * 0.1,
26+
number_directions=3
2627
)
2728

28-
hct.Optimization.start_proceed_study(config=config, number_trials=10000)
29+
# hct.Optimization.start_proceed_study(config=config, number_trials=10000)
2930

3031
hct.global_plot_settings_font_latex()
3132

hct/thermal_dataclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Dataclass definitions."""
22
# Python libraries
33
from dataclasses import dataclass
4-
from typing import List
4+
from typing import List, Optional
55

66

77
@dataclass
@@ -66,7 +66,7 @@ class OptimizationParameters:
6666

6767
# constraints
6868
number_directions: int
69-
area_min: float
69+
area_min: Optional[float]
7070

7171

7272
@dataclass

0 commit comments

Comments
 (0)