Assembled Capacity
assembled_capacity(m; bc=zero(T)) builds an AssembledCapacity from GeometricMoments.
Indexing Model
All scalar capacities are stored on a node-shaped lattice (nnodes), not a pure cell-centered compressed list.
Definitions:
nnodes = (n₁, ..., nN)ntotal = prod(nnodes)- physical cells are indices where each component is
< n_d - halo cells are indices where any component is
== n_d
When assembling:
- physical entries are copied from moments
- halo entries are replaced by
bc(usually0.0)
This avoids propagating NaN values from geometry backends into sparse operator algebra.
Stored Fields
AssembledCapacity stores:
- diagonal CSC matrices (same sparsity pattern):
V::SparseMatrixCSCA::NTuple{N,SparseMatrixCSC}B::NTuple{N,SparseMatrixCSC}W::NTuple{N,SparseMatrixCSC}Γ::SparseMatrixCSC
- raw geometry vectors:
C_ω,C_γ,n_γ,cell_type
- shape metadata:
nnodes,ntotal
- diagonal buffers:
buf.V,buf.Γ,buf.A[d],buf.B[d],buf.W[d]
Important implementation detail:
- the CSC matrices reuse these buffer vectors as their
nzval - updates through
rebuild!therefore refresh both buffer and matrix views without rebuilding sparsity
Rebuild Path
rebuild!(cap, m; bc=...) updates:
- diagonal buffers (including halo fill)
- raw geometry vectors
without recreating colptr/rowval structure.
This is the preferred path when the grid shape is unchanged and only geometry values are updated (e.g., moving interface with fixed node lattice).
Example
using CartesianGeometry
using CartesianOperators
using CartesianGeometry: nan
grid = (0.0:0.25:1.0,)
levelset(x, _=0) = x - 0.5
m0 = geometric_moments(levelset, grid, Float64, nan; method=:vofijul)
cap = assembled_capacity(m0; bc=0.0)
# later after geometry/moments change:
m1 = geometric_moments(levelset, grid, Float64, nan; method=:vofijul)
rebuild!(cap, m1; bc=0.0)Related APIs
- assembly:
build_GHW(cap)andbuild_Winv(cap) - wrappers:
DiffusionOps(cap),ConvectionOps(cap, uω, uγ) - apply layer:
gradient(op, xω, xγ),divergence(op, qω, qγ)