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

UDF for pressure outlet backflow total temperature

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

Like Tree4Likes
  • 1 Post By MrDaimon
  • 2 Post By A CFD free user
  • 1 Post By macfly

Reply
 
LinkBack Thread Tools Display Modes
Old   January 27, 2014, 04:47
Default UDF for pressure outlet backflow total temperature
  #1
New Member
 
Gilberto Santo
Join Date: Apr 2012
Location: Gent (Belgium)
Posts: 18
Rep Power: 6
MrDaimon is on a distinguished road
Hi all,
I am trying to solve a solidification and melting problem using Ansys Fluent 13. My problem is: I have a mass of PCM (Phase Change Material) which is warmed up by a flux of oil in a heat pipe. When melting occurs, I set the density of the PCM to reduce, so I need an outlet in the volume occupied by PCM to make mass flow out of domain. Obviously convective movements are important in my simulation, so I need to know if there is a way to set the backflow temperature equal to the temperature in the cell near the pressure outlet, maybe using a UDF. Can anyone help me?
I hope I've been clear.
Regards
adnanghreeb likes this.
MrDaimon is offline   Reply With Quote

Old   January 27, 2014, 14:48
Default
  #2
Senior Member
 
A CFD free user's Avatar
 
A-A Azarafza
Join Date: Jan 2013
Posts: 205
Rep Power: 6
A CFD free user is on a distinguished road
Hi guy,
I think, it's possible. First, try to get the temperature in cells near the pressure outlet using a DEFINE_ADJUST general purpose macro. Then store it in a C_UDMI and recall it by a DEFINE_PROFILE macro for the face thread.
MrDaimon and adnanghreeb like this.
__________________
Regard yours
A CFD free user is offline   Reply With Quote

Old   January 28, 2014, 03:28
Default Thanks
  #3
New Member
 
Gilberto Santo
Join Date: Apr 2012
Location: Gent (Belgium)
Posts: 18
Rep Power: 6
MrDaimon is on a distinguished road
Thanks man! Unfortunately I'm not so good using that kind of macro... Can you tell me more about it? How would you write it?
MrDaimon is offline   Reply With Quote

Old   January 29, 2014, 09:42
Default
  #4
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 380
Rep Power: 9
macfly is on a distinguished road
I got exactly what you want, did that in the past

Did you look on the udf forum?

Code:
 #include "udf.h"
 real T_mean;  /* defined outside because will be used in multiple DEFINE macros */

 DEFINE_ADJUST(adjust, domain, t)
 {
 real T_tot;
 real u;
 real counter = 0;

 face_t f;
 int ID = 20; /* outlet ID displayed in Fluent boundary conditions panel */
 Thread *thread;
 thread = Lookup_Thread(domain, ID);
 begin_f_loop(f, thread)
 {
 u = F_U(f, thread); /* x velocity */
 if (u >= 0) /* if fluid is going out... */
 {
 T_tot += F_T(f, thread);
 counter = counter + 1;
 }
 }
 end_f_loop(f, thread)
 T_mean = T_tot/counter; /* arithmetic mean T of outflow */
 }



 DEFINE_PROFILE(T_backflow, thread, position)
 {
 face_t f;
 begin_f_loop(f, thread)
 {
 F_PROFILE(f, thread, position) = T_mean;
 }
 end_f_loop(f, thread)
 }
- modify the velocity component and the if condition depending on your geometry...

- If I remember well, I think you have to interprete the udf before each simulation to reset the variables

- It does an arithmetic mean of the outgoing fluid temperature, not accurate if your mesh is not uniform at the outlet and temperature varies a lot

- If I were you, I'd modify the code for an area-weighted average of T of the outgoing fluid at the boundary
A CFD free user likes this.

Last edited by macfly; January 29, 2014 at 13:50.
macfly is offline   Reply With Quote

Old   January 29, 2014, 10:05
Default
  #5
New Member
 
Gilberto Santo
Join Date: Apr 2012
Location: Gent (Belgium)
Posts: 18
Rep Power: 6
MrDaimon is on a distinguished road
Thank you soooo much!
MrDaimon is offline   Reply With Quote

Old   January 29, 2014, 12:05
Default ANSYS Fluent
  #6
New Member
 
adnan
Join Date: Nov 2013
Location: Germany
Posts: 6
Rep Power: 4
adnanghreeb is on a distinguished road
Dear friends, I have question in fluent please.
I used ICEM for simulate heat transfer in kiln, then export to fluent, actually in this time i run my program without combustion.
can get converge at residual e-2 but with not good report about mass net, as same time reasonable result.

so take more for residual until e-4 , also get converge but not reasonable result and in this case report mass excepted?

any suggest, thanks in advance
adnan

adnanghreeb is offline   Reply With Quote

Old   January 29, 2014, 12:13
Default
  #7
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 380
Rep Power: 9
macfly is on a distinguished road
Quote:
Originally Posted by adnanghreeb View Post
Dear friends, I have question in fluent please.
I used ICEM for simulate heat transfer in kiln, then export to fluent, actually in this time i run my program without combustion.
can get converge at residual e-2 but with not good report about mass net, as same time reasonable result.

