Skip to content

ESS_butterfly: colour-coded MCDISPLAY with solid moderators - #2947

Draft
willend wants to merge 9 commits into
mccode-dev:mainfrom
willend:2026-10-ess-butterfly-display
Draft

willend wants to merge 9 commits into
mccode-dev:mainfrom
willend:2026-10-ess-butterfly-display

Conversation

@willend

@willend willend commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Display-only update of the ESS_butterfly source's MCDISPLAY (in ESS_butterfly.comp and share/ESS_butterfly-geometry.c). Nothing in INITIALIZE/TRACE changes, so simulated results are unaffected.

Changes

  • Colours: ESS blue #0099dc as the base pen colour (from the logo SVG on ess.eu, /themes/custom/ess/logo.svg), and a dark grey (#a9a9a9) proton-beam arrow. The arrow is now drawn in the style of Arm, as a line plus a cone, 13.7 cm below the moderator plane, so the arrowhead tip sits under the moderator centre instead of inside the moderator assembly. The shaft is a 1 cm radius cylinder.
  • ESS emblem as the target wheel: the emblem was digitised from ess.eu themes/custom/ess/graphics/logo-small.svg (7 contours, 439 points, 437 cap triangles; ear-clipped offline, with the triangle area checked against the contour area). It is drawn in ESS blue at proton-beam level: 2.6 m in diameter (the ESS figure for the wheel) and 8 cm thick (the tungsten brick height). Its centre is 1.138 m downstream of the beam impact point, so the arrowhead sits inside the nearest swoosh with a 2 cm margin (2.5 cm measured clearance in all sectors tested). It reads correctly seen from above, with the letters' up direction along the proton beam. Solid at --trace=2, outlines at --trace=1. Its polyhedron uses the same butterfly_solid() writer as the moderator solids. A new setting parameter logo=1 controls it, and logo=0 suppresses it. The ESS logo is (c) ESS, all rights reserved. This is stated in the component header (%D, rendered by mcdoc) and in the comment above the generated logo data, and the digitiser script writes it with every regeneration.
  • Digitiser script: share/ESS_butterfly-logo.py regenerates the emblem data block (between BEGIN/END markers in ESS_butterfly-geometry.c) from the SVG. It has --dry-run and --preview options and checks that the triangle area equals the contour area. Re-running it reproduces the committed data exactly.
  • Open cylinders: the 2 m "empty zone" and 5.5 m target-monolith rings (3 circles each, at y = 0, ±0.1 m and y = 0, ±1 m) are replaced by lid-less vertical walls of 36 mcdis_polygon rectangles. The built-in cylinder primitive always draws lids.
  • Butterfly drawn last: light-blue (#66ccff) cold wings, red thermal boxes and yellow emission planes, including the extra TBL cold-wing plane. Cold vs. thermal is taken from the emission geometry: the cold plane at 24.24° runs along the lobes, and the thermal plane spans the notch opening.
  • Solid moderators at --trace=2: the new butterfly_prism() helper emits each moderator as one closed triangle-mesh mcdis_polyhedron. Each non-convex outline is split into convex pieces for the top and bottom faces. Nothing extra is drawn at --trace=1.
  • Rotation fix: the beamline loop now uses its own rotation variables instead of overwriting the Br11..Br22 moderator rotation, which the butterfly outline needs now that it is drawn after that loop.

Testing (macOS arm64, clang)

  • mcrun --trace=2 -n 0 with a minimal test instrument, after deleting the generated .c. For N1, N7, S3, E5, W2 and W11 (TBL), every line segment matches the previous version exactly, except the proton-beam arrow (3 lines at y = 0 become 1 line plus a cone at y = −0.137 m). The only other additions are the 72 wall polygons, the 3 moderator solids and the emblem.
  • The 3 solids are closed meshes with consistent orientation, and their top/bottom faces have the same area as the outlines.
  • Checked in mcdisplay-webgl-classic: all walls and solids are Lambert-shaded surfaces in the expected colours.
  • --trace=1 emits outlines only.
  • The generated C has no new warnings with -Wall -Wextra.
  • logo=0 removes exactly the emblem (1 polyhedron at --trace=2, 439 outline segments at --trace=1).
  • ESS_butterfly_test runs with the new component (mcrun -n 10000).

Not tested: Linux, Windows/MSVC, the new webgl frontend in a browser, and the matplotlib/pyqtgraph frontends at --trace=2. The display code is excluded from OpenACC builds.

🤖 Generated with Claude Code

willend and others added 6 commits October 31, 2026 12:18
Display only, no change to the simulated neutrons:
- ESS blue (#0099dc, from the ess.eu logo) as base pen colour, dark grey
  proton-beam arrow.
- The 2 m "empty zone" and 5.5 m target-monolith circles (3 rings each)
  become open, lid-less vertical cylinder walls of 36 polygons.
- The butterfly is drawn last: light-blue cold wings, red thermal boxes,
  yellow emission planes (also the extra TBL cold-wing plane). At
  --trace=2 the cold and thermal moderators are also shown as closed,
  shaded solids (new butterfly_prism() polyhedron helper; --trace=1
  keeps the outlines only).
- The beamline loop now uses its own rotation variables instead of
  overwriting the Br11..Br22 moderator rotation, which the butterfly
  outline relies on now that it is drawn after that loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Draw the proton-beam arrow as a line and a cone (as in Arm) instead of
three lines, 13.7 cm below the moderator plane, so the arrowhead tip sits
under the moderator centre rather than inside the moderator assembly.
Display only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Proton-beam arrow shaft is now a 1 cm radius cylinder (was a line).
- The ESS emblem (digitised from the ess.eu logo-small.svg: 7 contours,
  439 points, 437 cap triangles) is drawn in ESS blue where the target
  wheel sits: at proton-beam level, 2.6 m diameter, 8 cm thick, its rim
  at the beam impact point and centred downstream of it. Solid at
  --trace=2, outlines at --trace=1.
- butterfly_prism() now builds on a general butterfly_solid() slab
  writer shared with the emblem; the moderator solids are unchanged.

Display only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New setting parameter logo=1: 0 suppresses the ESS emblem in MCDISPLAY.
- Emblem centre moved from 1.3 m to 1.138 m downstream of the beam impact
  point, so the proton-beam arrowhead sits inside the nearest swoosh with
  a 2 cm margin (2.5 cm measured clearance in all sectors).
- Add share/ESS_butterfly-logo.py, which digitises the ess.eu emblem SVG
  and rewrites the generated block (now between BEGIN/END markers) in
  ESS_butterfly-geometry.c, with --dry-run and --preview. Re-running it
  reproduces the committed data exactly.

Display only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@willend

willend commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-10-31 at 13 11 34 Screenshot 2026-10-31 at 13 12 36 Screenshot 2026-10-31 at 13 12 27 Screenshot 2026-10-31 at 13 12 00 Screenshot 2026-10-31 at 13 11 52 Screenshot 2026-10-31 at 13 11 00 Screenshot 2026-10-31 at 13 10 47 Screenshot 2026-10-31 at 13 10 44

@willend
willend marked this pull request as draft October 31, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant