|
[Sponsors] |
January 25, 2005, 07:15 |
cells less than one
|
#1 |
Guest
Posts: n/a
|
I am looking at some UDF code that someone gave me and I am a litte confused, it is show below. My questionis why would a cell index (c1) be assigned a negative value (i.e. < 0). Any help would be super.
DEFINE_UDS_FLUX(conv_fluxes, f, thread, eqn) { cell_t c0, c1; Thread *tc0, *tc1; c0 = F_C0(f, thread); tc0 = THREAD_T0(thread); c1 = F_C1(f, thread); tc1 = THREAD_T1(thread); if( c1 < 0 ) { return one thing } else { return another } } |
|
January 25, 2005, 09:29 |
Re: cells less than one
|
#2 |
Guest
Posts: n/a
|
According to me the cell_t index goes from 0 to n-1 cells. So the first if will never be executed. Luca
|
|
January 26, 2005, 06:41 |
Re: cells less than one
|
#3 |
Guest
Posts: n/a
|
I ran this code with a Message if c1<0 and it produced results. so at some point c1 does adopt a negative value. When this happens c1 adopts the value of -1 according to the output line. I am guessing this must be something to do with the boundary, but some more insight would be very helpful.
|
|
January 26, 2005, 06:48 |
Re: cells less than one
|
#4 |
Guest
Posts: n/a
|
Try to discover where is the cell with index -1. For example export its node position with the macro NODE_X(node). I had never come across a negative index. Maybe it means something... Is it the only negative index you found? Please let me know. Luca
|
|
January 26, 2005, 06:54 |
Re: cells less than one
|
#5 |
Guest
Posts: n/a
|
AH! Maybe C1<0 means that no c1 cell exist. If you're applying your function on a boundary face-thread, there's no C1 cell adjacent to it, only a C0 cell. I used the macro BOUNDARY... reported on the UDF guide. Let me know what you discover.Luca
|
|
January 26, 2005, 08:29 |
Re: cells less than one
|
#6 |
Guest
Posts: n/a
|
-1 is the only negative index retuned and from returning F_CENTROIDS, it looks like you are right. if c == -1 then it appears to be a boundary face and hence c1 dosen't exist.
Thanks. |
|
January 27, 2005, 06:15 |
Re: cells less than one
|
#7 |
Guest
Posts: n/a
|
OK then, we learned something more about UDF programming... Have a good day,Luca
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Netgen] Import netgen mesh to OpenFOAM | hsieh | OpenFOAM Meshing & Mesh Conversion | 32 | September 13, 2011 06:50 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |
[snappyHexMesh] snappyHexMesh aborting | Tobi | OpenFOAM Meshing & Mesh Conversion | 0 | November 10, 2010 04:23 |
[snappyHexMesh] external flow with snappyHexMesh | chelvistero | OpenFOAM Meshing & Mesh Conversion | 11 | January 15, 2010 20:43 |
physical boundary error!! | kris | Siemens | 2 | August 3, 2005 01:32 |