|
[Sponsors] |
September 27, 2015, 18:59 |
Identifying specific cell for energy source
|
#1 |
New Member
Mario Alberto
Join Date: Sep 2015
Location: Russian Federation
Posts: 10
Rep Power: 11 |
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 |
|
Tags |
cell centroid, macros, source code, udf and programming |
|
|
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 |