CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Integrating/Interfacing cfx with Matlab

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 6, 2013, 22:25
Default
  #21
Member
 
Darren Leong
Join Date: Dec 2010
Posts: 64
Rep Power: 15
Darren Leong is on a distinguished road
Hi Ali,

Just replied your email but good to see you did post the question on forum. The example script is pretty much what you're asking for, you just need to work thru it.

Otherwise, as mentioned in the email, you can just use the system command terminal:

Have a look at the subsections in the link below on how to use cfx through your system command terminal:
https://www.sharcnet.ca/Software/Flu.../i1304872.html

If you're familiar with .bat, write the command for execution for each mesh row by row using a text editor, save it as *.bat, run it and you're done.

As for post processing of quantitative data, you can use cfxmonitor.exe to extract the outputs of *.res in a .csv format to be read by excel/matlab. If you want visualisation, the only way is using cfx-post.

_

On the hind side, try looking into the design optimisation feature in ANSYS Workbench. It works well for structural but i'm not sure if it's applicable for CFX yet.
Darren Leong is offline   Reply With Quote

Old   January 7, 2013, 16:08
Default
  #22
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,826
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
ANSYS Workbench optimsation works fine for CFX.
ghorrocks is offline   Reply With Quote

Old   September 1, 2015, 02:03
Lightbulb call CFX from Matlab
  #23
New Member
 
arash ghorban-nia
Join Date: Aug 2012
Posts: 9
Rep Power: 14
Arash67.m is on a distinguished road
Send a message via Yahoo to Arash67.m
Hi everyone,
I have set up a CFD problem in CFX (workbench 16) and it works with no problem and accurate results. Now I want to set input velocity and output pressure to specific values from MATLAB and then start solving with cfx5solve. I can categorize my issue in two following questions:

1- How is it possible to set specific values for velocity and pressure from MATLAB, is it possible to set them in ccl or def files (editing ccl and def) and then call cfx5solve to run the analysis.

I assume that a command like this should work:

set-> variable name->variable value
but I can not find the corresponding command in MATLAB

2- How should I define run in MATLAB? I tried the following code in command window in MATLAB:

%%%%%%%%%%%%
!"C:\Program Files\Ansys Inc\V160\CFX\bin\cfx5solve" -def FFCFX0203.def -ccl relaibilityCCL.ccl
%%%%%%%%%%%%

but I receive the following error:

An error has occurred in cfx5solve:

Command Language file relaibilityCCL.ccl does not exist

I would be truly thankful if you could help me to manage this issue.
Arash67.m is offline   Reply With Quote

Old   September 1, 2015, 02:21
Default
  #24
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 415
Rep Power: 13
-Maxim- is on a distinguished road
Quote:
Originally Posted by Arash67.m View Post
Command Language file relaibilityCCL.ccl does not exist
Well, isn't that error message pretty clear? Maybe because of a typo? It's spelled "reliability" to my English knowledge

Last edited by -Maxim-; September 1, 2015 at 02:21. Reason: typo
-Maxim- is offline   Reply With Quote

Old   September 1, 2015, 02:52
Default
  #25
New Member
 
arash ghorban-nia
Join Date: Aug 2012
Posts: 9
Rep Power: 14
Arash67.m is on a distinguished road
Send a message via Yahoo to Arash67.m
Quote:
Originally Posted by -Maxim- View Post
Well, isn't that error message pretty clear? Maybe because of a typo? It's spelled "reliability" to my English knowledge
Thanks for your attention Maxim. But it is a typing mistake in both file name and command :-) so it is not the problem as I checked.
Is there any special directory for def and ccl files I have left both of them on desktop!
Arash67.m is offline   Reply With Quote

Old   September 1, 2015, 02:54
Default
  #26
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 415
Rep Power: 13
-Maxim- is on a distinguished road
okay, but if the message is still: 'does not exist', your script cannot find the file in the folder it is looking for the file. My guess would be that the ccl file isn't in the right folder? Is it in the same directory as your def file?
-Maxim- is offline   Reply With Quote

Old   September 1, 2015, 02:55
Default
  #27
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
My guess is that the working directory is not set. CFX looks for your .ccl file somewhere else.
Lance is offline   Reply With Quote

Old   September 1, 2015, 03:03
Default
  #28
New Member
 
arash ghorban-nia
Join Date: Aug 2012
Posts: 9
Rep Power: 14
Arash67.m is on a distinguished road
Send a message via Yahoo to Arash67.m
Quote:
Originally Posted by -Maxim- View Post
okay, but if the message is still: 'does not exist', your script cannot find the file in the folder it is looking for the file. My guess would be that the ccl file isn't in the right folder? Is it in the same directory as your def file?
Yes, both of them are in desktop directory.
yhe question is when I type the following command in matlab, I do not know in wich directory Matlab looks up the def and ccl files! ? I think a special directory should be specified. Am I right?
Arash67.m is offline   Reply With Quote

Old   September 1, 2015, 03:06
Default
  #29
New Member
 
arash ghorban-nia
Join Date: Aug 2012
Posts: 9
Rep Power: 14
Arash67.m is on a distinguished road
Send a message via Yahoo to Arash67.m
Quote:
Originally Posted by Lance View Post
My guess is that the working directory is not set. CFX looks for your .ccl file somewhere else.
Thanks for your help Lance.
But I think MATLAB has got a big problem in finding def and ccl files because when I wright the following command it fails to find deffile. the same error hapens for both ccl and def!

