Fluid domain

Name

Fluid domain -- 

Synopsis


#include <gfs.h>


#define     GFS_DOMAIN_CLASS                (klass)
#define     GFS_DOMAIN                      (obj)
#define     GFS_IS_DOMAIN                   (obj)

            GfsDomainClass;
            GfsDomain;

GfsDomainClass* gfs_domain_class            (void);
guint       gfs_domain_alloc                (GfsDomain *domain);
void        gfs_domain_free                 (GfsDomain *domain,
                                             guint i);
GfsVariable* gfs_domain_add_variable        (GfsDomain *domain,
                                             const gchar *name);
GfsDerivedVariable* gfs_domain_add_derived_variable
                                            (GfsDomain *domain,
                                             GfsDerivedVariable v);
void        gfs_domain_cell_traverse        (GfsDomain *domain,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttCellTraverseFunc func,
                                             gpointer data);
void        gfs_domain_cell_traverse_boundary
                                            (GfsDomain *domain,
                                             FttDirection d,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttCellTraverseFunc func,
                                             gpointer data);
void        gfs_domain_cell_traverse_box    (GfsDomain *domain,
                                             GtsBBox *box,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttCellTraverseFunc func,
                                             gpointer data);
void        gfs_domain_traverse_mixed       (GfsDomain *domain,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             FttCellTraverseFunc func,
                                             gpointer data);
void        gfs_domain_face_traverse        (GfsDomain *domain,
                                             FttComponent c,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttFaceTraverseFunc func,
                                             gpointer data);
void        gfs_domain_combine_traverse     (GfsDomain *domain1,
                                             GfsDomain *domain2,
                                             FttCellCombineTraverseFunc inside,
                                             gpointer idata,
                                             FttCellTraverseFunc outside,
                                             gpointer odata);
void        gfs_domain_traverse_cut         (GfsDomain *domain,
                                             GtsSurface *s,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             FttCellTraverseCutFunc func,
                                             gpointer data);
FttCell*    gfs_domain_locate               (GfsDomain *domain,
                                             FttVector target,
                                             gint max_depth);
void        gfs_domain_bc                   (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             GfsVariable *v);
void        gfs_domain_copy_bc              (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             GfsVariable *v,
                                             GfsVariable *v1);
void        gfs_domain_homogeneous_bc       (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             GfsVariable *ov,
                                             GfsVariable *v);
void        gfs_domain_face_bc              (GfsDomain *domain,
                                             FttComponent c,
                                             GfsVariable *v);
void        gfs_domain_surface_bc           (GfsDomain *domain,
                                             GfsVariable *v);
void        gfs_domain_match                (GfsDomain *domain);
guint       gfs_domain_depth                (GfsDomain *domain);
GtsRange    gfs_domain_stats_variable       (GfsDomain *domain,
                                             GfsVariable *v,
                                             FttTraverseFlags flags,
                                             gint max_depth);
GfsNorm     gfs_domain_norm_variable        (GfsDomain *domain,
                                             GfsVariable *v,
                                             FttTraverseFlags flags,
                                             gint max_depth);
GfsNorm     gfs_domain_norm_velocity        (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth);
void        gfs_domain_stats_balance        (GfsDomain *domain,
                                             GtsRange *size,
                                             GtsRange *boundary,
                                             GtsRange *mpiwait);
GtsRange    gfs_domain_stats_solid          (GfsDomain *domain);
void        gfs_domain_solid_force          (GfsDomain *domain,
                                             FttVector *pf,
                                             FttVector *vf,
                                             FttVector *pm,
                                             FttVector *vm);
void        gfs_domain_init_fraction        (GfsDomain *domain,
                                             GtsSurface *s,
                                             GfsVariable *c);
GfsDomain*  gfs_domain_read                 (GtsFile *fp);
void        gfs_domain_split                (GfsDomain *domain,
                                             gboolean one_box_per_pe);
void        gfs_domain_remove_droplets      (GfsDomain *domain,
                                             GfsVariable *c,
                                             gint min);
void        gfs_domain_remove_ponds         (GfsDomain *domain,
                                             gint min,
                                             FttCellCleanupFunc cleanup,
                                             gpointer data);
