Output data for specific tag

Asked by Nathan Di Vaira on 2019-11-21

Good morning,

Is there a way to output particle data, either via a checkpointer or fieldsaver, such that only particles with a specific tag are saved?

Specifically, I have two groups of particles with tags 1 and 2 respectively, but I'd only like to visualise/process those of tag 2.

Cheers,

Nathan

Question information

Language:
English Edit question
Status:
Solved
For:
ESyS-Particle Edit question
Assignee:
No assignee Edit question
Solved by:
Dion Weatherley
Solved:
2019-11-21
Last query:
2019-11-21
Last reply:
2019-11-21
Best Dion Weatherley (d-weatherley) said : #1

Hi Nathan,

Yes, there are two FieldSavers specifically for saving particle scalar and vector fields. These are:

* TaggedParticleScalarFieldSaverPrms(..) :
http://esys.geocomp.uq.edu.au/esys-particle_python_doc/current/pythonapi/html/esys.lsm.LsmPy.TaggedParticleScalarFieldSaverPrms-class.html

* TaggedParticleVectorFieldSaverPrms(..):
http://esys.geocomp.uq.edu.au/esys-particle_python_doc/current/pythonapi/html/esys.lsm.LsmPy.TaggedParticleVectorFieldSaverPrms-class.html

These work pretty much the same as their ordinary Particle*FieldSaverPrms(..) counterparts. They are added to a simulation via LsmMpi.createFieldSaver(..):

e.g. To save the positions of particles whose tag=2, starting at timestep 0 and ending at timestep 10000, every 100 timesteps:

sim.createFieldSaver(
   TaggedParticleVectorFieldSaverPrms (
      fieldName = "position",
      fileName = "positions_tag_2",
      fileFormat = "RAW",
      beginTimeStep = 0,
      endTimeStep = 10000,
      timeStepIncr = 100,
      tag = 2,
      mask = -1
   )
)

This will generate a numbered series of output files with prefix "positions_tag_2" containing the current positions of each particle whose tag=2.

I hope this helps. Have fun!

Cheers,

Dion

Nathan Di Vaira (ndivaira1) said : #2

Ahh perfect, thanks!