CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   [solidification/melting] udf to init Temperature (

ghost82 November 28, 2012 02:53

[solidification/melting] udf to init Temperature
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:


#include "udf.h"

  cell_t c;
  Thread *t;
  real xc[ND_ND];

  /* loop over all cell threads in the domain  */

      /* loop over all cells  */
            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;
                C_T(c,t) = 316.15;

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?


ghost82 November 28, 2012 04: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 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.


yashganatra June 19, 2013 02:31

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?

All times are GMT -4. The time now is 12:08.