1. Introduction
The VOF method uses a scalar indicator function,
f defined by:
to represent a two-phase flow. On a discretized numerical grid, it is the fraction of the cell occupied by Fluid 1 defined by:
where
V is the cell volume, and is discontinuous by nature. Fully occupied by fluid 1 is denoted as
, completely void of fluid 1 as
, and two-fluid or interfacial as
, as depicted in
Figure 1. The volume is tracked by the advection equation:
The most common solutions to the advection Equation (
3) are geometric methods. Geometric methods follow a two-step process: interface reconstruction followed by flux calculation. Interface reconstruction uses a geometric approximation created from the
F field. The simplest method is the simple line interface calculation (SLIC) method where, in a split manner, a straight line is constructed parallel to one of the coordinate axes. Only neighboring cells in the respective direction are needed. The fluxes are calculated from upwind and downwind cells with a weight determined by the orientation of the interface and local velocities. The simplicity of this method struggles with accurately capturing more complex configurations, and, as Noh and Woodward [
1] observed, fluid separation for complex velocities when vorticities and shearing occur at the interface.
More commonly used is the piecewise linear interface calculation (PLIC) method where the equation of a line:
represents the interface.
ensures that the volume under the interface is equivalent to the cell’s volume, and
can be calculated in numerous ways. Youngs [
2] used a straightforward method of the normalized gradient of
F, but as the resolution increased, the accuracy reduced from second order to first order. Alternatively, a centered scheme using the neighboring row-wise or column-wise volume fractions for horizontal and vertical directions, respectively, can be used to calculate the slope. Pilloid and Puckett [
3] presented the efficient least-squares volume-of-fluid interface reconstruction algorithm (ELVIRA) where six choices from forward, centered, and backward schemes are considered. The candidate that minimizes the least-squares error between the volume of the true and approximate interfaces is selected. ELVIRA is second-order accurate, but is computationally expensive. Scardovelli [
4] combined the centered-column method and the least-squares approach of ELVIRA in least-square fit where a radius extends from the target cell and all points are used in a linear or quadratic least-square fit.
Once the interface is reconstructed, the volume fluxes are calculated in either a Lagrangian or Eulerian reference frame in a split or unsplit manner. Split methods are simpler by comparison. The volume is updated to an intermediate volume after a directional sweep and is updated to after all directions have been swept. The order of the direction sweeps changes with each iteration to prevent directional bias. In a Lagrangian frame, the endpoints of the reconstructed line segment are advected by local velocities. The volume that has moved across the cell face is the flux. In an Eulerian frame, the volume under the interface of width moves across the face determined by velocity.
Unsplit methods are more complex. In a Lagrangian frame, the vertices containing the fluid are advected by local velocities. This results in new polygons cut by the cell faces, and the volumes of the resulting polygons are distributed. In an Eulerian frame, the fluxed regions overlap and will be advected multiple times. Rider and Kothe [
5] proposed cutting the corners with triangles based on the face center velocities forming a trapezoidal flux region that reduces but does not eliminate the overlap. López et al. [
6] expanded on this by using cell vertex velocities to eliminate the overlap. López et al. [
7] wrapped many of these methods into the VOFTools library.
Interest in the application of machine learning in computational simulations of multiphase flow has been increasing. Zhu et al. [
8] provide a review of various ML implementations for improving the efficiency and accuracy of computational fluid dynamic (CFD) simulations of multiphase flow. The approaches range from simple neural networks (NNs) to data-driven surrogates. They point to extensive works utilizing ML algorithms for closure modeling for drag, turbulence, heat, and mass transport. Ma et al. [
9] used data generated from direct numerical simulations (DNSs) of a simple bubble system to create a relatively small NN consisting of one hidden layer with 10 nodes. This NN was able to create a function for the closure terms of interest. When implemented and tested, the NN recovered the main aspects of the DNS solutions. Tang et al. [
10] utilized ML as an alternative for determining the coefficient and correlation regarding bubble condensation. The resulting NN, consisting of three hidden layers with 80, 40, and 20 nodes in the layers, was trained on experimental data and randomly generated data points of existing conditional correlations. They found good agreement when compared to experimental data without the need to select the appropriate correlation and coefficient.
Ansari et al. [
11,
12] deployed data-driven surrogates in place of conventional CFD simulations. Their data sets were comprised of phase fraction, pressure, and velocity components produced by CFD and proposed three approaches: data from a single time step, multiple time steps from “significant dynamic moments”, and repeating the multiple time step approach with the addition of time steps with the highest error. The surrogates showed good agreement with the CFD solutions while being computationally less expensive. Similarly, Ganti and Khare [
13] developed a framework for data-driven surrogates trained on DNS results utilizing the VOF method for flow over a circular cylinder and liquid injection in a quiescent environment. They noted excellent agreement between the DNS and surrogate solutions, as well as excellent speed up.
Several efforts have been made to incorporate ML into different aspects of the VOF method. One area is the calculation of interface curvature. Qi et al. [
14] substituted conventional interface curvature calculations with a single hidden layer NN of 100 nodes. They proposed a relationship between the interface curvature and the volume fractions of a
stencil for utilizing 2D circles of various sizes as their data set. Patel et al. [
15] extended this to three-dimensions using a
stencil of volume fractions. Their data set comprised 3D waves, ellipsoids, and Gaussian surfaces. They deploy a grid search method to find an optimal NN topology of a single hidden layer with 80 nodes. Both studies showed good agreement with analytical solutions and other curvature calculation methods. Cervone et al. [
16] altered the inputs opting to use the height function instead of the volume fractions. They found an optimal size of a single hidden layer with 100 nodes. A key note in their study was that the NN lacked convergence with grid resolution compared to its conventional counterpart.
The ML work also includes the interface normal calculation and interface reconstruction. Li et al. [
17] developed an NN to compute the interface normals in the VOF method in 3D. Much like the previous formulations, they showed that a relationship between the interface normals and the volume fractions of a
stencil could be generated. The data set used spheres of various sizes, and the resulting NN consisted of three hidden layers with 50, 20, and 10 nodes, respectively. When compared to Young’s method and the height function for reconstruction, the NN produced lower errors for various test conditions. Ataei et al. [
18] coined NPLIC, referring to using an NN for computing PLIC calculations. They proposed using separate NNs relating
in Equation (
4) to the inputs specific to the mesh type. Their NNs produced interface reconstruction results as accurate as conventional PLIC for a variety of mesh types, while providing up to five times speed up. Cahaly et al. [
19] proposed an alternative formulation, referred to as PLIC-Net, for interface reconstruction using the volume fractions of
stencil and the phasic barycenters. Their data set was compromised of various paraboloid surfaces to resemble common interface geometries observed in multiphase flows. The resulting NN used three hidden layers with 100 nodes in each layer. They reported improvements versus the least-squares volume-of-fluid interface reconstruction algorithm (LVIRA), and ELVIRA as PLIC-Net had fewer errors than LVIRA with only limited spurious planes and lower computational costs when implemented into a flow solver. Finally, Després and Jourdren [
20] approached the dimensionless flux calculations in the VOF method via NN. Their data set was comprised of circles with the addition of corners to cover cases that could not be represented by a single line with increasing mesh resolution. They tested
and
stencils, noting that both exhibit roughly the same accuracy for smooth interfaces, but the
stencil performed better for corners.
In this work, we present a data-driven approach, that is a ML function that directly calculates F of the next time step without the need for the typical two-step process. That is a novel application of ML to volume tracking in the VOF-based multiphase flow solvers. The structure of the papers is as follows. First, the problem setup and ML approach will be laid out. Then, the ML function’s performance will be evaluated on commonly used advection tests and a set of new tests. Finally, a discussion and summary will conclude the paper.
3. Results
We present the results of the chosen ML function. It begins with a series of input sensitivity tests to gauge the ML function’s response to deviations in inputs and loosely relate the input contributions to the output. We follow with the 1D translation, rotation, and vortex test cases outlined in Raessi et al. [
27] to provide a comparison between the ML function and other VOF methods. Additionally, a 2D translation test was added. A brief discussion of results specific to the tests will be provided here. More general discussions pertaining to all test cases will be made in the section after.
The same error metrics:
,
, and
were used. Contour plots with levels at
,
, and
will be displayed at points throughout the tests. For brevity, only the interface geometries from the ML function are presented here. The interface geometries associated with the other methods can be seen in [
27] Two paths were tracked for translation and rotation cases: ML only and hybrid. ML only is self-explanatory where the volume fraction field is initialized at the starting position, and was advected by the ML function at every time step. The difference between the ML only and hybrid path was that the ML function never used its previously predicted outputs as inputs. The exact solution at each time step for the translation and rotation cases was known and was supplied to the ML function as inputs. That is, the
F field was initialized and the ML function would produce outputs for the next time step based on the exact values. At the next time step, the
F field was reinitialized, and the ML function would once again produce outputs based on the exact values. This would highlight cascading errors versus single time step errors. For these tests, the contour plots will us a “+” to mark the center of mass calculated by:
where
is the cell center location, and a dashed line represents the exact path.
3.1. Volume Sensitivity and Cell Contribution
The purpose of this test was to determine the volume magnitude threshold in which the ML function becomes blind to values less than the threshold. Eight of the nine cells in the input stencil were initialized as full, and the last cell was variable. The location of the variable cell shifts through all of the input cell positions with a volume ranging from
to
. The value of the variable cell is referred to as the zero sensitivity value as the ML solution was compared to the exact solution when the variable cell was empty in each configuration. The results for
in either direction are reported in
Figure 7 and
Figure 8. The volume threshold was found to be around ∼
evident by the relative error remaining constant until increasing or decreasing depending on the velocity and configuration.
Notice that the error depends on the position of the variable cell as well. This was the secondary purpose of the test—to provide insight into each cell’s contribution to the output. How the target cell donates and accepts fluid depends on the volume and velocity configuration. Consider translation in the positive x-direction. The target cell receives fluid from cell
and donates fluid to cell
. The other cells would have no effect on the target. Therefore, varying the volumes of the other cells would not change the output, and a constant error should be as they do not contribute to the target. Generally, this was observed. However, some exceptions can be observed in
Figure 8. For
, errors were observed when the value of corner cells
and
changed, similar to
where corner cell
produced error. Of particular note was
, where cells
and
produced significant errors. Cell
was expected as it receives fluid from the target. Cell
was the outlier. As the cells became filled, the output was corrected.
3.2. Velocity Sensitivity
Similarly, the velocity inputs were expected to have a threshold. Three of the nine cells of the input stencil were initialized as full and the remaining were empty. The full cells were oriented such that they created occupied column
for horizontal translation and row
for vertical translation. The test varied the
from
to
. The outputs of
for varying magnitudes of
are shown in
Figure 9. Asymptotic behavior, as observed for the output and ∼
, was determined to be the threshold. Coupling this with the volume sensitivity and cell contribution results, strange outputs with large errors for various input configurations were expected to occur.
3.3. Filter
The hyperbolic tangent activation constrained the output to
asymptotically. When combined with floating-point numbers, the ML function rarely produced solutions of exactly zero or one. Outputs that should be unity were less of an issue compared to outputs that would be zero, referred to as residuals. Combining the residuals with the marking function, the residuals spread throughout the domain and eventually reached the computational bounds as depicted in
Figure 10a. Based on several translation test cases, residuals were observed to infrequently peak around ∼
with this particular ML function.
A filter was applied to correct the asymptotic values. For this ML function, filter strength was set to
, one magnitude lower than the infrequently observed peaks. Tying in with the volume sensitivity results, volume inputs below
had little to no impact on the ML output. With the filter applied, the residuals vanished, and the marked cells remained close to the interface, as depicted in
Figure 10b.
3.4. The 1D Translation
A circle with radius 0.15 was initially centered at
and was advected to
in
. A minimum velocity of
, and a maximum of
was used.
Table 3 reports the errors between the ML only solution and the exact solution at the final position. Contour snapshots of the initial and final positions are shown in
Figure 11. Error plots are shown in
Figure 12, and final errors are reported in
Table 3.
There is not much to note here as the ML function was able to run at all velocity conditions and resolutions without fluid separation and minimum interface distortion. As increased, the overall shape appeared to flatten and interface distortions appeared most notably in the highest velocity cases.
3.5. The 2D Translation
A circle of radius 0.15 was initially centered at
and was advected to (0.75, 0.55) in
. The velocity used the same range as the 1D translation test, and the velocity field had a ratio of
. Contour snapshots of the initial and final positions are shown in
Figure 13. Error plots are shown in
Figure 14, and final errors are reported in
Table 4.
Similar to 1D translation, the ML function was able to run all conditions without fluid separation. The interface flattening and distortions were more apparent at high-velocity conditions. Especially in where the contours appear more triangular at , and fingers/tendrils begin to appear at .
3.6. Rotation
A circle of radius 0.15 was initially centered at (0.75, 0.5) in
. The center of rotation is (0.5, 0.5) with an angular velocity
.
ranged from
to
. Contour snapshots at every third of a revolution are shown in
Figure 15. Error plots are shown in
Figure 16, and the final errors are reported in
Table 5. If the test exited prematurely, the final position is reported instead of the errors.
The ML function struggled at the lowest velocity condition, only completing the test at the lowest resolution. At the other resolutions, fluid separation was observed beginning on the edges closest to the domain bounds and at the center of the domain. The separations appeared to stick in place and continued to grow with proceeding time steps in the velocity direction. On the outer edge, the separations also grew to the domain bounds.
This unexpected behavior was due to the velocity inputs, as these issues were not observed when increased. In the prescribed velocity field, occurred at the domain bounds going to zero towards the domain center. The velocity inputs would be around ∼ on the outside edge and lower towards the domain center. As observed in the velocity sensitivity results, low to ∼ corresponded to transitioning to the threshold.
The best performance was seen from to with the ML function completing at all resolutions with no fluid separation. At , the filter strength needed to be increased to as residuals peaked around high ∼ at completion. These residuals spread to the domain bounds ending the test.
3.7. Vortex Test
A circle of radius 0.15 was initially centered at (0.5, 0.75) in
. The velocity field was defined by:
The fluid was advected to
, the velocity was reversed and advected to
where the fluid should return to its initial position, recovering its initial interface geometry, i.e., a circle of radius
centered at
. Contour snapshots at
,
,
, and
are shown in
Figure 17 and
Figure 18 for 30 and 60 CPD, respectively. Unlike the previous tests, the exact solution is only known at the initial and final positions. As a result,
and
of the volume fraction field could not be tracked throughout the test; they are only available at the end of the test (
) and are reported in
Table 6. Throughout the vortex test (i.e.,
), only the error in the total volume,
, can be monitored, which is shown in
Figure 19.
The ML function struggled the most with this test and was only able to complete it with specific conditions. The most consistent range was from to where the fluid returned to its original shape with minimum interface distortion, and volume was conserved well.
There appeared to be two different failure areas between low and high
. At low
the tail was the point of failure as it would separate multiple times. Rudman [
28] reported similar behavior for other VOF methods on a similar test, a key difference being that the separations maintained a local shape in Rudman. Here, the separations spread like in the rotation test. In contrast to rotation, the separation growths closely follow the velocity field. The tail is a common point of failure due to its sharp interface. In terms of machine learning, the tail was not reflected in the data set, but one could argue the tail could be represented by a series of circles. One could also argue that the area was under-resolved, but no improvement was observed as the resolution increased. This pointed towards the velocity inputs where the range at a particular
would produce unexpected results.
At , the leading portion was the problem area. This result was a surprise as this did not occur at other conditions. The leading and outer curve interfaces would begin to distort. At times, the leading curve would be first and vice-versa. The distortions would eventually split the body, growing with the velocity field. The velocity inputs are suspected to be the root again as this was more of a test of extrapolation compared to the translation and rotation tests.
4. Discussion
We begin with a discussion on resolution and error. Generally, when fell within the training data range, was inversely related to resolution. This was attributed to the number of time steps. In order to have a matching advection distance, the highest resolution required four times the amount of steps of the lowest resolution. The hybrid advection paths revealed that for single time steps produced a consistent range of error. With the ML only advection paths, the error would accumulate and invite more opportunities for unexpected outputs. It is likely that would reach its maximum given enough time steps. For CFL conditions above , begins relatively high, as extrapolations for velocity inputs were more prone to error.
The opposite was observed with and being directly related to resolution. This was attributed to the number of marked cells at any given time step. Recall that was defined as the average error in the domain, and the volume calculated by the sum of volume in all domain cells. Both of these metrics are heavily influenced by full and empty cells. Marked interface and near interface cells accounted for a small percentage of the total number of cells. Doubling the resolution resulted in a squared increase in the number of fluid cells, but only a doubling in marked cells. For the rotation test, marked cells represented , , and of the fluid cells for , , and , respectively. As resolution increased, the ML function had less effect on the domain.
Moving to the input values, the ML function was capable of completing all tests, but required certain conditions for the rotation and vortex test. For CFL conditions within the range of the training data, the ML function generally had little issue. As discussed previously, the struggles in the rotation and vortex tests at lower CFL were a result of the velocity inputs falling close to the threshold for velocity, and large errors were produced.
As CFL increased, performance improved until moving above where extrapolation with a high degree of uncertainty was required. For the ML function, it appeared that it had some capability to extrapolate in that the tests were completed. The translation tests began to exhibit interface deformations. More notably, in 2D translation, the shape was more deformed with protruding fingers. For rotation, although occurred at the domain bounds, the fluid was subjected to a velocity greater than on the outer edges and performed well. For the vortex test, the tail tip geometry required extrapolation and resulted in unexpected outputs. These errors then produced more strange outputs.
With these points stated, a major crux of the ML function was the unexpected outputs even under ideal conditions. In the volume sensitivity/cell contribution test, the volume configurations were relativity simple compared to the other tests, and the velocity inputs were within the training data range. Yet, large errors were produced. The outputs were accepted as the ML function cannot be easily modified. Attempting to find and adjust the weights responsible for the unexpected behavior would be daunting, especially for a network of this size. Additionally, this adjustment could propagate more errors throughout the network. It would be simpler to retrain the model on different data sets or different network configurations.
In comparison to the results of Raessi et al. [
27], the ML function reported
and
one magnitude of order worse. The ML function did not conserve volume either, even though the data set was comprised of volume-conserving cases. At best,
was less than
, mostly due to the increased resolution. For other successful tests,
reached
. In terms of speed up, ML VOF completed the 1D translation test at
in sub 30 s. Raessi et al. [
27] reported VOF and advecting normals at 2 min and 13 min, respectively. Note that it is not a perfect comparison with the differences in hardware and program environment with Raessi et al. [
27] utilizing C.
For future work, there are a plethora of directions. A natural progression would be the extension to 3D. This comes with the challenge of producing a dataset that sufficiently represents the range of inputs. Another avenue would be to adjust the data set to include different geometries and CFL conditions. Training on more geometries, such as sharp interfaces, might help resolve the tail in the vortex test. With CFL conditions, a wide range was attempted here. A wider range could be attempted with , or a specific range could be chosen based on the stability of particular flow solvers. To aid with network selection, a more robust rating system to better quantify the performance of a network could be developed. The rating system here was briefly mentioned, as limited success was found here as several ML functions were tested to find the “best” performing one.
Of the multitude of directions, creating more specialized functions and physics-informed neural networks are of particular interest. The general function could handle a variety of cases adequately. A combination of several specialized functions assigned to specific cases could improve the overall performance. A few examples include the following: one function to handle interface cells, and another to handle near interface cells. Since these are more specialized, the data sets and network configurations could be smaller, leading to faster training.
Another suggested future direction to potentially enhance the performance of the ML model for VOF advection is following the physics-informed neural networks (PINNs) approach introduced by Raissi et al. [
29], which incorporates the underlying physical laws into the training process. Cai et al. [
30,
31] found success with the PINN approach when implemented in convective heat transfer, 3D wake flows, supersonic flows, and biomedical flows. Cuomo et al.’s [
32] review points to additional implementations and modified formulations of the PINN approach to unsteady diffusion and advection. In this work, the advection (or transport) Equation (
3), obtained through the conservation of mass law, governs the volume transport of multiphase flows. As such, using a PINN approach with the advection Equation (
3) in the training process could lead to a mass-conserving function. Although the current approach uses volume (or mass) conserving data, that property is not perfectly preserved during training, pointing out the proposed PINN approach as a way to enforce mass conservation, thereby enhancing the ML model’s performance.