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

UDF "Define_On_Demand" error: "Segmentation Violation"

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By pakk
  • 1 Post By upeksa
  • 1 Post By upeksa
  • 1 Post By upeksa

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   February 3, 2015, 03:23
Default UDF "Define_On_Demand" error: "Segmentation Violation"
  #1
Member
 
Anh
Join Date: Sep 2014
Posts: 69
Rep Power: 11
dinhanh is on a distinguished road
Hi, Fluent UDF user,

This is the same question as previous thread: Hooking On_Demand error.
I re-wrote new code, the compiler and loading UDF is OK. But when the code hooked, It showed the proplem as in the picture below (pic.12 is the compiler successful, pic.11 is the error).

Could you please help me solve this problem??

Thank you very much.

#include "udf.h"
#include "math.h"

DEFINE_ON_DEMAND(contour)
{
Domain *d;
Thread *t;
cell_t c;
Node *v;
d=Get_Domain(1);
int i,j,k,n,m;
real dx,dy,dz,delta,Cdes=0.65,Lt,Ldes;
thread_loop_c(t,d) /*loops over all cell threads in domain*/
{
begin_c_loop(c,t) /* loops over cells in a cell thread */
{
c_node_loop(c,t,n) /* loops over node in a cell thread */
{
v=C_NODE(c,t,n);
NODE_MARK(v)=0;
}
}
end_c_loop(c,t)

begin_c_loop(c,t) /* loops over cells in a cell thread */
{
k=C_NNODES(c,t);
real x[k],y[k],z[k];
real delx1=0,dely1=0,delz1=0;
for (m=0;m<=k;m++)
{
c_node_loop(c,t,n) /* loops over node in a cell thread */
{
v=C_NODE(c,t,n);
x[m]=NODE_X(v);
y[m]=NODE_Y(v);
z[m]=NODE_Z(v);
if (NODE_MARK(v)==0)
NODE_MARK(v)=1;
}
}
for (i=0;i<=k;i++)
{
for (j=0;j<=k;j++)
{
dx=MAX(delx1,fabs(x[i]-x[j]));
dy=MAX(dely1,fabs(y[i]-y[j]));
dz=MAX(delz1,fabs(z[i]-z[j]));
delta=MAX(dx,dy);
delta=MAX(delta,dz);
}
}
Lt=sqrt(C_K(c,t))/0.09/C_O(c,t);
Ldes=Cdes*delta;
if(Lt>Ldes)
{
C_UDMI(c,t,1)=1;
}
if(Lt<=Ldes)
{
C_UDMI(c,t,1)=0;
}
}
end_c_loop(c,t)
}
}
Attached Images
File Type: jpg 11.jpg (28.6 KB, 12 views)
File Type: jpg 12.jpg (32.4 KB, 12 views)
dinhanh is offline   Reply With Quote

 


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
specified shear at wall - temperature gradient - UDF - access violation error senD Fluent UDF and Scheme Programming 9 September 18, 2014 07:29
UDF for Mass Flow at the Outlet: ERROR ACCESS VIOLATION I-mech Fluent UDF and Scheme Programming 1 May 23, 2014 12:37
udf segmentation violation when hooked jjchristophe Fluent UDF and Scheme Programming 9 June 25, 2012 05:46
udf error : access violation butterfly007 Fluent UDF and Scheme Programming 2 June 1, 2012 11:01
UDF Access violation therandomestname FLUENT 0 April 15, 2011 17:31


All times are GMT -4. The time now is 18:56.