Natural vibration

ModalSolver finds the natural frequencies and mode shapes of a structure's free, undamped vibration, . It takes the same model as LinearStaticSolver, nodes, members, supports and hinges, built the same way. What it adds is mass, placed like a load. Available from 0.4.0.

A mass on a cantilever

A 500 kg mass at the tip of a 3 m cantilever, an IPE 300 that has no mass of its own:

vibration.ts
import { DofID, ModalSolver, type Beam2D } from '@edubeam/fem'

const modal = new ModalSolver()
const { domain } = modal
domain.createMaterial(1, { e: 210e9, g: 81e9 })
domain.createCrossSection(1, { a: 53.8e-4, iy: 8356e-8, k: 1e32 }) // IPE 300, shear-rigid
domain.createNode('A', [0, 0, 0], [DofID.Dx, DofID.Dz, DofID.Ry]) // clamped
domain.createNode('B', [3, 0, 0])
domain.createBeam2D(1, ['A', 'B'], 1, 1)

modal.loadCases[0].createNodalMass('B', 500) // 500 kg at the tip
modal.solve()

for (const mode of modal.modes) {
  console.log(mode.frequency.toFixed(3), 'Hz', mode.period.toFixed(4), 's', mode.omega.toFixed(2), 'rad/s')
}
Output
9.939 Hz 0.1006 s 62.45 rad/s
138.126 Hz 0.0072 s 867.87 rad/s

By hand: across the beam the mass sits on a spring kN/m, so rad/s and Hz. The second mode moves the mass along the beam, against : Hz.

Masses

Masses belong to the first load case, modal.loadCases[0], and are placed like loads:

MethodUnitPlaces
createNodalMass(node, mass)kga point mass, which moves with the node in x and z alike
createBeamMass(member, mass)kg/ma mass spread evenly along the member: its own mass, or what it carries

Each returns the mass, a NodalMass or a BeamMass; they are kept in lc.nodalMassList and lc.elementMassList, with the label in target and the value in mass, which you can change before solving again.

  • Nothing comes from the material. The density d of a material is not used: a member has no mass until you give it one with createBeamMass, for its own mass.
  • A mass has no direction and there is no gravity: a point mass resists acceleration in x and z the same, and has no rotational inertia.
  • Only masses count. Forces, temperature loads and prescribed displacements in the load case are ignored, and supports hold their DOFs at zero.

A LinearStaticSolver accepts masses too and ignores them, so one model can serve both analyses; only ModalSolver reads them.

Modes

After solve(), modal.modes lists the modes, lowest first:

MemberUnitDescription
omegarad/scircular frequency
frequencyHz
periods; Infinity for a mechanism
shapethe mode shape, one value per equation number like lc.r (supported DOFs 0)

A shape is scaled so that , its largest component positive; its size means nothing else. Read it through the node or the member:

TypeScript
const [first] = modal.modes
domain.getNode('B').getModeDisplacements(first, [DofID.Dx, DofID.Dz, DofID.Ry])
// [0, 0.04472, -0.02236]: B moves down, 1/√500, and turns

const beam = domain.getElement(1) as Beam2D
beam.computeGlobalModeShape(first, 3).w
// [0, 0.006625, 0.02319, 0.04472]: the shape at 4 points along the member, global z

getModeDisplacements(mode, dofs) gives a node's displacements in its own axes, as getUnknowns does in statics. computeGlobalModeShape(mode, n) gives { u, w } in global x and z at n + 1 points along the member, hinges included. @edubeam/plot draws a mode with modelFromSolver(modal, { mode: 0 }).

How many modes

There is one mode for every free DOF that carries mass. A point mass on a free node gives two, its x and z; a member mass also gives its ends' rotations mass. DOFs without mass, such as the rotation under a point mass, have no inertia: they are condensed out statically, and their values in shape are what the masses force on them. A model with no mass at all solves to no modes: modes is [].

Divide members with mass along them

A point mass on a massless member is exact. A mass along a member uses the member's consistent mass matrix: very good for the first mode, less and less for the higher ones, whose waves are shorter than the member. Divide the member to describe them. A simply supported 6 m IPE 300 with its own mass, 42.2 kg/m:

divide.ts
import { DofID, ModalSolver } from '@edubeam/fem'

/** A simply supported 6 m IPE 300 of its own mass, 42.2 kg/m, in n members */
const beamModes = (n: number) => {
  const modal = new ModalSolver()
  const { domain } = modal
  domain.createMaterial(1, { e: 210e9, g: 81e9 })
  domain.createCrossSection(1, { a: 53.8e-4, iy: 8356e-8, k: 1e32 })
  for (let i = 0; i <= n; i++) {
    const bcs = i === 0 ? [DofID.Dx, DofID.Dz] : i === n ? [DofID.Dz] : []
    domain.createNode(i, [(6 * i) / n, 0, 0], bcs)
  }
  for (let i = 1; i <= n; i++) {
    domain.createBeam2D(i, [i - 1, i], 1, 1)
    modal.loadCases[0].createBeamMass(i, 42.2)
  }
  modal.solve()
  return modal.modes.slice(0, 3).map((mode) => mode.frequency.toFixed(2))
}

console.log(beamModes(1))
console.log(beamModes(3))
console.log(beamModes(12))
Output
[ '31.23', '143.11', '237.72' ]
[ '28.16', '113.88', '218.06' ]
[ '28.14', '112.55', '215.75' ]

The bending modes are : 28.14 Hz and 112.55 Hz, which twelve members match to every digit shown and one member misses by 11 % and 27 %. The third mode here is not bending: the beam vibrates along its length, Hz, as the roller lets it.

When solving fails

A mechanism that carries mass is not an error: its free motion comes out as a mode with omega 0 (or a hair above it) and period Infinity. A mechanism where nothing carries mass cannot be condensed out, and solve() throws:

text
RangeError: The structure is a mechanism where it carries no mass

The theory, worked by hand, is in How EduBeam solves; the app's modal analysis uses this solver.