|
[Sponsors] |
how to search all cells that have the same value of x[0] |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 21, 2010, 22:33 |
how to search all cells that have the same value of x[0]
|
#1 |
New Member
Gloria
Join Date: Feb 2010
Posts: 16
Rep Power: 16 |
Hi, All,
Thank you for taking your time. I have a problem on how to loop search all cells that have the same value of x[0] in a domain using UDF of FLUENT. Thanks, lig |
|
December 22, 2010, 08:45 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
If you want to do it for the same value of x[0] each time, you can mark the cells (Adapt > Mark), which you can then access in your UDF as a separate zone. Otherwise I see no better alternative than to loop over all cells and check x[0].
|
|
December 24, 2010, 14:22 |
|
#3 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Try this unchecked code...It is a partial UDF, in that I don't know where you're using it (DEFINE_PROPERTY, etc...), but it should loop over all threads and all cells in a domain. Note that this assumes your UDF is passed a domain pointer.
Code:
real value_to_search_for; Thread *c_thread; cell_t c; real xc[ND_ND]; /* your value here */ value_to_search_for=5.0; thread_loop_c(c_thread, domain) /*loops over all cell threads in domain*/ { begin_c_loop(c, c_thread) /* loops over cells in a cell thread */ { C_CENTROID(xc,c,c_thread); if (xc[0]==value_to_search_for) { /* your code here */ } } end_c_loop(c, c_thread) } |
|
December 31, 2010, 01:46 |
|
#4 |
New Member
Gloria
Join Date: Feb 2010
Posts: 16
Rep Power: 16 |
Hi, ComputerGuy,
Really thank you for the reply. I was working on my code using the similar method you mentioned. However, I could not be able to make the program work. The main purpose is to get the summation of values of cells in same rows of a zone (the code is for the source term in UDS and applied for a porous zone). If possible, could you please help me to check the code I wrote? If so I am really appreciated, and please tell me your email address that I can sent the code file to you. Thanks and Happy New Year, Lig |
|
December 31, 2010, 01:55 |
|
#5 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Check your inbox. Reply with your code.
Cheers! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] Number of cells in mesh don't match with size of cellLevel | colinB | OpenFOAM Meshing & Mesh Conversion | 14 | December 12, 2018 09:07 |
[Netgen] Import netgen mesh to OpenFOAM | hsieh | OpenFOAM Meshing & Mesh Conversion | 32 | September 13, 2011 06:50 |
[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 |