CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Trouble with Lookup_Thread!

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

LinkBack Thread Tools Search this Thread Display Modes
Old   September 28, 2019, 01:25
Default Trouble with Lookup_Thread!
New Member
Join Date: Sep 2019
Posts: 24
Rep Power: 3
NonStopEagle is on a distinguished road
Hello everyone,
I am having trouble running the following udf. Its giving me a segmentation fault, but as far as i know, there seems to be nothing wrong with it. I suspect the Lookup_Thread() is the problem...
Also I am running Fluent 18.1

the udf is :

#include "udf.h" /* must be at the beginning of every UDF */
#define k_B 1.3805e-23 /* Boltzman constant (j/K)*/
#define sigma 419e-12 /* molecular diameter*/
#define sigma_v 1 /* Tangential momentum accommodation coefficient*/
#define sigma_T 1 /*Thermal accommodation coefficient*/
#define pi 3.14159 /* pi number*/
#define sqrt_2 1.41421 /* sqrt(2) number */
#define len = 20e-5;

FILE* slip;

Domain* domain;
double T, P, density, MU, K, landa, a_m, du_da, dT_dx, u_f, DUY, DVY, DUX, DVX, u, v;
face_t f;
Thread* t0;
cell_t c0;
double Slip_Vel;
domain = Get_Domain(1);

t0 = Lookup_Thread(domain, 8);
slip = fopen("Slip_Velocity.out", "w");
if (slip == NULL)
Message("UDF cannot open file");
begin_f_loop(f, t0)
T = C_T(c0, t0); /* temperature of the cell */
P = C_P(c0, t0); /* peressure of the cell */
density = C_R(c0, t0); /* density of the cell*/
MU = C_MU_L(c0, t0); /* laminar viscosity of the cell */
u = C_U(c0, t0);
v = C_V(c0, t0);
K = C_K_L(c0, t0); /* thermal conductivity of the cell */
landa = (k_B * T) / (sqrt_2 * pi * sigma * sigma * P); /* mean free path line */
DUX = C_DUDX(c0, t0);
DVX = C_DVDX(c0, t0);
DUY = C_DUDY(c0, t0);
DVY = C_DVDY(c0, t0);
Slip_Vel = (((2 - sigma_v) / sigma_v) * landa * (((DUX + DVX) * (v / sqrt(u * u + v * v))) - ((DUY + DVY) * (u / sqrt(u * u + v * v)))));
fprintf(slip, "%f\n", Slip_Vel);
end_f_loop(f, t0)

I would appreciate it if someone could help me solve this problem.
Thanks in advance.


Last edited by NonStopEagle; September 28, 2019 at 01:28. Reason: I made a mistake in the udf
NonStopEagle is offline   Reply With Quote

Old   September 29, 2019, 21:27
Senior Member
Join Date: Apr 2013
Posts: 1,419
Rep Power: 21
AlexanderZ will become famous soon enough
but as far as i know, there seems to be nothing wrong with it
how do you know, that there is no other problems except Lookup_Thread() macro?

compile your code and read log.
stop open new threads for same problems

best regards
AlexanderZ is offline   Reply With Quote


fluent, fluent - udf, udf code

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
[waves2Foam] Having a lot of trouble for a short wavelengths arieljeds OpenFOAM Community Contributions 0 April 18, 2017 07:06
Trouble with rotating wall boundary condition king1989 OpenFOAM Running, Solving & CFD 7 July 29, 2016 13:44
Trouble with sampleDict syntax for OpenFOAM 2.3.1 rawdoggity OpenFOAM Post-Processing 1 February 1, 2015 05:24
[ICEM] trouble with mesh quality from ICEM in CFX Solver escher25 ANSYS Meshing & Geometry 0 February 28, 2011 07:38
[GAMBIT] Trouble meshing complex VOF geometry RPJones ANSYS Meshing & Geometry 2 February 14, 2011 18:54

All times are GMT -4. The time now is 21:02.