CAVITATION HYDROFOIL CASE - README (TEXT)

Overview
- This repository contains a CFD case to simulate cavitation over a NACA 0012 hydrofoil using OpenFOAM.
- Two-stage workflow:
  1) pimpleFoam for non-cavitating base flow (RANS k-ω SST or k-epsilon)
  2) interPhaseChangeFoam for cavitating flow with Schnerr-Sauer mass transfer

Repository Structure
- readme.txt (this file): Primary documentation
- readme.md: Short pointer to this file
- gmesh_files/: Hydrofoil domain geometry and mesh (Gmsh)
  - hydrofoil.geo: Domain, transfinite meshing, extrusion, physical groups
  - naca_airfoil.geo: NACA 0012 spline definition
  - hydrofoil.msh: Gmsh mesh
- case_files/
  - pimplefoam/: Non-cavitating case
  - interPhaseChangeFoam/: Cavitating case (parallel-ready)

Geometry & Mesh (Gmsh)
- 2D hydrofoil (NACA 0012) extruded by 10 units in z → 2D simulation with empty front/back
- Domain extents: x in [-2, 700], y in [-400, 400], z in [0, 10]
- Mesh counts (transfinite): n_inlet=150, n_vertical=150, n_airfoil=150, n_wake=150
- Physical groups: inlet, outlet, walls, front, back, fluid
- After gmshToFoam, use createPatch to:
  - Merge (front, back) → frontandback (empty)
  - Rename walls → hydrofoil (wall)

Physics & Models
- pimpleFoam: Incompressible RANS with k-ω SST; startFrom=startTime (0)
- interPhaseChangeFoam: Two-phase (water/vapour), Schnerr-Sauer cavitation model
  - Water: rho=1000 kg/m^3, nu=1e-6 m^2/s
  - Vapour: rho=0.023 kg/m^3, nu=4.273e-4 m^2/s
  - pSat≈2337 Pa, sigma=0.7, nucleation: n=1e12 1/m^3, dNuc=5e-5 m
- Inlet velocity example: U=(16.834, 2.365, 0) m/s (~17 m/s at ~8° AoA)

How To Run (pimpleFoam)
1) Navigate to the case:
   cd case_files/pimplefoam
2) Clean and mesh:
   ./Allclean 2>/dev/null || true
   rm -rf [0-9]*e-* [0-9]*.[0-9]* log.*
   gmshToFoam hydrofoil.msh
   createPatch -overwrite
3) Run solver:
   pimpleFoam > log.pimpleFoam

Notes:
- If a tiny time (e.g., 7e-05 or 0.00014) appears and solver complains about missing fields, either remove that time and keep only 0, or copy 0 → that time.
- Ensure mesh patches in constant/polyMesh/boundary are: inlet, outlet, hydrofoil (wall), frontandback (empty).

How To Run (interPhaseChangeFoam)
1) Prepare initial conditions from pimpleFoam latest time (e.g., 0.3):
   cd case_files/interPhaseChangeFoam
   ./Allclean 2>/dev/null || true
   rm -rf 0 log.* [0-9]*e-* [0-9]*.[0-9]*
   cp -r ../pimplefoam/0.3 0
2) Parallel run via Allrun (decompose, run, reconstruct):
   chmod +x Allrun
   ./Allrun

Troubleshooting
- Patch mismatch ("Cannot find patchField entry for back"): run createPatch -overwrite and verify 0/* boundaryField sections use inlet, outlet, hydrofoil, frontandback.
- p vs p_rgh: The pressure field file may be named p but has object p_rgh; this is expected in p_rgh formulations.
- Courant numbers: pimpleFoam uses maxCo=7; interPhaseChangeFoam uses maxCo=2.5, maxAlphaCo=0.2 with adjustTimeStep=yes.

Results & Post-processing
- For cavitation, inspect alpha.water and pressure distributions to identify cavitation zones.
- Evaluate lift/drag changes, cavity extent, and surface pressure coefficients.

Credits
- OpenFOAM v2406 toolchain, Gmsh mesh generation.
