CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Identifying specific cell for energy source

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 27, 2015, 17:59
Post Identifying specific cell for energy source
  #1
New Member
 
Mario Alberto
Join Date: Sep 2015
Location: Russian Federation
Posts: 10
Rep Power: 3
mrwts is on a distinguished road
Hi everybody, I am new in Fluent and UDF programming and I have got some troubles trying to create a simple UDF code.
I am working with an energy source, whose position is time-dependent. Using simple functions, I determine the source position in x and y. But, I need to compare that position with the cell centroid.
Which Macro Access Data should I use to get (or identify that specific cell, that cointains my source position point)?
Knowing the source position, my code goes like:

begin_c_loop(c,t)
{
C_CENTROID(x_c,c,t);
C_CENTROID(y_c,c,t);
w = x_c[1];
if (pow((w-SOURCE_X_POSITION),2)+pow((w-SOURCE_Y_POSITION),2) < pow(r,2))
{
double V = 3.1415*pow(r,2);
source = power/V;
dS[eqn] = 0;
}
else
{
source = 0;
dS[eqn] = 0;
}
return source;
}
end_c_loop(c, c_thread)

Somehow, I need the program to identify which specifics cell has to be compared with the source position. So it's basically: Identifying cell, which contains the source position, comparing its centroid with the source position and calculating the source power.

Thanks in advance
mrwts is offline   Reply With Quote

Reply

Tags
cell centroid, macros, source code, udf and programming

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
Patches to compile OpenFOAM 2.2 on Mac OS X gschaider OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 134 December 5, 2015 04:30
refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 0 April 27, 2015 18:25
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 4 August 14, 2014 06:42
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 35 March 1, 2012 21:41
Warning 097- AB CD-adapco 6 November 15, 2004 05:41


All times are GMT -4. The time now is 11:07.