Skip to content

PLIC: mass and momentum fluxes consistent with the volume fluxes - #256

Open
ThomasHowarth wants to merge 1 commit into
AMReX-Fluids:developmentfrom
ThomasHowarth:plic-5-momentum
Open

ThomasHowarth wants to merge 1 commit into
AMReX-Fluids:developmentfrom
ThomasHowarth:plic-5-momentum

Conversation

@ThomasHowarth

@ThomasHowarth ThomasHowarth commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds mass and momentum fluxes for momentum advected in conservative form at a large density ratio (Rudman 1998). They come from the same flux volumes as the volume fraction. With rho^n = PLIC::mixture(F^n, rho_l, rho_g), the rho^{n+1} from the mass fluxes is the mixture density of F^{n+1} to round-off, so a uniform velocity stays uniform across the interface whatever the density ratio.

New API

  • PLIC::ComputeMassMomentumFluxes: works per box and follows the conventions of ComputeEdgeStateAndFluxes. Near the interface, each piece of a flux volume carries the density of its phase and the velocity of the cell it lies in. Away from the interface, the flux volume is in one phase and carries the density of the upwind cell and a face velocity vel_face the solver provides: an upwind value, or the edge state of the solver's velocity scheme.
  • Two overloads of PLIC::ComputeEdgeStateAndFluxes that give the volume fluxes, edge states, mass fluxes and momentum fluxes from one set of cuts. The cuts are most of the cost, so this halves the cost compared with calling both functions.
    • With vel_face: every flux in one call.
    • Without it, for a solver that advances F before it has the face velocity of its momentum scheme: the momentum fluxes of the faces away from the interface are left marked with PLIC::far_field_mark (a quiet NaN).
  • PLIC::FarFieldMomentumFluxes: fills the marked faces later, as mflux * vel_face. It finds them from the mark in pflux, not from F, so the solver may update F in place in between. A face it misses carries the NaN into the momentum update rather than passing silently.
  • PLIC::CorrectiveMassMomentumFluxes: the counterpart of PLIC::CorrectiveFluxes. Where a corrective u_flux differs from umac (multilevel sync, or HydroUtils with u_flux), it rewrites the mass and momentum fluxes so that they carry the corrected volume fraction flux. The mass flux is (rho_l fe + rho_g (1 - fe)) u_flux, at the densities of the upwind cell, so rho stays the mixture density of F there too. Both functions take fe from one shared kernel, corrective_fraction.
  • PhaseDensityArray: each phase density is a value or a cell-centered field, as for SharpFaceDensity, which now reads it the same way. With fields, a flux volume carries its liquid at the mean liquid density of its pieces, held within those of the cells they lie in, and likewise its gas. Uniform fields give the fluxes of their values, to the bit.
  • The mass and momentum entry points take check_courant, as ComputeEdgeStateAndFluxes does: a GPU solver checks the level once with PLIC::CheckCourantNumber and skips the per-box check.

The single-cut paths match the separate calls to the bit. All the flux functions share one implementation, and the mass and momentum terms are compiled in only where they're asked for.

Tests

Tests/PLIC/inputs.momentum runs a drop in a uniform flow and in a vortex flow, with a density ratio of 1000, with the phase densities as values and as fields. It checks, to round-off:

  • the density matches the mixture density of the new F, and uniform fields give the fluxes of the values, to the bit;
  • with a corrective velocity (reversed or 1% faster on some faces), the mass fluxes carry the volume fraction fluxes of CorrectiveFluxes at the phase densities, on every face;
  • a uniform velocity stays uniform;
  • momentum is conserved in every case, relative to the momentum of one cell of liquid at the largest speed;
  • the single-cut fluxes, from either overload, equal those of the separate calls, to the bit.

Docs/source/PLIC.rst and Tests/PLIC/README.md are updated. All the PLIC test inputs pass in 2D and 3D.

🤖 Generated with Claude Code

@ThomasHowarth
ThomasHowarth force-pushed the plic-5-momentum branch 8 times, most recently from 6dc5feb to ba42085 Compare November 20, 2026 16:27
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

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