Spaces:
Sleeping
Sleeping
Update simulators/ansys_simulation.py
Browse files
simulators/ansys_simulation.py
CHANGED
@@ -1,24 +1,9 @@
|
|
1 |
from ansys.mapdl.core import launch_mapdl
|
2 |
|
3 |
def run_ansys_simulation(apdl_file):
|
4 |
-
"""
|
5 |
-
Run ANSYS simulation using a dynamically generated APDL script.
|
6 |
-
|
7 |
-
Parameters:
|
8 |
-
apdl_file (str): Path to the APDL script file.
|
9 |
-
|
10 |
-
Returns:
|
11 |
-
max_stress (float): Maximum stress from the simulation.
|
12 |
-
deformation (float): Total deformation from the simulation.
|
13 |
-
"""
|
14 |
mapdl = launch_mapdl()
|
15 |
-
|
16 |
-
# Load and execute the APDL script
|
17 |
mapdl.input(apdl_file)
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
deformation = mapdl.get_value("NODE", 0, "U", "SUM") # Total deformation
|
22 |
-
|
23 |
-
mapdl.exit() # Close the session
|
24 |
return max_stress, deformation
|
|
|
1 |
from ansys.mapdl.core import launch_mapdl
|
2 |
|
3 |
def run_ansys_simulation(apdl_file):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
mapdl = launch_mapdl()
|
|
|
|
|
5 |
mapdl.input(apdl_file)
|
6 |
+
max_stress = mapdl.get_value("NODE", 0, "S", "EQV")
|
7 |
+
deformation = mapdl.get_value("NODE", 0, "U", "SUM")
|
8 |
+
mapdl.exit()
|
|
|
|
|
|
|
9 |
return max_stress, deformation
|