UDF : velocity, k and epsilon (radial profile)
Hello,
I am an user of FINE/Open. I would like to make a comparison with Fluent. Therefore, I need a little help in Fluent: I have a radial profile (in inlet) for speed, k and epsilon. And I'd like to define an UDF. Is it possible to give a profile of a distance and say that the problem is cylindrical in an UDF? (To simplify the problem). To complicate matters, my inlet surface is divided into two inlet in Fluent (I imported the Hexpress mesh to Gambit and I could not merge the surfaces). Thanks a lot ! 
You can use the
Code:
DEFINE_PROFILE 
Can you give me a little example?
For example, if I have a velocity profile: for r = 0, v = 25 m / s r= 0.02m = r v = 10 m / s r = 0.03 m, v = 0.5 m / s r = 0.2 m, v = 0 m/s 
For simplicity, I assume that the velocity profile is piecewise constant.
Code:
#include "udf.h" 
Ok, thank you very much ! I must just read a little about commands that you used in the code.
I may come back with some questions in a few days ;) 
I have a small question about the line
real orig [ND_ND] = ... if the inlet face has a distance on 0.06m (on the z axis) above the origin. I can replace our line by : static const real origin [3]= {0.0; 0.0; 0.06} it's correct? Thank you again for the help ! 
Yes, and
r = NV_MAG(x); should be replaced by r = sqrt(x[0]*x[0]+x[1]*x[1]); I made a mistake in my previous post. 
Ok, thank you! I didn't see the fault.

I took r as the distance between x and the origin in my #4 post, i.e., r=XO. But in fact r should be the length of projection of the vector <XO> onto the (r, theta) plane, that's why x[2] vanishes in #7.

Yes yes, I understood. I meant that I hadn't seen the fault before you say it.

And just a last thing : you have simplify the case, but if we want to interpolate the velocity, we must use a loop or there is another possibility (a function) ?

Yes, you simply change
F_PROFILE(f, thread, position) = v;to F_PROFILE(f, thread, position) = some_func(r);where Code:
real some_func(real r) { 
hi guys
i need a udf for a work. i'll explain what i need . I want to provide a linear varying temperature boundary condition on the circular side of a cylinder . can you help me?? My idea about udf is very small. diameter of cylinder is 41.3 mm . temperature may vary from 25 to 50 degrees 
@blackmask : Thank you ! can you tell me if the code is correct?
#include "udf.h" real some_func(real r) { real vel; real r0[] = {0.0, 0.02, 0.03, 0.20}; real v0[] = {25.0, 20.0, 10.0, 0.00}; int j=0; int i=0; while(i<=ND_ND) { if(r==0) { vel[i]=v0[0]; } if(r<0.2) { while (r<r0[j]) { j++; } vel[i]=((v0[j+1]v0[j])/(r0[j+1]r0[j]))*(rr0[j])+v0[j]; } else { vel[i]=0; } i++; } return vel; } DEFINE_PROFILE(inlet_axial_velocity, thread, position) { static const real orig[3]={0.0, 0.0, 0.06}; real x[ND_ND]; face_t f; real r; real v; int i=0; begin_f_loop(f,thread) { F_CENTROID(x, f, thread); NV_VV(x,=,x,,orig); r = sqrt(x[0]*x[0]+x[1]*x[1]); F_PROFILE(f, thread, position) = some_func(r); } end_f_loop(f, thread) } @ str6063 : I started too. So, I do not know how to help you. 
A linear interpolation could be implemented as follows:
Code:
#include "udf.h" 
Thank you again !
Juste to be sure, I think that there is two mistake : 1) the 4 int the two vector : real r0[4]={...}; 2) the second return : I think, it must be : return return v0[i1]+((v0[i]  v0[i1])/(r0[i]  r0[i1]))*(rr0[i1]); and for k and epsilon, I suppose that is exactly the same ? And now, I have an other question : In my domain, I have a fluid part and a solid part. In the solid, I'd like inserting a localized heat source in terms of x, y and z. Is this possible? (and in the definition of the coordinates, it slightly exceeds? eg, due to an imprecise geometry, my xcoordinate exceeds of 1 mm, how Fluent work? ) Can you help me ? Thank you again for your help ! 
(I forgot to say that I want to insert the heat source in the solid)

#16
1) c array is zerobased so that the last index in the array is length of array minus one 2) you are right, I forget the (r  r0[i1]) term You can use Code:
FLUID_THREAD_P 
You can help me to construct the udf ? if I have this coordonates for the heat source :
 x : x=0 to 0.001  y : y=0 to 0.0015  z : z=0.001 to 0.00012 vol=0.001*0.0015*0.0002; HT=10/vol; thanks a lot ! 
hi
i need a udf for a work. i'll explain what i need . I want to provide a linear varying temperature boundary condition on the circular side of a cylinder . can you help me?? My idea about udf is very small. diameter of cylinder is 470mm. temperature may vary from 25 to 50 degrees from botom to top 
All times are GMT 4. The time now is 12:46. 