CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CONVERGE (https://www.cfd-online.com/Forums/converge/)
-   -   CONVERGE udf (https://www.cfd-online.com/Forums/converge/243454-converge-udf.html)

Drag June 20, 2022 00:18

CONVERGE udf
 
I am using CONVERGE 3.0, and have a question about the UDF for the cells attached to a boundary. From the UDF documents, we can use the function of CONVERGE_boundary_iterator_create to iterate over all cells associated with a boundary. But how can I get the property in each individual boundary cell? For example, if I hope to calculate one parameter for one cell that is a function of the boundary cell temperature, what should I do? I tried using "temperature[<iter>]", but I guess the iterator here is different from the one created using "CONVERGE_boundary_iterator_create" function.
Also, can we get the contact area for a cell with the wall? Thanks in advance. :)

rvigneshwar June 22, 2022 14:58

Hi Drag,

Sorry for the late response. Boundary cells can be accessed with the following for loops, the first loop will loop over the boundary IDs and the second loop will loop over each node of that boundary.

CONVERGE_mesh_t mesh = <get mesh>
CONVERGE_boundary_t bound;
CONVERGE_iterator_t mb_it;
CONVERGE_mesh_boundary_index_iterator_create(mesh, &mb_it);
for(CONVERGE_index_t i = CONVERGE_iterator_first(mb_it);
i != -1;
i = CONVERGE_iterator_next(mb_it))
{
bound = CONVERGE_mesh_boundary(mesh, i);
CONVERGE_iterator_t b_it;
CONVERGE_boundary_iterator_create(bound, &b_it);
for(CONVERGE_index_t j = CONVERGE_iterator_first(b_it);
j != -1;
j = CONVERGE_iterator_next(b_it))
{
// Access boundary node j of boundary i
}
CONVERGE_iterator_destroy(&b_it);
}
CONVERGE_iterator_destroy(&mb_it);


Regarding accessing the boundary values, you can use variable_name[j] to access that variable (example temperature[j]). If you don't want to run all the boundary IDs you can remove the 1st loop and replace the bound variable with a specific boundary ID.

bound = CONVERGE_mesh_boundary(mesh, specific_bound_id)

And for accessing the cell area at the boundary, use can use the following variable:
CONVERGE_precision_t* boundary_face_area

Let me know if the response was useful. If you have further issues with UDF, contact our respective support office:
support@convergecfd.com(US)
supportEU@convergecfd.com(EU)
support.in@convergecfd.com(IN)

We can look at your case and directly help building the UDF for you.


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