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

Fluent data structure

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2021, 07:47
Default Fluent data structure
  #1
Senior Member
 
Simbelmynė's Avatar
 
Join Date: May 2012
Posts: 546
Rep Power: 15
Simbelmynė is on a distinguished road
EDIT: I realize now that perhaps this should be moved to a different section on the forum.



Hi,


I am looking at the data structure, i.e. Domain, Thread and Cell.


For a fluid simulation with only one zone (the fluid) I assume that we have one Thread of interest if we wish to manipulate cell values (the Thread corresponding to the fluid zone).


What puzzles me a bit is how this is explained in almost all examples:

Code:
/*****************************************************************
   UDF for initializing phase volume fraction                    
******************************************************************/

#include "udf.h"

/* domain pointer that is passed by INIT function is mixture domain  */
DEFINE_INIT(my_init_function, mixture_domain)
{
  int phase_domain_index;
  cell_t cell; 
  Thread *cell_thread;
  Domain *subdomain;
  real xc[ND_ND];
 
  /* loop over all subdomains (phases) in the superdomain (mixture) */
  sub_domain_loop(subdomain, mixture_domain, phase_domain_index)
  {
     /* loop if secondary phase  */
     if (DOMAIN_ID(subdomain) == 3)      

     /* loop over all cell threads in the secondary phase domain  */
     thread_loop_c (cell_thread,subdomain)
     {
         /* loop over all cells in secondary phase cell threads  */
         begin_c_loop_all (cell,cell_thread)
         {
             C_CENTROID(xc,cell,cell_thread);
             if (sqrt(ND_SUM(pow(xc[0] - 0.5,2.),
                             pow(xc[1] - 0.5,2.),
                             pow(xc[2] - 0.5,2.))) < 0.25)
      
               /*  set volume fraction to 1 for centroid  */
               C_VOF(cell,cell_thread) = 1.;
             else
               /*  otherwise initialize to zero  */
               C_VOF(cell,cell_thread) = 0.;     
         }
         end_c_loop_all (cell,cell_thread)
     }

   }
}
Why do they use a sub_domain_loop in this example? Why not just set the subdomain directly in the thread_loop_c? Assuming that we have a gas and a liquid phase, would this be a valid method?





Code:
d_mix = Get_Domain(1);  /* Mixture domain */
d_liq = Get_Domain(2); /* Liquid domain (primary fluid) */
d_gas = Get_Domain(3); /* Gas domain */
zone_ID = 3; /* This must be checked explicitly in the Fluent GUI to correspond to the fluid zone */
       
 t_mix = Lookup_Thread(d_mix, zone_ID);
 t_liq = THREAD_SUB_THREAD(t_mix, PHASE_DOMAIN_INDEX(d_liq));
 t_gas = THREAD_SUB_THREAD(t_mix, PHASE_DOMAIN_INDEX(d_gas));
Then we can just simply loop over all cells in any of the threads (it should be the same cells since all threads are derived from the mixture thread, right?)




Code:
begin_c_loop(c,t_mix)
{
    C_VOLUME(c,t_mix) = v_mix; 
    C_VOLUME(c,t_liq) = v_liq;
    C_VOLUME(c,t_gas) = v_gas; 

     // v_mix = v_liq = v_gas  <--- from testing this seems to be true
    // This is reasonable, but it is also reasonable if v_liq and v_gas 

   // were undefined and only the v_mix was defined

 


    C_VOF(c,t_gas) = vf_gas; 

    C_VOF(c,t_liq) = vf_liq; 



    // vf_gas != vf_liq    <--- this is also true from testing, and it seems reasonable


}
end_c_loop(c,t_mix)
I do not see the point of looping over all subdomains and all threads as in the first example. It seems really inefficient. However, since all examples are like that, I assume I am missing something. The question is what. Any insight would be much appreciated =)

Last edited by Simbelmynė; February 10, 2021 at 07:56. Reason: Wrong part of the forum
Simbelmynė 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
looking for a smart interface matlab fluent chary FLUENT 24 June 18, 2021 09:07
The accuracy of exported solution data in FLUENT ALBATTROSS FLUENT 0 November 30, 2020 11:04
chemkin thermal data and default fluent thermal data Weiqiang Liu FLUENT 0 May 20, 2020 02:57
[General] Fluent 2019R1 -> Paraview: Problem exporting data Fabio88 ParaView 0 August 30, 2019 04:00
Reading Additional Data Quantities from Fluent into Tecplot fremder Tecplot 9 December 16, 2016 15:35


All times are GMT -4. The time now is 03:43.