From 173973071b4b2c11cd2fc94a9b4dd3b5edd245a1 Mon Sep 17 00:00:00 2001 From: SVS87 Date: Mon, 15 Jun 2026 00:18:20 -0400 Subject: [PATCH] fix: correct axis normalization in s_compute_moment_of_inertia Use sqrt(sum(axis**2)) instead of sqrt(sum(axis)) to compute the unit vector along the rotation axis. The incorrect norm produced a non-unit normal_axis, making the orthogonal projection and computed moment of inertia wrong for 3D moving IBs with non-analytic geometry. Fixes #1481 --- src/simulation/m_ibm.fpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/m_ibm.fpp b/src/simulation/m_ibm.fpp index 99aeb1e382..d8bdaa2cc5 100644 --- a/src/simulation/m_ibm.fpp +++ b/src/simulation/m_ibm.fpp @@ -1143,7 +1143,7 @@ contains patch_ib(ib_idx)%moment = 1._wp return else - normal_axis = axis/sqrt(sum(axis)) + normal_axis = axis/sqrt(sum(axis**2)) end if ! if the IB is in 2D or a 3D sphere, we can compute this exactly