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

udf to adjust pressure

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

Like Tree1Likes
  • 1 Post By elcino

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2011, 09:56
Default udf to adjust pressure
  #1
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
I'm presently analyzing fluid flow in hydrodynamic bearings. As some people know
at some points the pressure drops below zero.
I'm good at fluent but I don't have much idea about UDF's.
What I need is a UDF which can analyze pressures in all cells after each iteration
and make those pressure values equal to zero which are < 0.

I'm going through the tutorials but i can't find relevant example which would be similar to this problem so that I can start working on it. Any suggestions and help would be of great help!
chandu143 is offline   Reply With Quote

Old   December 15, 2011, 23:42
Default
  #2
Member
 
fox000002's Avatar
 
Join Date: Apr 2009
Posts: 46
Rep Power: 16
fox000002 is on a distinguished road
Why not using Solution Limits?

Set Minimum Pressure.
fox000002 is offline   Reply With Quote

Old   December 16, 2011, 11:45
Default
  #3
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
I have tried that but somehow there seems to be no effect of that on end solution.
chandu143 is offline   Reply With Quote

Old   December 20, 2011, 13:36
Default
  #4
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
anybody some suggestions please , it would be of great help!!
chandu143 is offline   Reply With Quote

Old   December 23, 2011, 04:50
Default
  #5
Senior Member
 
duri
Join Date: May 2010
Posts: 245
Rep Power: 16
duri is on a distinguished road
There is nothing wrong with negative pressure for a pressure based solver. If you try to adjust the pressure it may end up in wrong results.

Whatever it is, this udf does the job what you need. you can put some print statements to check pressure values in the udf. After building udf hook it to adjust.


#include "udf.h"
DEFINE_ADJUST(pres_cor,d)
{
Thread *t;
cell_t c;
printf("inside pres_cor");
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if(C_P(c,t)<0) C_P(c,t)=0;
}end_c_loop(c,t)

}
}
duri is offline   Reply With Quote

Old   December 23, 2011, 13:51
Default
  #6
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
Thanks for the reply.I have tried something like your udf only but still it left some parts with
-ve pressure.

Tried your udf its the same result again some parts still have -ve pressure.

The thing is while calculating the load carrying capacity the -ve pressures are to be ignored and all +ve pressures need to be integrated. I have standard values of load carrying capacities from diff texts for bench marking. Previously I solved slider bearings on FLUENT, the results were 99% in tune with textbook values but journal is giving me hard time since the pressure is +ve for 1st half and -ve for second half so practically load carrying capacity becomes zero! In theory -ve pressures are ignored for some reason! I hope u understand my problem fully now.

Define Adjust doesn't seem to solve the problem but it has some effect.

Last edited by chandu143; December 23, 2011 at 14:07.
chandu143 is offline   Reply With Quote

Old   December 23, 2011, 16:14
Default
  #7
Senior Member
 
duri
Join Date: May 2010
Posts: 245
Rep Power: 16
duri is on a distinguished road
I don't know how loads are calculated in bearings. In general, for eg., when you are calculating load along x-direction it is P*mag(A). Integral of P.A will not work because P is tensor and direction of p is relative to the area normal.
When p is +ve on one half and -ve on other half with a flip in area vector then you need to add the load on both half they won't cancel each other. I am very curious to know why do you ignore negative pressure.
ok now to the udf, if you want to change pressure values for post processing. I hope the same routine should work under execute_on_demand. In this case after convergence simply run the udf once manually and update the pressure distribution for post processing.
duri is offline   Reply With Quote

Old   January 2, 2012, 14:24
Default
  #8
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
Sorry I got it wrong about the pressures actually what I had to do was take pressure value from last iteration and calculate error by comparing with present pressure . So I have a new doubt now :P

How a value from last iteration can be passed on to present iteration?
For example if I had to calculate difference between last iteration pressure and preset pressure, how can it be done?
chandu143 is offline   Reply With Quote

Old   January 3, 2012, 00:01
Default
  #9
Senior Member
 
duri
Join Date: May 2010
Posts: 245
Rep Power: 16
duri is on a distinguished road
you can do it by using an user defined memory. Store the pressure value in UDM and then use it for next iteration. But, why do you want to do this way, upon convergence last and new pressure values will be same. Difference will go like continuity residuals.
duri is offline   Reply With Quote

Old   February 27, 2012, 09:07
Default
  #10
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
Quote:
Originally Posted by duri View Post
When p is +ve on one half and -ve on other half with a flip in area vector then you need to add the load on both half they won't cancel each other. I am very curious to know why do you ignore negative pressure.
Ya the problem is the basic definition of liquids. We can compress them to very high pressure with negligible compressibility. But we cannot go decreasing pressure of a liquid forever. Liquids have vapor pressures and when the negative pressure here reaches to that level cavitation sets in and there is no further change in pressure. For some reason fluent doesn't care about it and goes on decreasing pressure, here up to the maximum pressure created at least area of cross section. In theory we can neglect all negative pressures because the vapor pressure is very less compared to the pressures generated in fluid flow of journal bearings.
chandu143 is offline   Reply With Quote

Old   May 1, 2012, 06:12
Default Use DEFINE_EXECUTE_AT_END
  #11
New Member
 
