Skip to content

Commit 9590a07

Browse files
authored
Merge edb2502 into 6f429f0
2 parents 6f429f0 + edb2502 commit 9590a07

34 files changed

+350
-74
lines changed

poetry.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pulse/interface/data/ui_files/main_window.ui

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
<string>Help</string>
155155
</property>
156156
<addaction name="action_about_openpulse"/>
157+
<addaction name="action_check_refprop"/>
157158
</widget>
158159
<widget class="QMenu" name="menu_general_settings">
159160
<property name="title">
@@ -842,6 +843,11 @@
842843
<string>Results workspace</string>
843844
</property>
844845
</action>
846+
<action name="action_check_refprop">
847+
<property name="text">
848+
<string>Check REFPROP</string>
849+
</property>
850+
</action>
845851
</widget>
846852
<resources/>
847853
<connections/>

pulse/interface/data/ui_files/model/editor/pulsation_suppression_device_input.ui

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>630</width>
10-
<height>651</height>
10+
<height>663</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -235,6 +235,9 @@
235235
</property>
236236
<item row="0" column="0">
237237
<widget class="QScrollArea" name="scrollArea">
238+
<property name="focusPolicy">
239+
<enum>Qt::NoFocus</enum>
240+
</property>
238241
<property name="frameShape">
239242
<enum>QFrame::NoFrame</enum>
240243
</property>
@@ -313,7 +316,7 @@
313316
</font>
314317
</property>
315318
<property name="text">
316-
<string>dual_chamber</string>
319+
<string>double_volume_psd</string>
317320
</property>
318321
<property name="alignment">
319322
<set>Qt::AlignCenter</set>
@@ -580,7 +583,7 @@
580583
</font>
581584
</property>
582585
<property name="currentIndex">
583-
<number>1</number>
586+
<number>0</number>
584587
</property>
585588
<item>
586589
<property name="text">
@@ -818,7 +821,7 @@
818821
</font>
819822
</property>
820823
<property name="text">
821-
<string>Volumes connection</string>
824+
<string>Volumes connection:</string>
822825
</property>
823826
<property name="alignment">
824827
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -2597,6 +2600,50 @@
25972600
</item>
25982601
</layout>
25992602
</widget>
2603+
<tabstops>
2604+
<tabstop>tabWidget_main</tabstop>
2605+
<tabstop>lineEdit_device_label</tabstop>
2606+
<tabstop>lineEdit_connecting_coord_x</tabstop>
2607+
<tabstop>lineEdit_connecting_coord_y</tabstop>
2608+
<tabstop>lineEdit_connecting_coord_z</tabstop>
2609+
<tabstop>comboBox_connection_pipe</tabstop>
2610+
<tabstop>comboBox_main_axis</tabstop>
2611+
<tabstop>comboBox_number_volumes</tabstop>
2612+
<tabstop>spinBox_volumes_spacing</tabstop>
2613+
<tabstop>comboBox_volumes_connection</tabstop>
2614+
<tabstop>comboBox_pipe1_connection</tabstop>
2615+
<tabstop>comboBox_pipe2_connection</tabstop>
2616+
<tabstop>comboBox_tuned_filter</tabstop>
2617+
<tabstop>lineEdit_rotation_plane</tabstop>
2618+
<tabstop>spinBox_pipe1_rotation_angle</tabstop>
2619+
<tabstop>spinBox_pipe2_rotation_angle</tabstop>
2620+
<tabstop>lineEdit_volume1_diameter</tabstop>
2621+
<tabstop>lineEdit_volume1_wall_thickness</tabstop>
2622+
<tabstop>lineEdit_volume1_length</tabstop>
2623+
<tabstop>lineEdit_volume2_diameter</tabstop>
2624+
<tabstop>lineEdit_volume2_wall_thickness</tabstop>
2625+
<tabstop>lineEdit_volume2_length</tabstop>
2626+
<tabstop>lineEdit_pipe1_diameter</tabstop>
2627+
<tabstop>lineEdit_pipe1_wall_thickness</tabstop>
2628+
<tabstop>lineEdit_pipe1_length</tabstop>
2629+
<tabstop>lineEdit_pipe1_distance</tabstop>
2630+
<tabstop>lineEdit_pipe2_diameter</tabstop>
2631+
<tabstop>lineEdit_pipe2_wall_thickness</tabstop>
2632+
<tabstop>lineEdit_pipe2_length</tabstop>
2633+
<tabstop>lineEdit_pipe2_distance</tabstop>
2634+
<tabstop>lineEdit_pipe3_diameter</tabstop>
2635+
<tabstop>lineEdit_pipe3_wall_thickness</tabstop>
2636+
<tabstop>lineEdit_pipe3_length</tabstop>
2637+
<tabstop>lineEdit_pipe3_distance</tabstop>
2638+
<tabstop>pushButton_create_psd</tabstop>
2639+
<tabstop>pushButton_cancel</tabstop>
2640+
<tabstop>pushButton_reset</tabstop>
2641+
<tabstop>pushButton_remove</tabstop>
2642+
<tabstop>lineEdit_selection</tabstop>
2643+
<tabstop>treeWidget_psd_info</tabstop>
2644+
<tabstop>lineEdit_volume1_distance_2</tabstop>
2645+
<tabstop>lineEdit_volume1_distance</tabstop>
2646+
</tabstops>
26002647
<resources/>
26012648
<connections/>
26022649
</ui>

