|
[Sponsors] |
Couple CFX with in-house code via user Fortran |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 19, 2020, 12:53 |
Couple CFX with in-house code via user Fortran
|
#1 |
New Member
Hu
Join Date: Jan 2014
Posts: 22
Rep Power: 12 |
Dear all,
Recently, I am trying to couple CFX with my code and what I need is the velocity field. So my question is how to obtain the velocity field, i.e., the cell coordinates and the corresponding velocity. Alternatively, it would be a better way if I can obatin the fluid velocity at any user specified position. I have read the guide book for CFX modeling, but still have no idea. Any one can help? |
|
July 19, 2020, 14:09 |
|
#2 |
Member
Henrique Stel
Join Date: Apr 2009
Location: Curitiba, Brazil
Posts: 93
Rep Power: 17 |
Could you provide us more details? Do you want the velocity field cell by cell during the solution or just the final results? What do you need that cant be done directly in cfd post?
|
|
July 19, 2020, 19:03 |
|
#3 |
New Member
Hu
Join Date: Jan 2014
Posts: 22
Rep Power: 12 |
Hi, Stel. I want the transient velocity field during the solution. My in-house code is used for particle simulation and the fluid velocity field is needed to calculate the momentum and energy source terms for both fluid and solid phases.
|
|
July 19, 2020, 20:03 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
You will probably need to do this with user fortran.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
July 20, 2020, 08:24 |
|
#5 |
Member
Henrique Stel
Join Date: Apr 2009
Location: Curitiba, Brazil
Posts: 93
Rep Power: 17 |
So far I've only worked with user fortran for particle tracking in Ansys, but I assume it is the same logic for any user fortran routine: when you call an external function for particle tracking via user fortran, new options become available in CFX Pre. One of them is the variable list you have to provide as arguments for the user fortran Routine, such as velocity, pressure, etc. At the beginning of your routine, you define and call those arguments. By default, any calculation you do with those variables within your routine will be performed cell by cell throughout your domain. Then, the output from your routine returns to the calculation both as a global value or a field variable, depending on how you define it.
You will have to read the user fortran documentation and search for some examples there or here in the forum to get used to the syntax, library generation, etc, but I guess this is the way to go. |
|
July 20, 2020, 08:38 |
|
#6 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
I am no expert in CFX User Fortran, but I know there is more to fortran in CFX than that. Somebody please correct me I am wrong, but you have two main approaches (described in the CFX Solver Modelling Guide, Chapter 19):
* User defined CEL * Junction Box routines User defined CEL are similar to normal CEL functions but user fortran to calculate it rather than the CFX interpreter. This is what Stel describes. These are quite simple to use and can be done with only a moderate amount of CFX fortran knowledge. But there are also Junction Box routines. These give lower level at different points in the solution process. This allows much more complex models to be implemented such as interaction with other software, but require a detailed knowledge of CFX fortran and memory structures (MMS) to get to work. It is not for the weak hearted. From what Cs Hu describes I think he will need Junction Box routines for his model. I did a CFX user fortran course run by ANSYS years ago and recall it was quite complex. (Unfortunately I have not used it much since so have forgotten most of it.) If the course still exists it would be a big help for you.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
|
July 20, 2020, 08:55 |
|
#7 | |
Member
Henrique Stel
Join Date: Apr 2009
Location: Curitiba, Brazil
Posts: 93
Rep Power: 17 |
Quote:
Well, Glenn is right, fortran routines for particle tracking for example are kind of straightforward programs you run just to generate a library to be used in CFX to perform other calculations. Well, if putting two codes to work in parallel via user fortran is what he wants then I believe he will indeed need some fancier user fortran programming to do so. To be honest with you I didn't even know this was possible in the first place. |
||
July 20, 2020, 10:40 |
|
#8 | |
New Member
Hu
Join Date: Jan 2014
Posts: 22
Rep Power: 12 |
Quote:
|
||
July 20, 2020, 10:41 |
|
#9 | |
New Member
Hu
Join Date: Jan 2014
Posts: 22
Rep Power: 12 |
Quote:
|
||
July 20, 2020, 13:02 |
|
#10 | |
Senior Member
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33 |
Quote:
Have you selected the location in the algorithm where to gather the information? Do you know the variable name you are trying to gather? Do you know where the variable is located in the memory system?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
July 20, 2020, 19:36 |
|
#11 | |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,870
Rep Power: 144 |
Quote:
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum. |
||
August 20, 2020, 10:16 |
|
#12 | |
New Member
Hu
Join Date: Jan 2014
Posts: 22
Rep Power: 12 |
Quote:
My challenging part now is to quickly find the neighboring vertices for any specified position. For example, there're three points ((0,0,0),(1,1,1),(2,2,2)) and how to find their nearest neighboring vertices (or elements). I tried the subroutine CAL_MESHMAP but it works only when the points overlap with mesh vertices. Do you have any suggestion? |
||
Tags |
coupling, user fortran |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
User Fortran with CFX 14.5.7 on winnt_amd64 | HLo | CFX | 22 | December 13, 2015 09:26 |
Using Fortran with CFX: How to connect Fortran to CFX? | l.te | CFX | 0 | October 21, 2012 12:42 |
CFX User Fortran: Particle User Sources | hustxinxin | CFX | 0 | March 8, 2012 09:37 |
Comparison between C/C++ and Fortran? | rick | Main CFD Forum | 45 | September 6, 2011 01:52 |
CFX11 + Fortran compiler ? | Mohan | CFX | 20 | March 30, 2011 19:56 |