Skip to content

Read plasma properties from state - #43

Draft
mikekryjak wants to merge 10 commits into
VANTAGE-Reactions-Coupling/devfrom
read-from-state
Draft

mikekryjak wants to merge 10 commits into
VANTAGE-Reactions-Coupling/devfrom
read-from-state

Conversation

@mikekryjak

@mikekryjak mikekryjak commented Sep 7, 2026 •

Copy link
Copy Markdown

Purpose

This PR will allow VANTAGE to read plasma fields from the Hermes-3 state instead of scalar user inputs. Since the plasma will evolve in time, it also adds machinery to update the plasma background during iteration.

This excludes the plasma velocity which will remain as a scalar input. This is because I don't want to deal with projection yet - we can deal with this when we add momentum sources.

Since we will still want tests without any plasma background, this PR also distinguishes between having plasma coupling enabled and disabled. When disabled, there are no reactions taking place at all and no plasma parameters are loaded into the particles. When enabled, the user can set a constant plasma background or an evolving one by choosing the appropriate Hermes-3 components.

Since Hermes-3 only deals with Field3D for its state fields, this is also where we make a decision on how to represent this in VANTAGE. Since we are only dealing with 2D at the moment, it feels like we should keep Field2Ds on our end. I added a throw on the presence of a 3rd dimension which found something funny - our tests were actually 3D by accident because we didn't set MZ=1 in the input file root.

The intention is for all of the existing tests to be unchanged and still pass. In the next PR which sets sources into the state we will need to deal with our pseudo particle balance test.

Change Summary

  • Add exception on 3rd dimension being present and update tests to be 2D
  • Add inputs defining species choice ion_species and neutral_species. The presence of ion_species controls whether plasma coupling is enabled or not. There is a console print at construction to indicate the choice.
  • Add function to collect plasma data into a vector and upload it to the SYCL device: send_plasma_data(). This now happens at the start of each VANTAGE call.
  • Add functions to read the plasma data from the SYCL device and put it into the recombination markers at the same time as their properties are calculated (update_recombination_markers) as well as the neutral particles (update_particle_background). The markers are updated once per call. The neutrals are updated once per timestep, since they move around and so each particle's background may change.
  • Remove scalar inputs and make plasma fields be read from the state. Update the tests.

Validation

AI Assistance

Documentation

Review Notes

Had to move a lot of things into private members of the class. Also tidied up paths and some types. Particle advection works but is now called per RHS evaluation which means they will get called twice in the tests causing them to fail.
Now the VANTAGE push is triggered every RHS evaluation and no longer runs in the constructor. Updated tests - now we run 1 real timestep. Had to change BCs to Neumann to prevent the fluid side from crashing.
Previously h5part would be recreated every RHS.
Previously the IO object would be created every step and spammed the console. Now we create it once then write and flush as needed. Also made a slightly nicer timestep printout.
Lambda functions are no longer allowed to capture private members with "=". I added a lot of members to move the push out of the constructor, they now need to be explicitly made local. This follows NESO-Particles convention.
- Extra comments for context
- h5part now created and closed straight away in constructor, turns out it is automatically opened on-demand.
- Unit test fixed by not adding a monitor when there is no solver present.
VANTAGE supports only 2D domains at the moment. Our integrated tests were running in 3D by accident. Now an exception prevent this and all tests were updated to 2D.
The user must specify an ion species for VANTAGE plasma coupling to be enabled, and the status of this is printed to console at construction. We now also require the neutral species to be explicitly specified. Tests have been updated.
Recombination markers must be made from up-to-date plasma properties. This is now a function which runs at the start of each VANTAGE call.
@mikekryjak mikekryjak changed the title Read from state Read plasma properties from the Hermes-3 state Sep 7, 2026
@mikekryjak
mikekryjak marked this pull request as draft September 7, 2026 09:41
send_plasma_data creates a vector of Hermes-3 plasma fields which gets sent to the SYCL target. update_recombination_markers and update_particle_background read this on-device and update the particle background. Markers can be done per VANTAGE call, but particles must be updated per timestep as they move around.

For now, the values for the plasma are still taken from scalars.
@mikekryjak mikekryjak changed the title Read plasma properties from the Hermes-3 state Read plasma properties from state Sep 7, 2026
Comment thread src/vantage.cxx
// Update plasma data projection
// Plasma data stays on device and particles read it every timestep.
// This is necessary as particles move between cells.
void update_particle_background(std::shared_ptr<ParticleGroup>& A_particle_group,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

2 participants