|
[Sponsors] |
UDF : velocity, k and epsilon (radial profile) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 19, 2013, 06:03 |
UDF : velocity, k and epsilon (radial profile)
|
#1 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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 ! |
|
July 19, 2013, 06:35 |
|
#3 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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 |
|
July 19, 2013, 07:11 |
|
#4 |
Senior Member
|
For simplicity, I assume that the velocity profile is piece-wise constant.
Code:
#include "udf.h" DEFINE_PROFILE(inlet_axial_velocity, thread, position) { real orig[ND_ND] = {1.0, 2.0, 3.0}; real x[ND_ND]; face_t f; real r; real v; begin_f_loop(f,thread) { F_CENTROID(x, f, thread); NV_VV(x,=,x,-,orig); r = NV_MAG(x); if ( r < 0.02) { v = 25.0; } else if ( r < 0.03) { v = 10.0; } else if ( r < 0.2) { v = 0.5; } else { v = 0.0; } F_PROFILE(f, thread, position) = v; } end_f_loop(f, thread) } |
|
July 19, 2013, 09:23 |
|
#5 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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 |
|
July 19, 2013, 11:10 |
|
#6 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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 ! |
|
July 19, 2013, 11:22 |
|
#8 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
Ok, thank you! I didn't see the fault.
|
|
July 19, 2013, 11:27 |
|
#9 |
Senior Member
|
I took r as the distance between x and the origin in my #4 post, i.e., r=|X-O|. But in fact r should be the length of projection of the vector <X-O> onto the (r, theta) plane, that's why x[2] vanishes in #7.
|
|
July 19, 2013, 11:33 |
|
#10 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
Yes yes, I understood. I meant that I hadn't seen the fault before you say it.
|
|
July 19, 2013, 12:21 |
|
#11 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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) ?
|
|
July 19, 2013, 22:02 |
|
#12 |
Senior Member
|
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) { real vel; real r0[] = {0.0, 0.02, 0.03, 0.20}; real v0[] = {25.0, 20.0, 10.0, 0.00}; // interpolation the value of vel at r return vel; } |
|
July 20, 2013, 12:15 |
|
#13 |
Member
sooraj
Join Date: Dec 2012
Posts: 38
Rep Power: 13 |
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 |
|
July 22, 2013, 06:37 |
|
#14 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
@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]))*(r-r0[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. |
|
July 22, 2013, 21:55 |
|
#15 |
Senior Member
|
A linear interpolation could be implemented as follows:
Code:
#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 i=0; if ( r >= r0[3] ) return 0.0; while( r >= r0[++i]) ; return v0[i-1]+(v0[i] - v0[i-1])/(r0[i] - r0[i-1]); } 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; 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) } |
|
July 23, 2013, 05:10 |
|
#16 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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[i-1]+((v0[i] - v0[i-1])/(r0[i] - r0[i-1]))*(r-r0[i-1]); 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 x-coordinate exceeds of 1 mm, how Fluent work? ) Can you help me ? Thank you again for your help ! |
|
July 23, 2013, 05:16 |
|
#17 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
(I forgot to say that I want to insert the heat source in the solid)
|
|
July 23, 2013, 05:43 |
|
#19 |
New Member
Join Date: Jul 2013
Posts: 21
Rep Power: 13 |
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 ! |
|
July 23, 2013, 06:03 |
|
#20 |
Member
sooraj
Join Date: Dec 2012
Posts: 38
Rep Power: 13 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for inlet velocity profile | Bollonga | Fluent UDF and Scheme Programming | 4 | June 29, 2021 05:40 |
SimpleFoam k and epsilon bounded | nedved | OpenFOAM Running, Solving & CFD | 16 | March 4, 2017 09:30 |
UDF to define velocity, k, epsilon profiles at velocity-inlet | aerospain | FLUENT | 0 | July 8, 2011 08:14 |
SimpleFoam k and epsilon bounded | nedved | OpenFOAM Running, Solving & CFD | 1 | November 25, 2008 21:21 |
UDF velocity profile problem | Steve | FLUENT | 0 | January 18, 2005 13:11 |