Skip to content
Projects

Cut-cell fractions

The equations of simgeometry.fractions, declared on the code that implements them and checked by the tests.

cell_fractions

functionsource

Estimate cell and face occupancy using a regular subcell sample lattice.

samples
p=xcell+k+12n h,k=0,…,n−1 per axisp = x_\mathrm{cell} + \frac{k + \tfrac12}{n}\,h, \qquad k = 0, \dots, n - 1 \text{ per axis}
fraction
f=#{samples inside}nd  (cells),#{inside}nd−1  (faces, normal coordinate on the face)f = \frac{\#\{\text{samples inside}\}}{n^{d}} \;\text{(cells)}, \qquad \frac{\#\{\text{inside}\}}{n^{d-1}} \;\text{(faces, normal coordinate on the face)}
Assumes
  • midpoint quadrature of the membership indicator, samples_per_axis nn per axis: a fraction is a multiple of n−dn^{-d}, not a reconstructed interface
  • features smaller than a sample spacing can be missed
  • periodic axes wrap the sample points and have NN cells; face arrays carry both periodic boundary copies

yee_fractions

functionsource

Edge-length and face-area fractions of a Yee grid cut by geometry.

edge
fedge=∑k(tk+1−tk) [tk+tk+12 inside]  (near edges, all crossings tk)f_\mathrm{edge} = \sum_k (t_{k+1} - t_k)\,\big[\tfrac{t_k + t_{k+1}}{2} \text{ inside}\big] \;\text{(near edges, all crossings } t_k\text{)}
gauss
xq=12±120.6, 12,wq=518,818,518per piece between breakpointsx_q = \tfrac12 \pm \tfrac12\sqrt{0.6},\ \tfrac12, \qquad w_q = \tfrac{5}{18}, \tfrac{8}{18}, \tfrac{5}{18} \quad \text{per piece between breakpoints}
face
fface=12∑directions∑qwq ℓinside(xq)f_\mathrm{face} = \tfrac12 \sum_{\text{directions}} \sum_q w_q\,\ell_\mathrm{inside}(x_q)
trace
T=h⊥∑qwq∑crossings∣n∥∣∣nplane∣,Tproj=h⊥∑qwq∑crossings∣n∥∣(summed over both directions)T = h_\perp \sum_q w_q \sum_\text{crossings} \frac{|n_\parallel|}{|n_\mathrm{plane}|}, \qquad T_\mathrm{proj} = h_\perp \sum_q w_q \sum_\text{crossings} |n_\parallel| \quad \text{(summed over both directions)}
trace sum
n^∥2 dℓ+n^⊥2 dℓ=dℓ,∑familiesha∑Tproj,a=2 area\hat n_\parallel^2\,d\ell + \hat n_\perp^2\,d\ell = d\ell, \qquad \sum_{\text{families}} h_a \sum T_{\mathrm{proj}, a} = 2\,\text{area}
Assumes
  • edges whose midpoint is farther than half their length from the surface take the midpoint's membership; near ones get all crossings (repeated crossings, at most max_hits)
  • a face is cut if one of its edges is crossed or its centre is within half a diagonal of the surface; lines across a cut face at the Gauss points of each piece between the face's edge crossings, in both in-plane directions
  • corners: where the in-plane normals of neighbouring lines turn by a sine above 0.05, the tangents' intersection becomes an extra breakpoint
  • fractions within 10−1210^{-12} of 0 or 1 are snapped; a wall lying in a grid plane counts as inside (a staircase)
  • exact for planes up to the crossings' accuracy; second order or better for curved surfaces (docstring and tests), without a single clean order
  • 2D or 3D grids with at least one cell per axis
References
Built from