feat(hex8): use reference-weighted mean-volume energy

This commit is contained in:
KOKO\Mimi
2026-10-10 23:32:40 +09:00
parent 29670e168d
commit 18b36c1c22
8 changed files with 537 additions and 155 deletions
@@ -573,7 +573,7 @@ TEST(SolidHhtDynamics,
auto result = RunDynamics(OneFree());
ASSERT_TRUE(result.HasValue()) << solid_hht_test::Message(result.GetStatus());
const auto d = solid_hht_test::Brick();
constexpr double lambda = 4.8;
constexpr double bulk = 8.0;
constexpr double mu = 4.8;
const double roundoff = 512 * std::numeric_limits<double>::epsilon();
const auto& frames = result.Value().state.AcceptedFrames();
@@ -592,17 +592,20 @@ TEST(SolidHhtDynamics,
double stiffness;
double stiffness_term_scale;
if (c == 0) {
stiffness = (lambda + 2 * mu) * (-sign[0]) * product[1] * product[2] +
stiffness = (4 * mu / 3) * (-sign[0]) * product[1] * product[2] +
mu * (-sign[1]) * product[0] * product[2] +
mu * (-sign[2]) * product[0] * product[1];
stiffness_term_scale = (lambda + 2 * mu) * product[1] * product[2] +
stiffness_term_scale = (4 * mu / 3) * product[1] * product[2] +
mu * product[0] * product[2] +
mu * product[0] * product[1];
} else {
const unsigned other = c == 1 ? 2 : 1;
stiffness = -.25 * (lambda * sign[c] + mu * sign[0]) * product[other];
stiffness_term_scale = .25 * (lambda + mu) * product[other];
stiffness =
-.25 * ((-2 * mu / 3) * sign[c] + mu * sign[0]) * product[other];
stiffness_term_scale = .25 * (2 * mu / 3 + mu) * product[other];
}
stiffness -= bulk * sign[c] / 16;
stiffness_term_scale += bulk / 16;
const double inertia = c == 0 ? scalar_mass * f.acceleration[0] : 0;
const double internal = stiffness * f.displacement[0];
const double applied = b == 0 && c == 0 ? .01 : 0;