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

Udf segmentation violation

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 30, 2013, 12:04
Default Udf segmentation violation
  #1
New Member
 
Leonidas Siozos-Rousoulis
Join Date: Jan 2013
Location: Brussels, Belgium
Posts: 10
Rep Power: 4
leonidassr is on a distinguished road
Hello people,

I'm trying to write down a simple UDF which will calculate the pressure time derivative for each cell and time step and will also assign a zero value to the z velocity. The pressure time derivative and z-velocity value will also be saved as two new variables.
I managed to compile and hook the function. However, when running the calculation I always get a SEGMENTATION VIOLATION and the simulation is terminated.

The UDF I have coded is the following:

/********************/
#include "udf.h"
#include "mem.h"

DEFINE_ADJUST(dp_dt_uzero,d)
{
Thread *t;
cell_t c;
real p1, p2, dt=0.05;

thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
/* Read pressure from previous and second previous time steps */
p1 = C_P_M1(c,t);
p2 = C_P_M2(c,t);
C_UDMI(c,t,0) = (p1 - p2) / (dt);

/* Assign value zero to uz */
C_UDMI(c,t,1) = 0.;
}
end_c_loop(c,t)
}
}
/********************/

Should I have looping in cells and threads?
I tried without the loops and still have the same problem.

Additionally, I am running in parallel. Might the code need to be parallelized?

Thanks!
leonidassr is offline   Reply With Quote

Reply

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
Udf segmentation violation dany_@ Fluent UDF and Scheme Programming 2 July 23, 2013 05:00
UDF segmentation violation error be89 Fluent UDF and Scheme Programming 1 December 21, 2012 04:07
DPM UDF - Segmentation Violation & Stack Backtrace Prashanth Fluent UDF and Scheme Programming 4 July 10, 2012 10:39
udf segmentation violation when hooked jjchristophe Fluent UDF and Scheme Programming 9 June 25, 2012 05:46
udf wall distance segmentation violation gento FLUENT 0 March 6, 2008 14:24


All times are GMT -4. The time now is 01:53.