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

c_face_loop seems not working

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 27, 2023, 11:31
Default c_face_loop seems not working
  #1
Nia
New Member
 
Romain Million
Join Date: Nov 2022
Location: Saint Nazaire, France
Posts: 4
Rep Power: 4
Nia is on a distinguished road
Hello everybody,

I am trying to get face centroïd of each face of cells that I browse with c_loop but the c_face_loop macro seems not working... Does any one have any hint on what is wrong with this code ? Or any information on this macro, Fluent udf manual is very light about it...

Code:
DEFINE_ON_DEMAND(Centroid)
{
    face_t face;
    cell_t cell;

    int n;

    Domain *domain = Get_Domain(2); /* 1 = mixture, 2=primary phase, 3=secondary phase etc*/
    int zone_id = 2;
    Thread *thread = Lookup_Thread(domain,zone_id);
    Thread *thread_face;

    real xc[ND_ND], xf[ND_ND], va[ND_ND];

    begin_c_loop_int(cell, thread)
    {
        C_CENTROID(xc, cell, thread);
        Message("\nc %f %f %f\n", xc[0], xc[1], xc[2]);
        
        c_face_loop(cell,thread, n)
        {
            face = C_FACE(cell, thread, n);
            thread_face = C_FACE_THREAD(cell, thread, n);
            F_CENTROID(xf, face, thread_face);
            Message("\nc %f %f %f\n", xf[0], xf[1], xf[2]);
        }
    }
    end_c_loop_int(cell, thread);
}
Thank you !
Nia is offline   Reply With Quote

Old   February 28, 2023, 02:46
Default
  #2
Member
 
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6
Siba11 is on a distinguished road
I think the problem is not with c_face_loop.
You have used begin_c_loop_int which loops over all the interior cells (only) in a domain. Meanwhile, your zone_id points towards the entire domain which contains both interior and exterior cells. This is causing a conflict.

Also, include the #if !RP_HOST . . . #endif line in your code.
Siba11 is offline   Reply With Quote

Old   February 28, 2023, 04:14
Default
  #3
Nia
New Member
 
Romain Million
Join Date: Nov 2022
Location: Saint Nazaire, France
Posts: 4
Rep Power: 4
Nia is on a distinguished road
Quote:
Originally Posted by Siba11 View Post
I think the problem is not with c_face_loop.
You have used begin_c_loop_int which loops over all the interior cells (only) in a domain. Meanwhile, your zone_id points towards the entire domain which contains both interior and exterior cells. This is causing a conflict.

Also, include the #if !RP_HOST . . . #endif line in your code.
Thak you for your response. The begin_c_loop_int is normal in my case because I want to get every centroid of cells. As I get domain and tell to Fluent to get associated threads with the Lookup_thread macro, the usual loop of begin_c_loop get repetition of direct externalcells of each thread, which I don't want. To this point the UDF works fine to me. The problem is that I want to extract from each cell that is browsed by this udf the centroid of the corresponding faces.
Nia is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TUI - Strange behavior related to the working directory Dav[ID] FLUENT 5 September 6, 2022 15:45
Porous media coefficients and working fluid Dronzer FLUENT 1 June 30, 2020 23:23
findCell() in parallel: not working if location is outside the domain TobiWol OpenFOAM 0 January 10, 2018 15:33
Processor 0 not working vishwesh OpenFOAM Running, Solving & CFD 0 November 17, 2017 04:35
DPM parallel is not working but serial is working johnwinter FLUENT 1 March 27, 2012 03:01


All times are GMT -4. The time now is 14:40.