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

Fluent udf Error: received a fatal signal (Segmentation fault)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By CeesH

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 24, 2016, 20:54
Default Fluent udf Error: received a fatal signal (Segmentation fault)
  #1
New Member
 
Join Date: Jun 2015
Posts: 10
Rep Power: 10
syble is on a distinguished road
Hello,

I am trying to write a udf that would access some boundary face values and store them in a UMD_I memory and am encountering the Error: received a fatal signal (Segmentation fault).

This is my udf:

#include "udf.h"
#include "sg.h"
#include "flow.h"
#include "unsteady.h"

/* constants for calc_AlvPPs*/
#define MO2 15.999 /* oxygen molar mass g/mol*/
#define MCO2 44.01 /* carbon dioxide molar mass g/mol*/
#define InWalZoneID 8.0 /* ID of wall on cylinder where values will be accessed */

DEFINE_EXECUTE_AT_END(calc_AlvPPs)
/* calc_AlvPPs - function name */
{
Domain *d;
Thread *t;
cell_t c;
face_t f;

real MFaO2;
real MFaCO2;
real PaO2;
real PaCO2;
real Pa = 0;
real MeanMolarMass;

d = Get_Domain(InWalZoneID);

thread_loop_f (t,d)
{
begin_f_loop (f,t)
{
Pa += F_P(f,t);
MFaCO2 = F_YI(f,t,0);
MFaO2 = F_YI(f,t,1);
MeanMolarMass = 1/(MFaCO2/MCO2 + MFaO2/MO2);

PaCO2 = Pa*MFaCO2*MeanMolarMass;
PaO2 = Pa*MFaO2*MeanMolarMass;

F_UDMI(f,t,0) = PaCO2;
F_UDMI(f,t,1) = PaO2;
}
end_f_loop (f,t)
}
}


Even when I comment out the inside of the threat_loop_f out I still get this error.
syble is offline   Reply With Quote

Old   February 25, 2016, 02:51
Default
  #2
Senior Member
 
Cees Haringa
Join Date: May 2013
Location: Delft
Posts: 607
Rep Power: 0
CeesH is on a distinguished road
Maybe a stupid remark, but did you initialize the UDMIs you are calling? A segmentation fault typically tells FLUENT tries to access a non-allocated memory location.
Ludwig Prandtl likes this.
CeesH is offline   Reply With Quote

Old   February 29, 2016, 16:44
Default
  #3
New Member
 
Join Date: Jun 2015
Posts: 10
Rep Power: 10
syble is on a distinguished road
Hi CeesH thanks for the message, I believe I had by clicking define-> user defined -> memory. There is currently two user-defined memory locations in the Fluent setup.
As I mentioned I get this error even if I comment out everything in the thread_loop_f loop.
syble is offline   Reply With Quote

Old   December 9, 2016, 16:28
Default
  #4
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
Syble,

Did you solve this? I am having similar issue and I printed some messages at different parts of the code to see where the error is being generated and saw that when I use "thread_loop_c (t,domain)" I get the error. not sure why? any idea?

Quote:
Originally Posted by syble View Post
Hello,

I am trying to write a udf that would access some boundary face values and store them in a UMD_I memory and am encountering the Error: received a fatal signal (Segmentation fault).

This is my udf:

#include "udf.h"
#include "sg.h"
#include "flow.h"
#include "unsteady.h"

/* constants for calc_AlvPPs*/
#define MO2 15.999 /* oxygen molar mass g/mol*/
#define MCO2 44.01 /* carbon dioxide molar mass g/mol*/
#define InWalZoneID 8.0 /* ID of wall on cylinder where values will be accessed */

DEFINE_EXECUTE_AT_END(calc_AlvPPs)
/* calc_AlvPPs - function name */
{
Domain *d;
Thread *t;
cell_t c;
face_t f;

real MFaO2;
real MFaCO2;
real PaO2;
real PaCO2;
real Pa = 0;
real MeanMolarMass;

d = Get_Domain(InWalZoneID);

thread_loop_f (t,d)
{
begin_f_loop (f,t)
{
Pa += F_P(f,t);
MFaCO2 = F_YI(f,t,0);
MFaO2 = F_YI(f,t,1);
MeanMolarMass = 1/(MFaCO2/MCO2 + MFaO2/MO2);

PaCO2 = Pa*MFaCO2*MeanMolarMass;
PaO2 = Pa*MFaO2*MeanMolarMass;

F_UDMI(f,t,0) = PaCO2;
F_UDMI(f,t,1) = PaO2;
}
end_f_loop (f,t)
}
}


Even when I comment out the inside of the threat_loop_f out I still get this error.
alinik is offline   Reply With Quote

Reply

Tags
fluent, segmentaion fault, thread_loop_f, udf


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
Fluent15: received a fatal signal (Segmentation fault) lcg44 FLUENT 4 August 29, 2016 12:19
FLUENT received fatal signal (ACCESS_VIOLATION) shashikant FLUENT 3 November 29, 2014 12:03
fluent 13.0.0 received a fatal signal (SEGMENTATION VIOLATION)) alinik FLUENT 1 January 9, 2014 10:21
A fatal signal (segmentation violation) sutthinan Fluent UDF and Scheme Programming 6 March 16, 2011 18:35


All times are GMT -4. The time now is 07:36.