core 1.8.1
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::geom::body_detail Namespace Reference

Functions

template<class Real, class Phi>
void interiorMoments (const Phi &phi, Vec3< Real > p0, Vec3< Real > d, int nseg, Real &m0, Real &m1, Real &m2)
 Moments of the NEGATIVE set {phi < 0} along p0 + s*d, s in [0,1], in the PARAMETER s: m0 = ∫ 1 ds, m1 = ∫ s ds, m2 = ∫ s² ds over the interior runs.
template<class Real>
void eigSym3 (const Real A[3][3], Real w[3], Real V[3][3])
 Jacobi eigensolver for a symmetric 3x3: A = V diag(w) V^T, V orthonormal columns.
template<class Real>
void largestProjections (const Real rn[3], int k, int sel[3])
 The k input axes with the largest projections rn into a degenerate cluster, in index order.
template<class Real>
void rotateOntoAxes (Real V[3][3], int i, int k, const int sel[3])
 Rotate the cluster columns i..i+k-1 of V onto the input axes sel (orthogonal Procrustes): M = V_sub^T E_sel (k x k), V_sub <- V_sub M (M^T M)^{-1/2}.
template<class Real>
void resolveDegenerateFrame (Real w[3], Real V[3][3], Real relTol=Real(1e-2))
 Within each cluster of (near-)equal eigenvalues, rotate the eigenbasis onto the input axes with the largest projection into that subspace (orthogonal Procrustes on the k x k projection).
template<class Real>
Quat< Real > quatFromRotation (const Real R[3][3])
 Rotation matrix (columns orthonormal, det +1) -> quaternion (x, y, z, w), Shepperd's method.
template<class Real>
void principalFrame (BodyProperties< Real > &bp)
 Principal moments and axes of bp.inertia into bp.principal / rotation / quat: degenerate clusters resolved onto the input axes, and a proper rotation (det +1).
template<class Real, class Phi>
int heightAxis (const Phi &phi, const Real o[3], const Real H[3])
 Height axis of a cell (origin o, size H): the axis of the strongest central difference at the cell centre, as in cellVolumeFraction.
template<class Real, class Phi>
void cellMoments (const Phi &phi, const Real o[3], const Real H[3], int order, int nq, int nseg, Real &V, Real(&M)[3], Real(&S)[3][3])
 One cell's contribution to the raw moments (V, M, S): a tensor Gauss rule (nq = gaussCount(order) nodes per transverse axis) of lines along the height axis, each integrated analytically.

Function Documentation

◆ interiorMoments()

template<class Real, class Phi>
void peclet::core::geom::body_detail::interiorMoments ( const Phi & phi,
Vec3< Real > p0,
Vec3< Real > d,
int nseg,
Real & m0,
Real & m1,
Real & m2 )

Moments of the NEGATIVE set {phi < 0} along p0 + s*d, s in [0,1], in the PARAMETER s: m0 = ∫ 1 ds, m1 = ∫ s ds, m2 = ∫ s² ds over the interior runs.

Same bracketed bisection as quadrature.hpp's positiveLength (an initial nseg subdivision brackets, 40 bisections refine to ~1 ulp of the parameter); the per-run integrals are analytic. NOTE the sign convention: bodies are the interior (phi < 0), where the aperture code measured the fluid (phi > 0).

Definition at line 66 of file body_properties.hpp.

References peclet::core::Vec3< Real >::x, peclet::core::Vec3< Real >::y, and peclet::core::Vec3< Real >::z.

◆ eigSym3()

template<class Real>
void peclet::core::geom::body_detail::eigSym3 ( const Real A[3][3],
Real w[3],
Real V[3][3] )

Jacobi eigensolver for a symmetric 3x3: A = V diag(w) V^T, V orthonormal columns.

Small, exact enough (50 sweeps to machine precision), no dependencies.

Definition at line 113 of file body_properties.hpp.

Referenced by rotateOntoAxes().

◆ largestProjections()

template<class Real>
void peclet::core::geom::body_detail::largestProjections ( const Real rn[3],
int k,
int sel[3] )

The k input axes with the largest projections rn into a degenerate cluster, in index order.

Definition at line 163 of file body_properties.hpp.

Referenced by resolveDegenerateFrame().

◆ rotateOntoAxes()

template<class Real>
void peclet::core::geom::body_detail::rotateOntoAxes ( Real V[3][3],
int i,
int k,
const int sel[3] )

Rotate the cluster columns i..i+k-1 of V onto the input axes sel (orthogonal Procrustes): M = V_sub^T E_sel (k x k), V_sub <- V_sub M (M^T M)^{-1/2}.

Definition at line 185 of file body_properties.hpp.

References eigSym3().

Referenced by resolveDegenerateFrame().

◆ resolveDegenerateFrame()

template<class Real>
void peclet::core::geom::body_detail::resolveDegenerateFrame ( Real w[3],
Real V[3][3],
Real relTol = Real(1e-2) )

Within each cluster of (near-)equal eigenvalues, rotate the eigenbasis onto the input axes with the largest projection into that subspace (orthogonal Procrustes on the k x k projection).

See the header comment; a fully degenerate tensor yields exactly the identity.

Definition at line 227 of file body_properties.hpp.

References largestProjections(), rotateOntoAxes(), and peclet::core::scale().

◆ quatFromRotation()

template<class Real>
Quat< Real > peclet::core::geom::body_detail::quatFromRotation ( const Real R[3][3])

Rotation matrix (columns orthonormal, det +1) -> quaternion (x, y, z, w), Shepperd's method.

Definition at line 253 of file body_properties.hpp.

References peclet::core::Quat< Real >::w, peclet::core::Quat< Real >::x, peclet::core::Quat< Real >::y, and peclet::core::Quat< Real >::z.

◆ principalFrame()

template<class Real>
void peclet::core::geom::body_detail::principalFrame ( BodyProperties< Real > & bp)

Principal moments and axes of bp.inertia into bp.principal / rotation / quat: degenerate clusters resolved onto the input axes, and a proper rotation (det +1).

Definition at line 287 of file body_properties.hpp.

References peclet::core::geom::BodyProperties< Real >::inertia, peclet::core::geom::BodyProperties< Real >::principal, peclet::core::geom::BodyProperties< Real >::quat, and peclet::core::geom::BodyProperties< Real >::rotation.

◆ heightAxis()

template<class Real, class Phi>
int peclet::core::geom::body_detail::heightAxis ( const Phi & phi,
const Real o[3],
const Real H[3] )

Height axis of a cell (origin o, size H): the axis of the strongest central difference at the cell centre, as in cellVolumeFraction.

Definition at line 310 of file body_properties.hpp.

Referenced by cellMoments().

◆ cellMoments()

template<class Real, class Phi>
void peclet::core::geom::body_detail::cellMoments ( const Phi & phi,
const Real o[3],
const Real H[3],
int order,
int nq,
int nseg,
Real & V,
Real(&) M[3],
Real(&) S[3][3] )

One cell's contribution to the raw moments (V, M, S): a tensor Gauss rule (nq = gaussCount(order) nodes per transverse axis) of lines along the height axis, each integrated analytically.

Definition at line 331 of file body_properties.hpp.

References peclet::core::geom::quad_detail::gaussLegendre01(), and heightAxis().