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

Changing Pressure at specifird location in domain

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 30, 2019, 03:11
Default Changing Pressure at specifird location in domain
  #1
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Hello everyone, i would like to know that how can we change the pressure in a transient run simulation at some specified location e.g after some time in simulation i want to increse or decrease the pressure in domain at specified location. Please look at my work and suggest.
i am using DEFINE_ADJUST but its not working



# define domain_ID 7
/* Pressure calculations */
DEFINE_ADJUST(my_adjust,d)
{

real del_p = 0;
real p_operating = RP_Get_Real ("operating-pressure");
Thread *t;
cell_t c;
face_t f;
t=Lookup_Thread(d, domain_ID);
d = Get_Domain(domain_ID);

if(CURRENT_TIME == 0.1)
{

del_p = -5;
}
else
del_p = 0;



thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
real pressure = C_P(c,t);
C_P(c,t) = pressure + del_p + p_operating;
}
end_c_loop(c,t)
}

thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
real pressure = C_P(c,t);
C_P(c,t) = pressure + del_p + p_operating;
}
end_f_loop(f,t)
}

if(CURRENT_TIME == 0.1)
{

del_p = -5;
}
else
del_p = 0;



thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
real pressure = F_P(f,t);
F_P(f,t) = pressure + del_p + p_operating;
}
end_c_loop(c,t)
}

thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
real pressure = F_P(f,t);
F_P(f,t) = pressure + del_p + p_operating;
}
end_f_loop(f,t)
}
}
ebrahem is offline   Reply With Quote

Old   October 31, 2019, 00:16
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
it depends on the way, how you will define location
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 31, 2019, 02:29
Default
  #3
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Thank u so much for replying
By using f_centroid we can restrict location but question am I right?
ebrahem is offline   Reply With Quote

Old   October 31, 2019, 23:14
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
yes, using f_centroid you can control coordinates on faces, to control coordinates in cells you need C_centroid macro
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 31, 2019, 23:37
Default
  #5
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Thank you so much.
But my problem is I am unable to see any changes in pressure field. Looks like I am doing something wrong
ebrahem is offline   Reply With Quote

Old   November 1, 2019, 02:59
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
firstly, compile your code, It has several errors.

your statement time == 0.1 most likely will never be true
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 1, 2019, 03:04
Default
  #7
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
UDF is compiling and giving no error and current time ==0.1 means that it will execute at flow time 0.1. but when I see pressure contours at 0.1flow time nothing happened.
ebrahem is offline   Reply With Quote

Old   November 1, 2019, 05:05
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
code above is wrong, show the code you are using with no errors....
del_p = -5; could be negligibly small, cause normal pressure is 101325 ,check it

if(CURRENT_TIME == 0.1) is only 1 moment time and it is possible, that fluent will never have exactly 0.1 time inside solver, it is possible to get 0.09999999999
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 1, 2019, 06:26
Default
  #9
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Once again really appreciated your insight.
My time step size is 0.001 so surely 0.1 comes in it's progression

Regarding dp=-5 I have just replaced my equation with this constant 5 value to make my point. Actually in that equation I am using C_Centroid to restrict the location of pressure change. In actual equation it will surely have effect prominent enough if it works properly. Because I have solved it manually and its value is compareble to 101325.
ebrahem is offline   Reply With Quote

Old   November 4, 2019, 10:31
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by ebrahem View Post
Once again really appreciated your insight.
My time step size is 0.001 so surely 0.1 comes in it's progression
No, not surely. Mathematically yes, 100*0.001=0.1, so after 100 time steps you should be exactly at that time. But numerically, no, because computers work with binary numbers, not decimal. You might want to learn something about floating point arithmetic.

But you fail to see that, even if you happen to hit exactly time 0.1 on time step 100, you don't have it anymore at time step 101. So the pressure changes for only one millisecond in your simulation.

I suspect that you don't want that. I suspect that you want the pressure to be changed for all times after 0.1 seconds. In that case:
Code:
if(CURRENT_TIME > 0.1)
pakk is offline   Reply With Quote

