|
[Sponsors] |
December 9, 2015, 01:05 |
udf for source term
|
#1 |
New Member
Join Date: Dec 2015
Posts: 11
Rep Power: 11 |
Good morning,
Please help me to write a UDF program for calculate the source term This source code calculation value of the source term to account for the phase change phenomenon of a material. As the temperature increases (T (t) > T (t-delta t) the material absorbs heat, so the source term is negative. And decreasing temperature (T (t) <T (t-delta t) the material releases heat, so the source term is positive and finally if the temperature remains constant (T (t) = T (t-delta t) the source term equal to the previous value (source at t - delta t). This code takes into account the hysteresis of a no pure phase change material. That is to say, the source term is different during the heat absorption and release of heat. This source term is written as a polynomial equation (Source = A * T + B). I inform you that I code is compiled during simulation but there is the following error: Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () This error is caused that this problem does not recognize the temperature at time t delta-t. #include "udf.h" DEFINE_SOURCE(terme_source, c, t, dS, eqn) { real source; real sourrce_previous; /*sourrce_previous= source at t-delta t */ if (C_T(c,t)>C_T_M1(c,t)) source = -5*C_T(c,t)-25; else if (C_T(c,t)<C_T_M1(c,t)) source = 8*C_T(c,t)+15; else source = sourrce_previous; dS[eqn]=0; return source; } |
|
December 10, 2015, 08:20 |
|
#2 |
Senior Member
Join Date: Nov 2010
Posts: 103
Rep Power: 16 |
I think the reason you are getting ACCESS VIOLATION error is that you haven't initialized the source_previous variable.
|
|
September 15, 2017, 04:50 |
|
#3 |
New Member
maziyar ghanikolahloo
Join Date: Jan 2017
Posts: 5
Rep Power: 9 |
Hello
I want to write a negative source term or heat flux UDF which has a linear relation with temperature I am very beginner in UDF could you help me? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF | acasas | CFD Freelancers | 1 | January 23, 2015 08:26 |
UDF for momentum source term | Tanmay_Dutta | Fluent UDF and Scheme Programming | 0 | December 6, 2014 07:24 |
UDF sink term | pichai | FLUENT | 0 | October 20, 2010 02:07 |
UDF Source Term | Christian | FLUENT | 4 | August 1, 2009 06:53 |
UDF Source Term Units? | Brian | FLUENT | 1 | October 24, 2005 10:15 |