Skip to content

Moving Hermite basis 1/5: carry u_s, alpha_s in the solver state - #56

Open
rogeriojorge wants to merge 2 commits into
adaptive/basefrom
adaptive/p1-basis-state
Open

rogeriojorge wants to merge 2 commits into
adaptive/basefrom
adaptive/p1-basis-state

Conversation

@rogeriojorge

Copy link
Copy Markdown
Member

Adds an optional basis state stack([u_s, alpha_s]) (shape (2, 3*Ns)) to the solver state. It is the first of five PRs for a moving and rescaled asymmetric Hermite basis.

  • ode_system accepts (Ck, Fk, basis). The state's u_s, alpha_s replace the configured ones in the kinetic operator and in the current.
  • simulation(frame="fixed") carries the basis and returns basis_u and basis_alpha per saved time. diagnostics uses the per-time basis for the kinetic energy.
  • The default frame=None is unchanged.
  • The basis is stored as complex with zero imaginary part, because Diffrax needs one dtype across the state.

Tested SHA 11e6b6e. Command: python -m pytest -q -n 2 tests. Result: 154 passed (baseline 149).

New tests (tests/test_moving_basis.py):

  • RHS with the basis in the state and zero rates is bitwise equal to the fixed-basis RHS. Setup: 3 species, unequal orders (Nn, Nm, Np) = (4, 3, 2), a 3D grid, all six field components, nu != 0.
  • The state basis overrides the configured one, bitwise.
  • J and kinetic energy with a per-time basis agree with Gauss-Hermite quadrature to 1e-13.
  • A constant-step trajectory is bitwise equal. An adaptive run agrees to 1e-9 relative: the RMS error norm also counts the basis components, so step sequences differ.

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. Local results only (macOS, Python 3.12, JAX 0.11.2, x64); GitHub CI on this branch has not been checked yet.
Formulation and literature checks: Pagliantini et al. arXiv 2208.14373; Bessemoulin-Chatard and Filbet; Ma, Sun and Tang.

…xed')

ode_system accepts an optional third state component stack([u_s, alpha_s]) that
replaces the configured basis in the kinetic operator and the current; with zero
rates the right-hand side is bitwise the fixed-basis one. simulation(frame='fixed')
carries the basis and returns basis_u/basis_alpha per saved time; diagnostics use
the per-time basis for the kinetic energy.
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