CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Cfx - matlab (https://www.cfd-online.com/Forums/cfx/65334-cfx-matlab.html)

camilo_costa June 11, 2009 13:42

Cfx - matlab
 
Dear members

Is possible use MATLAB together with ANSYS-CFX? More specifically, is possible create a user routine ou user function in MATLAB and read this routine or function in ANSYS-CFX?

I canīt believe that the only way to insert a aditional function in CFX is through FORTRAN!

Thx for all!!

ckleanth June 11, 2009 13:52

short answer NO you cant

this is because
1 the solver is written in FORTRAN
2 you need the FORTRAN compiler to write your script and create the program in the low level programing language( i think its assembly but might be wrong)

camilo_costa June 11, 2009 14:27

Thx!! for your objective reply!

I will try to create a user function by FORTRAN. But I am new in this program language. Can you or someone help me to find many examples for study how to implement a new user routine by FORTRAN in CFX.

Is very dificult to understood the explanation about user FORTRAN in CFX help.

THX!!

ckleanth June 11, 2009 17:27

why would you want to create a user function in fortran? what you want to archive :confused:

camilo_costa June 11, 2009 18:32

I study heat exchangers with the tow-phase flow thermosiphons tecnology!

The heat transfer between evaporator and condenser is modelate by a analitical equation (in MATLAB) that nowadays I change the values manualy every 200 steps.

I want to automate through a user routine!!

thx!!

ghorrocks June 11, 2009 18:36

Hi,

CFX has the expression language CEL so most of the time fortran is not required to do functions.

Glenn Horrocks

camilo_costa June 11, 2009 19:08

Thx! but CEL is not sufficient for me!! the work fluid that contais inside of the tubes (heat pipes) have physical characteristics that change whit temperature and pressure that are modelate by a analyticall expression.

Why is so difficult to have access the one book our pdf that explain step by step how to implement a user function in CFX? Thx!!

ckleanth June 11, 2009 19:19

:rolleyes: It always amazes me how many times people start a task the difficult way. I'm pretty confident you can model the HE without even touching fortran

you can easily model real fluids in cfx, you just need to setup the appropriate materials.

rogbrito June 13, 2009 18:18

I think itīs possible, you can use FORTRAN, C or MATLAB.

ckleanth June 13, 2009 20:44

Quote:

Originally Posted by rogbrito (Post 219220)
I think itīs possible, you can use FORTRAN, C or MATLAB.

:rolleyes: yea ok then.. could you please enlighen us how on earth you would write a code in any other language apart fortran that would work and communicate with the CFX solver ?

Martijn June 14, 2009 06:40

Quote:

Originally Posted by ckleanth (Post 219223)
:rolleyes: yea ok then.. could you please enlighen us how on earth you would write a code in any other language apart fortran that would work and communicate with the CFX solver ?

Well you could use perl to analyse the output of a simulation whilst adapting the CCL for the next (short) simulation ;-) .

ckleanth June 14, 2009 09:19

Quote:

Originally Posted by Martijn (Post 219242)
Well you could use perl to analyse the output of a simulation whilst adapting the CCL for the next (short) simulation ;-) .

;) didnt think of using perl :p
will keep that in mind :cool:

ghorrocks June 14, 2009 20:40

Hi,

Just repeating chleanth's comment - most functions like this can be done using CEL with no need for fortran. Can you explain what in your function cannot be done in CEL?

How to implement fortran in CFX is described in the documentation. For simple stuff like just returning a CEL variable it is not too bad (I think you use a junction box for that. But I have never had to use fortran in CFX since I was using CFX4 in 1999. Ever since CFX5 was developed I have managed to do everything in CEL.

Glenn Horrocks

hung June 16, 2009 23:39

Hi,

I got the same problem. for example. i have to measure velocity in pipe. it is transient simulation, and at different timestep i got different velocity values at the output and i can see that value in CFX post. if i want to integrate that value from 0 to T. do i have to write the function of CEL at the CFX-Pre or CFX Post?. how to access with different timestep? because as same as camilo_costa i might have to export 200 steps to data matrix end then do all the calculation in Matlab.
thanks,

hung

astrorajesh October 14, 2013 08:15

how to couple
 
hello friends

i am going to optimize rotor 37,for that is there any coupling tools are available

I have a MATLAB optimization code and the objective function will require results from ANSYS CFX. The Setup is like this: Ansys Turbogrid - CFX Pre - Solver - Post - Result to MATLAB - MATLAB create new geometry - Start new cycle again starting with turbogrid.

The ANSYS Programme will be in Ansys workbench. I dont know how to link it with MATLAB and vice versa

thanks in advance

ghorrocks October 14, 2013 17:18

The look you describe sounds simple to implement as a batch (windows) or shell ([L]unix) script.


All times are GMT -4. The time now is 10:52.