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

Error: receive a fatal signal(Segmentation fault)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 6, 2016, 03:23
Question Error: receive a fatal signal(Segmentation fault)
  #1
Member
 
Nate Lau
Join Date: Mar 2016
Posts: 33
Rep Power: 10
SNeCu is on a distinguished road
I wirte UDF to get momentum flux in x direction on a face after each iteration. However, it shows error: receive a fatal signal(Segmentation fault). Error Object: #f and it cannot continue. Could any one tell me where is the mistake(k-e, series)? Thanks.
#include "udf.h"
DEFINE_EXECUTE_AT_END(momentumxflux)
{
real mf=0;
Domain *d;
Thread *t;
face_t f;
thread_loop_f(t,d)
{
begin_f_loop(f,t)
mf+=F_FLUX(f,t)*F_U(f,t);
end_f_loop(f,t)
}
printf("Momentum flux on this face is: %g\n", mf);
}
SNeCu is offline   Reply With Quote

Old   March 6, 2016, 14:57
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
Quote:
Originally Posted by SNeCu View Post
I wirte UDF to get momentum flux in x direction on a face after each iteration. However, it shows error: receive a fatal signal(Segmentation fault). Error Object: #f and it cannot continue. Could any one tell me where is the mistake(k-e, series)? Thanks.
#include "udf.h"
DEFINE_EXECUTE_AT_END(momentumxflux)
{
real mf=0;
Domain *d;
Thread *t;
face_t f;
thread_loop_f(t,d)
{
begin_f_loop(f,t)
mf+=F_FLUX(f,t)*F_U(f,t);
end_f_loop(f,t)
}
printf("Momentum flux on this face is: %g\n", mf);
}
Since you are not hooking it in any boundary, I think you gotta define the value of the thread. Have a look in your case file and change your code in order to match this new face thread value.
Bruno Machado is offline   Reply With Quote

Old   March 7, 2016, 07:33
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by Bruno Machado View Post
Since you are not hooking it in any boundary, I think you gotta define the value of the thread. Have a look in your case file and change your code in order to match this new face thread value.
Yes. This.

Two relevant lines from the code:

Code:
Domain *d;
The line above means: reserve variable "d" to contain a pointer a domain.

Code:
thread_loop_f(t,d)
This means: loop through all threads in domain "d". But what is domain "d"? You didn't specify it yet! This is causing your program to crash.

And actually, you don't want to loop through all threads. You want to have only one thread: the face that you are interested in. You need to find a way to specify this face, look in the help for this.
pakk is offline   Reply With Quote

Old   March 15, 2016, 22:16
Default
  #4
Member
 
Nate Lau
Join Date: Mar 2016
Posts: 33
Rep Power: 10
SNeCu is on a distinguished road
Yes, I revised the code and it works! Thank you.
SNeCu is offline   Reply With Quote

Reply

Tags
fluent - udf, fluent 14 to fluent 15., momentum, segmentation fault, udf and programming


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
fluentError: received a fatal signal (Segmentation fault). thomaszhangjing Fluent UDF and Scheme Programming 11 January 13, 2021 09:37
a fatal signal (segmentation fault) Turbo_hrf Fluent UDF and Scheme Programming 4 September 14, 2017 09:35
Fluent error: Fatal error (Segmentation fault) shufang FLUENT 2 April 20, 2015 07:06
receive fluent received a fatal signal (Segmentation fault). chenkaiqe FLUENT 2 March 10, 2015 08:21
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 15:16


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