Skip to content

Moving Hermite basis 4/5: remap triggers with hysteresis, frozen replay - #59

Open
rogeriojorge wants to merge 2 commits into
adaptive/p3-remapfrom
adaptive/p4-triggers
Open

rogeriojorge wants to merge 2 commits into
adaptive/p3-remapfrom
adaptive/p4-triggers

Conversation

@rogeriojorge

Copy link
Copy Markdown
Member

Adds remap_trigger, which decides a remap per species from the measured moments.

When it fires:

  • |U - u|/a > 0.3;
  • or |a'/a - 1| > 0.05 (a' capped);
  • or, optionally, the tail fraction above 2N/3 exceeds tail_on, has doubled since the last event, and the move is non-trivial.

A remap resets the moment measures to round-off, so firing again needs the same growth (hysteresis). Species that do not fire keep their basis. For gradients, record the events and replay them as a frozen schedule with remap.

Tested SHA 045abc1. Command: python -m pytest -q -n 2 tests. Result: 179 passed.

New tests:

  • Manufactured shifted and heated Maxwellians fire or not as expected, and never fire again after their own remap.
  • A slow drift of 0.05 a per check fires every 6 or more checks, never on consecutive checks.
  • The tail trigger needs both growth and a move.
  • A live segmented plasma-oscillation run with at least 2 events:
    • its recorded schedule replays bitwise;
    • jax.grad through the replay matches central finite differences to 1e-6 relative.

Stack: base adaptive/base = integration/dark-baseline 9d0982d (main ab87385 + #48, #46, #13, #12, #9, #55, #50, #44, #18, #51). This lands on main after those foundation PRs and the earlier PRs of this stack (#56 first). Local results only (macOS, Python 3.12, JAX 0.11.2, x64); GitHub CI on this branch has not been checked yet.

remap_trigger compares the capped moment target with the basis per species and
fires on |U - u|/a > 0.3 or |a'/a - 1| > 0.05 (optionally on a doubled tail
fraction with a non-trivial move). A remap resets the measures to round-off, so
an unchanged state never fires twice. Tests: manufactured shifted/heated
Maxwellians, no chattering under slow drift, and a live segment run whose
recorded schedule replays bitwise and differentiates (grad vs central FD).
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