simulationapps / utils /ansys_utils.py
karthikmn's picture
Update utils/ansys_utils.py
ff78e03 verified
raw
history blame contribute delete
734 Bytes
from ansys.mapdl.core import launch_mapdl
def run_simulation(step_file):
"""
Runs ANSYS simulation on the provided STEP file.
Returns the simulation results.
"""
try:
mapdl = launch_mapdl()
mapdl.prep7()
mapdl.et(1, "solid185")
mapdl.mp("EX", 1, 210e3)
mapdl.mp("NUXY", 1, 0.3)
mapdl.mp("DENS", 1, 7.85e-9)
mapdl.n(1, 0, 0, 0)
mapdl.n(2, 100, 0, 0)
mapdl.n(3, 0, 50, 0)
mapdl.e(1, 2, 3)
mapdl.solve()
results = mapdl.post_processing.nodal_solution
mapdl.exit()
return f"Simulation completed successfully. Results: {results}"
except Exception as e:
return f"Error in ANSYS simulation: {e}"