|
[Sponsors] |
May 26, 2015, 08:25 |
Segmentation fault during VoF simulation
|
#1 | |
Member
Rafal
Join Date: Aug 2013
Location: CK
Posts: 36
Rep Power: 13 |
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; } Quote:
I'm quite new to all VoF things so I need some help to start. Thanks in advance! |
||
May 29, 2015, 07:31 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
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).
|
|
|
|
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 22:59 |
Using VOF model and Lagrangian Multiphase in the same simulation | ganesh_krishnan | STAR-CCM+ | 2 | March 17, 2017 02:34 |
Fluent error: Fatal error (Segmentation fault) | shufang | FLUENT | 2 | April 20, 2015 08:06 |
[OpenFOAM] Segmentation fault with paraFoam and paraview 3.6.1 on Fedora 11 32 and 64 bit | nanes | ParaView | 2 | September 11, 2009 10:12 |
segmentation fault | usker | Siemens | 5 | March 6, 2007 00:14 |