VOFTools 5: An extension to non-convex geometries of calculation tools for volume of fluid methods - López, Joaquín; Hernández, Julio; Gómez, Pablo; Zanzi, Claudio; Zamora, Rosendo (Computer physics communications, 2020)
The VOFTools library includes useful tools for performing the geometrical operations that typically arise in volume of fluid (VOF) methods. We present a major improvement of VOFTools to extend its use to non-convex geometries without the need for costly convex-decomposition techniques. A thorough adaptation of the different routines has been carried out to meet the challenges of the new geometries and to maintain, and even improve, the efficiency and robustness of the previous tools. Specifically, we upgraded the routines for (1) truncating a polyhedron with a half space, (2) computing the interface position to cut off a certain volume fraction from a cell in PLIC (piecewise linear interface calculation) reconstruction and (3) computing the volume of a material body, defined by an implicit function, that is contained inside a mesh cell. To assess the performance of the supplied routines, different tests, which are provided in FORTRAN and C, were implemented for several 2D and 3D non-convex geometries. Program Title:VOFTools Program Files doi:http://dx.doi.org/10.17632/brrgt645bh.3 Licensing provisions: GPLv3 Programming language:FORTRAN and C, with C interfaces Journal reference of previous version: J. López, J. Hernández, P. Gómez, C. Zanzi, R. Zamora, “VOFTools 3.2: Added VOF functionality to initialize the liquid volume fraction in general convex cells”, Comput. Phys. Comm. 245 (2019) 106859. Does the new version supersede the previous version?: Yes Reasons for the new version: Extension to non-convex geometries without the need for costly convex-decomposition techniques. Summary of revisions: The main features added with respect to the previous VOFTools version are the following: •The inte3d, enforv3d (originally presented in [1]) and initf3d [2] routines for volume truncation, conservation enforcement and initialization operations in VOF methods, respectively, have been extended to non-convex geometries following the methodology presented in [3], without the need for costly convex-decomposition techniques. Among other aspects, the main change in implementation affects the arrangement of the vertices of the regions resulting from any of the above operations. To this end, the newpol3d subroutine has been updated by replacing Algorithm 3 in [1] by the new Algorithm 1, which is briefly presented below. Let us consider a generic polyhedron, either convex or non-convex, of J face boundaries, with NIPV0(j) vertices sequentially connected and forming a closed loop on each face boundary j. Vertex number ip, assigned to vertex with index i of face boundary j, is stored using the two dimensional array IPV0(j,i)=ip (the highest value of the vertex number is denoted as NTP). The NIPV1 and IPV1 arrays are used to define the new region resulting from the geometric operation under consideration. For every vertex ip located inside the half-space used in a truncation operation or the material body used in a volume fraction initialization operation, the array element IA(ip) is set to 1, and 0 otherwise. According to [3], a “key vertex” of a new face boundary j is a new vertex IPV1(j,i) whose next vertex IPV1(j,i+1) has an IA value equal to 1. [Display omitted] •The new polout2d and polout3d routines have been added to depict the cell geometry in two-column text and VTK (visualization toolkit [4]) format files, respectively.•Files mesh.f and cmesh.h have been updated to include several types of non-convex polygonal and polyhedral cells (Fig. 1 shows some of them) used in the test programs presented below.•The 2D and 3D test programs, which are implemented in both FORTRAN (test2d.f and test3d.f) and C (test2d.c and test3d.c), have been updated to perform the following operations on either convex or non-convex cells (Fig. 2 shows an example for the non-convex cell of Fig. 1(g)):(a) Volume conservation enforcement (VCE). A planar interface with a given orientation is positioned in the cell to cut off a given volume fraction.(b) Volume truncation. The truncation of the original cell by a plane that contains the reconstructed interface is performed, and the resulting truncated volume/area is computed.(c) Volume initialization. The volume/area within the cell of a material body defined by an implicit function is computed.Table 1 presents the CPU times consumed by the 2D and 3D test programs for the different operations and non-convex cell geometries shown in Fig. 1 (the gfortran compiler with the -O0 option to avoid automatic vectorization and a Linux platform with a 2.9 GHz Intel Xeon E3-1535Mv5 processor were used). For operations (a) and (b), the liquid volume fraction is made equal to 0.5, and the components of the unit-length vector n normal to the planar interface are made equal to 1∕D, where D=2 in 2D and 3 in 3D. For operation (c), the interface of the material body to be initialized in the cell is given, as a function of the x, y, z-coordinates, by (x−0.5)2+(y−0.5)2=0.3252 in 2D and (x−0.5)2+(y−0.5)2+(z−0.5)2=0.3252 in 3D, and 10 uniform cell divisions along each coordinate direction are used. Note that the VCE operation requires, on average, twice the time required by the truncation operation. Also note that the initialization operation requires substantially higher CPU times (which obviously depend on the number of divisions used), although it is usually performed only once at the beginning of simulations involving interfacial dynamics problems. In addition, despite the extensive implementation changes required by the more complex geometry considered, the new version of the VOFTools library maintains, and even improves by almost 30% for 3D, the computational efficiency obtained for convex cells. This noticeable improvement is mainly due to the differences between Algorithm 3 in [1] and the proposed Algorithm 1, and a more efficient computation of arithmetic expressions involved in VCE operations.•Files uservoftools.f and cuservoftools.h have been updated to include two new functions (func2d2 and func3d2) with two new material body shapes (an ellipse and a torus, respectively).•Makefile.linux and Makefile.mac are examples of scripts provided to build the new version of the VOFTools library and test programs using different compilers in several platforms (the user can adapt any of these examples to other compilers or platforms).•Updated user manual: The user manual supplied with the software package has been updated to include, along with several minor changes, (1) the input and output arguments and calling convention of the new polout2d and polout3d routines, (2) an analysis of the performance of the different routines for several non-convex cells and (3) execution examples of test programs. Nature of problem: The package of routines includes efficient analytical and geometrical tools for area/volume computation; truncation operations that typically arise in VOF methods; area/volume conservation enforcement to position the interface in PLIC reconstruction; computation of the area/volume of a material body defined by implicit functions that is contained inside a general polygonal or polyhedral cell; and computation of the distance from a given point to the reconstructed interface. Tools for writing in external files the geometry of polygons and polyhedra are also supplied. Solution method: The area/volume computation of a polygon/polyhedron uses an efficient formula based on a quadrilateral decomposition and a 2D projection of each polyhedron face. The analytical VCE method is based on coupling an interpolation bracketing procedure with an improved final calculation step based on the above area/volume computation formula. The area/volume fraction is initialized using a refinement algorithm valid for general polygonal/polyhedral cells. The distance from a given point to a reconstructed PLIC interface is calculated by using the method proposed in [5]. Declaration of Competing Interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Acknowledgments The authors gratefully acknowledge the support of the Spanish Ministerio de Ciencia, Innovación y Universidades - Agencia Estatal de Investigación and FEDER through projects DPI2017-87826-C2-1-P and DPI2017-87826-C2-2-P. References [1] J. López, J. Hernández, P. Gómez, F. Faura, VOFTools - A software package of calculation tools for volume of fluid methods using general convex grids, Comput. Phys. Comm. 223 (2018) 45–54. [2] J. López, J. Hernández, P. Gómez, C. Zanzi, R. Zamora, VOFTools 3.2: Added VOF functionality to initialize the liquid volume fraction in general convex cells, Comput. Phys. Comm. 245 (2019) 106859. [3] J. López, J. Hernández, P. Gómez, F. Faura, Non-convex analytical and geometrical tools for volume truncation, initialization and conservation enforcement in VOF methods, J. Comput. Phys. 392 (2019) 666–693. [4] Kitware, https://www.vtk.org. [5] J. López, P. Gómez, J. Hernández, F. Faura, A two-grid adaptive volume of fluid approach for dendritic solidification, Comput. Fluids 86 (2013) 326–342.