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

Identifying specific cell for energy source

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 27, 2015, 18:59
Post Identifying specific cell for energy source
  #1
New Member
 
Mario Alberto
Join Date: Sep 2015
Location: Russian Federation
Posts: 10
Rep Power: 11
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


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
GPU Linear Solvers for OpenFOAM gocarts OpenFOAM Announcements from Other Sources 37 August 17, 2022 15:22
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 12:04
[OpenFOAM.org] Patches to compile OpenFOAM 2.2 on Mac OS X gschaider OpenFOAM Installation 136 October 10, 2017 18:25
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
Warning 097- AB Siemens 6 November 15, 2004 05:41


All times are GMT -4. The time now is 18:04.