Skip to content

Support for writing ParticleSetView#2620

Draft
erikvansebille wants to merge 3 commits intoParcels-code:mainfrom
erikvansebille:writing_in_kernel
Draft

Support for writing ParticleSetView#2620
erikvansebille wants to merge 3 commits intoParcels-code:mainfrom
erikvansebille:writing_in_kernel

Conversation

@erikvansebille
Copy link
Copy Markdown
Member

Description

This PR implements a way to write a ParticleSetView into a ParticleFile, and adds a tutorial to show how it works. I think this could be a killer feature, as it provides the user much more control over when particles are written (an often-asked feature pre-v4!)

Note that there are still a few rough edges about this implementation. Notably:

  1. Since the FieldSet is not an attribute of a ParticleSet view (unlike a ParticleSet), it needs to be added as an extra argument. An alternative could be to also add a ParticleSetView.fieldset?
  2. The ParticleFile.write() requires a time to write, but the Kernel itself doesn't know the timestep. Users can provide particles.time, but this may result in particles being written that have not yet started (to be explored)
  3. A particle file that is intended to only be written in a kernel (so not in the pset.execute loop) still requires an outputdt argument on initialisation, even though that has no effect. Would be better to also allow None here?
  4. A particlefile that is only used in the kernel does not get closed automatically, so needs to be closed manually. Not sure though if there's anything we can do about that.

Once we settled on these four open questions here, I will add unit tests etc

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
    • Describe how you used it (e.g., by pasting your prompt):

@erikvansebille
Copy link
Copy Markdown
Member Author

@VeckoTheGecko, keen to hear your thoughts about these four items above!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Explore and expose use of writing particles in a Kernel

1 participant