# UDF for heat source in Soldification and melting model

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

 June 23, 2014, 05:20 #2 New Member   karthik Join Date: Oct 2013 Posts: 7 Rep Power: 9 Awaiting for reply.. Thanks.

 June 23, 2014, 06:01 #4 New Member   karthik Join Date: Oct 2013 Posts: 7 Rep Power: 9 Thanks Pakk for your kindful reply. I will again go through the UDF and get to understand the Physics more.

 June 30, 2014, 00:09 #5 New Member   karthik Join Date: Oct 2013 Posts: 7 Rep Power: 9 Hi Pakk, I went through the UDF again and made little corrections. Changed the temp to tempe, hence I don't see any warning.And used if condition to calculate the source for the temperature range( 300.97 to 303 K). The physical time step size (delta t) is used to avoid error due to time step incorporation in heat source term. Thanks for your suggestions. Again I like to highlight about the source term for better view: My source term is: S=-ρ/∆t *∫f(T)dT ( temperature lower limit: Tsolidus; upper limit: Tliquidus) Se = - density/Time*intergral of f[T] , (unit will be W/meter cube, since f(T) is J/kg). My UDF is: #include "udf.h" #define C1 1757.9 #define C2 3.0e6 #define C3 2e9 #define C4 1e12 #define C5 2e14 #define C6 3e16 #define C7 1e18 DEFINE_SOURCE(phase_change,c,t,dS,eqn) { real rho; real source; real tempe; real time; time =RP_Get_Real("physical-time-step"); rho = C_R(c,t); tempe = C_T(c,t); if(tempe>300.97 && tempe<303) { source = -(rho/time)*((C1*pow(tempe,6))-(C2*pow(tempe,5))+(C3*pow(tempe,4))-(C4*pow(tempe,3))+(C5*pow(tempe,2))-(C6*tempe)+C7); } else { source=0; } dS[eqn]=0; return source; } No error in temperature (like the previous one which had 1 K when the simulation runs). The simulation runs but I don't find any difference in results (temperature variation with time) with and without source to energy equation. My question is: Whether the UDF for source is correct? Since my source is a unsteady term and dependent on temperature, I assume there is an error in the source UDF ( code). Whether I have to use C_UDSI or C_UDMI for source term to update temperature in source term for every timestep? I found from manual and CFD online forum there is a unsteady udf built function. Whether it has to be combined to Define source udf.? Please kindly help me about this UDF function. Thank you. Regards, Karthik

 June 30, 2014, 02:19 #6 Senior Member   Join Date: Nov 2013 Posts: 1,759 Rep Power: 22 A UDF is correct if it does want you want it to do. I don't know what you want it to do, so I can not judge that. You explained the purpose of this udf, "simulating melting process for a phase change material in a spherical capsule", but that is not nearly detailed enough. To judge that, you would need to write down exactly the sink that you want to implement. Don't bother to do that, I will probably not want to spend time to check it. (I have other things to do ) Having said that, I still think having the time step in the sink definition is wrong. Because you should not incorporate the time step in the heat source term. I don't understand your comment that you add this "to avoid error due to time step incorporation in heat source term". If you think it is fine, ok, it's your model, but I don't believe it.

 June 30, 2014, 02:45 #7 New Member   karthik Join Date: Oct 2013 Posts: 7 Rep Power: 9 Thanks Pakk. In my first post I took difference in flow time ( current time - previous time) for delta t. After going through UDF manual and forum I came to know that time step size is used for delta t.