modflowpy / flopy

A Python package to create, run, and post-process MODFLOW-based models.
https://flopy.readthedocs.io
Other
506 stars 306 forks source link

fix(ParticleTrackFile): fetch correct particleids in get_alldata #2223

Closed martclanor closed 2 months ago

martclanor commented 2 months ago

This PR aims to fix the fetching of correct particleids in the get_alldata method of ParticleTrackFile.

This mppth file, pathlinefile.zip, is an output of a modpath simulation with the following log:

MODPATH Version 7.2.002 PROVISIONAL 
Program compiled Oct 16 2023 03:40:46 with IFORT compiler (ver. 20.21.7)        

Run particle tracking simulation ...
Processing Time Step     1 Period     1.  Time =  1.09500E+03  Steady-state flow                                                    

Particle Summary:
         0 particles are pending release.
         0 particles remain active.
        25 particles terminated at boundary faces.
         0 particles terminated at weak sink cells.
         0 particles terminated at weak source cells.
        82 particles terminated at strong source/sink cells.
         0 particles terminated in cells with a specified zone number.
       551 particles were stranded in inactive or dry cells.
         0 particles were unreleased.
         0 particles have an unknown status. 
Normal termination.                                                        

In this simulation, 107 out of 658 particles were successfully tracked. If the mppth is read as a ParticleTrackFile and if the get_alldata method is called on it,

pl = fp.utils.PathlineFile("pathlinefile.mppth")
pl_data = pl.get_alldata()

pl_data is returned as a list of length 107 but with all elements being empty arrays.

Iiuc, that is because the get_alldata method uses the first 107 particles which are not necessarily the ones that were tracked successfully.