%%%%%%%%%%%%%%%
!"C:\Program Files\Ansys Inc\V160\CFX\bin\cfx5solve" -def FFCFX0203.def
%%%%%%%%%%%%%%

error:

An error has occurred in cfx5solve:

ANSYS CFX Solver Input File C:/Users/NP/Documents/MATLAB/FFCFX0203.def does
not exist
Arash67.m is offline   Reply With Quote

Old   September 1, 2015, 04:09
Default
  #30
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 415
Rep Power: 13
-Maxim- is on a distinguished road
then either put your def and ccl file in C:/Users/NP/Documents/MATLAB/

or change your command to
-def C:/Users/NP/Desktop/FFCFX0203.def

this is standard batch/console/programming syntax.
Or look up what a 'working directory' is and how it is set.
I don't want to be rude but I think you should go back a step and teach yourself some basics first...
-Maxim- is offline   Reply With Quote

Old   September 1, 2015, 05:24
Default
  #31
New Member
 
arash ghorban-nia
Join Date: Aug 2012
Posts: 9
Rep Power: 14
Arash67.m is on a distinguished road
Send a message via Yahoo to Arash67.m
Quote:
Originally Posted by -Maxim- View Post
then either put your def and ccl file in C:/Users/NP/Documents/MATLAB/

or change your command to
-def C:/Users/NP/Desktop/FFCFX0203.def

this is standard batch/console/programming syntax.
Or look up what a 'working directory' is and how it is set.
I don't want to be rude but I think you should go back a step and teach yourself some basics first...
Thanks a Million Maxim,
It worked:
!"C:\Program Files\Ansys Inc\V160\CFX\bin\cfx5solve" -def C:/Users/NP/Desktop/FFCFX0203.def

Anyway, you are right. I am not familiar with programming.
Arash67.m is offline   Reply With Quote

Old   September 1, 2015, 13:03
Default
  #32
New Member
 
arash ghorban-nia
Join Date: Aug 2012
Posts: 9
Rep Power: 14
Arash67.m is on a distinguished road
Send a message via Yahoo to Arash67.m
Quote:
Originally Posted by Arash67.m View Post
Hi everyone,
I have set up a CFD problem in CFX (workbench 16) and it works with no problem and accurate results. Now I want to set input velocity and output pressure to specific values from MATLAB and then start solving with cfx5solve. I can categorize my issue in two following questions:

1- How is it possible to set specific values for velocity and pressure from MATLAB, is it possible to set them in ccl or def files (editing ccl and def) and then call cfx5solve to run the analysis.

I assume that a command like this should work:

set-> variable name->variable value
but I can not find the corresponding command in MATLAB

2- How should I define run in MATLAB? I tried the following code in command window in MATLAB:

%%%%%%%%%%%%
!"C:\Program Files\Ansys Inc\V160\CFX\bin\cfx5solve" -def FFCFX0203.def -ccl relaibilityCCL.ccl
%%%%%%%%%%%%

but I receive the following error:

An error has occurred in cfx5solve:

Command Language file relaibilityCCL.ccl does not exist

I would be truly thankful if you could help me to manage this issue.
taking the advantage of your guidance I fixed the second issue I mentioned above, but my first question remains a disaster!

I need to edit CFX definition file (.def) in MATLAB and set some boundary conditions to new values and restart the analysis for updated boundary conditions.

I think it is a common issue in optimization problems but I can not find related topics in forum. I would be truly thankful if you could help me to fix this issue.
Arash67.m is offline   Reply With Quote

Old   September 2, 2015, 02:15
Default
  #33
Senior Member
 
Maxim
Join Date: Aug 2015
Location: Germany
Posts: 415
Rep Power: 13
-Maxim- is on a distinguished road
Darren Leong posted some Matlab code a page back. I would go from there and try to implement your ideas in the same syntax.
I don't have Matlab installed right now, so I cannot test things.
But what about you post your Matlab code that you have written so far?
-Maxim- is offline   Reply With Quote

Old   September 2, 2015, 02:40
Default
  #34
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Write a new .ccl in Matlab and use the -ccl option? You can get the syntax for the .ccl file by right clicking on the boundary condition in cfx-pre and 'edit in command editor'.
Lance is offline   Reply With Quote

Old   February 9, 2019, 07:33
Default
  #35
Member
 
HS
Join Date: Sep 2015
Posts: 30
Rep Power: 11
amsys is on a distinguished road
Quote:
Originally Posted by Darren Leong View Post



This seems perfect for what I am currently trying to achieve. However the link is now invalid, is there anyway you could please re-upload the link to the files?


Thanks!
amsys is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cfx - matlab camilo_costa CFX 15 October 14, 2013 17:18
Matlab & CFX Meri CFX 1 March 16, 2006 00:39
CFX 7.1 and Matlab Juan G. CFX 1 March 5, 2006 21:37
CFX & MatLab Walid CFX 4 March 8, 2005 16:30
How to make data file for matlab from CFX? cfxbeginner CFX 4 October 19, 2002 07:56


All times are GMT -4. The time now is 12:48.