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

(ask) how to create UDF for inlet velocity profile

Register Blogs Community New Posts Updated Threads Search

Like Tree21Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2013, 06:04
Default salam
  #41
New Member
 
tehran
Join Date: May 2013
Posts: 4
Rep Power: 13
armanrazy is on a distinguished road
hi amir .can i ask u about sth about b.c with udf
armanrazy is offline   Reply With Quote

Old   August 14, 2013, 13:05
Default Defining TOP HAT VELOCITY profile
  #42
New Member
 
Yunusrulz
Join Date: Apr 2012
Posts: 10
Rep Power: 14
yunusrulz is on a distinguished road
I want to define a top hat velocity profile at my inlet. I dont know the code to define top hat velocity profile. does any body know it. Please answer.
yunusrulz is offline   Reply With Quote

Old   January 14, 2014, 05:58
Red face Velocity inlet UDF in fluent
  #43
New Member
 
Akshay Khadse
Join Date: Sep 2013
Posts: 11
Rep Power: 13
Ammofreak is on a distinguished road
hi guys,

I want to use a user defined function for velocity inlet for following conditions:

v_x = (2/3)*z for z = 0 to 30
v_x = 20 for z = 30 to 70
v_x = (200/3)-(2/3)*z for z = 70 to 100

It is for 3D compressor cascade inlet. I do not know how to write such functions.
Can anyone help me?
Ammofreak is offline   Reply With Quote

Old   July 9, 2014, 14:01
Default
  #44
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Hello,

I have a 2D axisymmetric geometry where I want to impose a non uniform velocity field in the fluid region (not a boundary, but the internal field). I have the coordinates and the axial and radial velocity components from a previous simulation.

How do I go about importing this into the current case. Also is there a better way to store the velocity value other than File -> Export?

Thanks in advance
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   January 12, 2016, 11:03
Thumbs up Periodic BC DDPM, UDF
  #45
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Dear Friend,
I am using, DDPM simulation using ANSYS 14.5, for a simple system. I used inlet as periodic and outlet as shadow in ANSYS for making it periodic but after making periodic I have no control on the inlet (I am unable to specify mass flow rate inlet), it is showing option to specify pressure gradient.
Thanks for helping in advance!!!
roopesh99 is offline   Reply With Quote

Old   April 25, 2016, 19:41
Default UDF for inlet y velocity 2D
  #46
New Member
 
Keyu Dhingani
Join Date: Dec 2015
Location: San Diego, CA
Posts: 3
Rep Power: 10
Keyu is on a distinguished road
Hi,

I have seen and used UDFs for the inlet x velocity, but what do I do to make a UDF for inlet y velocity.

Here is the UDF that I used for inlet x velocity.
[
#include "udf.h"
#define umean 10.0
#define R 0.0005
DEFINE_PROFILE(inlet-x-velocity,t,i)
{
real x[ND_ND];
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = (3./2.)*umean*(1-pow((y-R)/R,2));
}
end_f_loop(f,t)
}
]

I tried replacing x with y and vice versa to hopefully get the y-direction velocity, but unsuccessful.

Any suggestions here will be useful.

Thanks,
Keyu
Keyu is offline   Reply With Quote

Old   April 26, 2016, 05:58
Default
  #47
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by Keyu View Post
Hi,

I have seen and used UDFs for the inlet x velocity, but what do I do to make a UDF for inlet y velocity.

Here is the UDF that I used for inlet x velocity.
[
#include "udf.h"
#define umean 10.0
#define R 0.0005
DEFINE_PROFILE(inlet-x-velocity,t,i)
{
real x[ND_ND];
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = (3./2.)*umean*(1-pow((y-R)/R,2));
}
end_f_loop(f,t)
}
]

I tried replacing x with y and vice versa to hopefully get the y-direction velocity, but unsuccessful.

Any suggestions here will be useful.

Thanks,
Keyu
This line varies the position along the X, Y, Z axis (0,1,2 respectively).