pulse/interface/handler/geometry_handler.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def create_geometry(self, gmsh_GUI=False):
162162
_end_coords = structure.end.coords()
163163
_center_coords = structure.center.coords()
164164

165-
print(f"Center coordinates (opps): {_center_coords} [m]")
165+
# print(f"Center coordinates (opps): {_center_coords} [m]")
166166

167167
if self.length_unit == "meter":
168168
start_coords = m_to_mm(_start_coords)
@@ -251,7 +251,6 @@ def process_pipeline(self):
251251
self.pipeline.reset()
252252

253253
lines_data = app().pulse_file.read_line_properties_from_file()
254-
# print("-> process_pipeline")
255254

256255
if isinstance(lines_data, dict):
257256
for _line_id, data in lines_data.items():
@@ -609,7 +608,7 @@ def process_curved_lines(self, lines):
609608
end_coords = self.get_point_coords(end_point)
610609

611610
corner_coords = self.get_corner_point_coords(start_point, end_point)
612-
center_coords = self.get_center_point_coords(start_point, end_point)
611+
# center_coords = self.get_center_point_coords(start_point, end_point)
613612

614613
if corner_coords is None:
615614
message = f"The connecting lines from 'Circle curve' {line} are parallel "
@@ -773,7 +772,7 @@ def get_center_point_coords(self, start_point, end_point):
773772
np.sum(n*coords_start)], dtype=float)
774773

775774
center_coordinates = np.linalg.solve(A, b)
776-
print(f"Center coordinates (gmsh): {center_coordinates}[m]")
775+
# print(f"Center coordinates (gmsh): {center_coordinates}[m]")
777776
return center_coordinates
778777

779778
def get_radius(self, corner_coords, start_point, end_point):

pulse/interface/main_window.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
from pulse.interface.user_input.project.new_project import NewProjectInput
2828
from pulse.interface.user_input.project.reset_project import ResetProjectInput
2929
from pulse.interface.user_input.project.import_geometry import ImportGeometry
30-
from pulse.interface.user_input.project.about_open_pulse import AboutOpenPulseInput
3130
from pulse.interface.user_input.project.save_project_data_selector import SaveProjectDataSelector
31+
from pulse.interface.user_input.checkers.refprop_check import CheckREFPROP
32+
from pulse.interface.user_input.project.about_open_pulse import AboutOpenPulseInput
3233
from pulse.interface.user_input.project.loading_window import LoadingWindow
3334

3435
import logging
@@ -122,6 +123,7 @@ def _define_qt_variables(self):
122123
self.action_model_setup_workspace: QAction
123124
self.action_analysis_setup_workspace: QAction
124125
self.action_results_workspace: QAction
126+
self.action_check_refprop: QAction
125127
self.action_export_geometry: QAction
126128
self.action_import_geometry: QAction
127129
self.action_export_pcf: QAction
@@ -494,11 +496,11 @@ def _update_recent_projects(self):
494496
self.menu_recent.removeAction(action)
495497

496498
self.menu_actions = list()
497-
for name, path in reversed(self.config.recent_projects.items()):
498-
path = Path(path)
499-
if not os.path.exists():
499+
for path in reversed(self.config.get_recent_files()):
500+
if not path.exists():
500501
continue
501-
import_action = QAction(str(name) + "\t" + str(path))
502+
503+
import_action = QAction(str(path.name) + "\t" + str(path))
502504
import_action.setStatusTip(str(path))
503505
import_action.triggered.connect(partial(self.open_project, path))
504506
self.menu_recent.addAction(import_action)
@@ -559,6 +561,9 @@ def action_export_pcf_callback(self):
559561
def action_export_geometry_callback(self):
560562
self.export_geometry()
561563

