Reading results

After solve(), results are read from the nodes and the members, for a given load case. Every example on this page reads one model, a 6 m simply supported beam, shear-rigid IPE 200, with 20 kN at 2 m from A:

results.ts
import { DofID, LinearStaticSolver } from '@edubeam/fem'

const solver = new LinearStaticSolver()
const { domain } = solver
domain.createMaterial(1, { e: 210e9, g: 81e9 })
domain.createCrossSection(1, { a: 28.5e-4, iy: 1943e-8, k: 1e32 }) // shear-rigid

const A = domain.createNode('A', [0, 0, 0], [DofID.Dx, DofID.Dz])
const B = domain.createNode('B', [6, 0, 0], [DofID.Dz])
const beam = domain.createBeam2D(1, ['A', 'B'], 1, 1)
const lc = solver.loadCases[0]
lc.createBeamConcentratedLoad(1, [0, 20e3, 0, 2], true)
solver.solve()
20 kN at 2 m on a 6 m span13.33−6.667−6.66720 kN13.336.667AB
20 kN at 2 m on a 6 m spanOpen in EduBeam

What to read where

ResultCallReturns
Reactionsnode.getReactions(lc){ dofs, values }: N, N·m
Displacementsnode.getUnknowns(lc, dofs)m, rad
N, V or M at a pointbeam.computeBendingMomentAt(lc, x)a number: N, N·m
N, V or M along a memberbeam.computeBendingMoment(lc, n){ x, M }, n + 1 points
Deflected shapebeam.computeLocalDefl(lc, n){ u, w }, n + 1 points, m
End forcesbeam.computeEndForces(lc)a mathjs matrix of 6

For N and V, the methods are computeNormalForceAt and computeShearForceAt, computeNormalForce and computeShearForce, returning { x, N } and { x, V }. The signs are on Units and signs.

Reactions

getReactions gives one reaction per DOF the support holds: dofs lists them, in the order they were given to createNode, and values holds the reactions in the same order. values is a mathjs matrix when there are several and a plain array when there is one, so a small helper makes it an array either way:

TypeScript
/** Make a mathjs Matrix, an array or a number a plain array. */
const list = (v: unknown): number[] =>
  typeof v === 'number'
    ? [v]
    : Array.isArray(v)
      ? v
      : (v as { toArray(): number[] }).toArray()

A.getReactions(lc).dofs // [0, 2]: DofID.Dx, DofID.Dz
list(A.getReactions(lc).values) // [0, -13333.3]
list(B.getReactions(lc).values) // [-6666.7]

To pick one reaction regardless of order, look its DOF up: list(values)[dofs.indexOf(DofID.Dz)], as the continuous beam recipe does.

A reaction is the force the support puts on the structure: −13 333 N along z is 13.3 kN pushing up, . On a node with turned axes, the reactions are in those axes; getReactions(lc, true) turns them into global ones and returns all three DOFs, with 0 where nothing is held. A node without a support gives { dofs: [], values: [] }.

Displacements

getUnknowns reads any DOFs of a node, supported or not:

TypeScript
list(A.getUnknowns(lc, [DofID.Dx, DofID.Dz, DofID.Ry])) // [0, 0, -0.0108924]

A turns clockwise by 0.010892 rad, . Asked for one DOF, getUnknowns returns a plain number, although TypeScript declares a matrix: list handles that too.

Internal forces along a member

The …At methods give a value at x metres from the member's first node:

TypeScript
beam.computeShearForceAt(lc, 1) // 13333.3 N
beam.computeShearForceAt(lc, 2) // -6666.7 N: at the load, the value after it
beam.computeBendingMomentAt(lc, 2) // 26666.7 N·m: R_A · 2

Where a point load makes a step, the value exactly at the load is the one on its far side. To read the near side, ask a hair before it, such as x - 1e-9.

The array methods sample a member at n + 1 evenly spaced points, ends included:

TypeScript
beam.computeBendingMoment(lc, 3)
// { x: [0, 2, 4, 6], M: [0, 26666.7, 13333.3, 0] }, to round-off

Expect round-off such as -3.6e-12 where the exact value is 0: format numbers with toFixed before you print them. The largest value along a member is the largest of a fine sampling, such as computeBendingMoment(lc, 500), as in the continuous beam recipe. Under distributed loads M is a polynomial, so its exact extreme is where V crosses zero; @edubeam/plot finds it exactly.

Deflected shape

TypeScript
beam.computeLocalDefl(lc, 3)
// { u: [0, 0, 0, 0], w: [0, 0.0174279, 0.0152494, 0] }

computeLocalDefl gives the displacements along and across the member, u and w, in its local axes; computeGlobalDefl the same points in global x and z. The deflection under the load, 17.43 mm, is . The shape between the nodes is exact, not interpolated from the end values. To draw it, see Drawing the results.

End forces

TypeScript
beam.computeEndForces(lc).toArray()
// [0, -13333.3, 0, 0, -6666.7, 0]: X12, Z12, M12, X21, Z21, M21

The forces the two nodes put on the member, in its local axes: the numbers of the app's Element results table, explained in End forces.

Results as numbers to check

Every value above matches its closed-form formula. The verification page works through many more textbook cases, solved by this same solver in your browser.