|
[Sponsors] |
Terminate Fluent when body reaches a temperature |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 18, 2013, 14:53 |
Terminate Fluent when body reaches a temperature
|
#1 |
New Member
Join Date: Nov 2013
Posts: 18
Rep Power: 12 |
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 |
|
November 20, 2013, 17:44 |
|
#2 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
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.
|
|
November 21, 2013, 16:55 |
|
#3 |
New Member
Join Date: Nov 2013
Posts: 18
Rep Power: 12 |
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); 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 18:20. |
|
November 21, 2013, 18:11 |
|
#4 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
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. |
|
November 21, 2013, 19:21 |
|
#5 |
New Member
Join Date: Nov 2013
Posts: 18
Rep Power: 12 |
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? 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 07:47. |
|
November 22, 2013, 13:50 |
|
#6 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
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 */ } } 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. |
|
November 25, 2013, 04:13 |
|
#7 |
New Member
Join Date: Nov 2013
Posts: 18
Rep Power: 12 |
Thanks a million for this. I haven't had a chance to try it just yet. Hopefully sometime today
Cheers |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wet bulb temperature in FLUENT | Abhya | FLUENT | 2 | August 15, 2017 19:08 |
Calculation of the Governing Equations | Mihail | CFX | 7 | September 7, 2014 06:27 |
Defining of initial temperature of certain body in unsteady heat transfer problem | toodrunktorun | FLUENT | 1 | September 5, 2013 09:34 |
HELP!:CFD modelling using FLUENT in swimming pool | Tee | Main CFD Forum | 0 | September 7, 2005 20:48 |
body temperature | jack | Phoenics | 1 | August 2, 2005 07:34 |