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

UDF pulsating pressure inlet

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 29, 2013, 06:17
Default UDF pulsating pressure inlet
  #1
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
Hi there,

I have a 2d fluent simulation with 3 pressure inlets 1 in x direction and 2 y direction. Now i I am trying to create a pulsating pressure inlet with a pressure of 1,3 bar in the Y direction for transit simulation.

It has to pulsate at a frequency of 50 Hz (thus 50 pulsation per seconde)

I know i need to use a UDF for this but i have looked through the manual but i find it very confusing.

If anyone is willing to help thank you very much
Tarano is offline   Reply With Quote

Old   May 29, 2013, 06:37
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
You are no more confused than I am. What do you want?
blackmask is offline   Reply With Quote

Old   May 29, 2013, 06:52
Default
  #3
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
Thank you for your reply, what i want is an UDF or something that will help me achieve a not constant inlet pressure in the Y direction i want the Y direction inlet pressures to pulsate (or give a burst of pressure 50 times a second). The pressure burst will have a pressure of 1,3 bar or 131.7225 kPa.

What you should image i am simulation is a valve opening en closing 50 times a second and just letting a small bit of air through. (btw this is not what i am trying to simulation but will help me achieve my goals it just to give a picture to what i want)

I looked through the UDF manual and came past a this UDF which i edited, but it doesn't seem to do anything atm at all. Though i might have gone the totally wrong way with this UDF

#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =131.7225*sin(100*t);
}
end_f_loop(f, thread)

It might be usefull to know the Y direction inlets are opposite each other and should both pulsate at 50 times a second but at opposite intervals thus at 0.01 t the one should pulsate an at 0.02 the other one should pulsate. What i am trying to achieve is an airflow that is oscillating
Tarano is offline   Reply With Quote

Old   May 29, 2013, 07:01
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
Note that the angular frequency should be 2*pi*f = 2*3.14159*50 = 314.159.
If the amplitude is 131 with an averaged value of 131k, it would be
Code:
F_PROFILE(f, thread, position) =131.7225*(1000+sin(100*M_PI*t));
blackmask is offline   Reply With Quote

Old   May 29, 2013, 08:55
Default
  #5
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
Thank you,

It did help its starting to do something now. I am still wondering when i plot this same equation in excel and make a graph of it with time steps of 0.01 i i looked like the image below. Thus actually not beeing a normal sin wave but a constantly increasing sin wave? I might be totally wrong about this but this is confusing to me.
Attached Images
File Type: jpg oscillation.jpg (94.5 KB, 57 views)
Tarano is offline   Reply With Quote

Old   May 29, 2013, 09:23
Default
  #6
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
Gee. The period is 0.02s, so 0.01s is half the period. You need minimum 20 points per period so please reduce time step to 0.001s or smaller.
blackmask is offline   Reply With Quote

Old   May 29, 2013, 10:05
Default
  #7
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
OMG, sometime i amaze myself at how obvious my mistakes are, thank you for pointing it out once you said it i realized what i did wrong .
Tarano is offline   Reply With Quote

Old   May 29, 2013, 10:58
Default
  #8
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
I still having problems to pulsate at different intervals. My current UDF is shown below (point out this does not represent the time step i actually want to achieve but i rather first try and get it in a bigger time step then a smaller one because then i can monitor the flow easier i find anyway once it works i will increase the frequency again). I have notice that the first one unsteady_pressure seems to work ( i can't really figure out if its pulsation correctly but it seems to work), but the bottom one doesn't seem to do anything atm it just ignores it and no pressure is put in through that inlet. any idea what is the problem.

Mathematically to have an sin wave oscillate in the opposite direction you would - the amplitude (i don't know if this would work in fluent though) if you know another way of off setting the sin without - the amplitude but delaying the sin wave by 180 degrees this could also work.

#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =7*(1000+sin(2*M_PI*t));
}
end_f_loop(f, thread)
}

DEFINE_PROFILE(unsteady_pressure2, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =-7*(1000+sin(2*M_PI*t));
}
end_f_loop(f, thread)
}
Tarano is offline   Reply With Quote

Old   May 29, 2013, 19:41
Default
  #9
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
The line
Code:
F_PROFILE(f, thread, position) =-7*(1000+sin(2*M_PI*t));
should be changed to
Code:
F_PROFILE(f, thread, position) =7*(1000-sin(2*M_PI*t));
blackmask is offline   Reply With Quote

Old   May 30, 2013, 10:27
Default
  #10
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
Thank you for all your help. But it seems somehow it is still not working. I have now run the simulation multiple times but i have noticed that it actually doesn't pulsate at all and just acts as a constant pressure inlet :S. i have tried first letting the flow develop in steady case and then going over to transit and also straight o transit both had no effect. The code i am using is

#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =(7*(1000+sin(2*(22/7)*t)));
}
end_f_loop(f, thread)
}

DEFINE_PROFILE(unsteady_pressure2, thread, position)
{
face_t f;
real t = CURRENT_TIME;
begin_f_loop(f, thread)
{
F_PROFILE(f, thread, position) =(7*(1000-sin(2*(22/7)*t)));
}
end_f_loop(f, thread)
}

I saved it as a .c file in notepad en loaded it into fluent through interpreted. and then i assine it as a boundary coditions inlet pressure and the name unsteady_pressure to it instead of a number. I don't notice any change in pressure at the inlet static or total and i don't see any difference in velocity. I went as far as to replace the constant inlet with this one to have a bigger inlet to exame but i can't see it working. Is there any way of checking if fluent has loaded the code correctly? or can anyone see a grave mistake i have made in the UDF.

PS. for those who do not no 22/7 is another way of defining PI as i though that might have been the problem
Tarano is offline   Reply With Quote

Old   May 31, 2013, 13:20
Default
  #11
New Member
 
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13
Tarano is on a distinguished road
Oke i figure out what i did wrong for anyone interested don't forget the . after the number very important.
Tarano 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
"Pressure Inlet" Boundary Setup Wijaya FLUENT 15 May 18, 2016 10:08
Mass flow inlet and pressure outlet issue nikhil FLUENT 5 December 11, 2013 12:30
UDF to set velocity and pressure in inlet GerardX89 Fluent UDF and Scheme Programming 0 July 16, 2012 10:15
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15
Fluent 5.2, UDF and Pressure BC's Alfonso Ferrandez FLUENT 0 May 4, 2000 07:02


All times are GMT -4. The time now is 19:10.