y = x[1];

If you want a velocity profile normal to the Y direction, you need to use the variation of the position in the X direction if 2D and X and/or Z direction if 3D.
Bruno Machado is offline   Reply With Quote

Old   April 27, 2016, 12:09
Default
  #48
Member
 
Rupesh Verma
Join Date: Jun 2013
Posts: 64
Rep Power: 13
roopesh99 is on a distinguished road
Dear
u r right..
roopesh99 is offline   Reply With Quote

Old   October 24, 2016, 05:51
Question UDF for inlet temperature
  #49
New Member
 
mm
Join Date: May 2016
Posts: 24
Rep Power: 9
mmunige is an unknown quantity at this point
Dear all

I have following UDF for inlet temperature, untill 1300s it takes correct values according to equation, but after 1300s values are higher and not accorrding to equation, like at 1301s it should have value of 405C but in simulation inlet temperature is 621C. I could not find the error in my UDF after lot of try. please check this and guide me
#include"udf.h"

DEFINE_PROFILE(inlet_temperature,thread,position )

{

face_t f;

begin_f_loop(f,thread)

{

real t = RP_Get_Real("flow-time");

if (t <=1300.0 )

{

F_PROFILE(f,thread,position) = 379.13 + 0.0005*t;

}

else if (1300.0 < t && t <= 1500.0 )

{

F_PROFILE(f,thread,position)= -1.04289036878969*pow(10,-10)*pow(t,6.0)+ 8.86126436853789*pow(10,-7)*pow(t,5.0)-3.13621260398811*pow(10,-3)*pow(t,4.0)+5.91804640375908*pow(t,3.0)-6.27969461279651*pow(10,3)*pow(t,2.0)+ 3.55273415252714*pow(10,6)*t - 8.37223405676245*pow(10,8);
}
else
{

F_PROFILE(f,thread,position) = -9.51538261322402*pow(10,-23)*pow(t,6) + 8.26192751387975*pow(10,-18)*pow(t,5)-2.85237398505875*pow(10,-13)*pow(t,4)+4.97518353700886*pow(10,-9)*pow(t,3)-4.58733775886876*pow(10,-5)*pow(t,2)+ 2.10251137071757*pow(10,-1)*t +3.57252192344954*pow(10,2);

}

}

end_f_loop(f,thread)

}
mmunige is offline   Reply With Quote

Old   October 24, 2016, 11:36
Default
  #50
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Code:
else if (1300.0 < t && t <= 1500.0 )
should be

Code:
else if ((1300.0 < t) && (t <= 1500.0 ))
pakk is offline   Reply With Quote

Old   January 25, 2017, 03:16
Default Sinus velocity
  #51
New Member
 
milad
Join Date: Jan 2017
Posts: 4
Rep Power: 9
miladspa is on a distinguished road
Hello
I have a question
How write( V=Asinwt) in fluent(udf)
Please help me
Thank you
miladspa is offline   Reply With Quote

Old   January 25, 2017, 03:47
Default
  #52
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
If you use this UDF:

Code:
Message("V=Asinwt");
The text you requested will be written in Fluent.

This is almost surely not what you want, but I can not guess what you really want. You should explain better what you want the UDF to do.

Edit: let me be a little bit more helpful, after drinking coffee.

If A, w and t are defined variables, and you want to put the result in V, the way to put that in a UDF is:
Code:
 V = A*sin(w*t);
But there is a lot that you have to put around this code (to define A, w, and t, and tell the computer what to do with V), and that depends on what you want to do with it.
KevinZ09 likes this.
pakk is offline   Reply With Quote

Old   January 25, 2017, 23:39
Default Sinus velocity
  #53
New Member
 
milad
Join Date: Jan 2017
Posts: 4
Rep Power: 9
miladspa is on a distinguished road
Thank you for the answers you have given me. I want to examine the impact of heat transfer in an oscillating jet, for sinusoidal input speed jet was
u = Asinwt
The A (Initial velocity), w (period), t (time)
But I do not know how to code the program is written udf
miladspa is offline   Reply With Quote

