mpacts.particles. deformableline

In order to be able to use this module import it like this:

import mpacts.particles
#or assign it to a shorter name
import mpacts.particles as prt

DeformableLine Layout

Particle of type DeformableLine:

  • vertexIndices (LineIndex)
  • parentIndex (Index)
  • localIndex (Index)
  • GeometryTag = GeometryTag_DeformableLine

DeformableLine Example creation

Creating a particle container consisting of ‘DeformableLines’ can be done like this:

import mpacts.particles as prt

defPC = prt.ParticleContainer("defPC"
                             , prt.DeformableBody.compose( (prt.Node, "nodes") #name "nodes" is only an example!
                                                         , (prt.DeformableLine, "lines", "nodes")
                                                           #the third argument here determines to which "nodes" the lines refers!
                                                         )
                             , mysim) #mysim is optional
particle = defpc.add_particle()
#add the degrees of freedom of the deformable body; assuming you have a python list of points:
particle.nodes.add_and_set_particles( x = points) #these are the real degrees of freedoms positions

#add the indices of the lines, assuming you have the index-list again as a python list of tuples vil:
particle.lines.add_and_set_particles( vertexIndices = vil )
             #any number of other arrays may be set at the same time (r, v, ...) and
             #they can either have the same length as vil or length 1

mypc = defPC('lines') #this is the pc on which the commands below will be available

Supported Commands

On the particle container following list of commands can be invoked.

Note

the pc keyword argument is passed automatically, as well as the parent if the pc is created with a parent.

mypc.AABBGeneratorCmd()
Command that generates a list of bounding boxes for known geometries.
Default location: ‘loop_cmds/pre_contact_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • margin (default value = 0) — Adds an additional (fixed size) margin to the bounding box. Useful to give planes a third dimension, or to provide margin, so the contacts don’t need to be detected every timestep
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
  • additional parameters (to quickly choose a gate to be applied):
    • executeOnce: If True, will set the ExecuteOnce gate
    • executeEvery: If given, will execute every “executeEvery” time-steps.
    • executeInterval: If given, will execute every interval seconds (approximate simulation time)
    • executeTimes: If given, will execute at times specified in the list provided (approximated to the nearest discrete time step!)
    • executeEveryPCSizeChange If given, will execute every time a specified particle container changes size.
  • parent: Can be set to ‘False’ or ‘0’ to explicitely prevent the command to be added to the (simulation) commandlist.
mypc.CSVWriterCmd()
Writer for CSV files for an arraymanager. The writer acts on the data member given in the constructor, which has to be an arraymanager. By default all arrays are written out, except those who have a disable_CSV_write child.
Default location: ‘loop_cmds/output_cmds’
  • Required keywords:
    • data — The manager of which the data will be written (CSV writer is not recursive!)
    • filename — The base filename of the files that will be written. A number will be appended to differentiate between different timesteps.
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • write_header (default value = 1) — Decides if a header is added or not.
    • write_index (default value = 0) — The current sequential number of the output file.
    • write_time (default value = 0) — Decides if a comment is added on the first line with the current time on it. (Paraview does not like this!).
  • additional parameters (to quickly choose a gate to be applied):
    • executeOnce: If True, will set the ExecuteOnce gate
    • executeEvery: If given, will execute every “executeEvery” time-steps.
    • executeInterval: If given, will execute every interval seconds (approximate simulation time)
    • executeTimes: If given, will execute at times specified in the list provided (approximated to the nearest discrete time step!)
    • executeEveryPCSizeChange If given, will execute every time a specified particle container changes size.
  • parent: Can be set to ‘False’ or ‘0’ to explicitely prevent the command to be added to the (simulation) commandlist.
mypc.ComputeCylinderIndexListCmd()
Command for calculating a list of cylinders/edges per node for a body. The array nodeIndexList (type std::vector<R3::Index_t> ) which is passed as argument stores the list of cylinders/edges connected to a given node.

Attention

