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

how to search all cells that have the same value of x[0]

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 21, 2010, 21:33
Default how to search all cells that have the same value of x[0]
  #1
lig
New Member
 
Gloria
Join Date: Feb 2010
Posts: 16
Rep Power: 16
lig is on a distinguished road
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
lig is offline   Reply With Quote

Old   December 22, 2010, 07:45
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
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].
Bernhard is offline   Reply With Quote

Old   December 24, 2010, 13:22
Default
  #3
Senior Member
 
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16
ComputerGuy is on a distinguished road
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)                
}
ComputerGuy is offline   Reply With Quote

Old   December 31, 2010, 00:46
Default
  #4
lig
New Member
 
Gloria
Join Date: Feb 2010
Posts: 16
Rep Power: 16
lig is on a distinguished road
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
lig is offline   Reply With Quote

Old   December 31, 2010, 00:55
Default
  #5
Senior Member
 
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16
ComputerGuy is on a distinguished road
Check your inbox. Reply with your code.

Cheers!
ComputerGuy is offline   Reply With Quote

Reply


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
[snappyHexMesh] Number of cells in mesh don't match with size of cellLevel colinB OpenFOAM Meshing & Mesh Conversion 14 December 12, 2018 08:07
[Netgen] Import netgen mesh to OpenFOAM hsieh OpenFOAM Meshing & Mesh Conversion 32 September 13, 2011 05:50
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


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