## Fluids

#### How to create valid UDF for specific heat if formula depends on whether it’s melting or solidifying?

• Leona
Subscriber
I would like to use the technique of assigning a certain function for the specific heat, dependent on whether the fluid is melting, T(t-1) < T(t), or solidifying, T(t-1) > T(t). This is known as hysteresis. I try to obtain T(t-1) via C_T_M1(c,t). However, the function DEFINE_SPECIFIC_HEAT(name, T, Tref, h, yi) only takes these five limited inputs, which does not include (c,t).nHow to solve this? Somewhere I saw a suggestion to a similar type of problem using 'domain *domain = Get_Domain(1); Thread *t; cell_t c;', but it is not sure if this works.nA piece of example code (NOT working yet) illustrating what I would like to do:n#include udf.hnnDEFINE_SPECIFIC_HEAT(name, T, Tref, h, yi, c, t)n{n real cp;n real Tprev = C_T_M1(c,t);n if (T => 300 && T=< 400 && Tprev < T)n cp = certain formula for melting;n if (T => 310 && T=< 390 && Tprev > T)n cp = certain formula for solidifying;n elsen cp = 2000;n *h = cp*(T-Tref);n return cp;nnAny suggestions would be amazing!nBests,nLeona
• Surya Deb
Ansys Employee