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

Accessing cell adjacent to cell

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 24, 2014, 09:10
Default Accessing cell adjacent to cell
  #1
New Member
 
Hakim Mkacher
Join Date: Apr 2013
Posts: 8
Rep Power: 13
kiurigan is on a distinguished road
Hi everybody, I'm trying to access cells before the outlet in aim to get horizontal velocity in their west faces. Actually I'm using 2d quad uniform mesh.. So I tried to exploit the face area vector direction to know the index of the west face, giving that the horizontal component of the vector will be negative (see the picture, the cells shaded in grey are the second and third cells in the UDF).. I'm not expert in UDF programming and it does not seem to work. Any corrections please?



Quote:
#include "udf.h"
#undef C_TYPE
#define C_TYPE(c,t) ((int) C_STORAGE(c,t,SV_TYPE,uchar_fl *))


DEFINE_PROFILE(u_leaving, thread, index)
{
real U1;
real U2;
real U3;
face_t f;
real A[ND_ND];
real B[ND_ND];
real C[ND_ND];

begin_f_loop(f, thread)

{

cell_t c0f1;
cell_t c0f2;
cell_t c0f3;

face_t f1;
face_t f2;
face_t f3;

Thread *c0t1;
Thread *c0t2;
Thread *c0t3;

Thread *t1;
Thread *t2;
Thread *t3;

int i;
int j;
int k;
int l;



c0f1=F_C0(f,thread);/*return the first cell_thread*/
c0t1=THREAD_T0(thread);


c_face_loop(c0f1,c0t1,i)

{
F_AREA(A,C_FACE(c0f1,c0t1,i),C_FACE_THREAD(c0f1,c0 t1,i));
if(A[0]<0)
{j=i;}
}

f1=C_FACE(c0f1,c0t1,j);/*return the west face_thread of the first cell*/
t1=C_FACE_THREAD(c0f1,c0t1,j);

c0f2=F_C0(f1,t1);/*return the second cell_thread*/
c0t2=THREAD_T0(t1);



c_face_loop(c0f2,c0t2,i)

{
F_AREA(A,C_FACE(c0f2,c0t2,i),C_FACE_THREAD(c0f2,c0 t2,i));
if(B[0]<0)
{k=i;}
}

f2=C_FACE(c0f2,c0t2,k);/*return the west face_thread of the second cell*/
t2=C_FACE_THREAD(c0f2,c0t2,k);

c0f3=F_C0(f2,t2);/*return the third cell_thread*/
c0t3=THREAD_T0(t2);


c_face_loop(c0f3,c0t3,i)

{
F_AREA(A,C_FACE(c0f3,c0t3,i),C_FACE_THREAD(c0f3,c0 t3,i));
if(C[0]<0)
{l=i;}
}

f3=C_FACE(c0f3,c0t3,l);/*return the west face_thread of the third cell*/
t3=C_FACE_THREAD(c0f3,c0t3,l);

U1=F_U(f1,t1);
U2=F_U(f2,t2);
U3=F_U(f3,t3);



F_PROFILE(f, thread, index) = 2.5*U1-2*U2+0.5*U3;
}
end_f_loop(f, thread)
}

Last edited by kiurigan; November 24, 2014 at 10:30.
kiurigan is offline   Reply With Quote

Reply

Tags
cell, face area vector, fluent, outlet, udf


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
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 12:25
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 14:38
Cells with t below lower limit Purushothama Siemens 2 May 31, 2010 21:58
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15
Warning 097- AB Siemens 6 November 15, 2004 04:41


All times are GMT -4. The time now is 23:49.