Ansys empowers the next generation of engineers
Students get free access to world-class simulation software.
Design your future
Connect with Ansys to explore how simulation can power your next breakthrough.
Students get free access to world-class simulation software.
Connect with Ansys to explore how simulation can power your next breakthrough.
ANSYS BLOG
July 7, 2017
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.
%initialize aaS orb=initialize_orb(); load_ansys_aas(); %connect to ANSYS products
iCoFluentUnit=actfluentserver(orb,'aaS_FluentId.txt'); iCoMapdlUnit=actmapdlserver(orb,'aaS_MapdlId.txt');
actwbserver('aaS_WbId.txt') %execute a Fluent TUI command iFluentTuiInterpreter=iCoFluentUnit.getSchemeControllerInstance();
fluentResult=iFluentTuiInterpreter.doMenuCommandToString('report summary') %execute a Mechanical APDL command
mapdlResult=char(iCoMapdlUnit.executeCommandToString('aas_param=22')) %retrieve the content of the remote Workbench Schematic execwbcommand('systems=GetAllSystems()') querywbvariable('systems')
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.