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

An error occurs after initialized FLuent loaded UDF.

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2017, 05:52
Default An error occurs after initialized FLuent loaded UDF.
  #1
New Member
 
DENG Weriping
Join Date: Jun 2015
Posts: 16
Rep Power: 10
wpdeng is on a distinguished road
1, When I compiled my UDFs, it didn't show any error. But after initialized Fluent, an error occurs.

2, Error: received a fatal signal (segmentation fault).


3, /*My UDF is about the fluid properties depending on temperatures.*/
/* my_density */
#include "udf.h"
double Tm1[2] = {
293.15 ,
294.15
};

double D[2] = {
0.16632 ,
0.03831
};
DEFINE_PROPERTY(my_density,c,t)
{
int i;
double density;
double temp = C_T(c,t);
if(temp <= Tm1[0]) density = D[0];
else if(temp > Tm1[1]) density = D[1];
else
{
for(i = 0;i <1;i++)
{
if(temp > Tm1[i] && temp <= Tm1[i+1])
density = D[i] + (temp - Tm1[i]) * (D[i+1] - D[i]) / (Tm1[i+1] - Tm1[i]);
}
}
return density;
}

4, Help me, Please! I really want to solve this problem quickly.
wpdeng is offline   Reply With Quote

Old   March 29, 2017, 07:39
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
First initialize, then load the UDF.
kmou likes this.
pakk is offline   Reply With Quote

Old   March 29, 2017, 08:01
Default initialize first?
  #3
New Member
 
DENG Weriping
Join Date: Jun 2015
Posts: 16
Rep Power: 10
wpdeng is on a distinguished road
Quote:
Originally Posted by pakk View Post
First initialize, then load the UDF.

My UDF is the properties of the fluid.
If initialize first, how to define the properties?
wpdeng is offline   Reply With Quote

Old   March 29, 2017, 08:13
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
That does not really matter, but if possible do something close to your expected result. Define it for example with a uniform density based on a typical temperature in your problem.
pakk is offline   Reply With Quote

Old   March 29, 2017, 10:30
Default Thanks!
  #5
New Member
 
DENG Weriping
Join Date: Jun 2015
Posts: 16
Rep Power: 10
wpdeng is on a distinguished road
Quote:
Originally Posted by pakk View Post
That does not really matter, but if possible do something close to your expected result. Define it for example with a uniform density based on a typical temperature in your problem.

Really really thank you! I tried the method you told, the fluent can running!
wpdeng is offline   Reply With Quote

Old   April 6, 2017, 04:46
Default I am also facing the same error
  #6
New Member
 
Karthikeyan
Join Date: Nov 2016
Posts: 14
Rep Power: 9
kar1209 is on a distinguished road
I am getting the "received a fatal signal (segmentation fault)" error. Is it because the function is not able to access the previous timestep values using F_U_M1 and C_U_M1?
Code:
#include"udf.h"
DEFINE_PROFILE(CBC_u_vel,t,i)
{
real u_f_old, u_c_old, u_temp, u_cor, mass_out = 0, ds;
real x[ND_ND], y[ND_ND];
Thread *nt;
face_t f;
cell_t c, nc;
begin_f_loop(f,t)
{
mass_out+=F_FLUX(f,t);
}
end_f_loop(f,t)
u_cor = (20 - mass_out)/20;
begin_f_loop(f,t)
{
nc = F_C0(f,t);
nt = THREAD_T0(t);
F_CENTROID(x,f,t);
C_CENTROID(y,nc,nt);
ds = x[0] - y[0];
u_f_old = F_U_M1(f,t);
u_c_old = C_U_M1(nc,nt);
u_temp = u_f_old - CURRENT_TIMESTEP*(u_f_old - u_c_old)/ds;
F_PROFILE(f,t,i) = u_temp + u_cor;
}
end_f_loop(f,t)
}
The UDF manual says:
Quote:
Note that data from C_T_M1 is available only if user-defined scalars are defined.
How do I define and use user-defined scalars to access data using C_U_M1 in my program?

Any help would be appreciated.
kar1209 is offline   Reply With Quote

Old   April 6, 2017, 21:41
Default Don't worry about the error!
  #7
New Member
 
DENG Weriping
Join Date: Jun 2015
Posts: 16
Rep Power: 10
wpdeng is on a distinguished road
Quote:
Originally Posted by kar1209 View Post
I am getting the "received a fatal signal (segmentation fault)" error. Is it because the function is not able to access the previous timestep values using F_U_M1 and C_U_M1?
Code:
#include"udf.h"
DEFINE_PROFILE(CBC_u_vel,t,i)
{
real u_f_old, u_c_old, u_temp, u_cor, mass_out = 0, ds;
real x[ND_ND], y[ND_ND];
Thread *nt;
face_t f;
cell_t c, nc;
begin_f_loop(f,t)
{
mass_out+=F_FLUX(f,t);
}
end_f_loop(f,t)
u_cor = (20 - mass_out)/20;
begin_f_loop(f,t)
{
nc = F_C0(f,t);
nt = THREAD_T0(t);
F_CENTROID(x,f,t);
C_CENTROID(y,nc,nt);
ds = x[0] - y[0];
u_f_old = F_U_M1(f,t);
u_c_old = C_U_M1(nc,nt);
u_temp = u_f_old - CURRENT_TIMESTEP*(u_f_old - u_c_old)/ds;
F_PROFILE(f,t,i) = u_temp + u_cor;
}
end_f_loop(f,t)
}
The UDF manual says:


How do I define and use user-defined scalars to access data using C_U_M1 in my program?

Any help would be appreciated.

I don't know your UDFs, maybe you can check carefully by yourself.

But if you cannot running the Fluent, you can try the method, which using a constant velocity to initialize the Fluent and then load your UDFs to running the Fluent.

Maybe your problems can be solved. If cannot, you can ask for help to others.
wpdeng is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Problem running fluent with udf on batch tobi b. Fluent UDF and Scheme Programming 3 April 14, 2016 13:54
implementing UDF for fluent in workbench for running multiple simulations faizan_habib7 Fluent UDF and Scheme Programming 0 March 18, 2016 22:29
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 13:41
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 10:16
UDF of Zimont model in fluent Z Main CFD Forum 0 February 17, 2005 03:07


All times are GMT -4. The time now is 05:28.