Spaces:
Sleeping
Sleeping
File size: 747 Bytes
352497d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from ansys.mapdl.core import launch_mapdl
def run_ansys_simulation(apdl_script_path):
"""
Executes the ANSYS simulation using the APDL script.
Parameters:
apdl_script_path (str): Path to the APDL script.
Returns:
tuple: (stress, deformation) from the ANSYS simulation.
"""
# Launch ANSYS MAPDL
mapdl = launch_mapdl()
try:
# Read and execute the APDL script
mapdl.input(apdl_script_path)
# Extract results (assuming stress and deformation are calculated in APDL script)
stress = mapdl.get_scalar("STRESS")
deformation = mapdl.get_scalar("DEFORMATION")
finally:
# Close the ANSYS MAPDL session
mapdl.exit()
return stress, deformation |