CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Create a Cosine shapped wall heat flux in 3d geometry (http://www.cfd-online.com/Forums/fluent-udf/99437-create-cosine-shapped-wall-heat-flux-3d-geometry.html)

scottimus April 3, 2012 12:30

Create a Cosine shapped wall heat flux in 3d geometry
 
Hello,

I have been tasked to model flow around heated rods in fluent. The heat flux profile for the rod is a cosine shape of the form

qflux (W/m^2) =A*cos(B*y);

where A and B are constants and y is the height position from 0 to some arbitrary height h.

My model is 3 dimensional but the wall upon which I want to put this condition is cylindrical in shape with constant radius, r.

I have been reading through the UDF manual and need some help. This is what I have so far:

/************************************************** ***
UDF for specifying the heat flux from a cosine shapped
heatflux boundary profile in three dimensions
************************************************** ***/

#include "udf.h"

DEFINE_PROFILE(cos_profile,t,i)
{
face_t f;
begin_f_loop(f,thread)
F_PROFILE(f,thread,i) = A*cos(B*y);
end_f_loop(f,thread)
}

Where once again A and B are just place holders for constant values and y represents the cosine profile which changes axially but is constant radially around the rod.

My question is what modifications/additions do I need to do to have this profile be implemented correctly for Fluent?

I appreciate your pointers and forgive me if this has been covered at some point and I did not locate it.

scottimus April 4, 2012 17:42

After much time of sadness and despair in my first escapades into the seemingly uncharted (to the beginner) but frequently traveled world of UDF's I regrouped and I think I fixed the little bugs and now have a working solution.

The solution below seems to work so have fun using this or adapting it to your purposes. Hopefully this will help someone out. If anyone, including myself, happens to find error in the future feel free to correct.

/************************************************** ***
UDF for specifying the heat flux from a cosine shapped
heatflux boundary profile in three dimensions
************************************************** ***/

#include "udf.h"

DEFINE_PROFILE(cos_profile, thread, position)
{
real x[ND_ND];
real y;
face_t f;

begin_f_loop(f, thread)
{
y = x[1];
F_CENTROID(x, f, thread);
F_PROFILE(f,thread,position) = A*cos(B*y);
}
end_f_loop(f, thread)
}

Take care yall!
Scott


All times are GMT -4. The time now is 04:58.