The command shall be applied on particle container containing segments.

  • Required keywords:
    • nodeIndexList — Array of std::vector<R3::Index_t> containing list of primitives connected to each node
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
  • additional parameters (to quickly choose a gate to be applied):
    • executeOnce: If True, will set the ExecuteOnce gate
    • executeEvery: If given, will execute every “executeEvery” time-steps.
    • executeInterval: If given, will execute every interval seconds (approximate simulation time)
    • executeTimes: If given, will execute at times specified in the list provided (approximated to the nearest discrete time step!)
    • executeEveryPCSizeChange If given, will execute every time a specified particle container changes size.
  • parent: Can be set to ‘False’ or ‘0’ to explicitely prevent the command to be added to the (simulation) commandlist.
mypc.CountPerParentCmd()
Command which counts how many elements (e.g. nodes) the given child-pc has.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • count (default value = None) — Array in parent where the count is stored, by default made and called “count_“+pc()->name().
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
  • additional parameters (to quickly choose a gate to be applied):
    • executeOnce: If True, will set the ExecuteOnce gate
    • executeEvery: If given, will execute every “executeEvery” time-steps.
    • executeInterval: If given, will execute every interval seconds (approximate simulation time)
    • executeTimes: If given, will execute at times specified in the list provided (approximated to the nearest discrete time step!)
    • executeEveryPCSizeChange If given, will execute every time a specified particle container changes size.
  • parent: Can be set to ‘False’ or ‘0’ to explicitely prevent the command to be added to the (simulation) commandlist.
mypc.PCStatisticsCmd()
PCStatistics command
Default location: ‘loop_cmds/pre_contact_cmds/Periodic_BC_CopyToGhost_PeriodicBoundary1D’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
  • additional parameters (to quickly choose a gate to be applied):
    • executeOnce: If True, will set the ExecuteOnce gate
    • executeEvery: If given, will execute every “executeEvery” time-steps.
    • executeInterval: If given, will execute every interval seconds (approximate simulation time)
    • executeTimes: If given, will execute at times specified in the list provided (approximated to the nearest discrete time step!)
    • executeEveryPCSizeChange If given, will execute every time a specified particle container changes size.
  • parent: Can be set to ‘False’ or ‘0’ to explicitely prevent the command to be added to the (simulation) commandlist.
mypc.VTKWriterCmd()
Writer of VTK (.vtp/vtu) files. The writer acts on the data member given in the constructor. By default all child array managers are written, but without their additional data arrays (such as for instance ‘r’, ‘v’, ...) this can be changed by invoking the ‘select_all’ member function.
Also individual arrays can be selected by adding a ‘enable_VTK_write’ child (‘ r.add_child( BaseObject(‘enable_VTK_write’)’), or they can be unselected by adding a ‘disable_VTK_write’ child.
Conforming to what ParaView expects, symmetric tensors are written as diagonal values, then upper triangle:
0 3 4
x 1 5
x x 2.
If you write a full matrix, however, the order is as in our c++ code, i.e.:
0 1 2
3 4 5
6 7 8.
Has no default location.
  • Required keywords:
    • data — The root of which the data will be written
    • filename — The base filename of the files that will be written. A number will be appended to differentiate between different timesteps.
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • select_all (default value = 0) — Determines whether the writer tries to write as much as possible or not (by default false). Note: for legacy reasons there is also a named function for this.
    • start_index (default value = 0) — Index of the next file that will be written. The index of each subsequent file will be incremented by one. Default is zero.
  • additional parameters (to quickly choose a gate to be applied):
    • executeOnce: If True, will set the ExecuteOnce gate
    • executeEvery: If given, will execute every “executeEvery” time-steps.
    • executeInterval: If given, will execute every interval seconds (approximate simulation time)
    • executeTimes: If given, will execute at times specified in the list provided (approximated to the nearest discrete time step!)
    • executeEveryPCSizeChange If given, will execute every time a specified particle container changes size.
  • parent: Can be set to ‘False’ or ‘0’ to explicitely prevent the command to be added to the (simulation) commandlist.