# [solidification/melting] udf to init Temperature

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 28, 2012, 02:53 [solidification/melting] udf to init Temperature #1 Senior Member     Daniele Join Date: Oct 2010 Location: Italy Posts: 918 Rep Power: 15 Hi, I'm trying to solve a solidification-melting problem and I have to initialize temperature, function of x coordinate: I used the following udf, which compiles/interprets fine: Code: ```#include "udf.h" DEFINE_INIT(my_init_func,d) { cell_t c; Thread *t; real xc[ND_ND]; /* loop over all cell threads in the domain */ thread_loop_c(t,d) { /* loop over all cells */ begin_c_loop_all(c,t) { C_CENTROID(xc,c,t); if (xc[0] <= 0.015) C_T(c,t) = 346.15; else if (xc[0] <= 0.01575 && xc[0] > 0.015) C_T(c,t) = -2208.*xc[0]+351.171; else if (xc[0] <= 0.01625 && xc[0] > 0.01575) C_T(c,t) = -414.*xc[0]+322.9155; else if (xc[0] <= 0.01675 && xc[0] > 0.01625) C_T(c,t) = -66.*xc[0]+317.2605; else if (xc[0] <= 0.01725 && xc[0] > 0.01675) C_T(c,t) = -8.*xc[0]+316.289; else if (xc[0] <= 0.01775 && xc[0] > 0.01725) C_T(c,t) = -2.*xc[0]+316.1855; else C_T(c,t) = 316.15; } end_c_loop_all(c,t) } }``` Solidus temperature for my problem is 316.15 K, liquidus temperature 327.15 K; However, after initializing, temperature contour plot looks fine, but when I plot liquid fraction my domain is 100% liquid.... Do I have to patch also the liquid fraction in my udf?If yes, how? Daniele thermal energy likes this.

 November 28, 2012, 04:15 #2 Senior Member     Daniele Join Date: Oct 2010 Location: Italy Posts: 918 Rep Power: 15 I initialized also the liquid fraction thanks to C_LIQF(c,t) to 0; my problem was that I initialized all my domain, whch is composed by solid and fluid, but, as the fluent guide says, C_LIQF(c,t) is available only for fluid zones, so I received an access violation..now all is ok (I think). ..but I didn't know that I had to initialize also the liquid fraction, I thought that fluent would compute it automatically. Daniele

 June 19, 2013, 02:31 #3 Member   Yash Ganatra Join Date: Mar 2013 Posts: 67 Rep Power: 4 Hi, I am also working on the same problem. Were you able to solve this problem? I know it's late, you should also update enthalpy right to get the updated liquid fraction? Did you use the inbuilt solidification module?

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post abir Fluent UDF and Scheme Programming 1 July 30, 2012 05:44 NeoGamaes Fluent UDF and Scheme Programming 5 January 16, 2012 04:10 mil3st3g Fluent UDF and Scheme Programming 2 January 6, 2011 15:07 arailos Fluent UDF and Scheme Programming 1 August 19, 2010 14:14 vemps FLUENT 0 May 1, 2009 01:09

All times are GMT -4. The time now is 00:03.

 Contact Us - CFD Online - Top