In 2013, I wrote a blog showing ANSYS users how to make MATLAB apps for ANSYS Fluent. Just as a quick reminder, a friend of mine, who is also an ANSYS Fluent and Mechanical APDL user has a Windows Matlab code programming a Linux Fluent session. She had just updated her hardware. Everything is moved to Linux. She also needed to integrate a Mechanical APDL session.
She was asking me: “Why, can’t I port my MATLAB® code running on the platform of my choice and be able to also connect to Mechanical APDL?” She challenged me to to create a less than 20 lines code example. Back in 2013, my example was for ANSYS 16.0. Here is my update for ANSYS 17.0.
- Mechanical APDL
- Network of computers with ANSYS or MathWorks software installed
- Download ANSYS aaS Matlab toolbox (supports Matlab R2014b to 2016a) from ANSYS Customer Portal
- Open the folder where the mltbx has been downloaded in a Matlab folder view.
- double click on it and follow instructions to install
- Start the ANSYS products in aaS mode
- Read the downloaded pdf for suggestions
- Collect the aaS keys (aas_FluentId.txt, aaSMapdlId.txt and aaS_WbId.txt) and transfer them to the MATLAB machine
- These are the “keys” required to connect with ANSYS aaS products.
- Now let’s code. What should it do? Well, I will keep it simple: one command per ANSYS product:
- ask a report from Fluent
- set a variable in Mechanical APDL
- retrieve the Workbench Schematic
%connect to ANSYS products
%execute a Fluent TUI command
%execute a Mechanical APDL command
%retrieve the content of the remote Workbench Schematic
Well, all in all I used only 19 lines of code. My friend added her own code to create her elegant and efficient so-simulation.
Thank you for reading.