calculate center of mass command
Purpose
This command calculates the center of mass of the bulk material (examples).
Warning
GPU support for this command has not been tested and may not work as expected.Syntax
calculate center_of_mass keyword/value pairs
Keywords |
Description |
|---|---|
id |
user-assigned name for the command call
default:
center_of_mass_[number of calculate] |
particle group for which the center of mass is evaluated
default:
all |
|
time step width for data output
default: same value as write_to_terminal_timestep; range: (0,∞); units: [time]
|
|
filename for data output |
|
Examples
calculate center_of_mass
calculate center_of_mass particle_group blueParticles id comBlue
calculate center_of_mass write_every_time 1e-3 file com_output.txt
Description
This command calculates the center of mass of the particles in the simulation
or, if the particle_group keyword is used, of a subset (definition see define_group command).
Per default, the command is evaluated at every write_to_terminal_timestep,
the write_every_time keyword can be used to modify the interval.
The final_update keyword will force a recomputation of the value at
the last integration step of a simulate command. This is
useful if the value is required in the input script between two simulate commands, e.g. for setting a variable.
Output information
The calculate center_of_mass command produces a global 3D-vector with the x, y and z position of the center of mass in distance units. The components of the generated vector for a command with ID COMID can be accessed by id_COMID[1], id_COMID[2] and COMID[3] or id_COMID.x, id_COMID.y and id_COMID.z.
When using the output_settings command, the results are automatically written to the simulation_data_aspherix.csv / result_monitor.txt file.
If the file keyword is used to explicitly define an output file name, the result is
additionally written to the defined file. The file contains of an array with four columns,
the first column contains the time, followed by the values for the x, y and z component of
the position.
Alternatively, also the write_to_file command can be used to output the data to a specified file.
Example for saving the center of mass to a separate file
calculate center_of_mass write_every_time 1e-3 id com
write_to_file file center_of_mass.txt string "id_time id_com[1] id_com[2] id_com[3]" &
title "# time x y z" write_every_time 1e-3
Restrictions
For multispheres, bonded and fibers the center of mass specified by the center_of_mass keyword of the particle_template command
is ignored by the calculate center_of_mass command.