CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF coming cells (https://www.cfd-online.com/Forums/fluent-udf/227435-udf-coming-cells.html)

alexsid93 May 28, 2020 15:06

UDF coming cells
 
Dear Fluent experts, good afternoon!

Please, tell me which way to dig, or maybe someone has encountered this and can tell.

The story is this. I supplement the solver by calculating some of the quantities I need, one of the terms of which is this thing:

ux*dSigma/dx=ux*((sigma(c-1)-sigma(c+1))/2deltax)

s-1 - cell "lower" on the axis, s + 1 - cell "higher" on the axis. - by itself conditionally.

I plan to replace the derivative of the quantity with its finite-difference analogue. However, here's the misfortune, how to find the nearest cells? As for the delta x, I understood roughly - if I know the number of the adjacent cell, I can find the coordinates of the centers of the cells and find the distance between them through C_CENTROID (x, c, t), it will suit me.

I tried to export the centers of the cells with their numbers, and realized that the cell with the number +1 could be in any direction. So you need to understand how to find the numbers of all adjacent cells.

Hope to help! Thanks in advance

vinerm May 30, 2020 07:27

Clarity
 
The description you provided is not very clear, such as, the statement,

Quote:

s-1 - cell "lower" on the axis, s + 1 - cell "higher" on the axis. - by itself conditionally
however, if you are struggling with ID of the cell, then you can fetch IDs using C_ID, just like you fetch centroid using C_CENTROID. ID returned by C_ID is global.


All times are GMT -4. The time now is 19:48.