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/)
-   -   Cell number from UDF (https://www.cfd-online.com/Forums/fluent-udf/185226-cell-number-udf.html)

rsarma March 21, 2017 10:21

Cell number from UDF
 
Hello,

I am writing a parallel UDF code for a deforming mesh problem. Basically I want to update the cells of a boundary at every time step. This update is based on a matrix which I read into my code. Each element of this matrix corresponds to a cell centre in the boundary that needs to be updated.

My problem is since the mesh is updating at each time step, it's coordinates change. As such, I cannot identify the cells and read the matrix values for a particular cell.

I was wondering if it possible to write the cell ID to a file? Or could you kindly give me any other suggestions?

Best,
R

kirmaks March 23, 2017 08:33

Hallo,

I've recently thought about similar problem. You may use UDM to store the cell's ID and then use it to get the required element of the matrix. Several steps are required:

1. store the cell's number and its coordinates (if required) in UDM, you may also save these data in a text for analysis how to order the elements in the matrix (DEFINE_ON_DEMAND).

2. use the stored ID's from UDM to access the matrix elements during iterations.

That's it, good luck and have a nice day.
Regards, Maks

rsarma March 23, 2017 09:00

Hi Maks,

Thank you for the reply. I will implement it. What is actually the macro for extracting the cell ID. I saw somewhere there is C_ID(cell_t c,Thread*t), but I am not quite sure if this exists as I could not locate it in the fluent udf manual. Could you kindly let me know?

Best,
R

kirmaks March 23, 2017 09:12

I'm not sure, You may define Your own indexing based for example on the coordinates. May be looping is also always done in the same order. You may check it. It also states in the help that
Quote:

face_t is an integer data type that identifies a particular face within a face thread.
cell_t is an integer data type that identifies a particular cell within a cell thread.
so You may check what value has the appropriate variable when You are looping throug the cells or faces.
Regards, Maks


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