# Recovery and validation notes

## Source of truth

Recovered from the supplied installer folder `SubAppInstaller9.1.1`, application directory `Submarine Design Tool_9_0_0_40`. The installer folder's name differs from the executable application version. Nothing in the source installer was edited.

The Windows executable was decompiled with ILSpy. Its calculation classes—not the draft Word document—were used as the numerical reference. For example, the executable's initial submerged displacement is `2356 × ln(crew) − 6250`, with normal displacement at 80% of submerged displacement. The older prototype and draft documentation did not reproduce this consistently.

Original help HTML was converted into plain text. Historical claims, examples, terminology and inconsistencies have not been independently updated. The excerpts that discuss real submarine capabilities should be treated as supplied teaching material, not current technical guidance. Mission maps are not included; use the course slides alongside the written briefs.

## Numerical verification

The recovered `Submarine`, `InputSet`, `OutputSet`, `Hull`, `Propulsion`, `Systems`, `Battery`, `Torpedo`, `CruiseMissile` and `PowerLengthValue` C# classes were compiled into a local reference harness. Only their Windows UI dependencies were stubbed. The harness ran the reference calculations and exported the outputs for comparison with `engine.js`.

Fourteen cases cover the original defaults and changes to crew, indiscretion ratio, patrol duration/range, payload, maximum speed, diving depth, deck height, deck count and transit distance. All shared numerical outputs passed at a relative tolerance of 0.0001; the maximum observed relative difference was approximately **5.57 × 10⁻⁸**. The browser translation uses Float32 assignments and round-to-even to preserve .NET Single behaviour. Reference outputs are serialized with the original export precision.

Run `node validation/check-engine.cjs` from this folder to repeat the numerical check. The small test also checks invalid input detection and verifies that required CAD layers contain finite, indexed triangle geometry. Interface/scene unit tests additionally passed using jsdom, real Three.js geometry and a stubbed WebGL boundary; see `validation/RESULTS.md`. These checks do not exercise GPU rendering or prove engineering validity.

The C# comparison covers the core calculation, not the original Windows GUI's complete event flow, input handling, validation prompts or Rhino execution. Optional fitting surcharges are transcribed but are not covered by the 14 C# fixture cases. Further cases and an instructor-led side-by-side Windows comparison are recommended before teaching use.

## Legacy behaviour deliberately retained

Compatibility is kept separate from scientific correction. In particular:

- The hull margin is assigned after the initial hull weight calculation.
- Several propulsion members, including normal displacement and hotel energy, are never populated in the recovered sequence.
- The propulsion weight formulation includes overlapping contributions.
- Battery quantities and battery weight/volume use an unusual legacy sequence, including a later minimum battery-count clamp.
- The balancing loop does not consistently recalculate all dependent weights, costs and volumes. In one branch it adds displacement without updating length. Some input combinations leave a large weight residual.
- The original volume calculation is not an enforced volume-balance solver.
- Shape choices do not feed individual hull/appendage hydrodynamics into the numerical engine. Optional fitting costs are added, but their structural weight and volume are not independently modelled.

Warnings flag L/D ratios outside 4–12, weight residuals larger than 200 tonnes, required volume exceeding displaced volume, and the added-displacement/stale-length branch. These are screening checks, **not certification that an unflagged design is feasible**. Returned dimensions can be inconsistent with displacement because the legacy routine is preserved.

Historical cost values retain the original course's dollar-million-style units. They have not been inflation-adjusted, calibrated to procurement costs, or established as current estimates.

The interface adds protective finite-number, positive-output and import checks. Mission duration and distance caps (365 days per phase and 100,000 nautical miles per phase) are browser guards, not recovered engineering limits. This is not a byte-for-byte port of all Windows UI restrictions.

## Geometry

The three supplied Rhino files contain saved render meshes. All 894, 858 and 816 Brep faces respectively had render meshes available. Their source hashes and extracted layer triangle counts are in `asset-provenance.json`. Water demonstration layers and non-rendered curves are not displayed. No submarine shape was generated from a text prompt.

The viewer uses the source `RhinoCode.rvb` model selection, nominal diameter factors, nose/tail lengths, body-length scaling, tail translation and sail placement logic. The original CAD coordinates are transformed into browser coordinates. The operations bay retains its nominal fixed size.

There is one intentional geometry safety difference: when an operations bay cannot fit on the selected body, the viewer omits it and states that it cannot fit. The original script's comment says to switch the bay off, but its actual visibility assignment appears to leave it on. The browser does not reproduce that contradictory overlap. The course cost still reflects the selected fitting, so revise the configuration if it is omitted.

Nominal design dimensions are not identical to the original CAD's measured outer bounds. The casing, appendages and extended masts may exceed the design diameter, and model end coordinates differ slightly from nominal script lengths. The guides are explicitly labelled calculated **design length** and **hull diameter**, not a measured CAD envelope or pressure-hull engineering drawing. The number of launch silos affects the legacy length calculation but does not generate individually counted launch tubes in the CAD.

Every comparison pane shares the same orthographic world span, orientation and zoom. Large changes may move a model outside the current view; use **Fit all** to fit the longest visible concept. Keeping a stable scale while editing is intentional.

## Remaining acceptance checks

1. Open `index.html` from the unzipped folder. Confirm all three hull variants render, and rotate each through a full turn. Check seams and appendage placement against the original Rhino views.
2. Hover, keyboard-focus and tap guidance buttons, especially indiscretion ratio. Confirm dismissal and mobile positioning.
3. Save the default design, change crew/deck height, and compare in side view. Confirm shared scale, dimensions, camera synchronisation, zoom and rotation controls.
4. Export/import a three-concept file and confirm names, notes, requirements and outputs round-trip. Reload and check saved snapshots remain on the intended classroom browsers.
5. Enter invalid requirements and confirm the model/results clear and saving is disabled. Review warning cases with an instructor.
6. Compare the 14 reference cases against the original Windows UI, including cost display units and units of submerged endurance.
7. Test representative course laptops/tablets and the approved static host. Browser appearance and WebGL rendering were not verified in the automated preview because local-file navigation was blocked.

## Dependencies and provenance

- [ILSpy](https://github.com/icsharpcode/ILSpy) for inspection of the supplied .NET program; not needed at runtime.
- [Rhino saved render mesh documentation](https://developer.rhino3d.com/en/guides/opennurbs/reading-render-meshes/) and [rhino3dm BrepFace API](https://mcneel.github.io/rhino3dm/python/api/BrepFace.html), used in local asset recovery; not needed at runtime.
- [Three.js](https://github.com/mrdoob/three.js/tree/r128), pinned local r128 classic build, MIT licence. All runtime assets are bundled; there are no CDN requests or telemetry.

No website has been published and no course files were uploaded to a third-party host. This build is separate from the earlier prototype.
