Why would you want to do this in MatLab? It would take forever! You should use a computer code designed to do this. Also, I wouldn't suggest using Lagrangian based particle tracking, because it's slower than a herd of snails stampeding up the side of a salt dome. In the Lagrangian method, the time step is controlled by the fastest movement in the smallest element, which is why it's so slow. The Hamiltonian method is orders of magnitude faster. Where time is the independent variable in Lagrangian particle tracking, velocity is the independent variable in Hamiltonian particle tracking. PTRAX is the fastest and most versatile program available and it has been extensively validated against analytical solutions and large-scale field data. It is used by several big DOE contractors for contaminant transport. Here's a link to the report http://dudleybenton.altervista.org/publications/Development%20of%20the%20Fast%203D%20Particle%20Tracker%20PTRAX.pdf If you're interested I could pull together some examples and put a ZIP file out where you can download it. It handles 2D and 3D domains and 5 shapes of elements (triangles, qudralaterals, tetrahedra, prisms, and bricks) as well as finite element or finite difference. It will create graphs of each particle track, snapshots of the concentrations, and even animations. I can put one of the animations somewhere so you can see what they look like. They're animated GIFs that will play in any web browser. You can also insert capture wells (circles in 2D or cylinders in 3D) and walls that will report every particle that passes through them.
Why would you want to do this in MatLab? It would take forever! You should use a computer code designed to do this. Also, I wouldn't suggest using Lagrangian based particle tracking, because it's slower than a herd of snails stampeding up the side of a salt dome. In the Lagrangian method, the time step is controlled by the fastest movement in the smallest element, which is why it's so slow. The Hamiltonian method is orders of magnitude faster. Where time is the independent variable in Lagrangian particle tracking, velocity is the independent variable in Hamiltonian particle tracking. PTRAX is the fastest and most versatile program available and it has been extensively validated against analytical solutions and large-scale field data. It is used by several big DOE contractors for contaminant transport. Here's a link to the report http://dudleybenton.altervista.org/publications/Development%20of%20the%20Fast%203D%20Particle%20Tracker%20PTRAX.pdf If you're interested I could pull together some examples and put a ZIP file out where you can download it. It handles 2D and 3D domains and 5 shapes of elements (triangles, qudralaterals, tetrahedra, prisms, and bricks) as well as finite element or finite difference. It will create graphs of each particle track, snapshots of the concentrations, and even animations. I can put one of the animations somewhere so you can see what they look like. They're animated GIFs that will play in any web browser. You can also insert capture wells (circles in 2D or cylinders in 3D) and walls that will report every particle that passes through them.
Oh yeah. It's a Windows application (32-bit or 64-bit). I've run models with as many as 3 million elements and 3 million particles. The particles can be tagged to represent different species or substances. Creating a particle seed file to represent an existing contaminant field is another problem, but I have several tools to do that too.
Sure it's possible, but it would be very slow and you'd probably need a huge computer! Why do you want to do something like that in MatLab? A lower level language like C or fortran would probably be a lot more efficient...