CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT

Set local radial axis for radial velocity with UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2020, 13:06
Default Set local radial axis for radial velocity with UDF
New Member
Vincenzo Luci
Join Date: Jan 2019
Posts: 9
Rep Power: 7
vincenzolights is on a distinguished road
Hello to every one,
I really appreciate it if anyone could help me. I am facing the problem to create a UDF for a radial velocity in several boundary conditions. I have almost 2000 nozzles under the same boundary condition and I need to set the radial velocity to be relative to the center of each nozzle. The results, attached below (in the figures there are only 4 nozzles but in the real model are almost 2000 nozzles), suggest to me that the rotational axis is always centered on the absolute center axes. I confirmed this theory using a scalar profile with the same UDF. For radial velocity, I think I need to change the local axis or translate in some way the velocity founded but I don't know how to do it. If I set (in this case) 4 velocity inlet with a local cylindrical axis centered in each circle the results will be good, but I cannot in the whole model. Summing up, I need either to set the local axis in the UDF or to find how to translate the radial velocity founded in this way to the center of each circle. Here below, there is the UDF used, someone could help me?

#include "udf.h"
#define Mdot 1 /* flow rate from each nozzle [kg/s]*/
#define theta_max 60 /* angolo di apertura massimo*/
#define R_max 0.05 /* Nozzle radius [m]*/
real coor[ND_ND],Ai[ND_ND];
real x,y,z,x1,y1,z1;
real nfaces = 0,Atot = 0.;
real nn = 0;
real dens, area, vci;
real rr, theta, theta_rad;

real xsum = 0., ysum = 0., zsum = 0.;
real xcen = 0., ycen = 0., zcen1 = 0.;
face_t f;

/*Count number of faces*/
nn += 1;
nfaces += 1;
F_AREA(Ai, f, t);
Atot = area + Atot;

/*Find center of the circle*/
begin_f_loop(f, t)

x = coor[0];
y = coor[1];
z = coor[2];
xsum = xsum + x;
ysum = ysum + y;
zsum = zsum + z;
end_f_loop(f, t);

xcen = xsum/nfaces;
ycen = ysum/nfaces;
zcen1 = zsum/nfaces;

begin_f_loop(f, t)

x1 = coor[0];
y1 = coor[1];
z1 = coor[2];
rr = pow( ( pow((x1-xcen),2.)+pow((y1-ycen),2.)+pow((z1-zcen1),2.) ),0.5);
theta = rr * theta_max/ R_max;
theta_rad = theta *M_PI/180.;

vci = Mdot/(dens*Atot);

F_PROFILE(f,t,i) = vci* sin(theta_rad);
end_f_loop(f, t);
Attached Images
File Type: jpg Velocity_dir.jpg (59.0 KB, 10 views)
File Type: jpg Radial velocity_needtobe.jpg (37.9 KB, 11 views)
vincenzolights is offline   Reply With Quote

Old   April 8, 2022, 04:13
New Member
pitroda jimesh
Join Date: Nov 2021
Posts: 2
Rep Power: 0 is on a distinguished road
did you solve this? it would be good that you share how you solve the problem. is offline   Reply With Quote


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 6, 2023 00:48
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 686 December 22, 2022 10:10
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58
How to set angular velocity in wall and axis of rotation? sachinlb OpenFOAM Running, Solving & CFD 0 January 19, 2012 10:02
Variables Definition in CFX Solver 5.6 R P CFX 2 October 26, 2004 03:13

All times are GMT -4. The time now is 23:06.