CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Differentiating between Boundary and Interface Faces

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 31, 2012, 05:07
Default Differentiating between Boundary and Interface Faces
  #1
New Member
 
Rory Monaghan
Join Date: May 2010
Posts: 3
Rep Power: 8
rmonaghan is on a distinguished road
Hello,
I am working with a UDF over a domain containing interfaces between different mesh structures. I need to distinguish between (a) interior cell faces, (b) boundary faces (i.e. at the edge of the domain) and (c) cell faces at INTERFACE boundaries (i.e. within the domain).
I am using the BOUNDARY_FACE_THREAD_P macro to pick out boundary faces but this also picks out interface faces.
Is there a unique macro to identify interface faces or can anyone suggest a way to distinguish between them?
Thanks very much!
Rory
rmonaghan is offline   Reply With Quote

Old   June 28, 2016, 10:13
Default
  #2
New Member
 
Join Date: Jun 2016
Posts: 7
Rep Power: 2
iteration is on a distinguished road
Hello,
are you sure with BOUNDARY_FACE_THREAD_P returning TRUE for both boundary and domain boundary faces? I didn't find anything in the UDF manual regarding this case.
I'm interested in identifying only the boundary faces (and not the domain boundary faces). Is there a clever way to do so?
Many thanks in advance!
iteration is offline   Reply With Quote

Old   June 29, 2016, 03:10
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 895
Rep Power: 12
pakk will become famous soon enough
You can identify the type of a thread t with THREAD_TYPE(t).

If you want to exclude interior boundaries:
Code:
if (THREAD_TYPE(t)!=THREAD_F_INTERIOR) {...}
And so on. The thread types are somewhere defined in a .h-file in your Fluent installation.

So in your case you want only walls (I guess), so you would say:
Code:
if (THREAD_TYPE(t)!=THREAD_F_WALL) {...}
I might be wrong about the name "THREAD_F_WALL", you can look it up in those .h-files. (Or use numbers instead, I think the number for type wall is 3, but that makes things less clear.)
pakk is offline   Reply With Quote

Old   June 29, 2016, 11:00
Default
  #4
New Member
 
Join Date: Jun 2016
Posts: 7
Rep Power: 2
iteration is on a distinguished road
Thank you very much!
THREAD_TYPE(t)==THREAD_F_WALL works well.

Now I've got another problem. Perhaps you can give me some advice to solve it.
In my geometry, there is a fluid domain and a porous domain which are matched via an interface. I want to know what happens in the neighbor cells of every cell in the fluid domain. Therefore I want to use the following code snippet in an UDF:

Code:
c_face_loop(cell,thread,indexnum)
    {
        f = C_FACE(cell,thread,indexnum);
        tf = C_FACE_THREAD(cell,thread,indexnum);
        if (THREAD_TYPE(tf)==THREAD_F_WALL)
        {
            boundary_flag[indexnum] = 1.0;
        }
        else
        {
            cell0 = F_C0(f,tf);
            cell1 = F_C1(f,tf);
            cellthread0 = THREAD_T0(tf);
            cellthread1 = THREAD_T1(tf);
            if (cell0!=cell && THREAD_ID(cellthread0)!=THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else if (cell1!=cell && THREAD_ID(cellthread1)!=THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else if (cell0!=cell && THREAD_ID(cellthread0)==THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else if (cell1!=cell && THREAD_ID(cellthread1)==THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else
            {
                boundary_flag[indexnum] = 0.5; /* should not occur */
            }
        }
    }
When I run Fluent I get the error: received a fatal signal (Segmentation fault).

But when I modify the code as follows:

Code:
c_face_loop(cell,thread,indexnum)
    {
        f = C_FACE(cell,thread,indexnum);
        tf = C_FACE_THREAD(cell,thread,indexnum);
        if (THREAD_TYPE(tf)==THREAD_F_WALL)
        {
            boundary_flag[indexnum] = 1.0;
        }
        else
        {
            cell0 = F_C0(f,tf);
            cell1 = F_C1(f,tf);
            cellthread0 = THREAD_T0(tf);
            cellthread1 = THREAD_T1(tf);
            if (cell0!=cell && THREAD_ID(cellthread0)!=THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else if (!BOUNDARY_FACE_THREAD_P(tf) && cell1!=cell && THREAD_ID(cellthread1)!=THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else if (cell0!=cell && THREAD_ID(cellthread0)==THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else if (!BOUNDARY_FACE_THREAD_P(tf) && cell1!=cell && THREAD_ID(cellthread1)==THREAD_ID(thread))
            {
                boundary_flag[indexnum] = 0.0;
            }
            else
            {
                boundary_flag[indexnum] = 0.5;
            }
        }
    }
...there is no error and I can see that the problem occurs in the cells next to the interface.

Do you see, what problem I missed in the upper code? The thing is, I also want to know what happens in the neighbor cells that lie in the porous zone.

Again thanks in advance!
iteration is offline   Reply With Quote

Old   July 5, 2016, 09:48
Default Can't remember how this worked out!
  #5
New Member
 
Rory Monaghan
Join Date: May 2010
Posts: 3
Rep Power: 8
rmonaghan is on a distinguished road
Hi there,
I am afraid I cannot be of much help to you. My original question was about 4 years and I have since moved on to other work. I hope you can get some assistance here.
Regards
Rory
rmonaghan is offline   Reply With Quote

Old   July 7, 2016, 03:20
Default
  #6
New Member
 
Join Date: Jun 2016
Posts: 7
Rep Power: 2
iteration is on a distinguished road
No problem, Rory.

Perhaps, for the other helpers, I should mention that I'm using the mixture model.
So if anybody recognizes my mistake in the code above (e.g. in the thread architecture or something) and can tell me about it, I will really appreciate it.
iteration is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 45 February 8, 2016 05:42
CFX13 Post Periodic interface EtaEta CFX 7 December 8, 2011 18:15
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


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