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

Fluent UDF Wall Shear Stress Segmentation Fault

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 22, 2015, 11:22
Unhappy Fluent UDF Wall Shear Stress Segmentation Fault
  #1
New Member
 
Ananth SNC
Join Date: Nov 2014
Posts: 3
Rep Power: 11
a1ananth is on a distinguished road
Hi, I am using DEFINE_PROFILE to define wall shear stress value on boundary layer faces. The interpretation is successful but I am getting "Error: received a fatal signal (Segmentation fault)." when I do hybrid initialization. My udf code is:

DEFINE_PROFILE(wall_shear_udf_faces, thread, i)
{
face_t f;
real x[ND_ND];
real ufree;
real wall_shear_value;
real L, U, rho, mu, Re;

ufree = USTAR;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
printf("X = %f and Y = %f\n\n", x[0], x[1]);

L = sqrt( (x[0] * x[0]) + (x[1] * x[1]) ); // distance formula
printf("Here\n\n");

rho = F_R(f, thread);
printf("L = %f and rho = %f\n\n", L, rho);

mu = F_MU_L(f, thread);
U = F_U(f, thread);

Re = (U * L) / mu;
printf("MU = %f and Re = %f\n\n", mu, Re);

// calculate using reynolds 1/5 power law
wall_shear_value = ((mult * rho) * (ufree * ufree)) / (pow(Re, POWER));

F_PROFILE(f, thread, i) = wall_shear_value;
}
end_f_loop(f, thread)
}

Error occurs in the line rho = F_R(f, thread); .. I know this because it prints "Here" in the fluent console.

Any idea why this error occurs and how to get it running? Thanks ahead!
a1ananth is offline   Reply With Quote

Old   February 22, 2015, 20:20
Default More error description
  #2
New Member
 
Ananth SNC
Join Date: Nov 2014
Posts: 3
Rep Power: 11
a1ananth is on a distinguished road
If I give constant values to all the variables it works.. but when I try to use the Face Field Variable Macros, it gives segmentation fault..
a1ananth is offline   Reply With Quote

Old   February 23, 2015, 17:34
Default
  #3
Member
 
subha_meter's Avatar
 
Subhasish Mitra
Join Date: Oct 2009
Location: Australia
Posts: 56
Rep Power: 16
subha_meter is on a distinguished road
Quote:
Originally Posted by a1ananth View Post
Hi, I am using DEFINE_PROFILE to define wall shear stress value on boundary layer faces. The interpretation is successful but I am getting "Error: received a fatal signal (Segmentation fault)." when I do hybrid initialization. My udf code is:

DEFINE_PROFILE(wall_shear_udf_faces, thread, i)
{
face_t f;
real x[ND_ND];
real ufree;
real wall_shear_value;
real L, U, rho, mu, Re;

ufree = USTAR;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
printf("X = %f and Y = %f\n\n", x[0], x[1]);

L = sqrt( (x[0] * x[0]) + (x[1] * x[1]) ); // distance formula
printf("Here\n\n");

rho = F_R(f, thread);
printf("L = %f and rho = %f\n\n", L, rho);

mu = F_MU_L(f, thread);
U = F_U(f, thread);

Re = (U * L) / mu;
printf("MU = %f and Re = %f\n\n", mu, Re);

// calculate using reynolds 1/5 power law
wall_shear_value = ((mult * rho) * (ufree * ufree)) / (pow(Re, POWER));

F_PROFILE(f, thread, i) = wall_shear_value;
}
end_f_loop(f, thread)
}

Error occurs in the line rho = F_R(f, thread); .. I know this because it prints "Here" in the fluent console.

Any idea why this error occurs and how to get it running? Thanks ahead!

The problem of "segmentation fault" occurs when a solver variable is illegally accessed which in this case I suspect are the density and viscosity variables because they are stored in cell nodes and not in faces.
__________________
SM
subha_meter is offline   Reply With Quote

Old   February 24, 2015, 03:23
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by a1ananth View Post
Hi, I am using DEFINE_PROFILE to define wall shear stress value on boundary layer faces. The interpretation is successful but I am getting "Error: received a fatal signal (Segmentation fault)." when I do hybrid initialization. My udf code is:

DEFINE_PROFILE(wall_shear_udf_faces, thread, i)
{
face_t f;
real x[ND_ND];
real ufree;
real wall_shear_value;
real L, U, rho, mu, Re;

ufree = USTAR;

begin_f_loop(f, thread)
{
F_CENTROID(x, f, thread);
printf("X = %f and Y = %f\n\n", x[0], x[1]);

L = sqrt( (x[0] * x[0]) + (x[1] * x[1]) ); // distance formula
printf("Here\n\n");

rho = F_R(f, thread);
printf("L = %f and rho = %f\n\n", L, rho);

mu = F_MU_L(f, thread);
U = F_U(f, thread);

Re = (U * L) / mu;
printf("MU = %f and Re = %f\n\n", mu, Re);

// calculate using reynolds 1/5 power law
wall_shear_value = ((mult * rho) * (ufree * ufree)) / (pow(Re, POWER));

F_PROFILE(f, thread, i) = wall_shear_value;
}
end_f_loop(f, thread)
}

Error occurs in the line rho = F_R(f, thread); .. I know this because it prints "Here" in the fluent console.

Any idea why this error occurs and how to get it running? Thanks ahead!
In the line
Code:
rho = F_R(f, thread);
you tell Fluent to get the content of F_R(f,thread), which is the density at the wall. This only works if there is a density at the wall. Before you initialize, there is no value defined for the density at the wall, so if you then ask for this value, Fluent can not get the value. Error.

In your case, if you do initialization, apparently this function is called before the density is set. If the order would have been differently, it would have worked.

I can give you two solution approaches:
1. Change the UDF, so that it first checks if the density is set, and if it is not set, it should use a 'default' value for the density. This is the best solution, but maybe difficult to program.
2. When you want to initialize, remove all calls to this function (or use constant values inside the function), and change the function to the correct version after initialization. This is the quick-and-dirty workaround.
pakk is offline   Reply With Quote

Reply

Tags
define profile, fluent - udf, wall shear stress


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
UDF for shear stress at wall in laminar flow Jafri FLUENT 1 April 6, 2020 18:20
Drift-flux model and wall shear stress laoji FLUENT 0 July 8, 2014 22:42
Accessing wall shear stress using UDF Robert Fluent UDF and Scheme Programming 2 July 31, 2013 08:34
How to get a value of wall shear stress for UDF shileijerry Fluent UDF and Scheme Programming 0 June 18, 2013 10:50
modelling wall shear stress through fluent rakadit Fluent UDF and Scheme Programming 5 June 27, 2011 12:33


All times are GMT -4. The time now is 16:39.