Skip to content

PLIC: documentation of the algorithm, and advection with a non-zero divergence - #262

Draft
ThomasHowarth wants to merge 5 commits into
AMReX-Fluids:developmentfrom
ThomasHowarth:plic-6-docs
Draft

ThomasHowarth wants to merge 5 commits into
AMReX-Fluids:developmentfrom
ThomasHowarth:plic-6-docs

Conversation

@ThomasHowarth

Copy link
Copy Markdown
Contributor

Draft: stacked on #256. The first commit (480fbf6) is #256. Once that merges, this will be rebased onto development and leave only the plic-6 commits.

Documentation

Docs/source/PLIC.rst is rewritten as a full description of the algorithm, in the style of the Godunov, MOL and BDS pages:

  • notation;
  • reconstruction: the volume/plane relations, the Youngs, MYC and height-function normals, thin structures, ghost cells;
  • wall ghost cells;
  • advection: flux volumes, fluxes and edge states, AMR, corrective velocities, use through HydroUtils;
  • the sharp face density;
  • mass and momentum fluxes;
  • an example time step, extending the library, verification, limitations.

New references are in refs.bib, with DOIs. Each was checked against the published record.

Non-zero divergence (low Mach solvers)

The flux volumes of a cell hold Δt times the discrete divergence of the face velocities, whatever that divergence is. So Owkes & Desjardins adds none of its own, and the fluxes need no change when ∇·u = S ≠ 0:

  • the liquid volume is conserved to round-off for any S;
  • with an incompressible liquid (S = 0 in the liquid), there is no source term: pure cells stay pure, and expanding or contracting gas moves the interface through the fluxes;
  • F stays in [0,1] where S > 0. Where S < 0 in a cell that holds liquid, F can exceed 1. This is documented under Limitations;
  • a liquid that dilates itself needs a Δt·F·S_l source, added by the solver.

The library code is unchanged apart from two doc comments in hydro_plic.H.

Tests

The advection test can now add a band of expanding gas to the prescribed velocity: (U(x), 0, 0), with discrete divergence S in the band and exactly 0 elsewhere, on every level.

  • inputs.2d.expand: a circle beside the band, 3 levels, through HydroUtils. Shape error 1.11e-5, against 1.17e-5 without the band. Volume change per step 6e-16.
  • inputs.2d.dilate: both phases expanding, so every cell of the circle becomes mixed. Volume and bounds hold to round-off.

All existing PLIC inputs pass in 2D and 3D with unchanged results. The docs build with no Sphinx warnings.

🤖 Generated with Claude Code

ThomasHowarth and others added 5 commits December 3, 2026 14:03
Following Rudman (IJNMF), the Owkes & Desjardins flux volumes also give
the mass and momentum fluxes of each face, from the cuts of the volume
fraction with phase densities given as PhaseDensityArray or fields.

- ComputeMassMomentumFluxes computes the volume, mass and momentum
  fluxes in one call, optionally with the face velocity; dt must be
  positive.
- FarFieldMomentumFluxes fills the faces the cuts marked, away from
  the interface. far_field_mark is a quiet NaN, so that a face left
  unfilled shows up in the momentum update.
- CorrectiveMassMomentumFluxes is the counterpart of CorrectiveFluxes:
  where a corrective u_flux differs from umac, the mass flux carries
  the corrected volume fraction flux at the phase densities of the
  upwind cell, so rho stays the mixture density of F. Both share
  corrective_fraction.
- The mass and momentum entry points take check_courant, as
  ComputeEdgeStateAndFluxes does, for solvers that check the level once
  with CheckCourantNumber.
- The cut kernels walk the pieces of a flux volume once, and skip the
  liquid lookup per piece in a flux volume of one phase. The liquid
  flux kernel captures no momentum arguments.
- SharpFaceDensity reads its phase densities as PhaseDensityArray.
- New test_momentum (inputs.momentum) with a Translate problem: checks
  the corrective fluxes, and that the momentum is conserved in every
  case, relative to one cell of liquid.

Ported as one commit onto development after plic-4 (AMReX-Fluids#255) merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V7EH6ZtZUnusy66tyAq5MH
Docs/source/PLIC.rst now describes the method as the Godunov, MOL and
BDS pages do, with equations, citations and API references:

- the VOF equation, the steps of a time step, notation and the plane
  representation;
- reconstruction: the volume <-> plane constant relations, the Youngs,
  MYC and height-function normals, thin structures, ghost cells;
- wall ghost cells: the three tiers of the plane search, the ghost
  value, edges and corners;
- advection: node tracing, the flux volume as tetrahedra, the
  correction apex, cutting, fluxes and edge states, their properties
  and requirements, AMR, corrective velocities, HydroUtils;
- the face density, and the mass and momentum fluxes with their
  formulas;
- a time step in a solver, extending the library, verification
  results, and the limitations.

refs.bib gains the ten papers cited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split the volume formula over two lines, put the plane constant and the
height function in display equations, define F_up for the cases, use
upright subscripts and superscripts (flux, MAC), shorten the code blocks
and make the main sections siblings of Notation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flux volumes of a cell hold dt times the discrete divergence of the
face velocities, whatever it is, so the scheme adds none of its own and
needs no change for a low Mach solver: the liquid volume is conserved to
round-off, an incompressible liquid needs no source term, and F stays in
[0,1] where the flow expands. Where it is compressed in a cell that holds
liquid, F can exceed 1.

Document this (a new subsection, the requirements, the mass/momentum
identity and the limitations), and verify it: the advection test takes
a band of expanding gas, with inputs.2d.expand (a circle beside the band,
3 levels, shape error that of no band) and inputs.2d.dilate (both phases
expanding, every cell mixed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant