3.23 enforv2d – PLIC interface location for 2D polygons

The enforv2d routine solves the two-dimensional VCE problem to locate the PLIC interface within a polygonal cell. Given a target liquid area \(\texttt{v}\), it determines the position of the interface line such that the area of the liquid region within the cell matches the specified value.

The interface is defined by the equation \(\mathbf{n} \cdot \mathbf{x} + \texttt{c}=0\), where \(\mathbf{n} = (\texttt{xnc}, \texttt{ync})\) is the unit normal vector pointing towards the liquid phase, and \(\texttt{c}\) is a scalar parameter determining the interface position. The routine computes \(\texttt{c}\) such that:

\[\mbox{Area}(\{\boldsymbol{x} \in \Omega_\text{cell} | \boldsymbol{n} \cdot \boldsymbol{x} + \texttt{c} > 0 \}) = \texttt{v}\]

where \(\Omega_{\text{cell}}\) is the domain of the polygonal cell.

\(\,\)

Fortran:

call enforv2d(c,ipv,ntp,ntv,v,vt,vertp,xnc,ync)

C:

enforv2d(&c,ipv,&ntp,&ntv,&v,&vt,vertp,&xnc,&ync);

Python:

c = voft.enforv2d(ipv,ntp,ntv,v,vt,vertp,xnc,ync)

Arguments:

c

OUT

W_P

scalar representing the signed distance from the PLIC interface to the origin along the unit normal vector \(\boldsymbol{n}\)

ipv

IN

I_P

array of length \(\texttt{nv}\) storing the vertex indices defining the polygon

ntp

IN

I_P

maximum vertex index in the connectivity list

ntv

IN

I_P

total number of vertices

v

IN

W_P

scalar representing the target liquid area within the cell

vt

IN

W_P

scalar representing the total area of the polygon

vertp

IN

W_P

array of dimensions \(({nv},2)\) storing the \(x,y\)-coordinates of each vertex

xnc, ync

IN

W_P

\(x,y\)-components of the unit-length vector \(\boldsymbol{n}\) normal to the PLIC interface pointing towards the liquid phase

Note: This routine serves as the general solver for arbitrary 2D polygons. For axis-aligned rectangular cells, the more efficient analytical method in enforv2dsz should be preferred. The input polygon must have compact vertex numbering, with \(\texttt{ntp} = \texttt{ntv}\). The total cell area vt must be positive, and the prescribed liquid area must satisfy \(0 \le \texttt{v} \le \texttt{vt}\). The argument v is an area, not an area fraction; for a prescribed fraction \(\alpha\), use \(\texttt{v} = \alpha \texttt{vt}\). The input polygon is not modified.