Conventions
Indexing
The package mixes 1-based and 0-based indexing, on purpose:
- Reading the i-th point/plane/element of an object you already have is 1-based, as Julia users expect:
getpt(cell, 1),getplane(sep, 1),acc[1]. - Telling IRL where something goes in its stencil or graph is 0-based, matching IRL's own documentation and examples:
setmember!(neigh, 0, cell, vf),set_center_of_stencil!(neigh, 13)(centre of a 27-cell stencil),connect!(link, 0, other). - Region tags and mesh ids are passed through as-is.
Rule of thumb: indexing into a Julia object is 1-based; telling IRL a stencil or edge position is 0-based.
Reconstruction guesses
LVIRA and R2P are optimizers that refine an initial guess. The guess follows IRL's own method: the normal is normalize(gas_centroid - liquid_centroid) of the centre cell, with the distance set to match its volume fraction.
reconstruct_r2p(neigh)builds the guess automatically (R2P stores the moments it needs).reconstruct_lvira(neigh, center_moments)takes the centre cell'sSeparatedMoments, because the C LVIRA neighbourhood only stores volume fractions, so the centroids come from the caller (as in IRL's driver).- Either function also accepts an explicit
PlanarSeparatorguess.
The ! forms (reconstruct_lvira!, reconstruct_r2p!) refine in place.
Global tolerances
A few settings are library-level switches rather than per-object options: they change the behaviour of every subsequent cut and reconstruction, on every thread. Set them once at startup, not inside a time loop.
set_vf_bounds!(1e-14)
set_vf_tolerance!(1e-14)
set_minimum_volume_to_track!(1e-15)
set_minimum_surface_area_to_track!(1e-15)The cutting algorithm is chosen the same way, with set_cutting_method!.