Luca Gorasso
Join Date: Oct 2011
Location: Harbin, China
Posts: 24
Rep Power: 14
elcino is on a distinguished road
Send a message via Skype™ to elcino
I analyze Journal bearing too, and of course negative pressure is negligible, I use an UDF type DEFINE_EXECUTE_AT_END that loops around the cells and the faces at if the pressure is negative is changed in 0.

#include "udf.h"

DEFINE_EXECUTE_AT_END(RBC)
{

Domain *d;
Thread *t;
cell_t c;
face_t f;


d = Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if (C_P(c,t)<=0.0) C_P(c,t)=0.0;
}
end_c_loop(c,t)
}


thread_loop_f(t,d)
{
begin_f_loop(c,t)
{
if (C_P(c,t)<=0.0) C_P(c,t)=0.0;
}
end_f_loop(c,t)
}


}

If u analyse this bearings can u help me with some thing like meshing and boundary conditions, I will appreciate it so much. Thanks!
sozen likes this.
elcino is offline   Reply With Quote

Old   May 1, 2012, 11:59
Default
  #12
New Member
 
Join Date: Dec 2011
Posts: 9
Rep Power: 14
chandu143 is on a distinguished road
Well I mostly concentrated on inclined slider bearings. If you think I can help PM me i'll be more than happy to share my thoughts!
chandu143 is offline   Reply With Quote

Old   May 1, 2012, 12:02
Default my email
  #13
New Member
 
Luca Gorasso
Join Date: Oct 2011
Location: Harbin, China
Posts: 24
Rep Power: 14
elcino is on a distinguished road
Send a message via Skype™ to elcino
luca.gorasso@gmail.com

very intersted.... i think we can share many things
elcino is offline   Reply With Quote

Old   June 8, 2014, 14:40
Default
  #14
New Member
 
Marco Dc
Join Date: Feb 2014
Location: Italy
Posts: 20
Rep Power: 12
I-mech is on a distinguished road
Quote:
Originally Posted by elcino View Post
I analyze Journal bearing too, and of course negative pressure is negligible, I use an UDF type DEFINE_EXECUTE_AT_END that loops around the cells and the faces at if the pressure is negative is changed in 0.

#include "udf.h"

DEFINE_EXECUTE_AT_END(RBC)
{

Domain *d;
Thread *t;
cell_t c;
face_t f;


d = Get_Domain(1);

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if (C_P(c,t)<=0.0) C_P(c,t)=0.0;
}
end_c_loop(c,t)
}


thread_loop_f(t,d)
{
begin_f_loop(c,t)
{
if (C_P(c,t)<=0.0) C_P(c,t)=0.0;
}
end_f_loop(c,t)
}


}

If u analyse this bearings can u help me with some thing like meshing and boundary conditions, I will appreciate it so much. Thanks!
I have some problems with your udf, I've tryed to build mine udf and Access Violation error occured. Then I've tryed yours but i've got the same error.
I'm analysing Tilting Pad Bearings and i want to analyse differences between using Half Sommerfeld condition and using a Cavitation Model with cavitation pressure at patm value.
Can you give me an hint?
__________________
Marco
I-mech is offline   Reply With Quote

Old   July 24, 2017, 09:41
Default
  #15
New Member
 
Duyikang
Join Date: Jun 2015
Location: Wuhan,China
Posts: 4
Rep Power: 10
DuYikang is on a distinguished road
hello, I have tried the macro command of define_adjust to change the negative pressure to zero,but i can't make it.Now, i don't know the why.
DEFINE_ADJUST(adjust_pressure,domain)
{
Thread *t;
cell_t c;
thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
if(C_P(c, t) < 0)
{
C_P(c, t) = 0;
}
}
end_c_loop(c,t)
}
}
DuYikang is offline   Reply With Quote

Old   December 5, 2018, 12:02
Default
  #16
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Can someone tell me where to hook define adjust UDF for pressure change in domain
Currently I m compiling the UDF and hooking it with define adjust next I don't know where to implement this UDF for pressure correction. e.g define source udf is hooked in source term tab. But in this case I don't know.
Thank in advance
ebrahem is offline   Reply With Quote

Old   December 5, 2018, 15:43
Default
  #17
New Member
 
Sanket Dange
Join Date: Jul 2013
Posts: 9
Rep Power: 12
sanketdange2007 is on a distinguished road
Quote:
Originally Posted by ebrahem View Post
Can someone tell me where to hook define adjust UDF for pressure change in domain
Currently I m compiling the UDF and hooking it with define adjust next I don't know where to implement this UDF for pressure correction. e.g define source udf is hooked in source term tab. But in this case I don't know.
Thank in advance
You need to hook it only in :
Define -> User-Defined -> Function Hooks -> Adjust
Define_Adjust is used to work over whole domain and after every iteration.
So there is no need to hook it in specific boundary face or even in a cell zone.
sanketdange2007 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accelerating pre and checking the mfr at exit how to hook udf to Pressure inlet(BC) kokoory Fluent UDF and Scheme Programming 0 August 17, 2011 09:20
UDF for transient pressure inlet, mass flow check at nozzle exit and volumetric heat kokoory FLUENT 0 August 17, 2011 03:07
Pressure profile UDF for unsteady-state problem? Mohsen Keshavarzian FLUENT 2 August 20, 2008 05:22
ADJUST udf Jubs FLUENT 3 February 12, 2007 07:00
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 03:15


All times are GMT -4. The time now is 02:26.