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

Issue inside DEFINE_SOURCE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2023, 01:38
Exclamation Issue inside DEFINE_SOURCE
  #1
Member
 
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6
Cooper24 is on a distinguished road
Hi. I have written a UDF for my source terms in energy equation. The part of the UDF inside DEFINE_SOURCE is:


if (r2 < R2 && myid == C_PART(c,sec_th)) // line 1
{
l = round((x[0] - sp[0] + R)/dz);
m = round((x[1] - sp[1] + R)/dz);
source = 1.0;
dS[eqn] = 0.0;
C_UDMI(c,t,7) = 1.0;
C_UDMI(c,t,8) = source;
}
else
{
source = 0.0;
C_UDMI(c,t,8) = source;
C_UDMI(c,t,7) = 0.0;
dS[eqn] = 0.0;
}
return source;


When I am using the if condition of line 1 and using C_UDMI(c,t,7) and C_UDMI(c,t,8) values in CFD-Post for plotting, it works fine. The values of these two UDMIs go from 0 to 1.


But when I am using the following UDF, the maximum values of UDMIs 7 and 8 is reduced by half in CFD-Post. They go from 0 to 0.5. I am unable to understand what is the issue.



if (r2 < R2 && myid == C_PART(c,sec_th)) // line 1
{
l = round((x[0] - sp[0] + R)/dz);
m = round((x[1] - sp[1] + R)/dz);

if( x[2] - (sp[2] - Hlaser[l][m]) <= 0.05*dz && x[2] - (sp[2] - Hlaser[l][m]) >= -0.1*dz) // line 2
{
source = 1.0;
dS[eqn] = 0.0;
C_UDMI(c,t,7) = 1.0;
C_UDMI(c,t,8) = source;
}
else
{
source = 0.0;
C_UDMI(c,t,8) = source;
C_UDMI(c,t,7) = 0.0;
dS[eqn] = 0.0;
}
}
else
{
source = 0.0;
C_UDMI(c,t,8) = source;
C_UDMI(c,t,7) = 0.0;
dS[eqn] = 0.0;
}
return source;


Can someone please help!! Thanks in advance.
Cooper24 is offline   Reply With Quote

Reply

Tags
define_source udf


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
Convergence issue in natural convection problem chrisf90 FLUENT 5 March 5, 2016 09:30
Meshing related issue in Flow EFD appu FloEFD, FloWorks & FloTHERM 1 May 22, 2011 09:27
Modelling the Heat flow inside the curing oven Marios Vlad CFX 1 February 6, 2008 08:11
meshing F1 front wing Steve FLUENT 0 April 17, 2003 13:37
How to determine a point is inside a tetrahedral? G.P. Xia Main CFD Forum 16 January 12, 2000 12:15


All times are GMT -4. The time now is 09:28.