CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF macros

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 18, 2019, 10:33
Default UDF macros
  #1
Member
 
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8
zahrae is on a distinguished road
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 !!
zahrae is offline   Reply With Quote

Old   March 18, 2019, 22:00
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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)
convert to cylindrical coordinates to get radial values

best regards
AlexanderZ is offline   Reply With Quote

Old   March 19, 2019, 06:55
Default
  #3
Member
 
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8
zahrae is on a distinguished road
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 !
Attached Images
File Type: png geometry.PNG (20.3 KB, 11 views)
zahrae is offline   Reply With Quote

Old   March 19, 2019, 22:17
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
du/dr=C_U_G(c,t)[0]

ur=C_U(c,t)[0]
are wrong, read description of these macros,
cylindrical coordinates is your homework

best regards
zahrae likes this.
AlexanderZ is offline   Reply With Quote

Old   April 2, 2019, 09:45
Default
  #5
Member
 
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8
zahrae is on a distinguished road
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.
zahrae is offline   Reply With Quote

Old   April 2, 2019, 22:00
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
google -> "cartesian coordinates to cylindrical coordinates"

first link: http://www.math.tamu.edu/~glahodny/M...ion%2013.9.pdf

best regards
AlexanderZ is offline   Reply With Quote

Old   April 4, 2019, 19:29
Default
  #7
Member
 
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8
zahrae is on a distinguished road
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);
}
zahrae is offline   Reply With Quote

Old   April 9, 2019, 07:30
Default
  #8
Member
 
imane
Join Date: Aug 2018
Posts: 62
Rep Power: 8
zahrae is on a distinguished road
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!
zahrae is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 18:44.