Types
CartesianGeometry.GeometricMoments — Type
GeometricMoments{N,T,VT,BT,CT,NT,XT}A data structure to hold geometric moments of a region defined by a level set function on a Cartesian grid. The type parameters are:
N: the spatial dimensionT: the numerical type (e.g.,Float64)VT: the type of the vector holding cell volumesBT: the type of the vector holding cell barycentersCT: the type of the vector holding cell typesNT: the type of the vector holding interface normalsXT: the type of the tuple holding node coordinates
The fields of the structure include:
V: a vector whereV[i]is the volume of cellibarycenter: a vector wherebarycenter[i]is the barycenter of cellias anSVector{N,T}interface_measure: a vector whereinterface_measure[i]is the measure of the interface in cellicell_type: a vector wherecell_type[i]is -1 for cut cells, 0 for empty cells, and 1 for full cellsbarycenter_interface: a vector wherebarycenter_interface[i]is the centroid of the interface in celliinterface_normal: a vector whereinterface_normal[i]is the unit normal on the interface in celliA: a tuple of vectors whereA[d][i]is the face area in directiondfor celliB: a tuple of vectors whereB[d][i]is the face barycentric moment in directiondfor celliW: a tuple of vectors whereW[d][i]is the staggered face-associated volume in directiondfor cellixyz: a tuple of vectors wherexyz[d][i]is the node coordinate in directiond
CartesianGeometry.check — Function
check(m::GeometricMoments)Check the consistency of the geometric moments data structure m. This function verifies that all fields have the correct lengths corresponding to the grid size. It can be used for debugging and validation purposes.
This section describes the main types and conventions used in CartesianGeometry.jl.
using CartesianGeometry
grid = (
collect(range(0.0, 1.0; length=17)),
collect(range(0.0, 1.0; length=17)),
)
f = HyperSphere{2,Float64}(0.45, (0.5, 0.5))
moms = geometric_moments(f, grid, Float64, nan; method=:vofi)GeometricMoments{2, Float64, Vector{Float64}, Vector{StaticArraysCore.SVector{2, Float64}}, Vector{Float64}, Vector{StaticArraysCore.SVector{2, Float64}}, Tuple{Vector{Float64}, Vector{Float64}}}([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0001896273572863623, 0.0006905640876468561, 0.0006905640876468554, 0.00018962735728636084 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], StaticArraysCore.SVector{2, Float64}[[0.03125, 0.03125], [0.09375, 0.03125], [0.15625, 0.03125], [0.21875, 0.03125], [0.28125, 0.03125], [0.34375, 0.03125], [0.422643304402808, 0.05966051582788933], [0.47080389239173237, 0.05689907887331049], [0.5291961076082676, 0.0568990788733105], [0.5773566955971919, 0.059660515827889345] … [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN]], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04361038434118777, 0.06270270328252925, 0.06270270328252925, 0.04361038434118789 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, -1.0, -1.0, -1.0 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], StaticArraysCore.SVector{2, Float64}[[NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN] … [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN], [NaN, NaN]], StaticArraysCore.SVector{2, Float64}[[0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0] … [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]], ([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.007666666666666683, 0.011833333333333348, 0.007666666666666683 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 … 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, NaN]), ([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.005450337756035616, 0.010924093120561577, 0.010924093120561577, 0.005450337756035616 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.02503940628821083, 0.0625, 0.0625, 0.025039406288210775 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]), ([NaN, 0.0, 0.0, 0.0, 0.0, 0.0, 8.544787979004024e-5, 0.00043901550549060045, 0.0007114561192994209, 0.0004390155054906007 … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN], [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN … NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]), ([0.0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1.0], [0.0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1.0]))V:Vector: volumesbary:Vector{SVector}: barycentersinterfacenorm:Vector: interface measurescelltype:Vector: cell types (empty 0, full 1, cut -1)baryinterface:Vector{SVector}: interface centroids (available with:vofijul)A,B,W:NTuple{D,Vector}: directional face moments and directional second-kind moments