I’m new to MFix, I’ve just read the user guide but I still don’t understand how to export the particle position, there is no option for the position in output task pane.
Hi BK, welcome to the MFiX forum.
You are correct that particle position is currently not one of the options in “Output” or “Monitors”. We may add this to a future release, since this question comes up from time to time.
It’s always good to search the forum before posting. Searching for “particle position” find this thread:
which explains how to get particle positions from VTP files, as well as this thread:
which discusses how to do this using a UDF approach.
If you have any further questions after reading these, you can follow up here.
Hope this helps,
– Charles
Hello! Thank you for your answer. I have seen that two threads. I am also new to python. I just try to run the code of onlyjus but there is a problem. It says “No module named ‘vtk’”. how can I solve it? Thank you very much!
This is a message from Python telling you that it cannot find the VTK (Visualization Took Kit) library.
If you are running in a Conda environment where MFiX is active (conda activate mfix-21.4
) then the VTK library should be available, since MFiX uses VTK for visualization.
If you are trying to do this in some other environment, then you will have to make sure VTK is installed. You can find out how to install VTK, as well as a lot more, at https://vtk.org/
Thank you very much! I have installed the VTK using cmake and Visual Studio 2019, and then i try to run the code of onlyjus in VS2019, it still tell me “ModelNotFoundError:No module named ‘vtk’”. How do I solve this problem?
I don’t know what Python interpreter VS2019 uses. There can be several instances of Python on the same machine, installed as part of different environments (Conda, etc) so if you install a library you have to make sure it is installed in the right environment. Somehow the VTK you installed is not found by VS2019 which means it did not get installed into the proper place.
I suggest you use the Conda mfix
environment so that all the needed libraries will be found. Conda also provides a nice Python IDE called “Spyder”. If you use this (and activate the mfix-21.4
environment) you should find that all required libs are found.
– Charles
Thank you, Charles. I have not used Python before and am also not familiar with some of the operations such as configuring the environment, maybe I should think of something else, is it possible to see the position of the particles in the Paraview, is the position of the particles at each moment in the .pvd file? The user guide does not specify this part. How to set the user variable in the other answer? I also checked the user manual and again there are no details on how to set it? Could you help me?
If you want to use the Python code that Justin posted, you need to be in an environment where VTK is installed. This can be done in the Anacoda environment where MFiX is activated. If you want an IDE, I suggest Spyder (part of Anaconda). Anacoda is designed to make Python easy for beginners, there are tutorials and help resources at anaconda.org.
If you want to use Paraview, note that this is not a Paraview support channel. The Paraview forum is at https://discourse.paraview.org/
– Charles
Thank you very much, Charles. I will think about it.
hello, Charles, I started S in Conda, copied the program in and it still says No module named ‘vtk’, what should I do?
This message at the bottom of the Spyder window shows that you are running in the conda “base” environment, not the mfix environment (where VTK is installed).
You have a few choices -
-
you could install VTK in the base enviroment (conda install vtk)
-
you could change the Spyder setting to use the existing MFiX conda environment (Settings/Preferences)
-
you could install Spyder into the existing MFiX Conda environment.
I think #3 is best, it will create a Spyder installation that is compatible with MFiX.
To do this:
Open an anaconda command prompt
Active the MFiX environment:
conda activate mfix-21.4
install Spyder into this env:
conda install spyder -c conda-forge
Make sure to include -c conda-forge
on this command so as not to mess up existing MFiX installation.
– Charles
To activate the MFiX environment:
conda activate mfix-21.4
To start spyder:
spyder
(There should also be something in your start menu for the new spyder-5)
– Charles
Thank you very much, Charles. It works. But I have not used Python and Spyder before and looking at the output, it may be because the files are not in the right place, could you tell me the steps in more detail?
- Open a Conda prompt. Activate the MFiX environment:
conda activate mfix-21.4
- Install Spyder in this environment:
conda install spyder -c conda-forge
- Start the Spyder that you just installed:
spyder
Going back to the original question, the particle positions are always exported into the vtp files so there is no explicit option to turn it on/off (particle data must store the positions so it would not make sense to turn it off). Particle positions are not currently used in monitors because monitors don’t store individual particle data, they apply some kind on operator on the data (say min, max, average etc). If you have a specific need, please fully describe what you want to postprocess. If this happens to also align with the need of other users, we may be able to implement it in a future release.
Thank you, I have done this part, I have opened Spyder and run the program, but I get an error on the right side, what I want to know is how to solve this problem and then how to get the position results afterwards, could you tell me more detailed?
OK, Sir, In fact, I wanted to generate the structure of the particle system through DEM open-source software Mfix and analyse the properties of it, so I needed to get or output the particle positions. After Charles’ guidance, I found out that it is not possible to get or output the particle positions directly in Mfix, and that post-processing, such as installing vtk and other operations, is needed, which is still very troublesome for new hands. I think this could be improved by allowing the user to get or output the particle position directly to txt/csv format on Mfix, which would be more convenient.