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

UDF Problem

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By antariksh
  • 1 Post By D.M

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 17, 2017, 04:08
Question UDF Problem
  #1
New Member
 
Antariksh Gupta
Join Date: Apr 2017
Posts: 3
Rep Power: 9
antariksh is on a distinguished road
Hello,

Please look into following UDF

#include "udf.h"
real ts1_temp;
DEFINE_EXECUTE_AT_END(temp1)
{
real ts1_coordinate[ND_ND];
real x1,y1,z1;
cell_t c;
Domain *d;
Thread *t;
x1=0.020;
y1=0.0075;
z1=0.0;
d=Get_Domain(2);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_CENTROID(ts1_coordinate,c,t);
x1=ts1_coordinate[0];
y1=ts1_coordinate[1];
z1=ts1_coordinate[2];
ts1_temp=C_T(c,t);
printf("temperature_1, %g/n", ts1_temp);
}
end_c_loop(c,t)
}
}

This UDF is being interpreted successfully but upon start of simulation fluent is giving error
Error: received a fatal signal (Segmentation fault).
Error Object: #f

Please help in resolving this problem
chaitanyaarige likes this.
antariksh is offline   Reply With Quote

Old   April 21, 2017, 02:12
Default
  #2
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
Hi
you should write the line "real ts1_temp" in the main body of your code, not out of it, or if you still want to write it there (out of the body), use static real instead of real.
the error "segmentation fault" usually happens because of a not identified parameter in the code.
let me know if it solved your problem or not.
D.M is offline   Reply With Quote

Old   April 25, 2017, 03:08
Default
  #3
New Member
 
Antariksh Gupta
Join Date: Apr 2017
Posts: 3
Rep Power: 9
antariksh is on a distinguished road
Dear Davoud,

Thanks for your reply.
I tried after changing to "static real" instead of "real"
But now while interpreting the UDF fluent is showing parse error in the line of static real ts1_temp.

Please help me with some solution.
antariksh is offline   Reply With Quote

Old   April 29, 2017, 18:05
Default Velocity UDF
  #4
New Member
 
Nitesh Kumar
Join Date: Nov 2015
Posts: 5
Rep Power: 11
NiteshNaik is on a distinguished road
hi,

I am new to UDF. can anyone please help me write a udf for the plot shown in the attachment. please help. My mail ID, nitesh_n@hotmail.com. Will be grateful
Plot.jpg
NiteshNaik is offline   Reply With Quote

Old   May 2, 2017, 05:35
Default
  #5
D.M
Member
 
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10
D.M is on a distinguished road
#include "udf.h"

DEFINE_EXECUTE_AT_END(temp1)
{
real ts1_temp;
real ts1_coordinate[ND_ND];
real x1,y1,z1;
cell_t c;
Domain *d;
Thread *t;
x1=0.020;
y1=0.0075;
z1=0.0;
d=Get_Domain(2);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_CENTROID(ts1_coordinate,c,t);
x1=ts1_coordinate[0];
y1=ts1_coordinate[1];
z1=ts1_coordinate[2];
ts1_temp=C_T(c,t);
printf("temperature_1, %g/n", ts1_temp);
}
end_c_loop(c,t)
}
}

try this , i compiled it without any errors.
antariksh likes this.
D.M is offline   Reply With Quote

Old   May 2, 2017, 05:39
Default
  #6
New Member
 
Nitesh Kumar
Join Date: Nov 2015
Posts: 5
Rep Power: 11
NiteshNaik is on a distinguished road
Quote:
Originally Posted by D.M View Post
#include "udf.h"

DEFINE_EXECUTE_AT_END(temp1)
{
real ts1_temp;
real ts1_coordinate[ND_ND];
real x1,y1,z1;
cell_t c;
Domain *d;
Thread *t;
x1=0.020;
y1=0.0075;
z1=0.0;
d=Get_Domain(2);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_CENTROID(ts1_coordinate,c,t);
x1=ts1_coordinate[0];
y1=ts1_coordinate[1];
z1=ts1_coordinate[2];
ts1_temp=C_T(c,t);
printf("temperature_1, %g/n", ts1_temp);
}
end_c_loop(c,t)
}
}

try this , i compiled it without any errors.
Hi DM
Thank u. My plot is velocity vs time. Wat changes r reqd? Or should I upload as it is

Sent from my XT1562 using CFD Online Forum mobile app
NiteshNaik is offline   Reply With Quote

Reply


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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
Problem with DPM simulation with particles injection and EXECUTE_AT_THE_END UDF. Ari Fluent UDF and Scheme Programming 4 May 31, 2016 09:51
udf loading problem santu Fluent UDF and Scheme Programming 1 May 22, 2015 16:47
Vaporization pressure UDF property problem? lehoanganh07 Fluent UDF and Scheme Programming 1 September 13, 2014 11:59
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 07:56


All times are GMT -4. The time now is 22:18.