February 11, 2017
Human kindness is a beautiful thing. As a software developer, I often wish that computer programs would be equally technically kind. Most of them are not. Many times, when a user mistypes a command, applications crash.
This is pretty common when driving Ansys Fluent from a remote program like Matlab. The Fluent scripting language is contextual. Consequently, the syntactic rules are changing during the simulation. For instance, substantially different commands are available when the CFD solver is changing the state, for example from meshing mode to simulation mode.
Fortunately, the aaS interface supports technical kindness. Consequently, when a command seems to be incorrect or incomplete, Fluent will switch to a "kind" response. Ultimately, the kindness will be offered as a clarifying exception. The exception should help the Matlab user understand the context. At this point such user could correct or complete the command.
My friend is using Matlab to drive Ansys Fluent, so I decided to demonstrate the technique in snippet of Matlab code for her. Here it is for you:
out='Report not received';
disp('Requesting <report summary>');
out = tui.doMenuCommandToString('report summary -?')
if strcmp(ex_id , 'MATLAB:Java:GenericException')
if strcmp(ex_object_class,'class AAS_CORBA.EYesNoQuestion')
disp('Answering <No> to the clarification question...');
disp('Requesting <report summary no>');
out = tui.doMenuCommandToString('report summary no -?');
Requesting <report summary>
write to file? [no]
Answering <No> to the clarification question...
Requesting <report summary no>
Version: 2d, dp, pbns, lam (2d, double pre....
Additionally, I would like to note something in the code. Adding the suffix "-?" to a command indicates that suggestions are welcomed. Similarly, the absence of "-?" will turn off Fluent "kindness". Finally, Fluent supports a set of four clarifying exceptions. Of course, they are properly documented in Ansys manuals. Just search for "aaS" keyword. For more information about Matlab Fluent cosimulation please check out How to Make Matlab Apps for Ansys.