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

Creating a UDF for fluid inlet velocity

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

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Display Modes
Old   February 8, 2017, 09:05
Default Creating a UDF for fluid inlet velocity
  #1
New Member
 
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 2
ameetks99 is on a distinguished road
Sponsored Links
Hi,
I am new in ansys, I don't know how to write a UDF.
Please can someone help me to write a UDF for fluid inlet velocity in recipricating pump which is rotating at 1450 rpm and total displacement of piston is 20 mm.
Diameter of piston is 14 mm.
ameetks99 is offline   Reply With Quote
Sponsored Links

Old   February 8, 2017, 09:34
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,074
Rep Power: 14
pakk will become famous soon enough
If you don't know how to start a udf, I would start by looking in the manual. Try if you can find a udf that does something similar, and think if you can figure out what should be changed. Change that in the code, as good as you guess/understand how that should be done.

Your first attempt will probably not work. Then post it here, so we can see how you are thinking, and can really assist you to learn how to make UDFs.
ameetks99 likes this.
pakk is offline   Reply With Quote

Old   February 9, 2017, 00:10
Default
  #3
New Member
 
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 2
ameetks99 is on a distinguished road
thank you for reply
But udf for sinusoidal velocity is not there in manual, if you have a udf for sinusoidal velocity please send it to me.
ameetks99 is offline   Reply With Quote

Old   February 9, 2017, 00:25
Default
  #4
New Member
 
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 2
ameetks99 is on a distinguished road
#include "udf.h"
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =2.61*sin(152*t);
}
end_f_loop(f, thread)
}
I tried this udf but inlet velocity is showing ZERO,
ameetks99 is offline   Reply With Quote

Old   February 9, 2017, 03:59
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,074
Rep Power: 14
pakk will become famous soon enough
And do you get any warnings when you compile or run?

I don't remember now if the sine function works by default, otherwise you have to add
Code:
#include <math.h>
to your code. But then you should have seen a warning like "undefined reference to sin"...
pakk is offline   Reply With Quote

Old   February 9, 2017, 06:36
Default
  #6
New Member
 
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 2
ameetks99 is on a distinguished road
cpp -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/multiport/src" -I. -DUDF
ONFIG_H="<udfconfig.h>" "C:\Users\Ameet Kumar Singh\Desktop\piston pump h\udf.h.c"
C:\\Users\\Ameet Kumar Singh\\Desktop\\piston pump h\\udf.h.c:2: math.h: No such file or directory
This message is showing when I added #include "math.h" and I interpret it
ameetks99 is offline   Reply With Quote

Old   February 9, 2017, 07:02
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,074
Rep Power: 14
pakk will become famous soon enough
Go back to your original UDF, but now in a foldername that has no spaces.

Quote:
C:\Users\Ameet Kumar Singh\Desktop\piston pump h\
There are four spaces in the name of this folder, and Fluent is known to have problems with that.
pakk is offline   Reply With Quote

Old   February 9, 2017, 07:16
Default
  #8
New Member
 
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 2
ameetks99 is on a distinguished road
cpp -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v150\fluent\fluent15.0.0/multiport/src" -I. -DUDF
ONFIG_H="<udfconfig.h>" "D:\\udf.c"
D:\\\\udf.c:2: math.h: No such file or directory
the problem remain same when I copy the udf file to a drive
ameetks99 is offline   Reply With Quote

Old   February 9, 2017, 07:19
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,074
Rep Power: 14
pakk will become famous soon enough
That is impossible, because your original UDF did not have any reference to math.h in it.
pakk is offline   Reply With Quote

Old   February 9, 2017, 07:21
Default
  #10
New Member
 
AMEET KUMAR
Join Date: Feb 2017
Posts: 14
Rep Power: 2
ameetks99 is on a distinguished road
If you can write the udf for inlet velocity of reciprocating pump which is rotating at 1450 rpm and movement of the piston is 20 mm It will be helpful for me
ameetks99 is offline   Reply With Quote

Old   February 9, 2017, 07:29
Default
  #11
Senior Member
 
Join Date: Nov 2013
Posts: 1,074
Rep Power: 14
pakk will become famous soon enough
Try this:
Code:
#include "udf.h"
DEFINE_PROFILE(unsteady_velocity, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =2.61*sin(152*t);
}
end_f_loop(f, thread)
}
If you could read answers that people gave you, it would be helpful for yourself.
pakk is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to put udf inlet velocity and udf outlet pressure in fluent raminostadi Fluent UDF and Scheme Programming 4 July 3, 2017 06:43
UDF for Inlet velocity Mijin Kim FLUENT 0 September 28, 2009 04:50
Urgent! Help on UDF to set inlet velocity Ray Hong FLUENT 4 December 30, 2005 13:32
UDF problem : inlet velocity in cyl. coord. system Jongdae Kim FLUENT 0 June 15, 2004 11:21
UDF paraboloid velocity inlet Ronak Shah FLUENT 0 June 4, 2003 09:44

Sponsored Links


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