Old   January 26, 2017, 03:56
Default
  #54
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Look for a UDF that does something similar, and change it.
There are UDFs mentioned in the messages above that do something similar... Read them!
pakk is offline   Reply With Quote

Old   January 28, 2017, 13:11
Default how to use data from .csv file as inlet boundry condition
  #55
New Member
 
hemant mittal
Join Date: Feb 2016
Posts: 21
Rep Power: 10
hemmt is on a distinguished road
hello every one
i have data file generated from matlab program which contains fluctuating velocity for atmospheric boundary layer
so please guide me how can i use this file as inlet boundary condition



thanks and regards
SimonaM likes this.
hemmt is offline   Reply With Quote

Old   January 30, 2017, 05:08
Default radial_velocity
  #56
New Member
 
SAIF MASOOD
Join Date: Sep 2016
Posts: 2
Rep Power: 0
saifmasood is on a distinguished road
Quote:
Originally Posted by Amir View Post
Dear Naimah,

It depends, e.g. if you want to have pressure or velocity in a specified point, you can use "solve->monitor->surface ...."; if you didn't activate it before iteration, you have to write a simple journal file for this purpose.
For extracting data of cross-sections; firstly you need to generate these cross-sections in "surface->quadratic or plane" then you can export desired data to other post processors in "file->export". But if you want to export these data for successive time steps; you have to choices: 1) there is such capability in ver. 13 in "file-> export" I think. 2) you can write a journal file to do what you want during iteration.

Bests,
Hi... Amir ...I had carried a simulation on shuttlecock. but my contours for radial velocity and tangential velocity are odd. I had attached the files can u help me with this.
fluentp1-1-02000.jpg

t.jpg
saifmasood is offline   Reply With Quote

Old   February 11, 2017, 10:54
Default Error message : output pipe has been closed
  #57
New Member
 
Thomas henderson
Join Date: Feb 2017
Posts: 3
Rep Power: 9
Thomas_henderson is on a distinguished road
Hi there,

I have tried to implement this UDF in ansys fluent however it is resulting in an error stating :

" output pipe has been closed "

Any ideas why this might be?
Thomas_henderson is offline   Reply With Quote

Old   February 13, 2017, 05:29
Default
  #58
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Which one is "this UDF"?
pakk is offline   Reply With Quote

Old   February 13, 2017, 05:50
Default Udf
  #59
New Member
 
Thomas henderson
Join Date: Feb 2017
Posts: 3
Rep Power: 9
Thomas_henderson is on a distinguished road
Quote:
Originally Posted by pakk View Post
Which one is "this UDF"?
#include "udf.h"

DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real vel;

vel= 0.2+0.1*sin(t);

begin_f_loop(f, thread)

{
F_PROFILE(f, thread, position) = vel;
} end_f_loop(f, thread)

}
Thomas_henderson is offline   Reply With Quote

Old   February 14, 2017, 12:45
Default Syntax error
  #60
New Member
 
Thomas henderson
Join Date: Feb 2017
Posts: 3
Rep Power: 9
Thomas_henderson is on a distinguished road
There is a syntax error in the line :

DEFINE_PROFILE(unsteady_velocity, thread, position)

However this is similar to other examples I have seen. Any ideas why this may be?
Thomas_henderson 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
UDF problems - velocity profile Oli Fluent UDF and Scheme Programming 6 October 24, 2016 11:38
How to create non-uniform velocity profile in FLUENT? pankaj FLUENT 7 October 24, 2016 05:52
udf for velocity profile in a geometry having two inlets shubham208011 Fluent UDF and Scheme Programming 0 April 6, 2009 16:13
UDF velocity and temperature Raj FLUENT 3 February 1, 2009 19:29
UDF velocity profile at nodes Emad FLUENT 2 January 29, 2009 07:35


All times are GMT -4. The time now is 21:40.