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

segment violation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 12, 2006, 13:59
Default segment violation
  #1
Peter
Guest
 
Posts: n/a
Hello,

can anybody help me? I always get the error:segment violation. I have posted my UDF below.

Thx for help.

#include <udf.h> #include <sg.h>

void Unterprg_1(cell_t,Thread *);/*Funktionsprototypendekleration*/ void Unterprg_2(cell_t,Thread *); void Unterprg_3(double,double,cell_t,Thread *); double Kapfunkt(void);

DEFINE_ADJUST(Druckgradient_und_absolut2,d) { Domain *mixture_domain=d;

Thread *c_thread; cell_t c; thread_loop_c(c_thread,mixture_domain) {

begin_c_loop(c,c_thread)

{

Unterprg_1(c,c_thread);

Unterprg_2(c,c_thread);

}

end_c_loop(c,c_thread) } }

void Unterprg_1(cell_t c1,Thread *c1_thread) { if(C_VOF(c1,c1_thread)==1.0) { C_P(c1,c1_thread)=Kapfunkt(); printf("C_P(c,c_thread)= %4.3e \n",C_P(c1,c1_thread)); } }

void Unterprg_2(cell_t c2,Thread *c2_thread) { if((C_VOF(c2,c2_thread)<1.0)&(C_VOF(c2,c2_thread)> 0.0)) { Thread *f_thread; face_t f; int i;

c_face_loop(c2,c2_thread,i)

{

double A[ND_ND];

double ds;

double es[ND_ND];

double A_by_es;

double dr0[ND_ND]; double dr1[ND_ND];

double B[2]={0.0,1.0};

double cos_alpha;

f=C_FACE(c2,c2_thread,i);

f_thread=C_FACE_THREAD(c2,c2_thread,i);

INTERIOR_FACE_GEOMETRY(f,f_thread,A,ds,es,A_by_es, dr0,dr1);

cos_alpha=NV_DOT(A,B)/(NV_MAG(A)*NV_MAG(B));

printf("NV_DOT(A,B)= %2.4e \n",NV_DOT(A,B));

printf("cos_alpha= %2.4e \n",cos_alpha);

Unterprg_3(dr0[1],cos_alpha,c2,c2_thread);

} } }

double Kapfunkt(void) { double R; double cos_theta; double theta=(67.5/180.0)*3.14; double p;

#define r 0.35 #define sigma 0.073

cos_theta=cos(theta); R=r/cos_theta; p=((2.0*sigma)/(R/1000.0));

return p; }

void Unterprg_3(double dr0_y,double cos_alpha_2,cell_t c3,Thread *c3_thread) { if(cos_alpha_2==1.0) { C_P_G(c3,c3_thread)[1]=((-1)*Kapfunkt())/(2*dr0_y); } }

  Reply With Quote

Old   December 13, 2006, 07:55
Default Re: segment violation
  #2
RoM
Guest
 
Posts: n/a
Using the thread loop with the mixture domain returns mixture threads. These threads only store information that are common to ALL phases, so you could use for instance C_VOLUME with this thread. C_VOF wont work because Fluent does not know which phase to adress. This is probably the cause of your crash. Please read udf manual chapter 6.3 on how to perfom multiphase specific loopings.

Good luck, RoM
  Reply With Quote

Old   December 13, 2006, 10:19
Default Re: segment violation
  #3
Peter
Guest
 
Posts: n/a
Hello RoM,

thank you very much for your help. Ihave read the udf manual chapter and modified my udf. Now it is working.
  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
Problem with segment surface and meshing Silmaril ANSYS Meshing & Geometry 1 October 13, 2011 16:42
Segmentation Violation Corentin FLUENT 1 February 13, 2011 01:07
Defining Multiphase by text and by gui = different result and Segmentation Violation RPJones FLUENT 0 June 9, 2009 16:24
Access violation - Help please AlwaysLearning FLUENT 3 August 22, 2006 12:21
PHI file structure Eugene Phoenics 9 November 2, 2001 22:00


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