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

Segmentation fault

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 17, 2016, 04:54
Default Segmentation fault
  #1
New Member
 
Abhiroop Bhadra
Join Date: Jul 2016
Posts: 10
Rep Power: 10
Abhiroop is on a distinguished road
Hi, I am getting a segmentation fault for this UDF, can someone help me out ?


#include "udf.h"

DEFINE_DPM_LAW(att1,p,ci)
{
Domain *d;
Thread *t;
cell_t c;
real cell_no=0;
real sum_dens;
real avg_dens;

thread_loop_c (t,d)
{

begin_c_loop_all (c,t)
{
sum_dens+= C_R(c,t);
cell_no=cell_no+1;
}
end_c_loop_all (c,t)
}

avg_dens=sum_dens/cell_no;

printf("Average density=%g\n",avg_dens);


}
Abhiroop is offline   Reply With Quote

Old   August 22, 2016, 05:42
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 Abhiroop View Post
Hi, I am getting a segmentation fault for this UDF, can someone help me out ?


#include "udf.h"

DEFINE_DPM_LAW(att1,p,ci)
{
Domain *d;
Thread *t;
cell_t c;
real cell_no=0;
real sum_dens;
real avg_dens;

thread_loop_c (t,d)
{

begin_c_loop_all (c,t)
{
sum_dens+= C_R(c,t);
cell_no=cell_no+1;
}
end_c_loop_all (c,t)
}

avg_dens=sum_dens/cell_no;

printf("Average density=%g\n",avg_dens);


}
you are pointing to the domain d but are not defining it. add the following line to your code

d = Get_Domain(1);
Bruno Machado is offline   Reply With Quote

Old   August 22, 2016, 09:50
Default
  #3
New Member
 
Abhiroop Bhadra
Join Date: Jul 2016
Posts: 10
Rep Power: 10
Abhiroop is on a distinguished road
Yeah I added that , thanks. I am having some problems compiling udfs in Windows 10. I can build them but it shows an error "libudf.dll" missing. Is anyone else getting the same error ?
Abhiroop is offline   Reply With Quote

Reply

Tags
fluent udf, fluent udf sequence


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 22:19.