Reference
Contents
Index
CartesianGeometry.HyperSphereCartesianGeometry.PLICCell2DCartesianGeometry.PLICCell3DCartesianGeometry._staggered_centroidCartesianGeometry.build_phase_polygon_2dCartesianGeometry.build_plic_unit_polyhedronCartesianGeometry.clamp01CartesianGeometry.clip_polygon_box_xCartesianGeometry.clip_polygon_box_yCartesianGeometry.clip_polygon_halfplaneCartesianGeometry.estimate_normals_2dCartesianGeometry.estimate_normals_3dCartesianGeometry.geometric_momentsCartesianGeometry.integrateCartesianGeometry.integrateCartesianGeometry.integrate_spacetimeCartesianGeometry.integrate_voftoolsCartesianGeometry.integrate_voftoolsCartesianGeometry.integrate_voftoolsCartesianGeometry.integrate_voftools_surf2nd_2d!CartesianGeometry.integrate_voftools_surf2nd_3d!CartesianGeometry.integrate_voftools_surf_2d!CartesianGeometry.integrate_voftools_surf_3d!CartesianGeometry.integrate_voftools_vol2nd_2d!CartesianGeometry.integrate_voftools_vol2nd_3d!CartesianGeometry.integrate_voftools_vol_2d!CartesianGeometry.interface_face_from_plic_3dCartesianGeometry.interface_segment_from_plicCartesianGeometry.levelset_curvatureCartesianGeometry.mix01CartesianGeometry.mix_apertureCartesianGeometry.mix_aperture_physCartesianGeometry.mix_apertures!CartesianGeometry.mix_apertures!CartesianGeometry.mix_staggerCartesianGeometry.mix_stagger_physCartesianGeometry.mix_staggers!CartesianGeometry.mix_staggers!CartesianGeometry.mixedness_weightCartesianGeometry.plic_reconstruct_2dCartesianGeometry.plic_reconstruct_3dCartesianGeometry.polygon_centroidCartesianGeometry.polygon_line_intersection_lengthCartesianGeometry.polyhedron_centroidCartesianGeometry.polyhedron_face_areaCartesianGeometry.polyhedron_plane_intersection_areaCartesianGeometry.rect_polygonCartesianGeometry.sample_cartesian_fieldCartesianGeometry.sample_levelset_curvatureCartesianGeometry.unit_cube_face_wet_areaCartesianGeometry.vofinit!CartesianGeometry.vofinit!CartesianGeometry.vofinit!CartesianGeometry.vofinit!CartesianGeometry.vofinit_dispatch!
CartesianGeometry.HyperSphere — Type
Vofinit requires level set function to take 3 positional arguments.
CartesianGeometry.PLICCell2D — Type
PLICCell2DStores the PLIC reconstruction state for one 2-D Cartesian cell.
Fields
nx,ny: unit-normal components pointing from wet to dryc: PLIC constant (thecin x·n + c = 0)frac: volume fraction in [0, 1]cell_type: CELLFULL, CELLEMPTY, or CELL_CUT
CartesianGeometry.PLICCell3D — Type
PLICCell3DStores the PLIC reconstruction state for one 3-D Cartesian cell.
CartesianGeometry._staggered_centroid — Method
integrate(T::Type{<:Tuple}, f, xyz, S, bc, bary)Computes second-kind moments:
T=Tuple{0}: staggered volumes (W)T=Tuple{1}: staggered face apertures (B)T=Tuple{2}: barycenter of staggered wet volumes (Wbary) only
Arguments
f: Level set function.xyz::NTuple{N}: the Cartesian coordinates of the lattice nodes.bc: Boundary condition.bary: Barycenters.
CartesianGeometry.build_phase_polygon_2d — Method
build_phase_polygon_2d(pc::PLICCell2D, x0, x1, y0, y1) -> Polygon2DBuild the wet polygon inside cell [x0,x1]×[y0,y1] for a cut cell described by pc. VOFTools inte2d! is used to clip the rectangle.
CartesianGeometry.build_plic_unit_polyhedron — Method
build_plic_unit_polyhedron(pc::PLICCell3D) -> Polyhedron3DBuild the PLIC-truncated wet polyhedron in unit coordinates [0,1]^3. Only call for CUT cells.
CartesianGeometry.clamp01 — Method
clamp01(x)Clamp x to [0, 1].
CartesianGeometry.clip_polygon_box_x — Method
clip_polygon_box_x(poly::Polygon2D, xlo::Float64, xhi::Float64) -> Polygon2DClip polygon to the vertical strip xlo ≤ x ≤ xhi.
CartesianGeometry.clip_polygon_box_y — Method
clip_polygon_box_y(poly::Polygon2D, ylo::Float64, yhi::Float64) -> Polygon2DClip polygon to the horizontal strip ylo ≤ y ≤ yhi.
CartesianGeometry.clip_polygon_halfplane — Method
clip_polygon_halfplane(poly::Polygon2D, dim::Int, val::Float64, keep_ge::Bool) -> Polygon2DClip a Polygon2D by an axis-aligned half-plane using Sutherland-Hodgman.
dim=1clips byx = val,dim=2byy = val.keep_ge=truekeeps the sidecoord ≥ val.keep_ge=falsekeeps the sidecoord ≤ val.
Returns a new Polygon2D with the clipped vertices.
CartesianGeometry.estimate_normals_2d — Method
estimate_normals_2d(frac, nx, ny) -> (normals_x, normals_y)Estimate interface normals from a VOF fraction field on an nx × ny Cartesian grid using the Youngs central-difference stencil.
Returns two flat arrays (normalsx, normalsy) of size nx*ny. Interior cells use the 3×3 stencil; boundary cells fall back to one-sided differences.
CartesianGeometry.estimate_normals_3d — Method
estimate_normals_3d(frac, nx, ny, nz)3-D Youngs stencil for normal estimation (27-cell stencil).
CartesianGeometry.geometric_moments — Function
geometric_moments(f, xyz, T=Float64, bc=nan; method=:vofi)Compute geometric moments of the region defined by f on the grid defined by xyz. The moments include:
V: cell volumesbarycenter: cell barycentersinterface_measure: measure of the interface in each cellcell_type: -1 for cut cells, 0 for empty cells, 1 for full cellsbarycenter_interface: interface centroids in each cellA: face areas in each directionB: face barycentric moments in each directionW: staggered face-associated volumes
The method keyword can be used to specify the integration backend (e.g., :vofi, :implicitintegration, etc.). The bc keyword specifies the boundary condition value for cells outside the domain.
CartesianGeometry.integrate — Method
integrate(Tuple{0}, f, xyz, T, bc)Computes volume-specific (Tuple{0}) apertures of the first kind.
Returns a Tuple where
- The first component is a
Vector{T}that stores the wet volumes of each cell, - The second component is a
Vector{SVector{N,T}}that stores the coordinates of the wet barycenters.
Wherever the moments can not be computed, the function bc is applied to the element type.
Arguments
f: the level set function.xyz: the Cartesian coordinates of the lattice nodes.T: theeltypeof the moments.bc: the boundary condition (e.g.nanorzero).
CartesianGeometry.integrate — Method
integrate(Tuple{1}, f, xyz, T, bc)Computes area-specific (Tuple{1}) apertures of the first kind.
Returns a NTuple where each element corresponds to direction.
Arguments
f: the level set function.xyz: the Cartesian coordinates of the lattice nodes.T: theeltypeof the moments.bc: the boundary condition (e.g.nanorzero).
CartesianGeometry.integrate_spacetime — Method
integrate_spacetime(phi, xyz, t0, t1, ::Type{T}, bc; method=:implicitintegration)Compute true space-time moments on the product grid (x..., t) for one slab [t0, t1].
Returns a SpaceTimeMoments bundle:
mST: N+1 dimensional geometric moments fromintegrate(Tuple{0}, ...)Vcap0,Vcap1: spatial cap measures extracted from the time-direction first-kind momentsintegrate(Tuple{1}, ...)[end]att=t0andt=t1.
CartesianGeometry.integrate_voftools — Method
integrate_voftools(T, frac, xyz, S, bc, bary; normals=nothing)Entry point for second-kind moments (Ws and Bs) via VOFTools.
CartesianGeometry.integrate_voftools — Method
integrate_voftools(Tuple{0}, frac, xyz, T, bc; normals=nothing, moms=nothing)Entry point for first-kind volume integration via VOFTools.
CartesianGeometry.integrate_voftools — Method
integrate_voftools(Tuple{1}, frac, xyz, T, bc; normals=nothing, moms=nothing)Entry point for first-kind surface integration via VOFTools.
CartesianGeometry.integrate_voftools_surf2nd_2d! — Method
integrate_voftools_surf2nd_2d!(moms, frac, xyz, bc, bary; normals=nothing)Second-kind staggered face apertures (Bs).
Bs[dim][n] = aperture of the face at the barycenter location in dimension dim.
CartesianGeometry.integrate_voftools_surf2nd_3d! — Method
integrate_voftools_surf2nd_3d!(moms, frac, xyz, bc, bary; normals=nothing)Second-kind staggered face apertures (Bs) in 3-D.
Bs[dim][n] = wet area of the face perpendicular to dim at the barycenter location of cell n.
CartesianGeometry.integrate_voftools_surf_2d! — Method
integrate_voftools_surf_2d!(moms, frac, xyz, bc; normals=nothing)Fill the face-aperture tuple moms = (Ax, Ay) for a 2-D grid.
Ax[n] = intersection length of the wet region with the left face of cell n (the face at x = x[i]). Ay[n] = intersection length of the wet region with the bottom face of cell n (the face at y = y[j]).
CartesianGeometry.integrate_voftools_surf_3d! — Method
integrate_voftools_surf_3d!(moms, frac, xyz, bc; normals=nothing,
mix_law=:softclosest05, mix_kwargs=(;))Fill the face-aperture tuple moms = (Ax, Ay, Az) for a 3-D grid.
In the single-view mode (mix_law === :none) each cell stores the aperture on its low face (left x-face, bottom y-face, back z-face). With a mixture law the left and right views are blended.
CartesianGeometry.integrate_voftools_vol2nd_2d! — Method
integrate_voftools_vol2nd_2d!(moms, frac, xyz, bc, bary; normals=nothing)Second-kind staggered volume moments (Ws).
Ws[dim][n] = ∫ dV over the staggered cell centred at node (i,j) for dimension dim, weighted by the wet polygon.
CartesianGeometry.integrate_voftools_vol2nd_3d! — Method
integrate_voftools_vol2nd_3d!(moms, frac, xyz, bc, bary; normals=nothing)Second-kind staggered volume moments (Ws) in 3-D.
Uses inte3d! (Sutherland-Hodgman on Polyhedron3D) to clip the wet polyhedron to the stagger cell extent for each dimension.
CartesianGeometry.integrate_voftools_vol_2d! — Method
integrate_voftools_vol_2d!(moms, frac, xyz, bc; normals=nothing)Fill the 5-tuple moms = (V, bary, interface_norm, cell_types, bary_interface) for every cell of a 2-D Cartesian grid.
CartesianGeometry.interface_face_from_plic_3d — Method
interface_face_from_plic_3d(poly::Polyhedron3D, dx, dy, dz)Identify the PLIC interface face (not on any unit-cube boundary) in a truncated unit-cube polyhedron and return
(area_phys, mx_unit, my_unit, mz_unit)where area_phys is the face area in physical coordinates (scaled by dx, dy, dz) and (mx, my, mz) is the face centroid in unit coordinates.
CartesianGeometry.interface_segment_from_plic — Method
interface_segment_from_plic(poly, c, xnc, ync)Given a full-cell polygon poly and PLIC parameters (c, xnc, ync), return (length, midpointx, midpointy) of the interface segment inside the cell.
The interface line is xncx + yncy + c = 0.
CartesianGeometry.levelset_curvature — Method
levelset_curvature(phi, xyz; eps_grad=sqrt(eps(float(eltype(phi)))))Compute nodal curvature from a nodal level-set field on a Cartesian node grid xyz.
- 1D: returns zeros with the same shape as
phi. - 2D/3D: computes
kappa = div(∇ϕ / sqrt(|∇ϕ|² + eps_grad²))with centered interior finite differences and one-sided boundary differences.
CartesianGeometry.mix01 — Method
mix01(xL, xR; law=:mean, eps=eps(T), p=2, beta=10,
lambda=zero(T), fL=nothing, fR=nothing, clamp=true)Mix two normalised candidate values xL, xR ∈ [0,1] into a single shared value using the specified law.
Supported laws
| Symbol | Formula |
|---|---|
:mean | (xL + xR) / 2 |
:geom | √(max(xL,0) · max(xR,0)) |
:harmonic | 2 xL xR / (xL + xR + ε) |
:min | min(xL, xR) |
:max | max(xL, xR) |
:closest05 | whichever of xL, xR is closer to 0.5 (mean on tie) |
:softclosest05 | weighted average with `w = 1/( |
:pull05 | minimiser of (x−xL)² + (x−xR)² + λ(x−0.5)² |
:mixedness | weighted average r(f) = 4f(1−f) using fL, fR |
When clamp=true (default) the result is clamped to [0, 1].
CartesianGeometry.mix_aperture — Method
mix_aperture(aL, aR; law=:mean, kwargs...) -> aMix two normalised face-aperture candidates. Identical to mix01.
CartesianGeometry.mix_aperture_phys — Method
mix_aperture_phys(AL, AR, ℓf; kwargs...) -> AfMix two physical face-aperture candidates (AL, AR) on a face of length ℓf. Normalises to [0,1], applies mix01, then scales back.
CartesianGeometry.mix_apertures! — Method
mix_apertures!(As, ALs, ARs; law=:mean, kwargs...)Direction-tuple overload: As[d], ALs[d], ARs[d] are the face arrays for direction d.
CartesianGeometry.mix_apertures! — Method
mix_apertures!(A, AL, AR; law=:mean, kwargs...)Fill A[f] = mix_aperture(AL[f], AR[f]; ...) for every face index.
CartesianGeometry.mix_stagger — Method
mix_stagger(wL, wR; law=:mean, kwargs...) -> wMix two normalised staggered-volume candidates. Identical to mix01.
CartesianGeometry.mix_stagger_phys — Method
mix_stagger_phys(WL, WR, Wtot; kwargs...) -> WfMix two physical staggered-volume candidates (WL, WR) with total dual-volume measure Wtot.
CartesianGeometry.mix_staggers! — Method
mix_staggers!(Ws, WLs, WRs; law=:mean, kwargs...)Direction-tuple overload.
CartesianGeometry.mix_staggers! — Method
mix_staggers!(W, WL, WR; law=:mean, kwargs...)Fill W[s] = mix_stagger(WL[s], WR[s]; ...) for every stagger index.
CartesianGeometry.mixedness_weight — Method
mixedness_weight(f)Mixedness weight r(f) = 4f(1−f). Peaks at f = 0.5, vanishes at f ∈ {0, 1}.
CartesianGeometry.plic_reconstruct_2d — Method
plic_reconstruct_2d(frac, xyz, normals_xy)Perform PLIC reconstruction on every cell of a 2-D Cartesian grid.
Arguments
frac: flat array of volume fractions (row-major, size nx*ny)xyz: tuple of vectors (x-nodes, y-nodes)normals_xy:nothing→ estimate with Youngs stencil(nx_arr, ny_arr)→ user-supplied per-cell normals
Returns a Vector{PLICCell2D} of length nx*ny.
CartesianGeometry.plic_reconstruct_3d — Method
plic_reconstruct_3d(frac, xyz, normals_xyz)Perform PLIC reconstruction on every cell of a 3-D Cartesian grid.
CartesianGeometry.polygon_centroid — Method
polygon_centroid(poly::Polygon2D)Return (cx, cy) centroid of the polygon using the shoelace formula.
CartesianGeometry.polygon_line_intersection_length — Method
polygon_line_intersection_length(poly, dim, val)Compute the length of the intersection of the polygon with the line x=val (dim=1) or y=val (dim=2). Returns the total intersection length (may consist of multiple segments).
CartesianGeometry.polyhedron_centroid — Method
polyhedron_centroid(poly::Polyhedron3D) -> (cx, cy, cz)Compute the centroid of a Polyhedron3D via tetrahedra-from-origin decomposition (divergence theorem).
CartesianGeometry.polyhedron_face_area — Method
polyhedron_face_area(poly::Polyhedron3D, is::Int) -> Float64Compute the area of face is of a Polyhedron3D using Newell's method.
CartesianGeometry.polyhedron_plane_intersection_area — Method
polyhedron_plane_intersection_area(poly::Polyhedron3D, axis::Int,
val::Float64) -> Float64Compute the area of the intersection of the polyhedron with the plane coord[axis] = val by clipping and finding the resulting face. The polyhedron is not modified (a copy is used internally).
The returned area is in the same coordinate system as the polyhedron vertices.
CartesianGeometry.rect_polygon — Method
rect_polygon(x0, x1, y0, y1) -> Polygon2DBuild a Polygon2D representing the axis-aligned rectangle [x0, x1] × [y0, y1] (counter-clockwise winding).
CartesianGeometry.sample_cartesian_field — Method
sample_cartesian_field(field, xyz, x::SVector)
sample_cartesian_field(field, xyz, xs::AbstractVector{<:SVector})Sample nodal Cartesian scalar fields by multilinear interpolation (linear/bilinear/trilinear in 1D/2D/3D). Points outside the box are clamped to the boundary.
CartesianGeometry.sample_levelset_curvature — Method
sample_levelset_curvature(phi, xyz, x; kwargs...)
sample_levelset_curvature(phi, xyz, xs; kwargs...)Convenience helper: compute nodal levelset_curvature(phi, xyz; kwargs...) then sample it at query points with sample_cartesian_field.
CartesianGeometry.unit_cube_face_wet_area — Method
unit_cube_face_wet_area(poly::Polyhedron3D, axis::Int, side::Int) -> Float64Find the wet area on a specific face of the unit cube [0,1]^3 after PLIC truncation.
axis: 1 = x, 2 = y, 3 = zside: 0 = face atcoord = 0, 1 = face atcoord = 1
Returns the area of the polygon lying on that face (in unit-cube coordinates, so full face = 1.0).
CartesianGeometry.vofinit! — Method
Call Vofi 2.0 for exact integration.
CartesianGeometry.vofinit! — Method
Call Vofi 2.0 for exact integration. ###
CartesianGeometry.vofinit! — Method
1d implementation complies with Vofi 2.0's API (see 2d and 3d).
CartesianGeometry.vofinit! — Method
Call Vofi extended for exact 4D integration.
CartesianGeometry.vofinit_dispatch! — Method
vofinit_dispatch!(method, xex, f, args...; nex=Cint.((1, 1)))Dispatch helper selecting either Vofi C (:vofi) or VofiJul (:vofijul).