Repository navigation
pyBmodes 1.18.0
Highlights
Five features closing the open issue backlog, plus a correctness fix in the eigensolver that is worth reading if you model very heavy tower tops.
A silent wrong answer is now caught. scipy.linalg.eigh reduces the generalised problem through a Cholesky factor of the mass matrix, and that reduction quietly loses accuracy when a very light beam carries a very heavy lump. LAPACK does not raise there, it returns wrong frequencies: on a 100 m cantilever at a 4000:1 lump-to-beam mass ratio the reported fundamental was 0.103 Hz against a true 0.0436 Hz, and the answer wandered with mesh density. solve_modes now measures the backward error of a dense symmetric solve and redoes it on the general path when that error is large, taking the retry only when it genuinely resolves a failed mode. A RuntimeWarning names the swap and SolverDiagnostics.residual_fallback records it. The sparse path is deliberately untouched, since eigsh(sigma=0) factorises K rather than the mass matrix and does not have this failure.
Modelling reach. Discrete point masses anywhere on the beam (#35), self-weight geometric softening (#134), distributed Winkler soil springs on the monopile path (#118), and n_nodes mesh control on the deck and BMI readers (#58).
Domain-aware validation. New pre-solve checks for civil-structural and geotechnical inputs, so an implausible shell slenderness or embedment ratio is caught before the solve rather than showing up as a strange frequency.
Note on the version number
1.18.0 was prepared on 2026-08-12 but never tagged or published. The eigensolver fix then landed on top of it, and both are folded into this single release rather than leaving a 1.18.0 that appears in the changelog but cannot be installed.
Added
- Discrete point masses at any station (#35).
Tower.add_point_mass(height, mass)attaches a lumped mass anywhere on
the beam, filling the gap betweenoutfitting_factor(smeared over the
whole tower) andtip_mass(a single lump at the top) — a flange, an
internal platform, a transformer, a boat-landing. The lump is assembled
through the element shape functions at its exact station, so it does
not have to land on a mesh node and the answer does not move if the
mesh does. Validated against the closed-form cantilever-with-lump
frequency. Its own rotary inertia about its centre is not modelled;
usetip_masswhere that term matters. - Self-weight geometric softening (#134).
Tower.run(gravity=True)(orgravity=9.80665) puts the weight of the
tower, the RNA and any point masses into the column as an axial load,
which lowers the bending frequencies — typically around 2 % on the 1st
fore-aft mode of a large machine, and usually the single largest term
when reconciling against a tool that models gravity by default. Off
by default, so every existing result is unchanged and the validated
reference cases stay pinned to the BModes-equivalent behaviour. The
geometric stiffness is anchored to two published buckling loads with
different load distributions, Euler tip-load and Greenhill self-weight,
both to 0.2 %. Refused for a free-base floating model, where buoyancy
would have to be netted against the weight, and for the pinned-free
cable BC. - Distributed Winkler soil springs on the monopile path (#118).
MudlineFoundation.distributed_springs()turns the soil the lumped
mudline springs were built from into a spring rate along the embedded
pile,k = D_P E_SO (z / L_P)^nwith the Shadlou and Bhattacharya
inhomogeneity exponents.Tower.attach_mudline_foundation(foundation, distributed=True)lays it intodistr_k, and
Tower.from_windio_with_monopile(..., soil_distributed=True)keeps the
embedded pile in the beam so it deflects against the soil over its real
length rather than being condensed onto a base spring. Cross-validated
against the lumped tier, which is the exact static condensation of the
same beam and bed: the two agree to 0.4 %, the residual being the
embedded pile's own inertia the condensed form drops. n_nodeson the deck and BMI readers (#58).Towerand
RotatingBladegain arefine_mesh(n_nodes)method and ann_nodes
keyword on every deck constructor —Tower(...),from_bmi,
from_elastodyn,from_elastodyn_with_subdyn,
from_elastodyn_with_mooring,RotatingBlade(...)and its
from_elastodyn. The geometry constructors already had it, so the
keyword is now uniform across the whole surface. It stays opt-in
because re-gridding a deck re-samples an already tabulated property
table rather than recomputing exact tube properties: aUserWarning
names any deliberate property step the new mesh misses, and a deck with
tension-wire supports is refused outright, since those attach to node
numbers that would silently move.- Domain-aware validation for the civil-structural and geotechnical
disciplines (#102).check_modelgains a fixed-bottomD / tband —
the support-type-aware tightening of the deliberately wide band
tubular_section_propsapplies at construction, which cannot know the
boundary condition and has to admit a floating tower's far thinner
shell. It also reports a monopile clamped rigidly at the mudline with
no soil springs as non-conservative (INFO) and an implausible embedment
ratioL / D(WARN). Newcheck_solved_frequenciesflags a
fixed-bottom tower whose first mode lands outside 0.01-10 Hz, which is
where a compounding scale error shows up when two inputs are wrong in
compensating directions and each passes its own band; it runs
automatically onTower.run(check_model=True). CheckOptionsgainsdiameter_thickness_min/_maxand
embedment_ratio_min/_maxfor the new bands.read_windio_monopile_towergainsclamp_at_mudline, and its result
carries the two reduced segments so a caller can read the raw tube and
material each was built from.
Fixed
-
The dense symmetric eigensolver could return confidently wrong low
modes on a near-singular mass matrix, silently.scipy.linalg.eigh
reducesK x = λ M xthrough a Cholesky factor of the mass matrix,
and that reduction loses accuracy when a very light beam carries a very
heavy lump. LAPACK does not raise there — it returns wrong frequencies.
On a 100 m cantilever with a 4000:1 lump-to-beam mass ratio the
reported fundamental was 0.103 Hz against a true 0.0436 Hz, a factor of
2.4, and the answer wandered non-monotonically with mesh density.solve_modesnow checks the backward error||K x - λ M x|| / ||K x||
of a dense symmetric solve and, when it is large, redoes it through
the general dense path, which factorises neither matrix. The retried
result is taken only when it resolves a mode the symmetric solve
had failed — improving it by more than 1000× and reaching a backward
error of 1e-3 or better. Both conditions are needed because a
rigid-body mode's residual divides one roundoff quantity by another,
so its value is arbitrary (0.076, 0.79 and 12.4 have all been measured
on healthy models) while its improvement ratio stays near 10x, four
orders short of the 1e5 to 1e10 a real rescue achieves. ARuntimeWarningnames
the swap, and attributes it to the mass matrix only when the mass
conditioning supports that — a wide stiffness range trips the same
guard with a perfectly conditioned mass.SolverDiagnosticsgains
residual_fallbackrecording it.The sparse path is deliberately not retried and never sets
residual_fallback.eigsh(sigma=0, mode='normal')factorisesK
rather than the mass matrix, so a near-singularMdoes not degrade
it — on the mesh sweep that motivated this work it returned correct
frequencies on exactly the meshes large enough to select it. Retrying
it would also mean comparing two different mode sets, since
which="LM"selects the modes nearest zero in magnitude while the
retry selects the algebraically smallest.No existing result changes. The decisive-improvement condition is
what guarantees that: a real deck can carry a large backward error
without being broken, and on the bundled NREL 5MW land tower (whose
adapter leaves the mass matrix at cond ~4e10) the general path is only
1.4× better while splitting a degenerate fore-aft / side-side pair
the symmetric solver resolves exactly.Acceptance requires the candidate to be non-regressive as well as
decisively better somewhere. Taking the retry replaces the whole
spectrum, not the modes that prompted it, so a candidate that rescues
one mode while pushing a previously acceptable one above the failure
threshold is refused — it would hand back a new bad mode in place of an
old one. The guarantee is one-sided and precise: a mode that was
acceptable can end up above the regression floor only by not having got
worse, never as collateral of another mode's rescue. Below that floor
it is free to move either way, which is deliberate — a residual already
that small is not a claim about accuracy worth defending. A mode
already failing carries no verdict either way — above the threshold
neither candidate is trustworthy, and a rigid-body mode, whose residual
divides one roundoff quantity by another and has been measured at 12.4
against 0.79 on a healthy model, lives entirely in that region.
max_residualstill reports it.The comparison is made per mode rather than on the two maxima, so
that rigid-body modes cannot distort it. Their backward error is a
ratio of two near-zero quantities and reads ~1 in both candidates
however exact each is; on a maximum that floors the alternative and
hides a genuinely corrupted elastic mode sitting alongside them, while
per mode it simply registers as no improvement. The retry preserves
zero and negative eigenvalues and verifies that nothing was dropped
from inside the returned window, so it can never backfill a missing
mode with a higher one and shift the spectrum.Scope. The rescue is reliable and platform-independent for the case
it was built for, a near-singular mass matrix with no rigid-body modes.
Where rigid-body modes and a near-singular mass matrix coincide it is
safe but not always effective: QZ may return the theoretically real
zero modes as complex-conjugate pairs, and where those land differs
between LAPACK builds. When they fall inside the requested window the
alternative's ordering cannot be verified and the retry declines,
leaving the result no worse than before withmax_residualstill
reporting the problem. Declining is deliberate — a guard added to stop
a silent wrong answer must not be able to introduce one.The retry is also bounded in size, since a sparse solve that fails to
converge falls back to dense at any size and an unboundedeigthere
could take minutes on a result already in hand. And it can decline: if
the alternative solver raises on the same defective pencil, the
symmetric result and its diagnostics are kept rather than the whole
solve failing. -
SolverOptionsgains five fields for the conditions above, each
governing one of them:residual_retry_threshold(what counts as a
failing mode),residual_retry_improvement(how much better the
candidate must be for the win to be a rescue rather than roundoff),
residual_retry_resolved(the backward error it must actually reach),
residual_regression_floor(where a worsened mode has to land before
the worsening counts) andresidual_retry_max_ndof(the size above
which the retry is not attempted at all).