# inter3PhasemergingChangeFoam

OpenFOAM implementation of a three-phase VOF phase-change solver for liquid, vapor, and non-condensable gas flows, including a merging-theory-based pressure closure for ventilated cavitation.

The solver was developed and validated as part of the following OpenFOAM Journal paper:

**Implementation and Validation of a Three-Phase Phase-Change Solver with Merging Theory for Gas–Liquid Cavitating Flows**  
Mehrdad Kazemi and Nikolai Kornev

**OpenFOAM version:** v2406

**DOI:** [10.51560/ofj.v6.169](https://doi.org/10.51560/ofj.v6.169)

---

## Repository Structure

The repository contains both the solver source code and the OpenFOAM cases used to reproduce the main results presented in the paper.

```text
inter3PhasemergingChangeFoam/
├── inter3PhasemergingChangeFoam/   # Solver source code
├── TestCase/                        # Reproducibility cases
├── Allwmake                         # Solver compilation script
├── Allwclean                        # Solver cleaning script
└── README.md
```

The `TestCase/` directory contains three configurations:

```text
TestCase/
├── Without-airInjection/
├── With-airInjection_FROM_Tap1_Q1LperMin/
└── With-airInjection_FROM_Tap5_Q1LperMin/
```

A detailed mapping between the test cases and the figures and tables in the paper is provided in the [`TestCase/README.md`](TestCase/README.md).

---

## Solver

The developed solver extends the OpenFOAM phase-change framework to three-phase flows consisting of:

- liquid,
- vapor,
- non-condensable gas.

Phase change occurs between the liquid and vapor phases, while the non-condensable gas is transported as an additional immiscible phase.

The implementation includes the merging-theory-based effective-pressure treatment described in the associated paper.

---

## Compilation

The solver is intended for **OpenFOAM v2406**.

After loading the OpenFOAM environment, clone the repository and enter the repository directory:

```bash
git clone https://github.com/Mehrdad-1991/inter3PhasemergingChangeFoam.git
cd inter3PhasemergingChangeFoam
```

Compile the solver using:

```bash
./Allwmake
```

To clean the compiled files, use:

```bash
./Allwclean
```

---

## Test Cases

The reproducibility cases are available in the [`TestCase/`](TestCase/) directory.

### 1. Without air injection

```text
TestCase/Without-airInjection/
```

Baseline cavitating hydrofoil simulation without air injection:

```text
Q = 0 L/min
```

### 2. Air injection through Tap 1

```text
TestCase/With-airInjection_FROM_Tap1_Q1LperMin/
```

Main three-phase air-injection simulation:

```text
Q = 1 L/min
Injection location: Tap 1
```

This case is used for most of the air-injection results presented in the paper.

### 3. Air injection through Tap 5

```text
TestCase/With-airInjection_FROM_Tap5_Q1LperMin/
```

Additional validation case:

```text
Q = 1 L/min
Injection location: Tap 5
```

This case is used for the cavitation-area comparison presented in **Fig. 14** of the paper.

---

## Running a Test Case

Enter the required case directory. For example:

```bash
cd TestCase/Without-airInjection
```

Run the case using:

```bash
./Allrun
```

To clean the case:

```bash
./Allclean
```

The individual case directories contain the OpenFOAM dictionaries and the corresponding run, cleaning, and post-processing scripts required to reproduce the reported quantities.

---

## Reproducibility

The repository is organized so that the solver source code and the corresponding test cases are available together in a single location.

For the detailed correspondence between the manuscript figures/tables and individual simulations, see:

**[TestCase/README.md](TestCase/README.md)**

---

## Authors

**Mehrdad Kazemi**  
**Nikolai Kornev**

Chair of Modeling and Simulation  
Faculty of Mechanical Engineering and Marine Technologies  
University of Rostock, Germany