void        gfs_domain_remove_specks        (GfsDomain *domain);
void        gfs_domain_advect_point         (GfsDomain *domain,
                                             GtsPoint *p,
                                             gdouble dt);
gdouble     gfs_domain_cfl                  (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth);
guint       gfs_domain_size                 (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth);
void        gfs_domain_timer_start          (GfsDomain *domain,
                                             const gchar *name);
void        gfs_domain_timer_stop           (GfsDomain *domain,
                                             const gchar *name);

Description

Details

GFS_DOMAIN_CLASS()

#define     GFS_DOMAIN_CLASS(klass)

klass :


GFS_DOMAIN()

#define     GFS_DOMAIN(obj)

obj :


GFS_IS_DOMAIN()

#define     GFS_IS_DOMAIN(obj)

obj :


GfsDomainClass

typedef struct {
  GtsWGraphClass parent_class;

  void (* post_read) (GfsDomain *, GtsFile * fp);
} GfsDomainClass;


GfsDomain

typedef struct {
  GtsWGraph parent;

  int pid;
  GfsClock * timer;
  GHashTable * timers;

  GtsRange timestep;
  GtsRange size;

  gboolean profile_bc;

  GtsRange mpi_messages;
  GtsRange mpi_wait;

  guint rootlevel;
  FttVector refpos;
  FttVector lambda;

  GArray * allocated;
  GSList * variables;
  GSList * derived_variables;

  GfsVariable * velocity[FTT_DIMENSION];

  GSList * variables_io;
  gboolean binary;

  gint max_depth_write;
} GfsDomain;


gfs_domain_class ()

GfsDomainClass* gfs_domain_class            (void);

Returns :


gfs_domain_alloc ()

guint       gfs_domain_alloc                (GfsDomain *domain);

domain :

a GfsDomain.

Returns :

the index of a memory location newly allocated for each cell of domain.


gfs_domain_free ()

void        gfs_domain_free                 (GfsDomain *domain,
                                             guint i);

Frees the memory location of domain defined by i.

domain :

a GfsDomain.

i :

a memory location index previously allocated using gfs_domain_alloc().


gfs_domain_add_variable ()

GfsVariable* gfs_domain_add_variable        (GfsDomain *domain,
                                             const gchar *name);

Adds a new variable name to domain.

domain :

a GfsDomain.

name :

the name of the variable to add or NULL.

Returns :

the new variable or NULL if a variable with the same name already exists.


gfs_domain_add_derived_variable ()

GfsDerivedVariable* gfs_domain_add_derived_variable
                                            (GfsDomain *domain,
                                             GfsDerivedVariable v);

Adds v to domain.

domain :

a GfsDomain.

v :

the GfsDerivedVariable.

Returns :

the GfsDerivedVariable if the variable was successfully added to domain or NULL if a variable with the same name already exists.


gfs_domain_cell_traverse ()

void        gfs_domain_cell_traverse        (GfsDomain *domain,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttCellTraverseFunc func,
                                             gpointer data);

Traverses the cell trees of domain. Calls the given function for each cell visited.

domain :

a GfsDomain.

order :

the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER.

flags :

which types of children are to be visited.

max_depth :

the maximum depth of the traversal. Cells below this depth will not be traversed. If max_depth is -1 all cells in the tree are visited.

func :

the function to call for each visited FttCell.

data :

user data to pass to func.


gfs_domain_cell_traverse_boundary ()

void        gfs_domain_cell_traverse_boundary
                                            (GfsDomain *domain,
                                             FttDirection d,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttCellTraverseFunc func,
                                             gpointer data);

Traverses the boundary of a domain in direction d. Calls the given function for each cell visited.

domain :

a GfsDomain.

d :

the direction of the boundary to traverse.

order :

the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER.

flags :

which types of children are to be visited.

max_depth :

the maximum depth of the traversal. Cells below this depth will not be traversed. If max_depth is -1 all cells in the tree are visited.

func :

the function to call for each visited FttCell.

data :

user data to pass to func.


gfs_domain_cell_traverse_box ()

void        gfs_domain_cell_traverse_box    (GfsDomain *domain,
                                             GtsBBox *box,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttCellTraverseFunc func,
                                             gpointer data);

