Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,14 +82,22 @@ PRNSOL,U,SUM ! Print total deformation results
|
|
| 82 |
try:
|
| 83 |
max_stress = mapdl.get_value("NODE", 0, "S", "EQV")
|
| 84 |
deformation = mapdl.get_value("NODE", 0, "U", "SUM")
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
print(f"Error reading ANSYS results: {e}")
|
| 87 |
max_stress = deformation = 0 # Default values in case of error
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
|
| 94 |
# Run the selected simulator
|
| 95 |
if simulator == "PyCalculix":
|
|
|
|
| 82 |
try:
|
| 83 |
max_stress = mapdl.get_value("NODE", 0, "S", "EQV")
|
| 84 |
deformation = mapdl.get_value("NODE", 0, "U", "SUM")
|
| 85 |
+
print("Running ANSYS simulation...")
|
| 86 |
+
mapdl = launch_mapdl()
|
| 87 |
+
mapdl.input("simulation_input.inp")
|
| 88 |
+
sleep(5) # Wait for 5 seconds to ensure results are calculated
|
| 89 |
+
|
| 90 |
+
# Check if the values are being fetched correctly
|
| 91 |
+
try:
|
| 92 |
+
max_stress = mapdl.get_value("NODE", 0, "S", "EQV")
|
| 93 |
+
deformation = mapdl.get_value("NODE", 0, "U", "SUM")
|
| 94 |
+
except Exception as e: # <-- This line should have the same indentation as the try block
|
| 95 |
print(f"Error reading ANSYS results: {e}")
|
| 96 |
max_stress = deformation = 0 # Default values in case of error
|
| 97 |
|
| 98 |
+
mapdl.exit()
|
| 99 |
+
stress, deformation = max_stress, deformation
|
| 100 |
+
print(f"Stress: {stress}, Deformation: {deformation}")
|
|
|
|
| 101 |
|
| 102 |
# Run the selected simulator
|
| 103 |
if simulator == "PyCalculix":
|