# Continuous beam analysis and validation

Beam Studio analyzes a straight continuous beam with 1–8 entered spans. Each span may have its own rectangular width `b`, depth `h`, elastic modulus `E` and stiffness multiplier, giving its own elastic flexural stiffness `EI`. Omitted section properties inherit the global values. Span length is in metres; section dimensions are in centimetres. Loads entered in kgf are converted using exactly `9.80665 N/kgf`. Positive moments are sagging; negative moments are hogging; positive deflection is downward. All result positions use distance from the first beam end.

Pin and roller stations restrain vertical displacement while preserving beam rotation continuity. They do not create internal hinges. A fixed station also restrains rotation; a free interior station only divides geometry and load regions. Free ends and overhangs are allowed when the complete arrangement is stable. A model needs a fixed station or at least two distinct vertical supports, plus a pin or fixed restraint against horizontal movement. A negative vertical reaction represents uplift and requires a real restraint capable of resisting that demand.

## Loads and patterns

Every span may have a nonnegative multiplier for each entered uniform load case. The multiplier applies to that span's uniform input for the specified case before combination factors are applied. Omitted multipliers equal 1. Automatic concrete self weight uses each span's own section area, remains present along every span and receives the combination's `D` factor; span multipliers do not remove or amplify self weight. Global point loads retain their entered positions and receive combination factors, independently of uniform-load span multipliers.

Load patterns are user defined. An all-spans gravity load is not an automatic envelope of every possible live-load arrangement. The solver carries signed load cases and separately reports positive and negative moment maxima.

## Production method

The production solver assembles the Euler–Bernoulli element matrix for each span, with degrees of freedom `[vA, thetaA, vB, thetaB]`. With downward displacement and rotation positive, the matrix is:

```text
       EI / l³ × [ 12       6l     -12       6l  ]
                [  6l      4l²     -6l      2l² ]
                [-12      -6l      12      -6l  ]
                [  6l      2l²     -6l      4l² ]
```

Uniform loading uses the consistent load vector `[wl/2, wl²/12, wl/2, -wl²/12]`. Interior point loads use the exact cubic Hermite shape functions. A point at a station acts directly on that station, so a load applied to a vertical support does not create a fictitious span force. The solver assembles each element with its own physical `EI`, normalized by the global reference `EI`, scales the free matrix by its diagonal and solves with partial pivoting. Exact curvature recovery uses each span's own `EI`. Displacement and rotation remain continuous through section changes; moment and shear stay continuous where no external station force or moment acts.

After solving the support compatibility equations, internal shear and moment are recovered exactly from element end forces and applied loads. Displacement is the exact quartic uniform-load polynomial plus point-load singularity terms; it is not a cubic displacement interpolation. Moment extrema include each span end, load discontinuity, and every interior zero of shear. Deflection extrema include all endpoints and roots of slope, with root intervals partitioned by the exact moment zeros. Diagram sampling includes at least 33 evenly spaced stations per span, the global stations and exact extrema, so a short span beside a long span keeps a smooth curve. Both sides of point-load and support jumps are retained. An interior fixed station may create an internal moment jump equal to the negative of its external moment reaction.

## Independent verification

Run `node continuous-beam-checks.cjs` from the project root. The command writes `dist/continuous-benchmark-results.json`. The current run passes 90,656 numerical and validation assertions.

The independent reference does not assemble the production stiffness matrix. It treats interior support reactions and fixed-station moment jumps as unknown redundant forces, integrates the global load diagram using singularity functions, and integrates curvature separately over every section's `EI` region to enforce zero displacement and rotation at the requested restraints. The reference compares reactions, moment reactions, shear, moment, deflection and slope across 240 deterministic models with 2–8 unequal spans: 120 retain the shared section regression coverage and 120 have independent width, depth, modulus and stiffness in every span. The models include signed loads, span patterns, point loads at stations and within spans, fixed restraints, free stations, cantilever layouts and overhangs. The largest normalized reaction difference is approximately `7.06e-11`; the acceptance tolerance is `4e-8`. The result JSON records all measured errors and normalization definitions.

Twenty-four further signed-load models check that exact extrema bound 4,001 independently sampled positions per span, including twelve with independent span sections. A 0.1 m span beside a 99.8 m span checks the diagonal scaling and minimum plot sampling. Variable-`EI` two/three-span closed forms, an exact stepped cantilever tip displacement, per-span self weights and section-change continuity provide additional checks. A reference-section invariance check confirms that changing a selected/global reference section leaves explicitly specified span analysis unchanged. Validation rejects unstable or malformed arrangements and invalid span properties. The unchanged legacy analysis path also passes `verify.cjs` (74 assertions) and the existing `benchmark.cjs` suite (51,265 assertions).

## Closed-form examples

Let `l` denote each span length and `w` the uniform line load, with zero support settlements and constant `EI`.

