# cells less than one

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

 January 25, 2005, 07:15 cells less than one #1 Andrew Garrard 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 Luca 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 Andrew Garrard 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 Luca 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 Luca 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 Andrew Garrard 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 Luca Guest   Posts: n/a OK then, we learned something more about UDF programming... Have a good day,Luca

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50 sc298 OpenFOAM Native Meshers: snappyHexMesh and Others 2 March 27, 2011 21:11 Tobi OpenFOAM Native Meshers: snappyHexMesh and Others 0 November 10, 2010 04:23 chelvistero OpenFOAM 11 January 15, 2010 20:43 kris CD-adapco 2 August 3, 2005 00:32

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