Computational geometry tool to fill a convex polygon with a given volume in a given direction
More...
◆ cg2_axisym_flood_polygon()
pure subroutine mod_cg2_axisym_flood_polygon::cg2_axisym_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 ) |
This routine matches a volume_sought assuming that the unit normal vector to the interface is known. It is only valid for a volume_sought bounded strictly by 0 and 1. The technique consists in computing the line constants of the lines parallel to the interface and passing through all nodes of the polygon. Then finding the bounding line constants c_low and c_up such that c_low < volume_sought < c_up, to this end we use the height of each trapezoid composed by the c_lines and the polygon faces to compute the increasing ck_volumes. When the sum of ck_volumes is superior to the volume_sought, the trapezoid which contains the interface is then known. Finally, using Newton method we search the only root of the polynomial V(h) - vh, where vh = volume_sought - V_low, to find the position of the interface.
- Parameters
-
[in] | polygon | Any convex polygon whose points are defined in counterclockwise order |
[in] | normal | The direction of flood given by a unit vector |
[in] | volume | The required volume of the flooded area |
[out] | s0,s1 | The extreme points of the interface line segment |
[out] | polygon_full | Part of the polygon full of fluid |
[out] | polygon_empty | Part of the polygon without fluid |