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

[solidification/melting] udf to init Temperature

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

Like Tree1Likes
  • 1 Post By ghost82

Reply
 
LinkBack Thread Tools Display Modes
Old   November 28, 2012, 02:53
Default [solidification/melting] udf to init Temperature
  #1
Senior Member
 
ghost82's Avatar
 
Daniele
Join Date: Oct 2010
Location: Italy
Posts: 920
Rep Power: 15
ghost82 will become famous soon enough
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.
ghost82 is offline   Reply With Quote

Old   November 28, 2012, 04:15
Default
  #2
Senior Member
 
ghost82's Avatar
 
Daniele
Join Date: Oct 2010
Location: Italy
Posts: 920
Rep Power: 15
ghost82 will become famous soon enough
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
ghost82 is offline   Reply With Quote

Old   June 19, 2013, 02:31
Default
  #3
Member
 
Yash Ganatra
Join Date: Mar 2013
Posts: 67
Rep Power: 4
yashganatra is on a distinguished road
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?
yashganatra is offline   Reply With Quote

Reply

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
UDF slip and temperature jump from IFRT abir Fluent UDF and Scheme Programming 1 July 30, 2012 05:44
UDF temperature profile NeoGamaes Fluent UDF and Scheme Programming 5 January 16, 2012 04:10
Parallel INIT UDF trouble mil3st3g Fluent UDF and Scheme Programming 2 January 6, 2011 15:07
UDF of linear distribution of temperature in a 2D tank arailos Fluent UDF and Scheme Programming 1 August 19, 2010 14:14
UDF or any approach for Bulk Temperature calculation vemps FLUENT 0 May 1, 2009 01:09


All times are GMT -4. The time now is 17:24.