Traverses the cell trees of domain. Calls the given function for each cell visited. Only the cells overlapping with box are visited.

domain :

a GfsDomain.

box :

a GtsBBox.

order :

the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER.

flags :

which types of children are to be visited.

max_depth :

the maximum depth of the traversal. Cells below this depth will not be traversed. If max_depth is -1 all cells in the tree are visited.

func :

the function to call for each visited FttCell.

data :

user data to pass to func.


gfs_domain_traverse_mixed ()

void        gfs_domain_traverse_mixed       (GfsDomain *domain,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             FttCellTraverseFunc func,
                                             gpointer data);

Calls func for each mixed cell of domain.

domain :

a GfsDomain.

order :

the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER.

flags :

which types of children are to be visited.

func :

the function to call for each visited FttCell.

data :

user data to pass to func.


gfs_domain_face_traverse ()

void        gfs_domain_face_traverse        (GfsDomain *domain,
                                             FttComponent c,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             FttFaceTraverseFunc func,
                                             gpointer data);

Traverses a domain. Calls the given function for each face of the cells of the domain.

If FTT_TRAVERSE_BOUNDARY_FACES is not set in flags, only "double-sided" faces are traversed i.e. the neighbor field of the face is never NULL.

domain :

a GfsDomain.

c :

only the faces orthogonal to this component will be traversed - one of FTT_X, FTT_Y, (FTT_Z), FTT_XYZ.

order :

the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER.

flags :

which types of children and faces are to be visited.

max_depth :

the maximum depth of the traversal. Cells below this depth will not be traversed. If max_depth is -1 all cells in the tree are visited.

func :

the function to call for each visited FttCellFace.

data :

user data to pass to func.


gfs_domain_combine_traverse ()

void        gfs_domain_combine_traverse     (GfsDomain *domain1,
                                             GfsDomain *domain2,
                                             FttCellCombineTraverseFunc inside,
                                             gpointer idata,
                                             FttCellTraverseFunc outside,
                                             gpointer odata);

Calls inside for each leaf cell of domain1 contained in domain2. The second cell argument to inside is set to the cell of domain2 containing the first cell argument.

If outside is not NULL it is called for each leaf cell of domain1 which is outside of domain2.

domain1 :

a GfsDomain.

domain2 :

another GfsDomain.

inside :

function to call for each pair of cells.

idata :

user data to pass to inside.

outside :

function to call for cells falling outside of domain2 or NULL.

odata :

user data to pass to outside.


gfs_domain_traverse_cut ()

void        gfs_domain_traverse_cut         (GfsDomain *domain,
                                             GtsSurface *s,
                                             FttTraverseType order,
                                             FttTraverseFlags flags,
                                             FttCellTraverseCutFunc func,
                                             gpointer data);

Calls func for each cell of domain cut by s.

domain :

a GfsDomain.

s :

a GtsSurface.

order :

the order in which the cells are visited - FTT_PRE_ORDER, FTT_POST_ORDER.

flags :

which types of children are to be visited.

func :

the function to call for each visited FttCell.

data :

user data to pass to func.


gfs_domain_locate ()

FttCell*    gfs_domain_locate               (GfsDomain *domain,
                                             FttVector target,
                                             gint max_depth);

Locates the cell of domain containing target. This is done efficiently in log(n) operations by using the topology of the cell trees.

domain :

a GfsDomain.

target :

position of the point to look for.

max_depth :

maximum depth to consider (-1 means no restriction).

Returns :

a FttCell of domain containing (boundary included) the point defined by target or NULL if target is not contained in any cell of domain.


gfs_domain_bc ()

void        gfs_domain_bc                   (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             GfsVariable *v);

Apply the boundary conditions in domain for variable v.

domain :

a GfsDomain.

flags :

the traversal flags.

max_depth :

the maximum depth of the traversal.

v :

a GfsVariable.


gfs_domain_copy_bc ()

void        gfs_domain_copy_bc              (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             GfsVariable *v,
                                             GfsVariable *v1);

Apply the boundary conditions of variable v in domain to variable v1.

domain :

a GfsDomain.

flags :

the traversal flags.

max_depth :

the maximum depth of the traversal.

v :

a GfsVariable.

v1 :

another GfsVariable.


gfs_domain_homogeneous_bc ()

