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

how can I get rid of segmentation fault

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2016, 13:37
Default how can I get rid of segmentation fault
  #1
New Member
 
LR
Join Date: Sep 2014
Posts: 6
Rep Power: 12
sabuj is on a distinguished road
Send a message via Skype™ to sabuj
I am a newbie in ANSYS FLUENT. So, a lot of things still make no sense to me. I have been browsing various sources for past 3/4 days for the issue but to no avail.

I have a very simple 3D geometry of a rectangular channel and I am trying to use a temperature dependent density function and use a udf. The geometry has only inlet, outlet and wall. The code:

#include "udf.h"

DEFINE_PROPERTY(density,c,t)
{
real rho_w, rho_f, rho_p;
real ci=0.01;
real temp = C_T(c,t);
rho_w = 838.466+1.4*temp-.003*temp*temp;
rho_p = 750./(0.001*(temp-319.15)+1.);
rho_f = ci*rho_p+(1-ci)*rho_w;
return rho_f;
}

Now although I can interpret this code, I keep getting 'segmentation fault' error.

Some questions have raised in my mind:

1) Is my code correct? does this thread pointer (t) represent the whole fluid domain?
2) Why do I keep getting this error?
3) If I replace those temperature dependent functions with some constants, the simulation runs and does not show the error message.

Someone please help me with the code.

Last edited by sabuj; July 1, 2016 at 13:29.
sabuj is offline   Reply With Quote

Old   July 1, 2016, 07:34
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by sabuj View Post
I am a newbie in ANSYS FLUENT. So, a lot of things still make no sense to me. I have been browsing various sources for past 3/4 days for the issue but to no avail.

I have a very simple 3D geometry of a rectangular channel and I am trying to use a temperature dependent density function and use a udf. The geometry has only inlet, outlet and wall. The code:

#include "udf.h"

DEFINE_PROPERTY(density,c,t)
{
real rho_w, rho_f, rho_p;
real ci=0.01;
real temp = C_T(c,t);
rho_w = 838.466+1.4*temp-.003*temp*temp;
rho_p = 750./(0.001*(temp-319.15)+1.);
rho_f = ci*rho_p+(1-ci)*rho_w;
return rho_f;
}

Now although I can interpret this code, I keep getting 'segmentation fault' error.

Some questions have raised in my mind:

1) Is my code correct? does this thread pointer (t) represent the whole fluid domain?
2) Why do I keep getting this error?
3) If I replace those temperature dependent equations with some constant values, the simulation runs and does not show the error message.

Someone please help me with the code.
did you enable energy equation?
Bruno Machado is offline   Reply With Quote

Old   July 1, 2016, 13:30
Default
  #3
New Member
 
LR
Join Date: Sep 2014
Posts: 6
Rep Power: 12
sabuj is on a distinguished road
Send a message via Skype™ to sabuj
Yes, Mr. Bruno. I enabled the energy equation. I am using FLUENT 15.0
sabuj is offline   Reply With Quote

Old   July 2, 2016, 09:53
Default
  #4
AHF
Member
 
AHF's Avatar
 
amirhossein
Join Date: Jul 2014
Location: Canada
Posts: 81
Rep Power: 12
AHF is on a distinguished road
Quote:
Originally Posted by sabuj View Post
I am a newbie in ANSYS FLUENT. So, a lot of things still make no sense to me. I have been browsing various sources for past 3/4 days for the issue but to no avail.

I have a very simple 3D geometry of a rectangular channel and I am trying to use a temperature dependent density function and use a udf. The geometry has only inlet, outlet and wall. The code:

#include "udf.h"

DEFINE_PROPERTY(density,c,t)
{
real rho_w, rho_f, rho_p;
real ci=0.01;
real temp = C_T(c,t);
rho_w = 838.466+1.4*temp-.003*temp*temp;
rho_p = 750./(0.001*(temp-319.15)+1.);
rho_f = ci*rho_p+(1-ci)*rho_w;
return rho_f;
}

Now although I can interpret this code, I keep getting 'segmentation fault' error.

Some questions have raised in my mind:

1) Is my code correct? does this thread pointer (t) represent the whole fluid domain?
2) Why do I keep getting this error?
3) If I replace those temperature dependent functions with some constants, the simulation runs and does not show the error message.

Someone please help me with the code.
some points :
use another name for temperature instead of "temp" , like "z" or any thing else

the path that you save your udf , should not have space in directory address .
for example
//c:new folder is wrong
//c:newfolder is right

and other thing is that why you use "." in this line :
rho_p = 750./(0.001*(temp-319.15)+1.);

after 750 and after 1 ?
AHF is offline   Reply With Quote

Old   July 3, 2016, 06:46
Default
  #5
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
Hi Sabuj,
i just checked your UDF and both interpret and compile worked well with it and nothing appeard as an error. (my geometry was just a fluid zone)
if u got fluid and solid in your geometry i think u should some how specify your fluid zone in your udf (i mean specify t) like:

if (FLUID_THREAD_P(t))
{
....
}
D.M is offline   Reply With Quote

Reply

Tags
udf density


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 running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 4 May 2, 2017 22:59
ABL use of fixed shear stress leads to segmentation fault 11 cristopf OpenFOAM Running, Solving & CFD 1 December 23, 2016 17:57
Segmentation fault when running in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 8, 2015 09:12
Segmentation Fault w/ compiled OF 2.2.0 - motorBike example sudo OpenFOAM Running, Solving & CFD 3 April 2, 2013 18:27
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 16:06


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