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

Pressure UDF not working as intended

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By blackmask

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2018, 09:01
Default Pressure UDF not working as intended
  #1
New Member
 
Madrid
Join Date: Apr 2018
Posts: 15
Rep Power: 8
miguwhynot is on a distinguished road
Hi, recently I used this UDF to set the pressure in a velocity inlet:


#include "udf.h"
DEFINE_PROFILE(pressure_inlet, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real v = 4;
real t1 = 11000/v;
real t2 = 20000/v;
real t3 = 32000/v;
begin_f_loop(f, thread)
{
if (t <= t1)
{
F_PROFILE(f, thread, position) = 101325.0*pow(((288.15-0.0065*v*t)/288.15),5.25577);
}
else if (t <= t2)
{
F_PROFILE(f, thread, position) = pow(22632,(-(v*t-1000)/6341.62));
}
else if (t <= t3) {
F_PROFILE(f, thread, position) = 5474.87*pow(((216.65+0.010*(v*t-20000))/216.65),-34.163);
}
else {
// Capture t values outside the allowed range:
// print a message to the console and stop.
Message("%d: Error: t=%e not allowed.\n",myid,t);
return;
}
end_f_loop(f,thread)

}
}


However the values I'm getting when I solve it, are no where close to what they should. Here are some images(see attached). What could be the reason behind it?

For refference the geometry is a cube with a sphere in it, both fluids. The velocity inlet is the top face and a pressure outlet is set in the bottom face. My intention is to set an uniforn flow with the pressure changing as the UDF is written.

Thanks in advance!

PS: I also have been wondering if it might have to something with either the operating conditions or the refference values.
Attached Images
File Type: png Sin título.png (17.7 KB, 7 views)
File Type: jpg Sin título2.jpg (37.0 KB, 9 views)
miguwhynot is offline   Reply With Quote

Old   August 28, 2018, 09:35
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
Did you set the initial/supersonic pressure or total pressure? It should be the latter. If the fluid is incompressible please set operating pressure to zero and modify your UDF accordingly, or you will be surprised.
blackmask is offline   Reply With Quote

Old   August 28, 2018, 10:17
Default
  #3
New Member
 
Madrid
Join Date: Apr 2018
Posts: 15
Rep Power: 8
miguwhynot is on a distinguished road
Hi, thanks for your answer. I was indeed setting my desired pressure as Initial/Supersonic so there's 100% a mistake.
However I don't seem to be able to set a Total Pressure for the veolvity inlet( attached photo).

I'm trying to set up my inlet conditions giving both the velocity and the pressure, since both of them change during the flow time.
Attached Images
File Type: png 10.png (14.5 KB, 4 views)

Last edited by miguwhynot; August 28, 2018 at 11:32.
miguwhynot is offline   Reply With Quote

Old   August 28, 2018, 14:00
Default
  #4
New Member
 
Madrid
Join Date: Apr 2018
Posts: 15
Rep Power: 8
miguwhynot is on a distinguished road
Here's more info:

Hi everyone,

I'm currently doing a project whose main goal is to be able to study how film temperature changes during the ascension of a high altitude balloon.
The geometry model is pretty simple, 2 volumes, onw for the balloon and the other one for the air that surrounds it.
To make the simulation my idea is to make a transient FLUENT simulation, whose inlet conditions change with the following UDFs:

-UDF 1 "Temperature"

#include "udf.h"
DEFINE_PROFILE(temperature_inlet, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real v = 4;
real t1 = 11000/v;
real t2 = 20000/v;
real t3 = 32000/v;
begin_f_loop(f, thread)
{
if (t <= t1)
{
F_PROFILE(f, thread, position) = 288.15-0.0065*v*t;
}
else if (t <= t2)
{
F_PROFILE(f, thread, position) = 216.65;
}
else if (t <= t3) {
F_PROFILE(f, thread, position) = 216.65+0.0010*(v*t-20000);
}
else {
// Capture t values outside the allowed range:
// print a message to the console and stop.
Message("%d: Error: t=%e not allowed.\n",myid,t);
return;
}
end_f_loop(f,thread)

}
}



-UDF2 Pressure
#include "udf.h"
DEFINE_PROFILE(pressure_inlet, thread, position)
{
face_t f;
real t = CURRENT_TIME;
real v = 4;
real t1 = 11000/v;
real t2 = 20000/v;
real t3 = 32000/v;
begin_f_loop(f, thread)
{
if (t <= t1)
{
F_PROFILE(f, thread, position) = 101325.0*pow(((288.15-0.0065*v*t)/288.15),5.25577);
}
else if (t <= t2)
{
F_PROFILE(f, thread, position) = 22605*pow(2.718281828,(11000-v*t)/6340);
}
else if (t <= t3) {
F_PROFILE(f, thread, position) = 2447*pow((141.89+0.003*v*t)/216.65,-11.388);
}
else {
// Capture t values outside the allowed range:
// print a message to the console and stop.
Message("%d: Error: t=%e not allowed.\n",myid,t);
return;
}
end_f_loop(f,thread)
}
}



As you can see both of them try to simulate the atmospheric external conditions for a ballon that ascends with a velocity of 4 m/s.
When I'm trying to implement the problem in FLUENT I'm finding troubles when trying to set both the velocity inlet to 4 m/s and the pressure as shown before. My general idea was to make a velocity-inlet whose velocity was 4 m/s and a pressure outlet with the pressure given by the UDF. However when I do both things I get "floating point", and if I only select (velocity or pressure) the other doesn´t match the case.

How would suggest to fix this case?

Thanks you in advance.
Attached Images
File Type: jpg geo1.jpg (75.4 KB, 1 views)
File Type: png geo2.png (56.8 KB, 2 views)
miguwhynot is offline   Reply With Quote

Old   August 28, 2018, 21:39
Default
  #5
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
I have no comment on the way of your modeling but have you considered that apply the pressure profile at the outlet rather then inlet? For a normal subsonic flow you will not be able to specify both pressure and velocity simultaneously at the inlet, which gives five independent constraints for four incoming waves (three vorticity wave plus one acoustic wave) and the problem turns to be over-determined. If you insist on doing this you could use
Code:
DEFINE_ADJUST
to adjust the pressure both at the inlet and the outlet such that the pressure at the inlet satisfy your profile while maintaining the pressure drop.
miguwhynot likes this.
blackmask is offline   Reply With Quote

Old   August 29, 2018, 04:22
Default
  #6
New Member
 
Madrid
Join Date: Apr 2018
Posts: 15
Rep Power: 8
miguwhynot is on a distinguished road
Thanks aain for your answer. Yes I have been testing other models and setting the pressure in the outlet seems to work just fine.

Thanks for your answer!
miguwhynot 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
What is difference between static pressure and gauge pressure? aja1345 FLUENT 1 July 20, 2018 21:05
UDF issue when implementing a downstream resistance dependent outlet pressure shiju7279 Fluent UDF and Scheme Programming 1 October 26, 2017 22:11
UDF for pressure outlet (resistance) Lilly Fluent UDF and Scheme Programming 0 October 15, 2014 07:22
Does star cd takes reference pressure? monica Siemens 1 April 19, 2007 12:26
Fluent 5.2, UDF and Pressure BC's Alfonso Ferrandez FLUENT 0 May 4, 2000 08:02


All times are GMT -4. The time now is 20:08.