CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   UDF get the variables of specified B.C (http://www.cfd-online.com/Forums/fluent/32978-udf-get-variables-specified-b-c.html)

David February 6, 2004 09:16

UDF get the variables of specified B.C
 
Hi, I want to know how to use UDF macro to get the values of coordinates and variables of the mesh nodes in the specified B.C.? for example,I want to get all the mesh nodes' coordinats & Static Pressure of some boundary faces,How to get and export them?thanks.

Andrew Garrard February 6, 2004 14:31

Re: UDF get the variables of specified B.C
 
This is actually pretty simple. There should be alot of helpful information in the Fluent 6 UDF manual. What is it that you want to do with these variables, print them to screen? If so you probably want something like this: DEFINE_PROFILE(coord_press, t, i)

{

fact_t f;

begin_f_loop(f, t)

{

real x[ND_ND];

F_CENTROID(x, f, t);

printf("\nface=%d, x-coord=%g, y-coord=%g, press=%g", f, x[0], x[1], C_P(f,t));

}

I haven't compiled or tested it, I did it on the fly, so there are probably a couple of mistakes, but you will probably want to customize it yourself depending on what you are trying to do with the UDF

Andrew Garrard February 6, 2004 14:32

Re: UDF get the variables of specified B.C
 
Sorry, you will need an end_f_loop(c,t) in there as well.

David February 6, 2004 22:05

Re: UDF get the variables of specified B.C
 
thank you Andrew.I am not very familiar with the UDF. I need the nodes's coordinates and variables,not the centroid,so whether the macro should be F_P(f,t)? But F_P(f,t) can not return the nodes' coordinates. How to solve this problem? And I want to export the nodes' coordinates & variables to a data file. I have used a UDF to define the B.C. profile,and whether this TWO UDFs should be writted in one file or two seperated files,and if the latter, how to compile them?thank u.

FJ February 8, 2004 23:15

Re: UDF get the variables of specified B.C
 
Hi,

F_P(f, t) shows static pressure of a specified face . Node coordintes are defined as NODE_X() and NODE_Y(), NODE_Z() , but there are just coordinate not any values on nodes in Fluent ,so nobody can get static pressure and temperature etc via UDF. (I think that when you select the Node-Based solver in Fluent , maybe you can get it).

The only thing you can get the node value of pressure ,you have to use a default export function(i.e. File-Export-Profile). This export data becomes node value.

Thank you

-- FJ


All times are GMT -4. The time now is 22:21.