# Values, macros and structures in Gerris

### From Gerris

Revision as of 14:14, 15 May 2012Blagree (Talk | contribs) ← Previous diff |
Revision as of 07:14, 16 May 2012Blagree (Talk | contribs) (→Gerris structures) Next diff → |
||

Line 47: |
Line 47: | ||

</source> | </source> | ||

- | The homogeneous version of the considered [[#GfsVariable|GfsVariable]] is stored in lhs. | + | The homogeneous version of the considered [[#GfsVariable|GfsVariable]] is stored in ''lhs''. |

=== DiffusionCoeff === | === DiffusionCoeff === | ||

Line 62: |
Line 62: | ||

</source> | </source> | ||

- | d is a [[#GfsSourceDiffusion|GfsSourceDiffusion]], dt is the timestep, the [[#GfsVariable|GfsVariable]] rhoc is the mass, metric is the implicit metric term, the [[#GfsFunction|GfsFunction]] alpha is the inverse of the density and domain is the considered [[#GfsDomain|GfsDomain]]. | + | ''d'' is a [[#GfsSourceDiffusion|GfsSourceDiffusion]], ''dt'' is the timestep, the [[#GfsVariable|GfsVariable]] ''rhoc'' is the mass, ''metric'' is the implicit metric term, the [[#GfsFunction|GfsFunction]] ''alpha'' is the inverse of the density and ''domain'' is the considered [[#GfsDomain|GfsDomain]]. |

=== FttCell === | === FttCell === | ||

Line 77: |
Line 77: | ||

</source> | </source> | ||

- | children and parent are the two [[The Fully Threaded Tree/Basic concepts|FttOct]]s associated with the FttCell. | + | ''children'' and ''parent'' are the two [[#FttOct|FttOct]]s associated with the FttCell. |

=== FttCellChildren === | === FttCellChildren === | ||

Line 87: |
Line 87: | ||

</source> | </source> | ||

- | The children of the considered [[#FttCell|FttCell]] are stored in c (4 in 2D and 8 in 3D). | + | The children of the considered [[#FttCell|FttCell]] are stored in ''c'' (4 in 2D and 8 in 3D). |

=== FttCellFace === | === FttCellFace === | ||

- | See [[The Fully Threaded Tree/Basic concepts/FttDirection|FttDirection]]. | + | See [[The Fully Threaded Tree#FttCellFace|FttCellFace]]. |

=== FttCellFlags === | === FttCellFlags === | ||

Line 114: |
Line 114: | ||

</source> | </source> | ||

- | c is the array containing the neighbors of a considered [[#FttCell|FttCell]]. | + | ''c'' is the array containing the neighbors of a considered [[#FttCell|FttCell]]. |

+ | |||

+ | === FttCellTraverse === | ||

+ | |||

+ | <source lang="c"> | ||

+ | struct { | ||

+ | FttCell ** cells; | ||

+ | FttCell ** curent; | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | === FttComponent === | ||

+ | |||

+ | <source lang="c"> | ||

+ | typedef enum | ||

+ | { | ||

+ | FTT_X = 0, | ||

+ | FTT_Y, | ||

+ | #if (!FTT_2D) | ||

+ | FTT_Z, | ||

+ | #endif /* FTT_3D */ | ||

+ | FTT_DIMENSION, | ||

+ | FTT_XY, | ||

+ | #if FTT_2D | ||

+ | FTT_XYZ = FTT_XY | ||

+ | #else /* FTT_3D */ | ||

+ | FTT_XYZ | ||

+ | #endif /* FTT_3D */ | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | === FttDirection === | ||

+ | |||

+ | See [[The Fully Threaded Tree#FttDirection|FttDirection]]. | ||

+ | |||

+ | === FttFaceType === | ||

+ | |||

+ | <source lang="c"> | ||

+ | typedef enum { | ||

+ | FTT_BOUNDARY, | ||

+ | FTT_FINE_FINE, | ||

+ | FTT_FINE_COARSE | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | === FttOct === | ||

+ | |||

+ | <source lang="c"> | ||

+ | struct { | ||

+ | guint level; | ||

+ | FttCell * parent; | ||

+ | FttCellNeighbors neighbors; | ||

+ | FttVector pos; | ||

+ | |||

+ | FttCell cells[FTT_CELLS]; | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | ''parent'' is the [[#FttCell|FttCell]] to which the FttOct is linked, ''level'' its level (0 for the root, 1 for the children of the root, and so on). The [[#FttCellNeighbors|FttCellNeighbors]] ''neighbors'' stores the neighbors of ''parent'' and the [[#FttVector|FttVector]] ''pos'' gives the coordinates of the center of ''parent''. The array ''cells'' contains the children of ''parent''. | ||

+ | |||

+ | === FttRootCell === | ||

+ | |||

+ | <source lang="c"> | ||

+ | struct{ | ||

+ | FttCell cell; | ||

+ | |||

+ | FttCellNeighbors neighbors; | ||

+ | FttVector pos; | ||

+ | guint level; | ||

+ | gpointer parent; | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | The [[#FttCellNeighbors|FttCellNeighbors]] ''neighbors'' stores the neighbors of the [[#FttCell|FttCell]] ''cell'' (which should be FttRootCells too). The [[#FttVector|FttVector]] ''pos'' gives the coordinates of the center of ''cell'' and ''level'' is the level of ''cell'' (the size of ''cell'' is <math>2^{level}</math>). | ||

+ | |||

+ | === FttTraverseType === | ||

+ | |||

+ | <source lang="c"> | ||

+ | typedef enum { | ||

+ | FTT_PRE_ORDER, | ||

+ | FTT_POST_ORDER | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | When the type ''FTT_PRE_ORDER'' is used, the traversed [[#FttCell|FttCell]] is considered before its [[#FttCellChildren|FttCellChildren]] (and all functions are applied in this order). It happens the other way when the type ''FTT_POST_ORDER'' is used. | ||

+ | |||

+ | === FttVector === | ||

+ | |||

+ | <source lang="c"> | ||

+ | struct { | ||

+ | gdouble x, y, z; | ||

+ | } | ||

+ | </source> | ||

+ | |||

+ | FttVector defines a vector of coordinates ''x'', ''y'', and ''z''. | ||

+ | |||

+ | === GfsBc === | ||

+ | |||

+ | <source lang="c"> | ||

+ | struct { | ||

+ | /*< private >*/ | ||

+ | GtsObject parent; | ||

+ | GfsLinearProblem * lp; | ||

+ | |||

+ | /*< public >*/ | ||

+ | GfsBoundary * b; | ||

+ | GfsVariable * v; | ||

+ | gboolean extra; | ||

+ | FttFaceTraverseFunc bc, homogeneous_bc; | ||

+ | FttFaceTraverseFunc homogeneous_bc_stencil; | ||

+ | FttFaceTraverseFunc face_bc; | ||

+ | } | ||

+ | </source> |

## Revision as of 07:14, 16 May 2012

## Contents |

## Values defined in Gerris

N_CELLS = FTT_CELLS = <math>2^{dimension}</math>

FTT_NEIGHBORS_2D = (FTT_BOTTOM) + 1

GFS_STATUS_UNDEFINED = 0

GFS_STATUS_SOLID = 1

GFS_STATUS_FLUID = 2

## Gerris Macros

## Gerris structures

### CellCube

typedef struct {

GtsPoint p[8];

GfsSegment s[12];

}

The vertices of the cube are stored in the GtsPoint array and the edges in the GfsSegment array.

### CellFace

typedef struct {

GtsPoint p[4];

GfsSegment s[4];

}

The vertices of the face are stored in the GtsPoint array and the edges in the GfsSegment array.

### CompatPar

typedef struct {

GfsVariable * lhs;

gboolean dirichlet;

}

The homogeneous version of the considered GfsVariable is stored in *lhs*.

### DiffusionCoeff

typedef struct {

GfsSourceDiffusion * d;

gdouble lambda2[FTT_DIMENSION];

gdouble dt;

GfsVariable * rhoc, * metric;

GfsFunction * alpha;

GfsDomain * domain;

}

*d* is a GfsSourceDiffusion, *dt* is the timestep, the GfsVariable *rhoc* is the mass, *metric* is the implicit metric term, the GfsFunction *alpha* is the inverse of the density and *domain* is the considered GfsDomain.

### FttCell

struct {

/*<public>*/

guint flags;

gpointer data;

/*<private>*/

struct _FttOct * parent, * children;

}

*children* and *parent* are the two FttOcts associated with the FttCell.

### FttCellChildren

struct {

FttCell * c[FTT_CELLS];

};

The children of the considered FttCell are stored in *c* (4 in 2D and 8 in 3D).

### FttCellFace

See FttCellFace.

### FttCellFlags

typedef enum {

FTT_FLAG_ID = 7,

FTT_FLAG_DESTROYED = 1 << 3,

FTT_FLAG_LEAF = 1 << 4, /* used only for I/O operations */

FTT_FLAG_TRAVERSED = FTT_FLAG_LEAF, /* used for face traversal */

FTT_FLAG_USER = 5 /* user flags start here */

}

### FttCellNeighbors

struct {

/* right, left, top, bottom, front, back */

FttCell * c[FTT_NEIGHBORS];

}

*c* is the array containing the neighbors of a considered FttCell.

### FttCellTraverse

struct {

FttCell ** cells;

FttCell ** curent;

}

### FttComponent

typedef enum

{

FTT_X = 0,

FTT_Y,

#if (!FTT_2D)

FTT_Z,

#endif /* FTT_3D */

FTT_DIMENSION,

FTT_XY,

#if FTT_2D

FTT_XYZ = FTT_XY

#else /* FTT_3D */

FTT_XYZ

#endif /* FTT_3D */

}

### FttDirection

See FttDirection.

### FttFaceType

typedef enum {

FTT_BOUNDARY,

FTT_FINE_FINE,

FTT_FINE_COARSE

}

### FttOct

struct {

guint level;

FttCell * parent;

FttCellNeighbors neighbors;

FttVector pos;

FttCell cells[FTT_CELLS];

}

*parent* is the FttCell to which the FttOct is linked, *level* its level (0 for the root, 1 for the children of the root, and so on). The FttCellNeighbors *neighbors* stores the neighbors of *parent* and the FttVector *pos* gives the coordinates of the center of *parent*. The array *cells* contains the children of *parent*.

### FttRootCell

struct{

FttCell cell;

FttCellNeighbors neighbors;

FttVector pos;

guint level;

gpointer parent;

}

The FttCellNeighbors *neighbors* stores the neighbors of the FttCell *cell* (which should be FttRootCells too). The FttVector *pos* gives the coordinates of the center of *cell* and *level* is the level of *cell* (the size of *cell* is <math>2^{level}</math>).

### FttTraverseType

typedef enum {

FTT_PRE_ORDER,

FTT_POST_ORDER

}

When the type *FTT_PRE_ORDER* is used, the traversed FttCell is considered before its FttCellChildren (and all functions are applied in this order). It happens the other way when the type *FTT_POST_ORDER* is used.

### FttVector

struct {

gdouble x, y, z;

}

FttVector defines a vector of coordinates *x*, *y*, and *z*.

### GfsBc

struct {

/*< private >*/

GtsObject parent;

GfsLinearProblem * lp;

/*< public >*/

GfsBoundary * b;

GfsVariable * v;

gboolean extra;

FttFaceTraverseFunc bc, homogeneous_bc;

FttFaceTraverseFunc homogeneous_bc_stencil;

FttFaceTraverseFunc face_bc;

}