File size: 734 Bytes
781da5a
 
ff78e03
781da5a
ff78e03
781da5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_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}"