|
[Sponsors] |
May 29, 2013, 07:17 |
UDF pulsating pressure inlet
|
#1 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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 |
|
May 29, 2013, 07:52 |
|
#3 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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 |
|
May 29, 2013, 08:01 |
|
#4 |
Senior Member
|
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)); |
|
May 29, 2013, 09:55 |
|
#5 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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. |
|
May 29, 2013, 11:05 |
|
#7 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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 .
|
|
May 29, 2013, 11:58 |
|
#8 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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) } |
|
May 30, 2013, 11:27 |
|
#10 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
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 |
|
May 31, 2013, 14:20 |
|
#11 |
New Member
N/A
Join Date: Apr 2013
Posts: 18
Rep Power: 13 |
Oke i figure out what i did wrong for anyone interested don't forget the . after the number very important.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Pressure Inlet" Boundary Setup | Wijaya | FLUENT | 15 | May 18, 2016 11:08 |
Mass flow inlet and pressure outlet issue | nikhil | FLUENT | 5 | December 11, 2013 13:30 |
UDF to set velocity and pressure in inlet | GerardX89 | Fluent UDF and Scheme Programming | 0 | July 16, 2012 11:15 |
Neumann pressure BC and velocity field | Antech | Main CFD Forum | 0 | April 25, 2006 03:15 |
Fluent 5.2, UDF and Pressure BC's | Alfonso Ferrandez | FLUENT | 0 | May 4, 2000 08:02 |