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

Segmentation fault during VoF simulation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2015, 07:25
Post Segmentation fault during VoF simulation
  #1
Member
 
Rafal
Join Date: Aug 2013
Location: CK
Posts: 36
Rep Power: 12
vekh is on a distinguished road
Hello. I have problem with my UDF for 2d case.
I want to get phase level at certain area/volume to define boundary between phases. I wrote simple UDF:
Code:
#include <udf.h>
# define r 0.0004
# define x0 0.002
# define y0 0.002
FILE *fout;

DEFINE_SOURCE(my_source, cell, thread, dS, eqn) 
{ 
  real x[ND_ND]; 
  real source, xc, yc, prom;

  Thread *tm = THREAD_SUPER_THREAD(thread); 
  Thread **pt = THREAD_SUB_THREADS(tm); 

  xc=x[0];
  yc=x[1]; 
  prom = sqrt(pow((xc-(x0)),2));

  if ((prom <= r)&&(C_VOF(cell, pt[1])<1))
  {
    fout=fopen("test.dat","a+");
    fprintf(fout,"%f\n",xc);
    fclose(fout);  
  }

source=1;
dS[eqn] =0; 
return source; 
}
and I've compiled it. But after first iteration Fluent returns:
Quote:
Error: received a fatal signal (Segmentation fault).
Function my_source if hooked at Cell Zone/Source Terms/Energy.
I'm quite new to all VoF things so I need some help to start. Thanks in advance!
vekh is offline   Reply With Quote

Old   May 29, 2015, 06:31
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Move the line of code "FILE *fout;" to within the DEFINE_SOURCE macro. If the error persists, try simplifying your code until you determine the problem line (or print text to the screen using Message(); every few lines for debugging).
`e` is offline   Reply With Quote

Reply


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
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 4 May 2, 2017 21:59
Using VOF model and Lagrangian Multiphase in the same simulation ganesh_krishnan STAR-CCM+ 2 March 17, 2017 01:34
Fluent error: Fatal error (Segmentation fault) shufang FLUENT 2 April 20, 2015 07:06
[OpenFOAM] Segmentation fault with paraFoam and paraview 3.6.1 on Fedora 11 32 and 64 bit nanes ParaView 2 September 11, 2009 09:12
segmentation fault usker Siemens 5 March 5, 2007 23:14


All times are GMT -4. The time now is 21:33.