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

Terminate Fluent when body reaches a temperature

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

Like Tree3Likes
  • 3 Post By macfly

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2013, 15:53
Default Terminate Fluent when body reaches a temperature
  #1
New Member
 
Join Date: Nov 2013
Posts: 18
Rep Power: 12
magicalmarshmallow is on a distinguished road
Hey,

I'm really new to using Fluent and I need to run a multiphysics heat transfer simulation. Basically I am cooling an aluminium block by passing water through channels on the surface.

The initial temperature of the block is 500K and the water temperature is 300K. The way I am setting the temperature of the block is using the patch setting after initialisation. Is the the best?

The main question though is how do I tell fluent to stop solving when the temperature of the block is at or below 350K? I haven't been able to work this out.

If someone could help it would be excellent

Cheers
magicalmarshmallow is offline   Reply With Quote

Old   November 20, 2013, 18:44
Default
  #2
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
You can do that with a DEFINE_EXECUTE_AT_END udf. The udf would calculate the average temperature in the domain at each timestep, and then an if condition would follow in the udf to stop Fluent if some average T is reached.
macfly is offline   Reply With Quote

Old   November 21, 2013, 17:55
Default
  #3
New Member
 
Join Date: Nov 2013
Posts: 18
Rep Power: 12
magicalmarshmallow is on a distinguished road
Is it possible to do this from the GUI? I am guessing not.

So far I have managed to cobble this lot together

Code:
 
#include "udf.h"
/* Obtain the mean temperature of the domain ID12
DEFINE_EXECUTE_AT_END(volume_temperature)
{ 
 volume_t c;
 Domain *d;
 Thread *t;
 d = Get_Domain(12);
I've no idea if this makes any sense at all. I assume it gets something more to end it that just this, but I haven't a clue

Finally, if I am sending this to a linux HPC using PBS, so my question then becomes; am I wasting my time? From what I have read, your UDF script is local and not included in the case file. Is this true?

Last edited by magicalmarshmallow; November 21, 2013 at 19:20.
magicalmarshmallow is offline   Reply With Quote

Old   November 21, 2013, 19:11
Default
  #4
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
Maybe an if condition in Calculation Activities\Execute Commands... Look here to see an example of how to implement an if condition: http://www.cfd-online.com/Forums/flu...tml#post387848

By the way, that's the kind of stuff that is soooo easy to figure out in Comsol and will take hours to work out in the prehistoric Fluent interface.
macfly is offline   Reply With Quote

Old   November 21, 2013, 20:21
Default
  #5
New Member
 
Join Date: Nov 2013
Posts: 18
Rep Power: 12
magicalmarshmallow is on a distinguished road
Sorry to be a hassle here, but I really have no clue as to what I am doing. I read the thread you recommended, but I still haven't a clue if I am on the right track (or any track) in terms editing and writing these functions to suit my purpose. I have no idea how to get the Execute command 'if' condition to link to the UDF which calculates the average temperature, not what should be included in the UDF. Moreover, I haven't a clue about writing the UDF.

I could simplify the problem to a the average temperature on a surface. Does this make the UDF any easier to write?



Quote:
Originally Posted by macfly View Post
By the way, that's the kind of stuff that is soooo easy to figure out in Comsol and will take hours to work out in the prehistoric Fluent interface.
Yeh I know, I wanted to use COMSOL, but unfortunately we don't have a licence for COMSOL in my faculty . We also don't have it on the HPC either

Last edited by magicalmarshmallow; November 22, 2013 at 08:47.
magicalmarshmallow is offline   Reply With Quote

Old   November 22, 2013, 14:50
Default
  #6
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
Ok here is how:
1. define a scheme variable in Fluent TUI: (rp-var-define 't_vol_avg 0 'real #f)

2. interpret the following udf which will calculate volume-weighted temperature and assign the result to the scheme variable:
Code:
#include "udf.h"

DEFINE_EXECUTE_AT_END(exec_at_end)
{
Domain *d; /* declare domain pointer since it is not passed as an argument to the DEFINE macro */
real t_vol_avg_1 = 0.;
real t_vol_avg_2 = 0.;
real t_cell = 0.;
real volume = 0.;
real volume_tot = 0.;
Thread *t;
cell_t c;
d = Get_Domain(1); /* Get the domain using ANSYS FLUENT utility */

thread_loop_c(t,d) /* Loop over all cell threads in the domain */
	{
	/* Compute volume-averaged temperature by looping over all cells */
	begin_c_loop(c,t)
		{
		volume = C_VOLUME(c,t); /* get cell volume */
		t_cell = C_T(c,t); /* get cell temperature */
		volume_tot += volume; /* sum of volumes */
		t_vol_avg_1 += t_cell*volume; /* sum of volume-weighted temperatures */
		}
	end_c_loop(c,t)
	t_vol_avg_2 = t_vol_avg_1/volume_tot; /* volume-weighted temperature */
	RP_Set_Real("t_vol_avg",t_vol_avg_2); /* update value of scheme variable */
    printf("\n Volume-weighted T = %g K \n",t_vol_avg_2); /* print volume-weighted temperature in TUI */
    }
}
3. Hook the udf: Define\User-Defined\Function Hooks...\Execute at End...

4. The value of the scheme variable can be retrieved in Fluent with: (rpgetvar 't_vol_avg)
Therefore we can implement an interrupting condition in Execute Commands, see attached picture.


Try with a simple 2D square transient conduction model. Initial T of solid at 500 K and all boundaries at 300 K.
Attached Images
File Type: png 001.png (14.4 KB, 139 views)
macfly is offline   Reply With Quote

Old   November 25, 2013, 05:13
Default
  #7
New Member
 
Join Date: Nov 2013
Posts: 18
Rep Power: 12
magicalmarshmallow is on a distinguished road
Thanks a million for this. I haven't had a chance to try it just yet. Hopefully sometime today

Cheers
magicalmarshmallow 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
Wet bulb temperature in FLUENT Abhya FLUENT 2 August 15, 2017 20:08
Calculation of the Governing Equations Mihail CFX 7 September 7, 2014 07:27
Defining of initial temperature of certain body in unsteady heat transfer problem toodrunktorun FLUENT 1 September 5, 2013 10:34
HELP!:CFD modelling using FLUENT in swimming pool Tee Main CFD Forum 0 September 7, 2005 21:48
body temperature jack Phoenics 1 August 2, 2005 08:34


All times are GMT -4. The time now is 15:54.