564+
def action_check_refprop_callback(self):
565+
CheckREFPROP()
566+
562567
def action_geometry_editor_workspace_callback(self):
563568

564569
self.clear_selection()
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
from pulse import app
2+
from pulse.interface.user_input.project.print_message import PrintMessageInput
3+
4+
import os
5+
from pathlib import Path
6+
7+
window_title_1 = "Error"
8+
window_title_2 = "Warning"
9+
10+
11+
class CheckREFPROP:
12+
13+
def __init__(self):
14+
super().__init__()
15+
16+
self.check_external_dependency()
17+
18+
def check_external_dependency(self):
19+
20+
from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary
21+
22+
refProp_path = self.get_refprop_path()
23+
24+
if refProp_path is None:
25+
return True
26+
27+
if os.path.exists(refProp_path):
28+
29+
self.refprop = REFPROPFunctionLibrary(refProp_path)
30+
if self.check_refprop_version():
31+
return True
32+
33+
def get_refprop_path(self):
34+
35+
refProp_path = None
36+
try:
37+
refProp_path = os.environ['RPPREFIX']
38+
except:
39+
pass
40+
41+
if refProp_path is None:
42+
try:
43+
refProp_path = app().config.get_refprop_path_from_file()
44+
except:
45+
pass
46+
47+
if refProp_path is None:
48+
49+
caption = 'Search for the REFPROP folder'
50+
initial_path = str(Path().home())
51+
52+
folder_path = app().main_window.file_dialog.get_existing_directory(caption, initial_path)
53+
54+
if folder_path == "":
55+
return None
56+
57+
if os.path.exists(folder_path):
58+
59+
if os.path.basename(folder_path) in ["REFPROP", "Refprop", "refprop"]:
60+
app().config.write_refprop_path_in_file(folder_path)
61+
refProp_path = folder_path
62+
63+
else:
64+
title = "Invalid folder selected"
65+
message = f"The selected folder path {folder_path} does not match with the REFPROP installation folder. "
66+
message += "As suggestion, try to find the default installation folder in 'C:/Program Files (x86)/REFPROP'. "
67+
message += "You should select the valid REFPROP installation folder to proceed."
68+
PrintMessageInput([window_title_1, title, message])
69+
70+
return refProp_path
71+
72+
def check_refprop_version(self):
73+
74+
version = self.refprop.RPVersion()
75+
76+
if version[:3] != "10.":
77+
title = "Invalid REFPROP version detected"
78+
message = "The installed REFPROP version is incompatible with the OpenPulse requirements. It is recommended "
79+
message += "to install a newer REFPROP version to maintain the compatibility with the application.\n\n"
80+
message += f"Current version: {version}\n"
81+
message += "Required version: >= 10.0"
82+
PrintMessageInput([window_title_2, title, message])
83+
return True
84+
85+
else:
86+
title = "REFPROP version detected"
87+
message = f"The current REFPROP version installed in the "
88+
message += "computer meets the OpenPulse requirements.\n\n"
89+
message += "Compatible versions: >= v10.0\n"
90+
message += f"Current version: v{version}\n"
91+
PrintMessageInput([window_title_2, title, message], auto_close=True)
92+
return False

pulse/interface/user_input/input_ui.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def plot_structural_mode_shapes(self):
201201
if solution is None:
202202
return None
203203
else:
204+
app().main_window.results_widget.show_empty()
204205
return self.process_input(PlotStructuralModeShape)
205206

206207
def plot_displacement_field(self):
@@ -210,6 +211,7 @@ def plot_displacement_field(self):
210211
if solution is None:
211212
return None
212213
else:
214+
app().main_window.results_widget.show_empty()
213215
return self.process_input(PlotNodalResultsFieldForHarmonicAnalysis)
214216

215217
def plot_structural_frequency_response(self):
@@ -260,6 +262,7 @@ def plot_acoustic_mode_shapes(self):
260262
if solution is None:
261263
return None
262264
else:
265+
app().main_window.results_widget.show_empty()
263266
return self.process_input(PlotAcousticModeShape)
264267

265268
def plot_acoustic_pressure_field(self):
@@ -269,6 +272,7 @@ def plot_acoustic_pressure_field(self):
269272
if solution is None:
270273
return None
271274
else:
275+
app().main_window.results_widget.show_empty()
272276
return self.process_input(PlotAcousticPressureField)
273277

274278
def plot_acoustic_frequency_response(self):

0 commit comments

Comments
 (0)