so take more for residual until e-4 , also get converge but not reasonable result and in this case report mass excepted?

any suggest, thanks in advance
adnan

I think you wanted to start a new thread. Please start a thread with a specific title about your problem, not the most general title like 'Ansys Fluent'.
macfly is offline   Reply With Quote

Old   January 29, 2014, 14:27
Default
  #8
New Member
 
Gilberto Santo
Join Date: Apr 2012
Location: Gent (Belgium)
Posts: 18
Rep Power: 6
MrDaimon is on a distinguished road
Quote:
Originally Posted by macfly View Post
I got exactly what you want, did that in the past

Did you look on the udf forum?

Code:
 #include "udf.h"
 real T_mean;  /* defined outside because will be used in multiple DEFINE macros */

 DEFINE_ADJUST(adjust, domain, t)
 {
 real T_tot;
 real u;
 real counter = 0;

 face_t f;
 int ID = 20; /* outlet ID displayed in Fluent boundary conditions panel */
 Thread *thread;
 thread = Lookup_Thread(domain, ID);
 begin_f_loop(f, thread)
 {
 u = F_U(f, thread); /* x velocity */
 if (u >= 0) /* if fluid is going out... */
 {
 T_tot += F_T(f, thread);
 counter = counter + 1;
 }
 }
 end_f_loop(f, thread)
 T_mean = T_tot/counter; /* arithmetic mean T of outflow */
 }



 DEFINE_PROFILE(T_backflow, thread, position)
 {
 face_t f;
 begin_f_loop(f, thread)
 {
 F_PROFILE(f, thread, position) = T_mean;
 }
 end_f_loop(f, thread)
 }
- modify the velocity component and the if condition depending on your geometry...

- If I remember well, I think you have to interprete the udf before each simulation to reset the variables

- It does an arithmetic mean of the outgoing fluid temperature, not accurate if your mesh is not uniform at the outlet and temperature varies a lot

- If I were you, I'd modify the code for an area-weighted average of T of the outgoing fluid at the boundary



Did you have the pressure outlet on the right side of domain? I have it on the left, so maybe I should consider the velocity in the opposite direction... Am I right?
MrDaimon is offline   Reply With Quote

Old   January 29, 2014, 14:29
Default
  #9
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 380
Rep Power: 9
macfly is on a distinguished road
yes that's it, plot the velocity you'll see what's negative or not
macfly is offline   Reply With Quote

Old   February 3, 2014, 09:16
Default
  #10
New Member
 
Gilberto Santo
Join Date: Apr 2012
Location: Gent (Belgium)
Posts: 18
Rep Power: 6
MrDaimon is on a distinguished road
Quote:
Originally Posted by macfly View Post
yes that's it, plot the velocity you'll see what's negative or not

Man, I'm sorry but it doesn't seem to work I used the ID of my outlet, change the velocity direction but it doesn't work... It sets the backflow total temperature to 0, even if I initialize my case with 423.15 K (which is my initial condition). My geometry is planar (2D), not solid, but I am using an assialsimmetry condition... does it affect the UDF? Was your UDF written for a 3D geometry?
MrDaimon is offline   Reply With Quote

Old   February 3, 2014, 13:16
Default
  #11
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 380
Rep Power: 9
macfly is on a distinguished road
- I assume you interpreted the udf and set the backflow T at the outlet.

- But did you hook the DEFINE_ADJUST? (Define\User-Defined\Function Hooks...\edit Adjust and select 'adjust'

The udf works in 2D or 3D. I don't think that the axial symmetry boundary affects the udf.

Last edited by macfly; February 3, 2014 at 16:20.
macfly is offline   Reply With Quote

Old   February 4, 2014, 03:10
Default
  #12
New Member
 
Gilberto Santo
Join Date: Apr 2012
Location: Gent (Belgium)
Posts: 18
Rep Power: 6
MrDaimon is on a distinguished road
I didn't know how to use the "adjust", I'm sorry I never used this kind of UDF before, so thank you so much! I'm now tryin to do what you told me.
Anyway, does this UDF work in steady and transition conditions too?
MrDaimon is offline   Reply With Quote

Old   February 4, 2014, 11:11
Default
  #13
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Laval University, Canada
Posts: 380
Rep Power: 9
macfly is on a distinguished road
hooking is like telling Fluent to use the udf it interpreted (or compiled), see the Ansys Fluent UDF Manual

yes it will work for steady or transient cases
macfly is offline   Reply With Quote

Reply

Tags
backflow, convection, pressure outlet, total temperature, udf

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 11 April 22, 2014 12:32
Inlet won't apply UDF and has temperature at 0K! tccruise Fluent UDF and Scheme Programming 2 September 14, 2012 06:08
non constant outlet temperature amir7 FLUENT 0 April 9, 2012 20:12
Increasing of total temperature Roland R CFX 2 December 20, 2011 12:04
ATTENTION! Reliability problems in CFX 5.7 Joseph CFX 14 April 20, 2010 15:45


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