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 when execute on demand udf

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By upeksa

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 8, 2015, 22:15
Default Segmentation fault when execute on demand udf
  #1
New Member
 
Dantong Shi
Join Date: Nov 2015
Posts: 6
Rep Power: 10
lion1990 is on a distinguished road
Hello,

I'm calculating dimensionless temperature using a udf (shown in the following). After I interpreted it, I click the execute on demand. Then the error appear. It says "Segmentation fault". I don't know how to solve it? Where is the fault in my udf?
The following is my udf.

Thanks!

#include "udf.h"

DEFINE_ON_DEMAND(dimentionless_temperature)
{
Domain *d;
real dimentionless_t;
real twall = 400;
real temp;
real xmin = 0;
real xmax = 0.2667;
real deltax = 0.01;
//int n= (xmax-xmin)/deltax;
real tbulk[27];
Thread *t;
cell_t c;
real x[ND_ND];
int i;
C_CENTROID(x,c,t);
d = Get_Domain(1); /* Get the domain using ANSYS Fluent utility */

thread_loop_c(t,d)
{
for(i=0; i<=26; i++)
{
begin_c_loop(c,t)
{
if (x[0]>=xmin+i*deltax && x[0]<=xmin+(i+1)*deltax)
{tbulk[i] += (C_T(c,t)*C_U(c,t)*C_VOLUME(c,t))/(C_U(c,t)*C_VOLUME(c,t));
temp = C_T(c,t);
dimentionless_t = (temp-twall)/(tbulk[i]-twall);
C_UDMI(c,t,0) = (temp-twall)/(tbulk[i]-twall);
}
end_c_loop(c,t)
}
}
}
}
lion1990 is offline   Reply With Quote

Old   November 9, 2015, 03:36
Default
  #2
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
When you write C_CENTROID(x,c,t);, neither c nor t are initialized.

C_CENTROID(x,c,t); must be included in the loop of cells, such as:

d = Get_Domain(1); /* Get the domain using ANSYS Fluent utility */

thread_loop_c(t,d)
{
for(i=0; i<=26; i++)
{
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
if ((x[0]>=xmin+i*deltax) && (x[0]<=xmin+(i+1)*deltax))//better write more parentheses
{tbulk[i] += (C_T(c,t)*C_U(c,t)*C_VOLUME(c,t))/(C_U(c,t)*C_VOLUME(c,t));
temp = C_T(c,t);
dimentionless_t = (temp-twall)/(tbulk[i]-twall);
C_UDMI(c,t,0) = (temp-twall)/(tbulk[i]-twall);
}
end_c_loop(c,t)
}
}
lion1990 likes this.
upeksa is offline   Reply With Quote

Old   November 9, 2015, 10:29
Default
  #3
New Member
 
Dantong Shi
Join Date: Nov 2015
Posts: 6
Rep Power: 10
lion1990 is on a distinguished road
Thank you for your help. I revised the udf as you suggested. Then I interpreted it and execute on demand. Another error appear.

It says:
Node 0: Process 7280: Recieved signal SIGSEGV.
Node 1: Process 7288: Recieved signal SIGSEGV.

MPI Application rank 1 exited before MPI_finalize() with status 2
The f1 process could not be started.

Fatal error in one of the compute processes.

Do you know what's wrong this time?

Thank you very much!
lion1990 is offline   Reply With Quote

Old   November 16, 2015, 08:20
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
If you are working in parallel, first try to get it working in serial. Only if that works, go to parallel.
pakk is offline   Reply With Quote

Old   June 19, 2017, 05:20
Default
  #5
Member
 
Shravan
Join Date: Mar 2017
Posts: 60
Rep Power: 9
Severus is on a distinguished road
Hello,
I dont know if this might help you now. But usually we get segmentation error in UDM when we have used it in a UDF but havent set the number of UDMs in fluent GUI.

When we compile a UDF in which we use a UDM, before compiling we should go to DEFINE->User Defined->Memory and Set the number as you wish
Just make sure you have done this before clicking Execute on Demand. Thanks
Severus is offline   Reply With Quote

Old   June 30, 2017, 03:03
Default Received a fatal Signal ( Segmentation fault )
  #6
Member
 
Muhammad Furqan Ali
Join Date: Oct 2014
Location: beijing
Posts: 53
Rep Power: 11
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

Tags
execute on demand, fluent, segmentation fault, 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
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 4 May 2, 2017 21:59
Segmentation fault when running in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 8, 2015 08:12
execute on demand --> (segmentation fault) fasc6813 Fluent UDF and Scheme Programming 1 June 6, 2014 02:27
Segmentation Fault w/ compiled OF 2.2.0 - motorBike example sudo OpenFOAM Running, Solving & CFD 3 April 2, 2013 17:27
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 15:06


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