Spaces:
Sleeping
Sleeping
Download simulators/ansys_simulation.py from jithenderchoudary/SRPT_APDL_01: direct link, hf CLI and curl.
- Browser
- Download file 750 Bytes
-
https://huggingface.co/spaces/jithenderchoudary/SRPT_APDL_01/resolve/main/simulators/ansys_simulation.py
- Command line
-
hf download hf://spaces/jithenderchoudary/SRPT_APDL_01/simulators/ansys_simulation.py
-
curl -L -o ansys_simulation.py https://huggingface.co/spaces/jithenderchoudary/SRPT_APDL_01/resolve/main/simulators/ansys_simulation.py
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 | |