Old   November 4, 2019, 20:15
Default
  #11
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Quote:
Originally Posted by pakk View Post
No, not surely. Mathematically yes, 100*0.001=0.1, so after 100 time steps you should be exactly at that time. But numerically, no, because computers work with binary numbers, not decimal. You might want to learn something about floating point arithmetic.

But you fail to see that, even if you happen to hit exactly time 0.1 on time step 100, you don't have it anymore at time step 101. So the pressure changes for only one millisecond in your simulation.

I suspect that you don't want that. I suspect that you want the pressure to be changed for all times after 0.1 seconds. In that case:
Code:
if(CURRENT_TIME > 0.1)
Actually I am increasing velocity at specified location and time by adding x and y momentum source. Obviously for increasing in velocity there will be decrease in pressure I want to compensate that pressure drop at that time.
ebrahem is offline   Reply With Quote

Old   November 4, 2019, 20:27
Default
  #12
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
code above is wrong, show the code you are using with no errors....
del_p = -5; could be negligibly small, cause normal pressure is 101325 ,check it

if(CURRENT_TIME == 0.1) is only 1 moment time and it is possible, that fluent will never have exactly 0.1 time inside solver, it is possible to get 0.09999999999
Please watch this video and tell me what is happening to pressure contours at 16s in video time which is 0.1s in simulation
https://youtu.be/IvIzLIqN29w
ebrahem is offline   Reply With Quote

Old   November 5, 2019, 01:53
Default
  #13
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by ebrahem View Post
Please watch this video and tell me what is happening to pressure contours at 16s in video time which is 0.1s in simulation
https://youtu.be/IvIzLIqN29w
It looks like the pressure dropped by 5 Pa for a very short moment. Isn't that what you wanted?
Is this your simulation?
If so, why did you say that the UDF was not working?
pakk is offline   Reply With Quote

Old   November 5, 2019, 02:04
Default
  #14
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
yes this is my simulation of vortical gust impinging to the cylinder i have generated the vortical gust by source term implementation in x and y momentum source through UDF.


according to my little understanding yes by increasing velocity at a point the pressure will be drop to compensate it . But i dont want to see the pressure drop thats why i am trying to use DEFINE_ADJUST UDF to compensate that pressure loss (UDF is compiling and giving no error i have hooked it in function hook but i am unable to see it effect i dont know how to check if UDF is effecting or not. if i only apply DEFINE_ADJUST UDF there is no change in lift, drag, pressure or residuals.)
ebrahem is offline   Reply With Quote

Old   November 5, 2019, 03:40
Default
  #15
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
You have been told already a few times why you see no effect.

I worry a bit about your statement
Quote:
But i dont want to see the pressure drop...
You understand that physically there has to be a pressure drop, but you don't want to see it... Why do you want to fool yourself?
pakk is offline   Reply With Quote

Old   November 5, 2019, 04:00
Default
  #16
Member
 
MEK
Join Date: Oct 2016
Posts: 39
Rep Power: 9
ebrahem is on a distinguished road
by introducing the vortical gust in domain there is a change in velocity and vorticity contours at localize location but in pressure contours whole inlet domain is disturbed. that is what bothering me.
ebrahem is offline   Reply With Quote

Old   November 5, 2019, 06:09
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Well, it can be physical or non-physical.

If it is physical, then you should accept it, because it's just what it is. You should not use a UDF to change the result just because you don't like it.

If it is non-physical, something is wrong in your simulation. You should find out what is wrong. What is the cause of this non-physical thing. Don't write a UDF to suppress the effect, but find the cause and get rid of it.

So you see, whatever it is, your UDF is not what you need.
pakk 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
Periodic Pressure drop cfd_begin CFX 10 May 25, 2017 07:09
Closed Domain Buoyancy Flow Problem Madhatter92 CFX 6 June 20, 2016 21:05
Setting rotating frame of referece. RPFigueiredo CFX 3 October 28, 2014 04:59
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 04:05


All times are GMT -4. The time now is 05:39.