|
[Sponsors] |
March 18, 2019, 10:33 |
UDF macros
|
#1 |
Member
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8 |
In my case study, I have to creat some udfs wich uses the radial velocity of the fluid and the radial gradient of velocity. I don’t know how to set these two parameters using fluent macros !
Please help !! |
|
March 18, 2019, 22:00 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
all depends on your case.
macros for velocities and gradients of velocities: Code:
C_U(c,t) C_V(c,t) C_W(c,t) G_C_U(c,t) G_C_V(c,t) G_C_W(c,t) best regards |
|
March 19, 2019, 06:55 |
|
#3 |
Member
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8 |
Thanks you for your reply!
I am modeling deposition of particles by DPM in a surface of a tube and I have to code the forces responsible for this deposition, drag force depends on the radial velocity and the lift force depends on the radial gradient of velocity. My geometry is a 3d tube inside of it the fluid flows in the Z direction. I have created those macros for radial gradient and radial velocity: du/dr=C_U_G(c,t)[0] ur=C_U(c,t)[0] 0 means the x direction (I suppose the x direction is the radial direction) but I am not sure. should I use the cylindrical coordinates and how ?Can you please if possible give me some guidelines ! |
|
March 19, 2019, 22:17 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
du/dr=C_U_G(c,t)[0] ur=C_U(c,t)[0] cylindrical coordinates is your homework best regards |
|
April 2, 2019, 09:45 |
|
#5 |
Member
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8 |
helloo!
Now I know how to express the velocities in cylindrical coordinates the difficulty lies in expressing their gradient. The macro used for expressing the gradient in fluent is: C_U_G (c,t) [i] i=0, 1,2 for x, y, z positions respectively. But for the cylindrical coordinates I don’t know how to express radial, tangential and axial positions. please help I m stuck with this problem, I have to resolve this problem very queckly!! Last edited by zahrae; April 2, 2019 at 12:24. |
|
April 2, 2019, 22:00 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
google -> "cartesian coordinates to cylindrical coordinates"
first link: http://www.math.tamu.edu/~glahodny/M...ion%2013.9.pdf best regards |
|
April 4, 2019, 19:29 |
|
#7 |
Member
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8 |
Thanks for your response!
But this isn't what I am searching for, By the program shown below I can found the radial,tangential and axial velocities and also the unit vectors in cylindrical coordiantes. Now I should code the gradient of the radial velocity. the gradient of a function f in cylindrical coordiantes is writing as: ∆f=∂f/∂r e_r+1/r + ∂f/∂θ e_θ+∂f/∂z e_z so the difficulty is how to write macros of these terms, specialy for the derivation in the radial and tangential directions (∂f/∂r e_r+1/r + ∂f/∂θ e_θ). I don't know how to deal with this. Any guidelines please! real NV_VEC(origin), NV_VEC(axis); real NV_VEC(V), NV_VEC(r), NV_VEC(R), NV_VEC(B); real NV_VEC(er), NV_VEC(et); real xc[ND_ND]; real Bmag, rmag, source; real ua, ur, ut; /* Get origin vector of fluid region */ NV_V (origin, =, THREAD_VAR(thread).cell.origin); /* Get axis of fluid region */ NV_V (axis, =, THREAD_VAR(thread).cell.axis); /* Store the 3 cartesian velocity components in vector V */ N3V_D(V, =, C_U(cell,thread),C_V(cell,thread),C_W(cell,thread) ); /* Get current cell coordinate */ C_CENTROID(xc,cell,thread); /* Calculate (R) = (Xc)-(Origin) */ NV_VV(R, =, xc, -, origin); /* Calculate |B| = (R) dot (axis)*/ Bmag = NV_DOT(R,axis); /* Calculate (B) = |B|*axis */ NV_VS(B,=,axis,*,Bmag); /* Calculate (r) = (R)-(B) This is the local radial vector*/ NV_VV(r, =, R, -, B); /* Calculate |r|*/ rmag = NV_MAG(r); if (rmag != 0.) { NV_VS (er,=,r,/,rmag); NV_CROSS(et, axis, er); ur = NV_DOT(V,er); ut = NV_DOT(V,et); ua = NV_DOT(V,axis); } else { ur = 0.0; ut = 0.0; ua = NV_DOT(V,axis); } |
|
April 9, 2019, 07:30 |
|
#8 |
Member
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8 |
No one has the answer of my question!!
I really need help. I read all the manuel of the UDF's but I didn't find anything, any guidelines please !! Thank you for your kind cooperation! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
Grid Macros for UDF | elena | FLUENT | 0 | May 9, 2006 09:44 |
UDF Macros | tom | FLUENT | 1 | April 26, 2006 06:40 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |