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

udf for source term

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 9, 2015, 00:05
Default udf for source term
  #1
New Member
 
Join Date: Dec 2015
Posts: 11
Rep Power: 10
fersim is on a distinguished road
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;
}
fersim is offline   Reply With Quote

Old   December 10, 2015, 07:20
Default
  #2
Sun
Senior Member
 
Sun's Avatar
 
Join Date: Nov 2010
Posts: 103
Rep Power: 15
Sun is on a distinguished road
I think the reason you are getting ACCESS VIOLATION error is that you haven't initialized the source_previous variable.
Sun is offline   Reply With Quote

Old   September 15, 2017, 03:50
Default
  #3
New Member
 
maziyar ghanikolahloo
Join Date: Jan 2017
Posts: 5
Rep Power: 9
maziyarghani is on a distinguished road
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?
maziyarghani is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


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 07:26
UDF for momentum source term Tanmay_Dutta Fluent UDF and Scheme Programming 0 December 6, 2014 06:24
UDF sink term pichai FLUENT 0 October 20, 2010 01:07
UDF Source Term Christian FLUENT 4 August 1, 2009 05:53
UDF Source Term Units? Brian FLUENT 1 October 24, 2005 09:15


All times are GMT -4. The time now is 04:44.