version 0.6.0
Loading...
Searching...
No Matches

Computational geometry tool to fill a convex polygon with a given volume fraction in a given direction More...

Functions/Subroutines

pure subroutine, public mod_cg2_flood_polygon::cg2_flood_polygon (polygon, normal, volume, s0, s1, polygon_full, polygon_empty)
 Flood a convex polygon with a given volume fraction in a given direction.
 

Detailed Description

Attention
Modify these functions at your own risk. Many algorithms depend on the specific behaviour of these functions. They are designed to not generate false negative results. Note that false positive results may occur due to the finite representation of real numbers. Take that into consideration when writing new algorithms.

Function/Subroutine Documentation

◆ cg2_flood_polygon()

pure subroutine, public mod_cg2_flood_polygon::cg2_flood_polygon ( type(t_polygon), intent(in) polygon,
double precision, dimension(2), intent(in) normal,
double precision, intent(in) volume,
double precision, dimension(2), intent(out) s0,
double precision, dimension(2), intent(out) s1,
type(t_polygon), intent(out) polygon_full,
type(t_polygon), intent(out) polygon_empty )

The interface between the full and empty part is supposed to be a line segment.

The input data consists in a convex polygon whose vertices are defined in counterclockwise order, a fill direction (normal) and a volume (volume).

Consider the following 6-point convex polygon and a fill direction (the right arrow):

   !!        4         3
   !!        +--------+-----+ 2
   !!       /                \         fill direction (normal)
   !!    5 +                  \             ---->
   !!       `.                 \
   !!         `+----------------+ 1
   !!          6
   !! 

The output is composed of the two extreme points of the interface line segment and two polygons (the full part and the empty part). Note that both full and empty parts are convex polygons.

   !!        4    s1  3
   !!        +-----+--+-----+ 2
   !!       /      |         \         fill direction (normal)
   !!    5 +  full |  empty   \             ---->
   !!       `.     |           \
   !!         `+---+------------+ 1
   !!          6  s0
   !! 

Requirements:

  • The volume fraction must be in the range of 0 and 1, both excluded
  • The polygon must be convex and its vertices defined in couterclockwise order
  • The normal must be a unit vector

Note that for better results you can find the empty part if the volume fraction is greater than 0.5.

The present algorithm is an adaptation to convex polygons of the algorithm presented by Breil et al.

References:

  • Breil, J., Galera, S., & Maire, P. H. (2011). A two‐dimensional VOF interface reconstruction in a multi‐material cell- centered ALE scheme. International Journal for Numerical Methods in Fluids, 65(11‐12), 1351-1364. doi:10.1002/fld.2342
Parameters
[in]polygonAny convex polygon whose points are defined in counterclockwise order
[in]normalThe direction of flood given by a unit vector
[in]volumeThe required volume fraction of the flooded area
[out]s0,s1The extreme points of the interface line segment
[out]polygon_fullPart of the polygon full of fluid
[out]polygon_emptyPart of the polygon without fluid