void        gfs_domain_homogeneous_bc       (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth,
                                             GfsVariable *ov,
                                             GfsVariable *v);

Apply the boundary conditions in domain for variable ov using the homogeneous version of the boundary condititons for v.

domain :

a GfsDomain.

flags :

the traversal flags.

max_depth :

the maximum depth of the traversal.

ov :

a GfsVariable.

v :

a GfsVariable of which ov is an homogeneous version.


gfs_domain_face_bc ()

void        gfs_domain_face_bc              (GfsDomain *domain,
                                             FttComponent c,
                                             GfsVariable *v);

Apply the boundary conditions on the faces of domain for variable v.

domain :

a GfsDomain.

c :

a component.

v :

a GfsVariable.


gfs_domain_surface_bc ()

void        gfs_domain_surface_bc           (GfsDomain *domain,
                                             GfsVariable *v);

Apply boundary conditions for variable v on embedded surfaces.

domain :

a GfsDomain.

v :

a GfsVariable.


gfs_domain_match ()

void        gfs_domain_match                (GfsDomain *domain);

Match the boundaries of domain.

domain :

a GfsDomain.


gfs_domain_depth ()

guint       gfs_domain_depth                (GfsDomain *domain);

domain :

a GfsDomain.

Returns :

the maximum depth of the cell trees of domain. This function is global i.e. it returns the maximum depth over all the processes (for parallel execution).


gfs_domain_stats_variable ()

GtsRange    gfs_domain_stats_variable       (GfsDomain *domain,
                                             GfsVariable *v,
                                             FttTraverseFlags flags,
                                             gint max_depth);

Traverses the domain defined by domain using gfs_domain_cell_traverse() and gathers statistics about variable v.

domain :

the domain to obtain statistics from.

v :

a GfsVariable.

flags :

which types of cells are to be visited.

max_depth :

maximum depth of the traversal.

Returns :

a GtsRange containing the statistics about v.


gfs_domain_norm_variable ()

GfsNorm     gfs_domain_norm_variable        (GfsDomain *domain,
                                             GfsVariable *v,
                                             FttTraverseFlags flags,
                                             gint max_depth);

Traverses the domain defined by domain using gfs_domain_cell_traverse() and gathers norm statistics about variable v.

The norm is weighted by the volume of each cell.

domain :

the domain to obtain norm from.

v :

a GfsVariable.

flags :

which types of cells are to be visited.

max_depth :

maximum depth of the traversal.

Returns :

a GfsNorm containing the norm statistics about v.


gfs_domain_norm_velocity ()

GfsNorm     gfs_domain_norm_velocity        (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth);

Traverses the domain defined by domain using gfs_domain_cell_traverse() and gathers norm statistics about velocity.

domain :

the domain to obtain the norm from.

flags :

which types of cells are to be visited.

max_depth :

maximum depth of the traversal.

Returns :

a GfsNorm containing the norm statistics about the velocity.


gfs_domain_stats_balance ()

void        gfs_domain_stats_balance        (GfsDomain *domain,
                                             GtsRange *size,
                                             GtsRange *boundary,
                                             GtsRange *mpiwait);

Gathers statistics about the sizes of the domains, their parallel boundaries and the execution time on each PE.

domain :

the domain to obtain statistics from.

size :

GtsRange in which to return stats for the total size of the domain.

boundary :

GtsRange in which to return stats for the size of the parallel boundaries of the domain.

mpiwait :

GtsRange in which to return stats for the average time spend waiting for MPI calls in each PE.


gfs_domain_stats_solid ()

GtsRange    gfs_domain_stats_solid          (GfsDomain *domain);

Traverses the domain defined by domain using gfs_domain_traverse_mixed() and gathers statistics about the solid volume fraction in mixed cells.

domain :

the domain to obtain statistics from.

Returns :

statistics about the solid volume fraction a in mixed cells.


gfs_domain_solid_force ()

void        gfs_domain_solid_force          (GfsDomain *domain,
                                             FttVector *pf,
                                             FttVector *vf,
                                             FttVector *pm,
                                             FttVector *vm);

Fills pf and vf (resp. pm and vm) with the components of the net pressure and viscous forces (resp. pressure and viscous moments) applied by the fluid on the solid surface embbeded in domain.

The reference point for the moments is the origin of the coordinate system.

domain :

a GfsDomain.

pf :

a FttVector.

vf :

a FttVector.

pm :

a FttVector.

vm :

a FttVector.


gfs_domain_init_fraction ()

void        gfs_domain_init_fraction        (GfsDomain *domain,
                                             GtsSurface *s,
                                             GfsVariable *c);

Initializes the fraction c of the interface s contained in all the cells of domain.

domain :

a GfsDomain.

s :

an orientable surface defining the interface boundary.

c :

a GfsVariable.


gfs_domain_read ()

GfsDomain*  gfs_domain_read                 (GtsFile *fp);

Reads the graph nodes (GfsBox) and edges and the corresponding boundaries (GfsBoundaryMpi if necessary) defined in fp.

fp :

a GtsFile.

Returns :

the GfsDomain or NULL if an error occured, in which case the corresponding fp fields (pos and error) are set.


gfs_domain_split ()

void        gfs_domain_split                (GfsDomain *domain,
                                             gboolean one_box_per_pe);

Splits each box of domain into its (4 in 2D, 8 in 3D) children. The corresponding newly created boxes are added to the graph and the parent boxes are destroyed.

domain :

a GfsDomain.

one_box_per_pe :

if TRUE each new box created is assigned to a different process, otherwise the newly created box inherits the pid of its parent.


gfs_domain_remove_droplets ()

void        gfs_domain_remove_droplets      (GfsDomain *domain,
                                             GfsVariable *c,
                                             gint min);

Removes all the droplets of domain smaller than min cells if min is positive, or all the droplets but the -$min largest ones if min is negative.

domain :

a GfsDomain.

c :

a GfsVariable.

min :

the minimum size (in cells) of the droplets.


gfs_domain_remove_ponds ()

void        gfs_domain_remove_ponds         (GfsDomain *domain,
                                             gint min,
                                             FttCellCleanupFunc cleanup,
                                             gpointer data);

Removes all the fluid "ponds" of domain smaller than min cells if min is positive, or all the ponds but the -min largest ones if min is negative.

If the domain is modified its boundaries are re"matched" using gfs_domain_match().

domain :

a GfsDomain.

min :

the minimum size (in cells) of the ponds.

cleanup :

a FttCellCleanupFunc or NULL.

data :

user data to pass to cleanup.


gfs_domain_remove_specks ()

void        gfs_domain_remove_specks        (GfsDomain *domain);

Removes all the solid "specks" of domain. Solid specks are islands which do not contain any empty cell.

Note that the domain's boundaries are not "matched" automatically.

domain :

a GfsDomain.


gfs_domain_advect_point ()

void        gfs_domain_advect_point         (GfsDomain *domain,
                                             GtsPoint *p,
                                             gdouble dt);

Updates the coordinates of point p at time t + dt using the velocity field defined by domain.

If p is not contained within domain, the coordinates are unchanged.

domain :

a GfsDomain.

p :

a GtsPoint.

dt :

the time step.


gfs_domain_cfl ()

gdouble     gfs_domain_cfl                  (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth);

domain :

a GfsDomain.

flags :

which types of cells are to be visited.

max_depth :

maximum depth of the traversal.

Returns :

the minimum over the cells of domain (traversed using flags and max_depth) of the time scale defined by the size of the cell and the norm of either the local velocity or the local acceleration.


gfs_domain_size ()

guint       gfs_domain_size                 (GfsDomain *domain,
                                             FttTraverseFlags flags,
                                             gint max_depth);

domain :

a GfsDomain.

flags :

which types of cells are to be visited.

max_depth :

maximum depth of the traversal.

Returns :

the number of cells of domain traversed using flags and max_depth.


gfs_domain_timer_start ()

void        gfs_domain_timer_start          (GfsDomain *domain,
                                             const gchar *name);

Starts timer name of domain. If name does not exist it is created first.

domain :

a GfsDomain.

name :

the name of the timer.


gfs_domain_timer_stop ()

void        gfs_domain_timer_stop           (GfsDomain *domain,
                                             const gchar *name);

Stops timer name of domain. This function fails if name is not a timer of domain.

domain :

a GfsDomain.

name :

the name of the timer.