Level Sets
The levelsets package tracks a material interface with a level-set function \(\phi\), whose zero contour \(\phi = 0\) marks the interface. The field is advected with the flow and periodically reinitialized to remain a signed distance function near the interface. It provides a sharp interface representation complementing the diffuse volume-fraction description of Chapter Hydrodynamics.
Warning
Experimental: The level-set package currently supports a single level set and requires hydrodynamics to be enabled.
Governing Equations
Advection
The level-set function is advected by the hydrodynamic velocity using the same flux-conservative machinery (reconstruction and Riemann solver) as the other advected fields,
By convention \(\phi > 0\) in the designated sharp material (sharp_mat) and \(\phi < 0\) elsewhere, so the interface is the \(\phi = 0\) contour.
Reinitialization
Advection distorts \(\phi\) away from a signed distance function (\(|\nabla\phi| = 1\)). Every reinit_modcyc cycles the package restores that property near the interface by evolving a hyperbolic Eikonal equation in a pseudo-time \(\tau\) (Sussman & Fatemi, SIAM J. Sci. Comput. 20, 1165, 1999),
where \(\phi_0\) is the level set at the start of reinitialization and \(\operatorname{sign}(\phi_0)\) is a smoothed sign function. The gradient magnitude is formed with upwind differences selected by the sign of \(\phi_0\) (forward differences where \(\phi_0 > 0\), backward where \(\phi_0 < 0\)) using second-order minmod-limited reconstruction. Reinitialization is applied only within a band of half-width reinit_width cells around the interface; outside the band \(\phi\) is held at a constant magnitude. The pseudo-time update runs for reinit_nstep steps, each propagating the correction roughly one cell.
Input Parameters
Level sets are enabled with the levelsets toggle in the <physics> block (Section Enabling Physics: the <physics> Block); hydro must also be enabled. The remaining controls live in the <levelsets> block.
Parameter |
Type |
Default |
Description |
|---|---|---|---|
sharp_mat |
int |
|
Index of the material on the \(\phi > 0\) side of the interface. |
reinit_modcyc |
int |
|
Reinitialize every this many cycles (\(1\) = every cycle). |
reinit_width |
int |
|
Half-width (in cells) of the band kept as a signed distance function. |
reinit_nstep |
int |
|
Number of pseudo-time steps per reinitialization (ideally \(>\) |
Registered Fields
The package registers the single advected level-set field in the table below, plus two single-copy scratch fields used only during reinitialization (\(\phi_0\) storage and the pseudo-time right-hand side).
Field |
Symbol |
Components |
Metadata / description |
|---|---|---|---|
levelset |
\(\phi\) |
1 |
Cell, Independent, Intensive, FillGhost, Advected, WithFluxes; the level-set function. |
levelset0 |
\(\phi_0\) |
1 |
Cell, Independent, Intensive, OneCopy; level set stored at the start of reinitialization. |
dudt_reinitialize |
\(\partial_\tau\phi\) |
1 |
Cell, Independent, Intensive, OneCopy; reinitialization right-hand side. |
Example
Track the interface of material 0, reinitializing every 25 cycles:
riot.input("physics", hydro=True, levelsets=True)
riot.input("levelsets", sharp_mat=0, reinit_modcyc=25,
reinit_width=4, reinit_nstep=15)