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

Cell Zone Segmentation Access Violation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2014, 11:46
Default Cell Zone Segmentation Access Violation
  #1
New Member
 
Join Date: Aug 2014
Posts: 3
Rep Power: 12
Exodiah is on a distinguished road
Hi, I have a UDF for a translating mesh. My code compiles and loads with no errors. But hooking the code into the cell zone, specifically into the translation velocity field, will yield a Segmentation Violation error. The code is pasted below.


--------------------------------------------------------------------
#include "udf.h"
#include "mem.h"

#define pi M_PI

static real vel=0.0;


DEFINE_TRANSIENT_PROFILE(trans,time)
{
real fx = 0.0; /* init drag force */
real vol = 0.5*pi*0.025*1*5; /* vol of wing */
real sigma = 2.55; /* specific gravity of wing material */
real mass = 1000*sigma*vol; /* mass of wing */
real dvel;
real NV_VEC(A);

face_t f;
Thread *t;
Domain *d;

/* single phase domain is 1, wing zone is 6 */
d = Get_Domain(1);
t = Lookup_Thread(d, 6);
if(NULL == d) Error("Something wrong with your domain id!\n");
if(NULL == t) Error("Something wrong with your thread id!\n");


/* sum of drag forces */
if (NULL != t)
{
begin_f_loop(f,t)
{
F_AREA(A,f,t);
fx += F_P(f,t)*A[0]+F_STORAGE_R_N3V(f,t,SV_WALL_SHEAR)[0];
}
end_f_loop(f,t)

/* acceleration */
dvel=fx/mass;

/* new translational velocity */
vel+=dvel*CURRENT_TIMESTEP;
}

return vel;
}
--------------------------------------------------------------------


The problem with the code is the line "fx+= ... ". Commenting out this line will not produce an error during hooking.

Please kindly advise.

I have not been able to find any solution in this forum - if there is please kindly point me to it.
Exodiah is offline   Reply With Quote

Reply

Tags
cell zone, segmentation error


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
Setting cell variable values in a fluid zone using UDF eromon84 Fluent UDF and Scheme Programming 6 March 28, 2021 12:59
Access cell face center / cell vertices lichmaster OpenFOAM Programming & Development 7 May 31, 2014 03:31
Udf segmentation violation dany_@ Fluent UDF and Scheme Programming 2 July 23, 2013 06:00
Segmentation Fault in fluent3DMeshToFoam cwang5 OpenFOAM Bugs 23 April 13, 2011 16:37
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 22:58


All times are GMT -4. The time now is 03:12.