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

Received a fatal signal (Segmentation fault) with UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 25, 2017, 03:17
Default Received a fatal signal (Segmentation fault) with UDF
  #1
Member
 
Join Date: Oct 2014
Posts: 43
Rep Power: 12
lisa_china is on a distinguished road
Dear all,
Here is a error when iterates with UDF to solve extra transport equations of UDS.
The error is
Quote:
Error: received a fatal signal (Segmentation fault).
By the way, there is no compile error. I am a UDF fresher and the code is written in terms of the examples given in Fluent UDF manul:
Quote:
#include "D:\Program Files\ANSYS Inc\v150\fluent\fluent15.0.0\src\udf.h"
DEFINE_UDS_UNSTEADY(mfUnsteady,c,t,i,apu,su)
{
real physical_dt, vol, rho, phi_old;
physical_dt = RP_Get_Real("physical-time-step");
vol=C_VOLUME(c,t);
rho=C_R_M1(c,t);
*apu=-rho*vol/physical_dt;/*implicit part*/
phi_old=C_STORAGE_R(c,t,SV_UDSI_M1(i));
*su = rho*vol*phi_old/physical_dt;/*explicit part*/
//printf("no error!\n");
}
DEFINE_UDS_FLUX(mfFlux,f,t,i)
{
real NV_VEC(psi),NV_VEC(A);
NV_D(psi,=,F_U(f,t),F_V(f,t),F_W(f,t));
NV_S(psi,*=,F_R(f,t));
F_AREA(A,f,t);
return NV_DOT(psi,A);
//printf("no error!\n");
}
DEFINE_DIFFUSIVITY(mfDiff,c,t,i)
{
return C_MU_T(c,t)/0.85;/*diffusivity from Sct number, needed to be tuned accordingly*/
//printf("no error!\n");
}
DEFINE_SOURCE(mfSource,c,t,dS,eqn)
{
real sourcemf;
sourcemf=0.0;
dS[eqn]=0.0;
return sourcemf;
//printf("no error!\n");
}
DEFINE_SOURCE(vrSource,c,t,dS,eqn)
{
real sourcevr,s1,s2,s3;
s1=C_UDSI_G(c,t,0)[0];
s2=C_UDSI_G(c,t,0)[1];
s3=C_UDSI_G(c,t,0)[2];
sourcevr=2.86*C_MU_T(c,t)*(s1*s1+s2*s2+s3*s3)-2.0*C_R(c,t)*C_D(c,t)*C_UDSI(c,t,1)/C_K(c,t);
dS[eqn]=-2.0*C_R(c,t)*C_D(c,t)/C_K(c,t);
return sourcevr;
//printf("no error!\n");
}
DEFINE_PROFILE(mfprofile1,t,i)
{
face_t f;
begin_f_loop(f,t)
{
F_PROFILE(f,t,i)=1;
}
end_f_loop(f,t)
}
DEFINE_PROFILE(mfprofile0,t,i)
{
face_t f;
begin_f_loop(f,t)
{
F_PROFILE(f,t,i)=0;
}
end_f_loop(f,t)
}
So is there any error in the code? or could anybody tell me how to find the reason results in the error?
Thanks in advance.
Shan

Last edited by lisa_china; April 25, 2017 at 08:41.
lisa_china is offline   Reply With Quote

Old   April 25, 2017, 08:49
Default
  #2
Member
 
Join Date: Oct 2014
Posts: 43
Rep Power: 12
lisa_china is on a distinguished road
Quote:
Originally Posted by lisa_china View Post
Dear all,
Here is a error when iterates with UDF to solve extra transport equations of UDS.
The error is
By the way, there is no compile error. I am a UDF fresher and the code is written in terms of the examples given in Fluent UDF manul:

So is there any error in the code? or could anybody tell me how to find the reason results in the error?
Thanks in advance.
Shan
I debugged the code with "Message("**")" and found that the error occurred in the Define_UDS_Flux part:
Code:
DEFINE_UDS_FLUX(mfFlux,f,t,i) 
{
real NV_VEC(psi),NV_VEC(A); 
NV_D(psi,=,F_U(f,t),F_V(f,t),F_W(f,t));
NV_S(psi,*=,F_R(f,t)); 
F_AREA(A,f,t); 
return NV_DOT(psi,A); 
//printf("no error!\n");
}
However, this part was the same as the example in Fluent UDF manual, and I don't know why it doesn't work. Since I just wanna define a default mass flow rate, finally I just choose the "mass flow rate" when define scalars in Fluent. And now, it works.
I still wanna know why with the DEFINE_UDS_FLUX it doesn't work. Could anybody help me?
Thanks for any reply.
Shan
lisa_china is offline   Reply With Quote

Old   June 30, 2017, 04:07
Default Received a fatal Signal ( Segmentation fault )
  #3
Member
 
Muhammad Furqan Ali
Join Date: Oct 2014
Location: beijing
Posts: 53
Rep Power: 12
furqanrk is on a distinguished road
Send a message via Skype™ to furqanrk
Hi everyone !

I hope you are fine. I am using UDF in VOF model in ANSYS FLUENT, although, my VOF model without UDF is running fine. The UDF is written by my friend used it successfully. He has graduated last year after getting the results from same UDF. The UDF was working well on his server. He was using Fluent 6.3 on Linux system. When I am using same case, date and UDF on my laptop the case is not running, although UDF compilation is very fine. I also check it on Linux system too. During or after initialization, Error occurred segmentation fault error. It is very strange that same case and UDF is not working on his office now. Main error occurred when I am hooking ADJUST and EXECUTE-AT-END UDFs. May be there is some problem of writing/calling style is different in Windows and Linux system with 32bit and 64bit. ( this is just my opinion).

I hope you can understand the situation and have a try to fix the problem. I would be highly thankful if you guide me that where is the problem. I can send UDF by email if needed..

Thanks in Advance,
Regards,
M. F. ALi
furqanrk 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 execute on demand udf lion1990 Fluent UDF and Scheme Programming 5 June 30, 2017 04:03
Error: udf received a fatal signal(segmentation fault) BIANBOSHEN Fluent UDF and Scheme Programming 2 February 8, 2017 04:54
fatal signal segmentation fault in a UDF hares FLUENT 6 January 21, 2017 04:26
error: FLUENT received fatal signal (ACCESS_VIOLATION) ehsan105 Fluent UDF and Scheme Programming 9 April 15, 2016 07:03
FLUENT received fatal signal (ACCESS_VIOLATION) osamaghani FLUENT 2 March 31, 2012 17:15


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