SRPT_APDL_01 / simulators /ansys_simulation.py
jithenderchoudary's picture
Update simulators/ansys_simulation.py
35775d6 verified
raw
history blame contribute delete
750 Bytes
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