ParticleTracking reinjection and general enquiry

Hello,

I am a full beginner at Paraview, and I just started to play with python for automating tasks (insertion of particle tracers in my domain).

The issue I currently have is that, the Force Reinjection Every Nth Steps does not work for me. Either at 0 it only inject a single particle, or at 1 it injects it every timestep. But I can not get to do it for every 2,3,4,5,etc… time steps… Any reason why?
The only particularity of my case is that I use a TemporalInterpolator, is that an issue? I tried of different cases and always the same issue.

I also use this post to ask a very general question. I found that ParticleTracer on the VtK wiki has a lot of methods that I’d like to use (termination time, start time, etc…) : https://vtk.org/doc/nightly/html/classvtkParticleTracerBase.html

Is there a way to access them? Or is there limitation through python? And if so, what would be the way?

Thank you so much for your time!

Hi @Ouxid , and welcome

The particle tracer is tricky to use indeed.

Could you share your data ? That would make it easier.

Here I tried with some data, and it works well (every 3 timesteps):

Peek 2022-10-27 12-40

The temporal interpolator should not have any effect on the particle tracer when you use its default settings.

The unexposed parameters are indeed not available in ParaView but can be exposed with a XML plugin, not trivial for a beginner though: https://www.paraview.org/Wiki/ParaView/Plugin_HowTo#XML_Only

Best,

Thanks for the quick answer!
I am sorry, I am not sure of which file to include. I exported the pvd and pvsm, but I believe without the mesh it will not be useful?

problemNthStep.pvd (299 Bytes)
problemNthStep.pvsm (793.7 KB)

I made a video to show the issue, if that helps:

https://im2.ezgif.com/tmp/ezgif-2-bec62daf93.gif

Finally, thank you for the XML plugin advice, I will dive into it and try to make it work.

I also need problemNthStep_0_*.vtp

My bad, here they are:

problemNthStep_0_0.vtp (6.2 KB)
problemNthStep_0_1.vtp (4.7 KB)

Sorry, I am also using this to ask again about XML, even though the two issues are not directly related.

I am coming back to the XML.

I think (?) I managed to import the VTK class “vtkParticleTracer” through this XML:

<ServerManagerConfiguration>

<ProxyGroup name="filters">

<SourceProxy name="MyParticleTracker" class="vtkParticleTracer" label="MyParticleTracker">

<Documentation

long_help="MyParticleTrackerBase"

short_help="MyParticleTrackerBase">

</Documentation>

<InputProperty

name="Input"

port_index="0"

command="SetInputConnection">

<ProxyGroupDomain name="groups">

<Group name="sources"/>

<Group name="filters"/>

</ProxyGroupDomain>

<DataTypeDomain name="input_type">

<DataType value="vtkDataSet"/>

</DataTypeDomain>

</InputProperty>

<InputProperty

name="Input2"

port_index="1"

command="SetInputConnection">

<ProxyGroupDomain name="groups">

<Group name="sources"/>

<Group name="filters"/>

</ProxyGroupDomain>

<DataTypeDomain name="input_type">

<DataType value="vtkDataSet"/>

</DataTypeDomain>

</InputProperty>

</SourceProxy>

</ProxyGroup>

</ServerManagerConfiguration>

Now the thing is, when I apply it it seems to work, but when I check the methods and attribute through the python shell, they do not display the one that I can find online (for example, the methods from the parent class like SetTerminationTime(double t).

I would love to use it on my new vtk-imported filter, but I have no idea how. The GUI shows no option, and I do not know how to proceed through python.

Right now I can access the object through the command “myParticleTracker1 = GetActiveSource()”

But then I can not access the methods.

Would you have any idea?
Thanks

Hi @Ouxid ,

Lets focus on your dataset issue first.

The .pvsm file you sent link to an OpenFOAM data I do not have access to.

Your .pvd/.vtp file do not seem to contain any interesting data.
problemNthStep_0_0.vtp contains a single point.
problemNthStep_0_1.vtp contains no point.

Please share the data you are trying to post process with ParaView.

Best,

Hi Mathieu,

Sorry, I am fairly unaware, and confused, on how to share data from paraview.
On the bright side, I just found out my issue while trying to reproduce the case to send it to you.

I was applying the particle tracer directly on my “initial” foam file. Instead, I just tried to apply it on the temporal interpolator filter as the source, and it works! Sorry for the complicated thread while the solution was fairly straightforward.

To be a bit more clear, let me explain what I am trying to do.

I would like to create “fake” time steps. Right now, what I am doing is loading twice the same timestep, but “faking” paraview into thinking they are different, by simply copying my folder “200” to “300” and reloading. I then apply a temporal interpolator to get the deltaT I like.

I do understand that this is highly inneficient, because through the interpolator, a lot of calculation are made for interpolating between two state that are exactly the same. But I am not sure if there is a better way to go, I could deep dive into the code and try to create a modified TemporalInterpolator so that it does not recalculate the field between the timesteps, but that seems quite a daunting task for a beginner. Would you have a better way in mind?
Thanks again!

1 Like

It is fine to do it like that imo, what it costs you in computation, it saves at reading timesteps.

But shouldn’t it be more efficient to have a filter acting very similar to the current temporal interpolator, but only the “fake” timestep creation?
Or since the timestep are not the same, even though their associated data is similar, paraview will try to re-read the whole field everytime? Would it be possible to avoid this?

Got it.

Indeed, just use a non temporal dataset and GenerateTimeSteps filter. Its a 5.11 addition :slight_smile:

Wow, that’s great!
Just tried now, and it does seem like what I had in mind.

But another issue arises, somehow, it seems like the particle just randomly moves around when the source is the generateTimeSteps filter.

I tried to attach an example, you can just “paraview a.foam” and then load the state, hopefully it works this time : WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

There is a memory issue somewhere with GenerateTimeSteps + ParticleTracer, I’ve opened an issue there: https://gitlab.kitware.com/paraview/paraview/-/issues/21639

The simple workaround is to save your data with timesteps after the GenerateTimeSteps, on disk, and opening it again.
Not as efficient but it works.

Ah, I see! Good, hopefully its not too hard to fix :slight_smile:

Let me come back to the ParticleTracer vtk, depite reading examples and the link you shared, I really have trouble setting up the XML for vtkParticleTracer that would allow me to use things like " SetStartTime()". Is there any chance there is an example close to implementing this somewhere?

Thanks!

Example/Plugins/ReaderXMLOnly shoudl get you started.

Hi!

I am reverting after a while.
I have been trying but can not find a way to solve my issue of generating timesteps.
If I apply the particle tracer on the particle generator, they go everywhere randomly, I guess from the bug you noticed. But if I generate a time generator but still apply the particle tracer on the original field, I get this weird bug:

The workaround of saving on disk is not successful, since the loadtime of each timestep is quite slow.
Finally, I tried to create a programmable filter creating time-step, with no success since the particle tracer seems not to take into account the generated timesteps (maybe just because I can’t create a proper filter, raised another topic on that… Create a programmable filter along timesteps)

At this point I am not sure which route I should go. The only one working so far is the temporal interpolate, but the fact that for each time step it calculates a new field make it too slow…

If you have any clue on any of these issues, It’d be more than welcome! Thanks!