How to loop over all cells along a particular direction(z-direction)?

PawanPawan India Member Posts: 14

I want to loop over all the faces of all the cells along the z direction only. For this I understand I can use c_face_loop inside begin_c_loop. Now I have defined a unit vector along z direction and using INTERIOR_FACE_GEOMETRY, I get es[ND_ND]. For looping along the z direction, I use a if condition and make use of dot product of unit vector along z direction and es[ND_ND]. Is my approach right? I am not an expert in writing UDFs and any help is much appreciated. Thanks in advance.

Here is my UDF:

It is a two-phase flow and I want to track the interfacial cells between the two phases after every iteration.

Best Answer

  • DrAmineDrAmine GermanyPosts: 7,890Forum Coordinator
    Accepted Answer

    The idea seems okay. I will recommend to first check the cells by coloring them by a marker memory (another UDMI) before doing anything else with the UDF. Perhaps in ON_DEMAND UDF.

Answers

  • DrAmineDrAmine GermanyPosts: 7,890Forum Coordinator
    edited November 23

    Perhaps you need to check if the face is an interior face before calling the interior face macro.

  • PawanPawan IndiaPosts: 106Member

    @DrAmine Thanks for your reply. Actually my interfacial cells will be well inside the domain as per my design and when I apply the source terms in the interfacial cells, I give an if condition for domain boundary also. Can you please elaborate a bit more on "coloring the cells by a marker" which you have suggested? I am not an expert in UDFs and would be really helpful.

Sign In or Register to comment.