Hi everyone,
I have been working on a script for quite a while now and I am unable to print data to a text file.
I am working with two different multi-sphere bodies. I need to know the position, velocity, forces.... on the Centre of Mass and have this data printed in a text file (csv, txt, dat...). For this I am using the next work flow:
1.- Compute command:
#-------Define Compute to Calculate the Properties of Individual Multi-sphere Bodies (clumps)------#
compute bid all rigid property id_multisphere #body id (1 value)
compute btype all rigid property clumptype #M-sphere type as defined in fix paticleteplate/multisphere (1 value)
compute xcm all rigid property xcm #body position (based on CoM) (3 values)
compute vel all rigid property vcm #body velocity (based on CoM) (3 values)
compute fcm all rigid property fcm #fbody force (based on CoM) (3 values)
compute quat all rigid property quat #body quaternion (based on CoM) (4 values)
compute bmass all rigid property masstotal #body mass (1 value)
2.- Define the variable, as follows:
#---------------------------------Multisphere Compute Variable-------------------------------------#
variable com1 equal c_xcm[1]
variable com2 equal c_xcm[2]
variable com3 equal c_xcm[3]
3.- Dump the data:
#----------------------------------Dump Multi-sphere Properties------------------------------------#
dump rigids all local 1000 post/rigids*.dump c_bid c_btype c_massms c_xcm[1] c_xcm[2] c_xcm[3] c_quat[1] c_quat[2] c_quat[3] c_quat[4] c_vel[1] c_vel[2] c_vel[3] c_fcm[1] c_fcm[2] c_fcm[3]
It works: I can open the dump file using a text editor, however LPP does not work on this files so paraview cannot read the data.
4.- Printing the results to a text file:
#----------------------------------Print Variables to Text File----------------------------------------#
fix clump_1 all print 1000 "${c_com1}, ${c_com2}, ${c_com3}" title "X_Positon,Y_Positon,Z_Positon" file post/outputP1.csv screen no
I get this:
ERROR on proc 0: Substitution for illegal variable
I also tried to print this variable using therm_style:
#-----------------------------------------Output Settings-------------------------------------------#
fix ts all check/timestep/gran 1000 0.1 0.1
thermo_style custom step time atoms ke f_ts[1] f_ts[2] c_xcm[1] c_xcm[2] c_xcm[3]
It does not work.
ERROR: Thermo compute does not compute vector
I have tried a lot of different possibilities with no success.
I know that the problem I am having is related to the type of variable I am trying to print. I am aware that there are three types of variable, (global, per-atom & local), I also know than these are local variable. I was able to print some data using the command fix ave/histogram as I read this command can print local variables but the information I obtained was confusing to me.
Could some one point me in the right direction???
I attached the script I am working on so you can have the whole picture.
Thanks!!!
Attachment | Size |
---|---|
![]() | 727.05 KB |
arnom | Wed, 08/08/2018 - 11:30
2 things:
2 things:
if you want vtk output use dump custom/vtk directly so you don't have to use lpp
The second problem comes from the fact that ${c_compute} does not work in a fix print. Instead you should define a variable and use that one, i.e.
variable tmp equal c_compute
fix print "${tmp}" file bla.csv
HTH,
Arno
Arnon | Fri, 08/10/2018 - 13:58
Thanks for the quick reply!
Hi Arno,
Thanks for your reply.
I had try what you suggest and it does not work. Anyhow I tried it again and here is what I obtained.
For the first option where I call custom/vtk
dump dmpvtk all custom/vtk 1000 data/dump*.pos.vtk c_xcm[1] c_xcm[2] c_xcm[3]
This is what I get:
dump dmpvtk all custom/vtk 1000 data/dump*.pos.vtk c_xcm[1] c_xcm[2] c_xcm[3]
ERROR: Dump particle compute does not compute per-atom info (../dump_particle.cpp:559)
(../dump_particle.cpp:559)
For the second suggestion I first define the compute, then the variable and lastly I try to print it out
#-------Define Compute to Calculate the Properties of Individual Multi-sphere Bodies (clumps)------#
compute xcm all rigid property xcm #body position (based on CoM) (3 values)
#---------------------------------Multisphere Compute Variable-------------------------------------#
variable com1 equal c_xcm[1]
variable com2 equal c_xcm[2]
variable com3 equal c_xcm[3]
#----------------------------------Dump Multi-sphere Properties------------------------------------#
fix clump_1 all print 1000 "${c_com1}, ${c_com2}, ${c_com3}" title "X_Positon,Y_Positon,Z_Positon" file post/outputP1.csv screen no
I obtain the following error:
ERROR on proc 0: Substitution for illegal variable (../input.cpp:505)
In the Error's section within the documentation I get this:
Substitution for illegal variable
Input script line contained a variable that could not be substituted for.
Although I have tried it in different ways. I am still clueless about how to solve this out.
Any Idea? :)
Regards,
Arnón
richti83 | Thu, 08/09/2018 - 20:20
dump rigids all local 1000
dump rigids all local 1000 post/rigids*.dump c_bid c_btype c_massms c_xcm[1] c_xcm[2] c_xcm[3] c_quat[1] c_quat[2] c_quat[3] c_quat[4] c_vel[1] c_vel[2] c_vel[3] c_fcm[1] c_fcm[2] c_fcm[3]
local dump files can be read directly by paraview reader for rigid dump files:
https://github.com/richti83/ParaView_Reader_for_LIGGGHTS/blob/master/rea...
https://github.com/richti83/ParaView_Reader_for_LIGGGHTS/tree/master/pre...
Arnon | Fri, 08/10/2018 - 14:31
Thanks for your plugin :)
Hi Christian
I have seen in the forum that you had developed the filters, for a while I was reading the Paraview manual to use your plugin, unfortunately I did not find what to do with the *.so files.
I will keep trying it. :)
Thanks
richti83 | Fri, 08/10/2018 - 20:13
you easily add the *.so files
you easily add the *.so files with tools->manage plugins->load new, than make sure the "Auto Load" checkbox is enabled. after that PV promts a dialog when choosing *.dump files, select liggghts rigid dump files and not lammps file.
Arnon | Thu, 09/20/2018 - 09:45
Thanks!!!
Hi Christian,
Thank you, it worked.
I had installed in my computer ParaView-5.5.2, it took me a while to realize that I was trying the plugin in the wrong version of the software. Once I downgrade ParaView-5.5.2 to ParaView-5.4.1 everything went smoothly.
Thanks a lot for you help!!
Regards,
Arnón
lumblab227 | Thu, 12/27/2018 - 04:08
I have met some error such as
I have met some error such as:
Traceback (most recent call last):
File "", line 22, in
File "", line 14, in RequestData
AttributeError: 'NoneType' object has no attribute 'GetPointData'
Could you please give me some suggestions?
Mohammad Manjiu... | Tue, 09/25/2018 - 14:27
How to visualise LIGGGHTS output in paraview 5.4.1
Hi all,
I am using LIGGGHTS 3.1.0 version, This version is fix langevin enabled that why I am using this but it does not support the vtk output. I am using this dump command output script
dump dmp all custom 150000 clu-38/try_*.lammpstrj id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius c_4
How to convert this lammpstrj to vtk and or which output should I use to visualise it in paraview 5.4.1?. Thanks
Daniel Queteschiner | Wed, 10/10/2018 - 13:13
LPP
Use the post-processing tool LPP to convert lammps files to vtk files
Also, see https://www.cfdem.com/post-processing-liggghtsr-simulations
abdelmalek.bellal | Mon, 07/26/2021 - 04:06
ERROR on proc 1: Substitution for illegal variable
Hello,
I am facing the same problem, I tried to run if condition loop to check if my simulation has reached the equilibrium but every time I get the flowing error: ERROR on proc 1: Substitution for illegal variable.
This is the loop part of the script:
label loop
print "Entering mass loop"
variable masspres equal ${massleft}
run 40000
variable deltam equal v_masspres-v_massleft
if "$deltam=<0.00000001" then "jump in.fracture_width_2x_Pc_10psi continuing"
variable masspres delete
variable deltam delete
jump in.fracture_width_2x_Pc_10psi loop
label continuing
run 100000
print "Done"
Thank you
mschramm | Mon, 07/26/2021 - 14:48
missing braces
Hello,
Your line: if "$deltam=<0.00000001" then "jump in.fracture_width_2x_Pc_10psi continuing"
is missing the {} around your variable deltam.
It should be: if "${deltam}=<0.00000001" then "jump in.fracture_width_2x_Pc_10psi continuing"
abdelmalek.bellal | Tue, 07/27/2021 - 08:45
still not working
Thank you for your reply but it still not working. PLease any other suggestions
THank you