Skip to content

Update surfaceInertia utility to print average facet normal and average facet unit-normal of a triangulated surface

Functionality to add/problem to solve

Add capability to compute the average facet normal and average facet unit-normal to the surfaceInertia utility ($FOAM_UTILITIES/surface/surfaceInertia/surfaceInertia.C) complementing the geometric information printed for a given surface.

Target audience

Useful for various orientation-related geometry or mesh manipulations during pre-/post-processing, e.g.

  • linearNormal patch-/surface-based mesh extrusion can lead to poor mesh quality/shape if the patch faces are non-planar. For arbitrarily oriented patches/surfaces or such or such with poor planar alignment, the 3D average patch/geometry normal can be used in combination with linearDirection to achieve better extrusion results.
  • good for lots of other stuff such as orientation of transformations, blockMesh blocks, other geometry, result projections, etc.

Proposal

Updated code: surfaceInertia.C

New output:

Density: 1
Mass: -0.00209889861842
Centre of mass: (1.21880357 0.0769090862495 1.16282665167e-07)
Surface area: 0.000891427162056
// New v v v
Average facet normal: (-2.92874518707e-06 -7.84706054422e-07 -8.84353742342e-12)
Average facet unit-normal: (-0.965929854246 -0.258804012079 -2.91668829782e-06)
// New - - -
Inertia tensor around centre of mass:
(-0.000114921960951 0.00282908801355 2.90759183879e-10 0.00282908801355 -0.00103930340855 6.17901397912e-05 2.90759183879e-10 6.17901397912e-05 -0.0011542252278)
eigenValues (principal moments): (0.00228994594549 -0.00344467431055 -0.00115372223224)
eigenVectors (principal axes):
(0.761868870637 0.647627074081 0.0116188153686)