| Model | Independent expectation |
| --- | --- |
| Two equal spans, both loaded | End reactions `3wl/8`; interior reaction `5wl/4`; support moment `-wl²/8`; sagging maximum `9wl²/128` at `3l/8` from the exterior support |
| Two equal spans, only left loaded | Reactions `[7wl/16, 5wl/8, -wl/16]`; interior moment `-wl²/16`; sagging maximum `49wl²/512` |
| Three equal spans, all loaded | Reactions `[0.4wl, 1.1wl, 1.1wl, 0.4wl]`; both interior moments `-wl²/10`; outer sagging maximum `0.08wl²`; middle sagging maximum `0.025wl²` |
| Two unequal spans `a` and `b`, both loaded | Interior moment `-w(a³+b³)/(8(a+b))`; exterior reactions `wa/2 + M/a` and `wb/2 + M/b` |
| Two equal spans, exterior ends fixed, both loaded | Moments `-wl²/12` at every station; reactions `[wl/2, wl, wl/2]`; each span's maximum downward displacement `wl⁴/(384EI)` |

For the equal two-span fully loaded case, first-span displacement in terms of `t = x/l` is:

```text
delta(t) = wl⁴/EI × (t/48 - t³/16 + t⁴/24)
```

The interior maximum occurs at `t = (1 + sqrt(33))/16`, approximately `0.421535`. The unloaded span in the partial-load example has upward maximum `-wl⁴/(144 sqrt(3) EI)` at local position `l(1 - 1/sqrt(3))`. These values are derived by integrating the moment field and differentiating the exact displacement equation, rather than using the rounded `1/185` deflection coefficient.

For two unequal spans with individual line loads and stiffness, the three-moment relation gives:

```text
Minterior = -(w1 a³/EI1 + w2 b³/EI2) / (8(a/EI1 + b/EI2))
RA = w1 a/2 + Minterior/a
RC = w2 b/2 + Minterior/b
```

For any adjacent pair in a three-span simply supported continuous beam, the weighted three-moment equation is:

```text
Mprev lprev/EIprev
  + 2 Mcurrent (lprev/EIprev + lnext/EInext)
  + Mnext lnext/EInext
  = -(wprev lprev³/EIprev + wnext lnext³/EInext)/4
```

The benchmark solves the two resulting equations independently and checks every reaction against production. For a stepped cantilever carrying a tip load `P`, exact tip displacement is `P ∫(L-x)²/EI(x) dx`, integrated over each span separately. These checks would detect using a shared section in either stiffness assembly, displacement recovery or automatic self weight.

The elementary elastic relations and the partial-load two-span support moment are supported by the [Cambridge University Engineering Department Structures Data Book, sections 4.2–4.5](https://teaching.eng.cam.ac.uk/sites/teaching.eng.cam.ac.uk/files/Documents/Databooks/Structures%202018.pdf). The independent compatibility method follows the subject taught in [IIT Bombay/NPTEL Structural Analysis I, Module 5, Lecture 4: Three Moment Equation](https://nptel.ac.in/courses/105101085). The equations above are the benchmark's own algebraic derivations under the stated assumptions.

## API notes

`c.spans` contains `{L, b, h, E, stiffness, loadScale}` entries; `b`, `h`, `E` and `stiffness` are optional and inherit the corresponding global properties when omitted. `c.L` equals the span-length sum within relative tolerance `1e-9`. The continuous result uses the exact span sum as its length and snaps near-equal station/tip coordinates within that tolerance, so UI rounding cannot lose a tip load. `c.interiorSupports` contains exactly one restraint type per interior station. Existing exterior `support`, `supportLeft` and `supportRight` fields remain active. Omitting `c.spans` retains the existing single-span solver unchanged.

`Beam.modelNodes(c)` returns `{index, x, type}` stations. `Beam.supportSpans(c)` returns actual unsupported lengths `{start, end, L, left, right}`; free interior geometry stations do not divide those lengths. `left` and `right` are restraint type strings.

Results expose `nodes` with all reactions and both one-sided moment/shear values, and `spans` with their actual `b`, `h`, `E`, stiffness multiplier, `I` in m⁴, `EI` in N·m², `self` in kgf/m, uniform loads and exact extrema. Each `span.at(x, side)` takes a global position restricted to that span. `result.at(x, side)` takes a global position over the entire beam; its default side is right, with internal one-sided values at exterior ends. `momentSamples` preserves fixed-station moment jumps; `shearSamples` preserves all shear jumps. `deflectionCandidates` contains global positions suitable for service checks over actual support gaps. Legacy `RA` and `RB` refer to the first and final node; `w`/`wKgf` and `self` are length-weighted mean line loads. Legacy `I` and `EI` retain the global reference section values; use the solved span properties for individual section checks.

## Scope

This is preliminary linear elastic beam analysis. It assumes piecewise constant `EI` in each entered span, small deflection, no support settlement and full rotational continuity. It excludes hinges, springs, axial/frame action, torsion, shear deformation, second-order effects, nonlinear concrete cracking and redistribution, long-term concrete deflection and complete Thai or ACI compliance. User-defined patterns and load combinations need engineering review. Reinforcement detailing, anchorage, development length and constructibility require separate review before construction.
