Read plasma properties from state - #43
Draft
mikekryjak wants to merge 10 commits into
Draft
mikekryjak wants to merge 10 commits into
mikekryjak wants to merge 10 commits into
Conversation
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
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
force-pushed
the
read-from-state
branch
from
September 7, 2026 09:44
37ac56a to
2e095b1
Compare
mrhardman
reviewed
Sep 10, 2026
| // 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, |
There was a problem hiding this comment.
Should this function instead use the evaluate functions from NESO-Particles, for moving std::vector data onto the particle properties on device. See https://github.com/ExCALIBUR-NEPTUNE/NESO-Particles/blob/6ff1b198b0fe46266c91485925964f706a0d423d/src/external_interfaces/petsc/project_evaluate/dmplex_project_evaluate_dg.cpp#L92-L100 and https://github.com/ExCALIBUR-NEPTUNE/NESO-Particles/blob/6ff1b198b0fe46266c91485925964f706a0d423d/include/neso_particles/external_interfaces/petsc/dmplex_project_evaluate.hpp#L140-L164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Field3Dfor 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 keepField2Ds 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 setMZ=1in 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
ion_speciesandneutral_species. The presence ofion_speciescontrols whether plasma coupling is enabled or not. There is a console print at construction to indicate the choice.send_plasma_data(). This now happens at the start of each VANTAGE call.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.Validation
AI Assistance
Documentation
Review Notes