About Force Chain

Submitted by venes520 on Fri, 03/30/2012 - 15:17

Hi Christoph,
I have seen discussion in the forum about reading and outputting the contact forces between particles using compute pair/gran/local and the dump local command,
but I notice the compute pair/gran/local command can only output f_x, f_y and f_z respectively,
can I possibly output the normal contact force? If yes, how?
Also, I know that the current pizza can't convert the dump file of this compute to .vtk file, is there any method to do the conversion?

Thanks in advance.

Somnath | Fri, 03/30/2012 - 20:22

Hi venes520

I use the following commands in liggghts to compute and dump the contact forces

compute fc all pair/gran/local id pos force
dump forcechain all local 40000 post/dump.fc.*.liggghts c_fc[1] c_fc[2] c_fc[3] c_fc[4] c_fc[5] c_fc[6] c_fc[7] c_fc[8] c_fc[9] c_fc[10] c_fc[11] c_fc[12]

Then, I use a slightly modified version of the script written by Mark Bentley (http://code.google.com/p/liggghts-force-chains/source/browse/trunk/dump2...) to convert it into a file that can be read using paraview to visualize the force chains.
You can download the code here: https://docs.google.com/open?id=0ByjsLm3KW1CBMmJWNWZMM3FTOGVNRFlhWjF1d1B6dw

Hope that helps!

Som

raguelmoon's picture

raguelmoon | Fri, 04/06/2012 - 13:03

Wow!
Great work. Can anybody tell me how to covert into vtk by using this code?
Thanks for help in advance...!
Ram

Ram

venes520 | Fri, 04/06/2012 - 18:28

Hi Ram,
It's been a long time since last email.
Somnath is so kind and he shared with me how to use this code:
To run the code, you first need to install EVTK (https://bitbucket.org/pauloh/pyevtk).

Then add the following line to your .bashrc file. You can do that by typing the following in terminal

echo 'alias dump2force="python -i $HOME/pizza/mylpp/src/dump2forcenew.py"' >> ~/.bashrc

The path to dump2forcenew.py should be modified in the above command based on where you have the .py file on your computer.

Activate the new environment variable by typing

. ~/.bashrc

Then, you can simply create the force chain files by typing in the terminal.

dump2force dump.fc.* (for multiple files)
or
dump2force dump.fc.200000.liggghts (for single files)

Exit python mode by typing ctrl+d. The output will be inside a directory called dump in the .vtu format.

I haven't have time to try it, but will be trying it very soon.
If you find anything interesting, please do share with us.

Cheers!

Cheers
Anson Liang

Somnath | Fri, 04/06/2012 - 23:00

I should also add that, you should be in the directory where you have the dump files when using the dump2forece command.

Also, I just wanted to develop this capability for something I am working on and I haven't thoroughly checked the force chains to see if they are correct force chains. Would be very useful interested to know if it works as expected.

Thanks!
Som

raguelmoon's picture

raguelmoon | Sat, 04/07/2012 - 12:53

Hi,
Thanks Liang and Somnath. It is really great work but I have still problem running new code. I installed evtk and did all like said but when i type this command then i get error:
dump2force dump.filenname
ERROR:
"/home/.../src/dump2forcenew.py", line 228, in module w.openPience(npoints=npoints, ncells=nconnex)
File "/usr/local/.../evtk/vtk.py", line 238, in openPiece
assert(False)
AssertionErrror
>>>
Thanks for troubleshooting the errors,
Ram

Ram

raguelmoon's picture

raguelmoon | Wed, 04/11/2012 - 09:38

Hi Som,
I am using latest version of LIGGGHTS, ie.; 1.5.2. I am uploading dumpfile in separate threat.

Thanks for helping me,
Best,
Ram

Ram

K.cheng | Sun, 05/10/2015 - 05:49

Hi Liang
I have been able to convert dump/local files into VTU format by following what you have said . But when i use Paraview to read the VTU files , an error is encountered . The error is
ERROR: In /home/kcheng/OpenFOAM/ThirdParty - 2.3.x/Paraview-4.1.0/vtk/IO/vtkXM LUnstructuredGridReader.cxx, line 164
vtkXMLUnstructuredGridReader (0xb127e48): Piece 0 is missing its NumberOfCells attribute

ERROR: In/home/kcheng/OpenFOAM/ThirdParty-2.3.x/Paraview-4.1.0/VTK/Common/ExecutionModel/vtkExecutive.cxx, line 754
vtkPVCompositeDataPipeline(0xa75e568): Algorithm vtkXMLUnstructuredGridReader(0xb127e48) returned failure for request: vtkInformation (oxcee5720)
Debug: Off
Modified Time: 17321630
Reference Count: 1
Registered Events: (none)
Request: REQUEST_INFORMATION
FORWORD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1

Could you tell me why? thank you very much~

K.cheng

Rachel | Wed, 01/24/2018 - 01:07

Hi,

I am trying to use your method mentioned above to output the force chain. I have installed EVTK and also modified the "bashrc" file. However, when I tried to use "dump2force dump.fc.*", I got the ERROR message as below:

dump2force dump.fc.*
Traceback (most recent call last):
File "/home/asd/Downloads/forcechain/src/dump2forcenew.py", line 22, in
from evtk.vtk import VtkFile, VtkGroup, VtkUnstructuredGrid
ImportError: No module named vtk
>>>

I don't know how to fix this problem "No module named vtk", could you please help me? Thank you very much.

Best,
Rachel

AndresMM | Wed, 01/24/2018 - 09:47

These are very old replies for old LIGGGHTS versions.

I would advise you to use the native LIGGGHTS VTK dump format

venes520 | Thu, 04/05/2012 - 09:08

Hi Som,

I am having difficulties using the code since I have no knowledge of coding.
Can you please give a clear instruction of how I should use it?

Do I download it and use python to load it? what next?

Thanks

Cheers
Anson Liang

shokeyi | Tue, 02/26/2013 - 14:36

Hi,
I have download the EVTK and installed it by the "sudo python setup.py install". However, I run this "echo 'alias dump2force="python -i $HOME/pizza/mylpp/src/dump2forcenew.py"' >> ~/.bashrc" in terminal, it has no reflect and I could not find the "bashrc.file". Does anyone know what is wrong with it? Thanks.