Skip to content

Alfven: initialize magnetic components with face averages - #1386

Open
agourakis82 wants to merge 1 commit into
fmihpc:devfrom
agourakis82:fix/1309-alfven-face-averages
Open

agourakis82 wants to merge 1 commit into
fmihpc:devfrom
agourakis82:fix/1309-alfven-face-averages

Conversation

@agourakis82

Copy link
Copy Markdown

Related to #1309.

Initialize the Alfven magnetic field with analytic averages over the lower x,
y and z faces instead of sampling all three components at the cell centre.
The continuous wave, parameters and restart behaviour are unchanged.

Using the closed-form sine/cosine integrals also avoids aliasing in the
existing Romberg routine when a face spans complete wave periods.

The standalone test covers aligned and oblique waves, unequal cell widths,
zero amplitude, complete periods and small cells, with long-double reference
values and an independent numerical-integration check on a resolved wave.

Validation: bash testpackage/test_alfven_face_averages.sh passed 7,779 checks
in C++23. AddressSanitizer and UndefinedBehaviorSanitizer also passed.
On the oblique reproducer, maximum discrete divergence decreased from
3.97e-18 to 4.54e-30 T/m.

A clean native C++23 build in the project's CI image passed, as did
initialization of the official Alfven configuration with two MPI ranks
and timestep_max=0. This checks initialization, not time evolution.

This only addresses the Alfven project, not all initializers in #1309.

Integrate the sinusoidal perturbation analytically over each lower face.
Keep the continuous field and restart initialization unchanged. Add
standalone coverage for oblique waves, anisotropic cells and whole periods.

LLM-offload-review:
  provider: Darwin coder-next
  task: math-review
  issue: numerical quadrature can alias complete wave periods; confirmed in C++23 and replaced by analytic face integrals

Review-fallback: independent providers unavailable or incomplete; no two-vendor approval claimed

This branch has not been deployed

No deployments
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