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

C_FACE(c,t,i) local face index i ?????????

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

Like Tree1Likes
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2012, 03:52
Default C_FACE(c,t,i) local face index i ?????????
  #1
New Member
 
Jacky
Join Date: Jul 2011
Posts: 24
Rep Power: 6
bharat.cmeri is on a distinguished road
Hi everyone....... can u pls tell me how would i know whether a face is top,bottom, right or left of a cell using this local face index ??

Regards,
Bharat
bharat.cmeri is offline   Reply With Quote

Old   April 19, 2012, 09:29
Default
  #2
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 534
Blog Entries: 14
Rep Power: 17
sbaffini will become famous soon enough
You can't because, in general, there is no such information in the cell of an unstructured solver (like Fluent), which can also be a tetrahedron (nonetheless, the information on the cell type is written in the case file). Still, if you define your own directions in space you can still check how the face centroid-cell centroid vector is oriented with respect to them and make your conclusions.
sbaffini is offline   Reply With Quote

Old   April 20, 2012, 01:15
Default
  #3
New Member
 
Jacky
Join Date: Jul 2011
Posts: 24
Rep Power: 6
bharat.cmeri is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
You can't because, in general, there is no such information in the cell of an unstructured solver (like Fluent), which can also be a tetrahedron (nonetheless, the information on the cell type is written in the case file). Still, if you define your own directions in space you can still check how the face centroid-cell centroid vector is oriented with respect to them and make your conclusions.
Thanks for replying...... I think I found d way out....... Below is what i hv done.... I hvnt ran it yet bt pls go thru it.........

V[0] = C_U(c,t);
V[1] = C_V(c,t);
mag = NV_MAG(V);
NV_D(xunit, = ,1,0,0);
NV_D(yunit, = ,0,1,0);

c_face_loop(c, t, n)
{
F_AREA(A, f,t);
C_CENTROID(dr0, F_C0(f,t),t->t0);
F_CENTROID(xf, f,t);
NV_VV(dr0, =, xf,-,dr0);
ds = NV_MAG(dr0);
NV_VS(es,=,dr0,/,ds);

XDOT = NV_DOT(es,xunit);
YDOT = NV_DOT(es,yunit);

if (XDOT <= 1.0 && XDOT > cos(15.0))
{
front = n;
}
else if( XDOT < -cos(15.0) && XDOT >= -1.0)
{
back = n;
}
else if( YDOT <= 1.0 && YDOT > cos(15.0))
{
top = n;
}
else if( YDOT < -cos(15.0) && YDOT >= -1.0)
{
bottom = n;
}

}
bharat.cmeri is offline   Reply With Quote

Old   April 21, 2012, 06:46
Default
  #4
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 534
Blog Entries: 14
Rep Power: 17
sbaffini will become famous soon enough
Besides your choice of conditions to check (which i admit, now at first i don't get) you got the main point.

Just notice that:

- you may not need mag and A(F_AREA)

- i'm not very practical with the pointer stuff but, at first it seems that with C_CENTROID(dr0, F_C0(f,t),t->t0) you are picking up the centroid of c0 (correct me if i'm wrong as i'm interested in this). In this case you you should be aware that c0 may not correspond to c (whose faces you are looping) but to the neighbor cell trough the face. However, i don't see where you are picking up f (which still can be my foult, so correct me if i'm wrong). I usually do it by something like:

f = C_FACE(cn,tn,nf);
tf = C_FACE_THREAD(cn,tn,nf);
c0 = F_C0(f,tf);
t0 = THREAD_T0(tf);
sbaffini is offline   Reply With Quote

Old   April 23, 2012, 10:35
Default
  #5
New Member
 
Jacky
Join Date: Jul 2011
Posts: 24
Rep Power: 6
bharat.cmeri is on a distinguished road
f is being picked just before c_face_loop.
well as far as I know c0 means the parent cell where from f is being tracked(which is c). so basically c will be c0.

Now let me ask one question. can't we use these loops inside our own functions like say
static real
LINSEG(cell_t c, Thread *t)
{
----------loop-----------
}

I am having trouble as solver is giving MPI error.....viz... no such file or directory exists..... I am not able to make out how to do it. If you pls tell me........


And yes mag and AREA are not needed.........
Thanks & Regards,
Bharat....
bharat.cmeri is offline   Reply With Quote

Old   April 23, 2012, 16:13
Default
  #6
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 534
Blog Entries: 14
Rep Power: 17
sbaffini will become famous soon enough
Dear bharat,

according to my knowledge of UDFs, what you are doing is not exactly correct, that is:

- f can't be picked up before the cell face loop because it is changing inside the loop. In practice, with F_CENTROID(xf, f,t) you are asking the centroid (which is put in xf) of the face f belonging to the face thread t (which, by the way are already used by the main c_face_loop and this is wrong), but for each face of the cell you can have a different face thread and face index, hence you need to ask for them just after the beginning of the c_face_loop.

- what you actually know about c0 and c1 is that the vector A is pointing from c0 toward c1 (on the boundaries, where c1 is missing, it is just pointing outside). There is no way to know in advance if the cell you are looping over is c0 or c1, except for boundaries where the ambiguity is resolved by c1 missing


As long as you pass your function all the arguments in the correct form there should be no issues in using loop or what else kind of Fluent internal macros in a separate function. However, i have to say it, i never did it and can't be of much help on this. I definitely suggest you to first debug your UDF in serial before going to parallel (where MPI errors are supposed to belong)
sbaffini is offline   Reply With Quote

Old   August 14, 2012, 10:27
Default local face index
  #7
New Member
 
Bruce
Join Date: Mar 2012
Posts: 8
Rep Power: 5
XJTH is on a distinguished road
f = C_FACE(cn,tn,nf);
tf = C_FACE_THREAD(cn,tn,nf);
c0 = F_C0(f,tf);
t0 = THREAD_T0(tf);[/QUOTE]


nf is the local face index number, could u tell me it's meaning? and the return global face index face_t f .

ths

XJTH
XJTH is offline   Reply With Quote

Old   August 14, 2012, 11:00
Default
  #8
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 534
Blog Entries: 14
Rep Power: 17
sbaffini will become famous soon enough
The meaning of the four lines above is:

- "f = C_FACE(cn,tn,nf);" = for a given cell cn belonging to the cell_thread tn, give me the global face index f corresponding to the local face index nf. It is assumed that the above statement is inside a cell_face loop "c_face_loop(cn, tn, nf)", a loop over the faces of the cell cn.

- "tf = C_FACE_THREAD(cn,tn,nf);" = as above, but now the request is for the face_thread tf containing the face f from above.

- "c0 = F_C0(f,tf);" given f and tf from above, this command asks for the so called cell c0 index. I described it in previous posts above; it is just one of at most two cells sharing the face f. Among the two (c0 and c1), c0 is the one which is always present.

- "t0 = THREAD_T0(tf);" this is just the cell_thread of the cell c0 above. Notice that, as the only input required is tf, all the faces on tf will have their c0 belonging to the same cell_thread t0.

Hope this is what you are looking for
XJTH likes this.
sbaffini is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


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