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

Cell Zone Segmentation Access Violation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 9, 2014, 10:46
Default Cell Zone Segmentation Access Violation
  #1
New Member
 
Join Date: Aug 2014
Posts: 3
Rep Power: 3
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

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access cell face center / cell vertices lichmaster OpenFOAM Programming & Development 7 May 31, 2014 02:31
Setting cell variable values in a fluid zone using UDF eromon84 Fluent UDF and Scheme Programming 5 October 15, 2013 05:16
Udf segmentation violation dany_@ Fluent UDF and Scheme Programming 2 July 23, 2013 05:00
Segmentation Fault in fluent3DMeshToFoam cwang5 OpenFOAM Bugs 23 April 13, 2011 15:37
Cells with t below lower limit Purushothama CD-adapco 2 May 31, 2010 21:58


All times are GMT -4. The time now is 17:54.