3.24 enforv2dsz – Efficient PLIC interface location for rectangular cells

The enforv2dsz routine solves the VCE problem specifically for axis-aligned rectangular cells, such as that defined in the voftools_square routine. It employs an efficient analytical solution proposed by [20], which provides a closed-form expression for the interface position \(c\) given the normal vector \(\boldsymbol{n}=(\texttt{xnc}, \texttt{ync})\) and target liquid area \(\texttt{v}\).

\(\,\)

\(\,\)

Fortran:

call enforv2dsz(c,dx,dy,v,vertp,xnc,ync)

C:

enforv2dsz(&c,&dx,&dy,&v,vertp,&xnc,&ync);

Python:

v = np.array(v, dtype=np.float64)
c = voft.enforv2dsz(dx,dy,v,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}\)

dx, dy

IN

W_P

scalars representing the cell dimensions along the \(x\) and \(y\) directions, respectively

v

INOUT

W_P

scalar representing the target liquid area within the cell; temporarily modified during the calculation and restored to its input value before returning

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: The cell must be an axis-aligned rectangle whose four corner coordinates occupy the first four rows of vertp. The positive dimensions dx and dy must match its side lengths along the coordinate axes. The prescribed liquid area must satisfy \(0 \le \texttt{v} \le \texttt{dx} \texttt{dy}\) ; for an area fraction \(\alpha\), use \(\texttt{v} = \alpha \texttt{dx} \texttt{dy}\).