daidezhi / geometricVofExt

An unofficial module of the geometric Volume of Fluid (VOF) method for OpenFOAM.
GNU General Public License v3.0
18 stars 8 forks source link


geometricVofExt

DOI

Overview

The geometricVofExt package is an unofficial module of the geometric Volume of Fluid (VOF) method for OpenFOAM. This extension has a suite of pre- and post-processing tools alongside various solvers dedicated to two-phase flow dynamics. The pre-processing utilities are methodically assembled to initialize fraction fields of arbitrary shapes with optional dynamic mesh refinement, and to set up scalar, vector or tensor fields that vary based on the fraction values. These utilities are designed to enhance the flexibility and accuracy of multiphase flow simulations.

Moreover, the geometricVofExt package features solvers that utilize the innovative SimPLIC method, which supports unstructured meshes composed of arbitrary polyhedral cells. The SimPLIC method integrates Piecewise Linear Interface Calculation (PLIC) with Simpson's rule, offering an accurate and efficient approach to solve the VOF equation. These solvers are also designed to simulate the phase change phenomena and floating body dynamics. Additionally, the solvers ensure high adaptability to complex simulation scenarios with optional dynamic mesh refinement.

Package Structure

The geometricVofExt package is a comprehensive collection that includes libraries, applications, and tutorials. This package is meticulously organized to facilitate easy navigation, allowing users to effortlessly utilize the solvers and utilities included in the package. The package structure is shown below.

It should be noted that the utilities, solvers and tutorials under test are used to replicate the results presented in this study (Dai, Dezhi, Haomin Yuan, Albert Y. Tong, and Adrian Tentner. "A Geometric VOF Method for Interface Flow Simulations." arXiv preprint arXiv:2402.05247 (2024)), which illustrates the concepts and efficiency of the SimPLIC method.

SimPLIC Library

The SimPLIC library embodies the implementation of the SimPLIC method.

Key features:

The VOF equation solved in the SimPLIC library is written as:

$$\frac{\partial \alpha}{\partial t} + \nabla \cdot \left(\alpha \mathbf{U}\right) = S_p \alpha + S_u,$$

where $\alpha$ represents the VOF function, $t$ denotes time, $\mathbf{U}$ is the velocity vector, and $S_p$ and $S_u$ correspond to the implicit and explicit contributions to the net source, respectively.

For incompressible two-phase flows without phase change, both $S_p$ and $S_u$ are zero ($S_p = S_u = 0$). In the case of compressible two-phase flows without phase change, $S_p$ remains zero ($S_p = 0$) and $S_u$ is given by $\left(\nabla \cdot \mathbf{U}\right) \alpha$. For incompressible two-phase flows involving cavitation, $S_p = \left(\nabla \cdot \mathbf{U}\right) + \dot{V}_v - \dot{V}_c$ and $S_u$ as $\dot{V}_c$, where $\dot{V}_v$ and $\dot{V}_c$ represent the volume change rates due to condensation and evaporation, respectively. Within OpenFOAM framework, the Kunz, Merkle or SchnerrSauer cavitation model in the phaseChangeTwoPhaseMixtures library is adopted to evaluate $\dot{V}_v$ and $\dot{V}_c$. A summary of the different scenarios along with the corresponding solver(s) is given in the table below.

|Scenario|Solver(s)|$S_p$|$S_u$|Note| |:---|:---|:---:|:---:|:---| |
  • Incompressible
  • Without phase change
|
  • `interPlicFoam`
  • `overInterPlicDyMFoam`
  • `wavePlicFoam`
|$0$|$0$|$\nabla \cdot \mathbf{U} = 0$| |
  • Incompressible
  • Cavitation
|
  • `interPlicPhaseChangeFoam`
  • `overInterPlicPhaseChangeDyMFoam`
|$\left(\nabla \cdot \mathbf{U}\right) + \dot{V}_v - \dot{V}_c$|$\dot{V}_c$|Cavitation models
  • `Kunz` model
  • `Merkle` model
  • `SchnerrSauer` model
|
When employing AMR, the geometric interpolation of fraction field during refinement can be achieved by setting the control parameter `mapAlphaField` to `true` within `fvSolution->solvers->"alpha.*"`. This innovative fraction interpolation scheme, initially introduced in [VoFLibrary](https://github.com/DLR-RY/VoFLibrary), has been reimplemented in the `SimPLIC` library. Its process is presented below, where the reconstructed interface within the parent cell is utilized to divide each of the child cells and compute their respective submerged volumes/fractions.
geometric interpolation
### `CGALVof` Library The `CGALVof` library acts as a bridge between OpenFOAM meshes and CGAL geometric algorithms. *Key features*: - Delivers accurate geometric predicates while providing approximate geometric constructions. - Capable of transforming an OpenFOAM surface mesh (`MeshedSurface`) or an OpenFOAM mesh cell into a CGAL polyhedral surface (`CGAL::Surface_mesh

`). - Allows for the direct creation of CGAL polyhedral surface meshes for boxes or spheres based on given dictionaries. - Supports the import of external surface mesh files, compatible formats include `*.stl`, `*.vtk` and `*.ftl`. - Features a Boolean operation processor for the manipulation of two CGAL surface meshes. - Enables the assessment of mesh cell locations in comparison to a designated surface mesh, typically denoting the interface between two distinct phases. ### Applications The current list of utilities distributed with `geometricVofExt` is given below: |Utility|Description| |:---|:---| |`setVofField`|Set the VOF field (`alpha.*`) with arbitrary shapes.

  • Built-in shapes: `box`, `sphere`, `cylinder` and `cone`.
  • External surface meshes: `*.stl`, `*.stlb`, `*.vtk`, *etc.*
  • Fraction-based dynamic mesh refinement.
| |`setShapedFields`|Set field values using arbitrary shapes.
  • Dictionary is similar to the one for `setFields`.
  • Volume-fraction averaging for cells partially enclosed by the shapes.
| |`writeVtkSeries`|Generate and write a VTK series for a `surfaces` function object.
  • Function name is ``.
  • Output file is `.vtp.series` or `.vtk.series`.
| The following are solvers that utilize the SimPLIC method: |Solver|Description| |:---|:---| |`interPlicFoam`|
  • Solver for two-phase flows.
  • Incompressible, isothermal and immiscible fluids.
  • Derived from `interFoam` and `interIsoFoam`.
  • Using SimPLIC method.
  • Dynamic mesh refinement.
| |`overInterPlicDyMFoam`|
  • Derived from `overInterDyMFoam` and `interPlicFoam`.
  • Incompressible, isothermal and immiscible fluids.
  • Overset (Chimera) meshes.
| |`interPlicPhaseChangeFoam`|
  • Derived from `interPhaseChangeFoam` and `interPlicFoam`.
  • Incompressible, isothermal and immiscible fluids.
  • Cavitating flows.
  • Dynamic mesh refinement.
| |`overInterPlicPhaseChangeDyMFoam`|
  • Derived from `overInterPhaseChangeDyMFoam` and `overInterPlicDyMFoam`.
  • Incompressible, isothermal and immiscible fluids.
  • Cavitating flows.
  • Overset (Chimera) meshes.
| |`wavePlicFoam`|
  • Solver for two-phase flows.
  • Incompressible, isothermal and immiscible fluids.
  • Employing `waves2Foam` toolbox to generate and absorb free surface water waves.
  • Derived from `interPlicFoam`.
  • Using SimPLIC method.
  • Dynamic mesh refinement.
| ## Build `geometricVofExt` ### Compatibility The source code of `geometricVofExt` is developed and maintained for [`OpenFOAM v2312`](https://www.openfoam.com/news/main-news/openfoam-v2312). ### Before Starting * Make sure that [`OpenFOAM v2312`](https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Build.md) has been compiled successfully on the target machine. * Verify that [`CGAL`](https://develop.openfoam.com/Development/openfoam/blob/develop/doc/Requirements.md) has been successfully compiled/loaded. Otherwise, the `CGALVof` library, `setVofField` and `setShapedFields` will not be compiled. ### Building * Create a directory named `modules` within `$WM_PROJECT_USER_DIR`, then proceed to download the `geometricVofExt` source code into `$WM_PROJECT_USER_DIR/modules`, *i.e.*, ```shell source /OpenFOAM-v2312/etc/bashrc [ -d $WM_PROJECT_USER_DIR ] || mkdir $WM_PROJECT_USER_DIR cd $WM_PROJECT_USER_DIR [ -d modules ] || mkdir modules cd modules git clone https://github.com/daidezhi/geometricVofExt.git ``` * Check `CGAL` library: ```shell source /OpenFOAM-v2312/etc/bashrc cd $WM_PROJECT_USER_DIR/modules/geometricVofExt ./checkCGAL ``` :warning: **IMPORTANT** :warning: The GNU Multiple Precision Arithmetic (`GMP`) and GNU Multiple Precision Floating-Point Reliably (`MPFR`) Libraries are highly recommended for use with `CGAL`. Otherwise, the `setVofField` and `setShapedFields` utilities will operate in a low-efficiency mode. If you are using a GCC compiler, one potential solution is: ```shell source /OpenFOAM-v2312/etc/bashrc cd $WM_PROJECT_USER_DIR/modules/geometricVofExt ./compileCGALWithGMPAndMPFRUsingSystemGCC ``` * (Optional) Enable the utilities and solvers to produce iso-surfaces/plic-surfaces at the initial time (*e.g.*, $t = 0$): ```shell source /OpenFOAM-v2312/etc/bashrc cd $WM_PROJECT_USER_DIR/modules/geometricVofExt ./enableInitialTimeWriting ``` * Compile libraries, utilities and solvers of `geometricVofExt`: ```shell source /OpenFOAM-v2312/etc/bashrc cd $WM_PROJECT_USER_DIR/modules/geometricVofExt ./Allwmake -j4 ``` * (Optional) Build `waves2Foam` library and `wavePlicFoam` solver (*It is important to mention that the Gnu Scientific Library (GSL) `2.7.1` is locally compiled for HPC users.*): ```shell source /OpenFOAM-v2312/etc/bashrc cd $WM_PROJECT_USER_DIR/modules/geometricVofExt ./compileWaves2FoamInOpenFOAM2312 ./Allwmake -j4 ``` * (Optional) Build utilities/solvers in `applications/test`: ```shell source /OpenFOAM-v2312/etc/bashrc cd $WM_PROJECT_USER_DIR/modules/geometricVofExt ./enableReconstructionTimeTrackingInIsoAdvector ./Allwmake.test ``` ## Gallery |