Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
geometry.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define plane_alpha   line_alpha
 
#define plane_volume(n, alpha)   line_area(n.x, n.y, alpha)
 
#define plane_area_center(m, a, p)   line_length_center(m,a,p)
 
#define plane_center(m, alpha, a, p)   line_center(m,alpha,a,p)
 This function fills the coordinates p of the centroid of the fraction a of a cubic cell lying under the plane $(m,alpha)$.
 

Functions

double line_alpha (double c, coord n)
 
double line_area (double nx, double ny, double alpha)
 Conversely there is a unique function computing \(c\) as a function of \(\mathbf{n}\) and \(\alpha\).
 
double rectangle_fraction (coord n, double alpha, coord a, coord b)
 VOF algorithms require the computation of volume fractions on (rectangular) parts of the initial square cell.
 
int facets (coord n, double alpha, coord p[2])
 From the interface definition, it is also possible to compute the coordinates of the segment in 2D, or facet in 3D, representing the interface in the unit cell.
 
double line_length_center (coord m, double alpha, coord *p)
 This function fills the coordinates p of the centroid of the interface fragment and returns the length/area of the fragment.
 
void line_center (coord m, double alpha, double a, coord *p)
 This function fills the coordinates p of the centroid of the fraction a of a square cell lying under the line $(m,alpha)$.
 

Macro Definition Documentation

◆ plane_alpha

#define plane_alpha   line_alpha

Definition at line 133 of file geometry.h.

◆ plane_area_center

#define plane_area_center (   m,
  a,
  p 
)    line_length_center(m,a,p)

Definition at line 438 of file geometry.h.

◆ plane_center

#define plane_center (   m,
  alpha,
  a,
  p 
)    line_center(m,alpha,a,p)

This function fills the coordinates p of the centroid of the fraction a of a cubic cell lying under the plane $(m,alpha)$.

Definition at line 564 of file geometry.h.

◆ plane_volume

#define plane_volume (   n,
  alpha 
)    line_area(n.x, n.y, alpha)

Definition at line 257 of file geometry.h.

Function Documentation

◆ facets()

int facets ( coord  n,
double  alpha,
coord  p[2] 
)

From the interface definition, it is also possible to compute the coordinates of the segment in 2D, or facet in 3D, representing the interface in the unit cell.

In two dimensions, the function below returns the 0,1 or 2 coordinates (stored in the p array provided by the user) of the corresponding interface segments. The case where only 1 coordinate is returned corresponds to the degenerate case where the interface intersects the cell exactly on a vertex.

In three dimensions, the function returns up to 12 coordinates of the planar fragment.

Definition at line 294 of file geometry.h.

References a, alpha, dimension, i, n, p, s, x, and vector::y.

◆ line_alpha()

double line_alpha ( double  c,
coord  n 
)

Basic geometric functions

These basic geometric functions are mostly related to Volume-Of-Fluid computations.

We consider a square cell of size unity centered on the origin, cut by a straight line.

Cell and interface

The line can be described by the equation

\[ n_xx+n_yy=\alpha \]

where \(\mathbf{n}\) is a vector normal to the interface and \(\alpha\) is the intercept. We note \(c\) the volume of the part of the square cell which lies "inside" the interface, where "inside" is defined by convention as the opposite direction to the normal vector \(\mathbf{n}\) (i.e. the normal vector is pointing "outside").

With these definitions, the interface is uniquely defined by providing \(\mathbf{n}\) and either \(\alpha\) or \(c\) i.e. there is a unique function which computes \(\alpha\) given \(c\) and \(\mathbf{n}\). We call this function line_alpha() and define it as:

Definition at line 37 of file geometry.h.

References alpha, c, clamp(), n, swap, vector::x, x, and vector::y.

Here is the call graph for this function:

◆ line_area()

double line_area ( double  nx,
double  ny,
double  alpha 
)

Conversely there is a unique function computing \(c\) as a function of \(\mathbf{n}\) and \(\alpha\).

We call this function line_area() and define it as:

Definition at line 165 of file geometry.h.

References a, alpha, area(), clamp(), sq(), v, and x.

Here is the call graph for this function:

◆ line_center()

void line_center ( coord  m,
double  alpha,
double  a,
coord p 
)

This function fills the coordinates p of the centroid of the fraction a of a square cell lying under the line $(m,alpha)$.

Definition at line 514 of file geometry.h.

References a, alpha, b, cube(), m(), n, p, sign(), sq(), vector::x, and x.

Here is the call graph for this function:

◆ line_length_center()

double line_length_center ( coord  m,
double  alpha,
coord p 
)

This function fills the coordinates p of the centroid of the interface fragment and returns the length/area of the fragment.

Definition at line 384 of file geometry.h.

References alpha, clamp(), m(), n, p, vector::x, x, and vector::y.

Here is the call graph for this function:

◆ rectangle_fraction()

double rectangle_fraction ( coord  n,
double  alpha,
coord  a,
coord  b 
)

VOF algorithms require the computation of volume fractions on (rectangular) parts of the initial square cell.

We first define a function which takes an interface definition ( \(\mathbf{n}\), \(\alpha\)), the coordinates of the lower-left a and upper-right b corners of a rectangle and returns the fraction of this rectangle which lies inside the interface.

Definition at line 269 of file geometry.h.

References a, alpha, b, dimension, n, plane_volume, vector::x, x, and coord::x.

Referenced by embed_fraction_refine(), fine(), for(), for(), and fraction_refine().

Here is the caller graph for this function: