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

Trouble with Lookup_Thread!

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 28, 2019, 02:25
Default Trouble with Lookup_Thread!
  #1
New Member
 
Join Date: Sep 2019
Posts: 24
Rep Power: 7
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;

DEFINE_ON_DEMAND(wall_slip_velocity)
{
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");
}
else
{
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.


NonStopEagle

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

Old   September 29, 2019, 22:27
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
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

Reply

Tags
fluent, fluent - udf, udf code


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 1 January 2, 2024 14:10
Trouble with rotating wall boundary condition king1989 OpenFOAM Running, Solving & CFD 7 July 29, 2016 14:44
Trouble with sampleDict syntax for OpenFOAM 2.3.1 rawdoggity OpenFOAM Post-Processing 1 February 1, 2015 06:24
[ICEM] trouble with mesh quality from ICEM in CFX Solver escher25 ANSYS Meshing & Geometry 0 February 28, 2011 08:38
[GAMBIT] Trouble meshing complex VOF geometry RPJones ANSYS Meshing & Geometry 2 February 14, 2011 19:54


All times are GMT -4. The time now is 17:40.