mpacts.particles. deformabletriangle

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

DeformableTriangle Layout

Particle of type DeformableTriangle:

  • vertexIndices (TriangleIndex)
  • parentIndex (Index)
  • normal (Vector)
  • localIndex (Index)
  • GeometryTag = GeometryTag_DeformableTriangle

DeformableTriangle Example creation

Creating a particle container consisting of ‘DeformableTriangles’ 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.DeformableTriangle, "triangles", "nodes")
                                                           #the third argument here determines to which "nodes" the triangles 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 triangles, assuming you have the index-list again as a python list of tuples vil:
particle.triangles.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('triangles') #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.ComputeCurvatureCmd()
This command calculates the local curvatures on the nodes for a triangulated body. This is translated to an inverse curvature or ‘radius of curvature’ for each triangle. The Voronoi area of each node is stored in the node array ‘area’, and the node normal is calculated and stored in the node array ‘normal’. The command creates two new arrays if they do not already exist: ‘area_flat’ (double) and ‘counter’ (unsigned), which are normally only used in-scope. Pre-requisites: normals ‘normal’ calculated for each triangle, list of neighbouring triangles ‘triangleIndices’ for each node as well as ‘area’ calculated for each triangle. Details on this algorithm can be found in ‘Meyer et al. Discrete differential-geometry operators for triangulated 2-manifolds. Visualization and mathematics III. Springer, Berlin, Heidelberg, 2003. 35-57‘.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • maximal_radius (m) — Maximal radius of curvature for a triangle in a deformable body. To avoid infinitely high radii, any calculated inverse curvature higher than this parameter will be set to maximal_radius.
    • pc — Particle container on which the command is applied
    • triangles — Array Manager containing the triangles of the deformable body.
  • Optional keywords:
    • enforce_positive (default value = 0) — If 'True', the radius of curvature is forced to be positive. Negative values get set to maximal_radius
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • minimal_radius (m) (default value = 0) — Minimal radius of curvature for a triangle in a deformable body. Any inverse curvature lower than this parameter will be set to minimal_radius, even if calculated otherwise.
    • 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.
    • save_for_nodes (default value = 0) — If 'True', the radius of curvature is also stored for each node in the array 'inverse_curvature' of the nodes.
    • x (default value = None) — Array with positions of the nodes
  • 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.ComputeTriangleIndexListCmd()
Command for calculating a list of triangles per node for a body. The array ‘nodeIndexList’ (type std::vector<R3::Index_t> ) which is passed as argument stores the list of triangles found for a given node. Note that a ComputeTriangleIndexListCommand should usually be followed by a SortTriangleIndexListCommand, to ensure that the triangles are sorted in a counter-clock-wise manner. The latter is a strict requirement for most methods that use the ‘triangleIndices’, e.g. mpacts.commands.geometry.triangle.ComputeCurvatureCommand.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • 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.ComputeTriangleNodeNormalsCmd()
Specifically for triangles: computes the normals of nodes (corners of Triangles) as the average of all the normals of surrounding triangles. The node manager (given as a property) needs to have an array with a std::vector<R3::Index_t> (see: ComputeTriangleIndexListCommand). The voronoi areas of each surrounding triangle is used to weight the contribution of each surrounding triangle. Hence, for triangles, this method should be superior to ComputeNodeNormalsCommand. Note that ComputeCurvatureCommand has a lot of duplicated functionality compared to this one (and duplicated code) and handles better corner cases.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • triangles — Array Manager containing triangles that surround each node.
    • x — Array with positions of the triangle corners
  • 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.
    • turning_angle_min_degrees (default value = 5) — Minimum turning angle in degrees for which the node normals will be calculated exactly with the weighted node normal algorith. For low turning angles, this algorith is ill definded. However in this case, all the triangle normal will be very similar.Therefore, the average of the vector normals is taken in this case.
  • 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.ComputeVolumeCmd()
Computes the volume of a closed triangulated body based on Gauss’ theorem. It requires the triangle ArrayManager ‘normal’ array to be computed at this point. Because the command only adds to the volume array, it is the responsibility of the user to make sure that the ‘volume’ array of the deformable body (parent particle container) has been set to 0. Formula: V = \sum_t^N(\frac{A_t}{3} \vec{x}_{t,i}\cdot\vec{\hat{n}}) where we loop over N triangles t and where i refers to the first of three counter-clockwise sorted triangle corners i, j and k.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • nodes — Array Manager containing the nodes of the deformable body.
    • 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.EncompassingSpheresCmd()
Command for computing the encompassing sphere with a given radius ‘inverse_curvature through triangles. The computed sphere center position is stored in an Array ‘center_sphere’. This command also computes the normal unit vector on the triangles ‘normal’, which it derives from the counter-clockwise ordering of the triangle indices. An array ‘x’ must be provided which is used as the triangle corners. This could be controlPoints(‘x’) in the case of a RigidBody geometry or an ‘x’ array in a node manager in the case of a deformable body geometry. Warning: the given radius of the sphere may be changed if the radius is too small for a sphere to fit. In that case, it will be changed to the minimal radius that can be fitted through the triangle.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • x — Array of positions of the triangle corners (Could be in controlPoints or other ArrayManager)
  • 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.NormalizeParentArrayWithChildCountCmd()
Normalizes a parent array with the number of particles per parent: i.e. array_i = array_i / N_children_i. The count array should be provided by the user (see also CountPerParentCommand).
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_count — Array in which the number of particles per parent is counted
    • array — Array normalize with count array
  • 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.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.SortTriangleIndexListCmd()
Command for sorting the order of the nodes saved in the array ‘triangleIndices’ which keeps the triangles connected to each node. The triangles are sorted in such a way that neighbouring triangles in the list always share one common edge (hence two common nodes). Important: in order for ComputeCurvature to work, the indices in the array ‘triangleIndices’ MUST be sorted in the same way as in this command!
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • triangles — Array Manager containing the triangles of the deformable body.
  • 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.SumArrayToParentCmd()
Sums up elements in child array and adds them up into the parent array according to the parentParticleIndex map. Warning: Does not Zero the parent array!
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_parent — Parent array which will keep the sum
    • array — Array to be summed up to parent
    • pc — Particle Container
  • 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.
    • weights (default value = None) — Weights (scalar) with which ‘array’ will be multiplied before summation.
  • 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.SumSurfaceAreaToParentCmd()
Sums up elements in child array and adds them up into the parent array according to the parentParticleIndex map. Warning: Does not Zero the parent array!
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array_parent — Parent array which will keep the sum
    • array — Array to be summed up to parent
    • pc — Particle Container
  • 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.
    • weights (default value = None) — Weights (scalar) with which ‘array’ will be multiplied before summation.
  • 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.TriangleAreaForceCmd()
Computes force per triangle based on local area difference area-area_eq and a global area tension which must be pre-computed (see ComputeGlobalAreaForceCommand) and stored in array 'area_tension'. For each triangle t with area A, a tension is computed as T_t = k_a (A_t - A_t^*)/A_t^* + T_e + \frac{T_g}{2} where * denotes the resting area of the triangle, T_e is an optional externally added tension and T_g is a global tension (kept per parent particle) that is computed by ComputeGlobalAreaForceCommand. The resulting tension is transferred to the F array of the triangle nodes in the direction towards the opposite triangle side: For each node i on triangle t with normal vector n, the force contribution is \vec{F}_{t,i} = T_t ( \vec{x}_k - \vec{x}_j ) \times \vec{\hat{n}}_t, where we have ensured that opposing nodes j and k are sorted in a counter-clock-wise manner.
Default location: ‘loop_cmds/body_force_cmds’
  • Required keywords:
    • ka (kg . s^-2) — Local Area conservation constant. T_local = ka * (area_triangle - area0) / area0 + T_external.
    • nodes — Array Manager containing the nodes of the deformable body.
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • external_tension (default value = None) — Array per triangle that keeps an ‘externally’ computed tension T_external that will be added to the triangle area force.
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • ka_compress (kg . s^-2) (default value = -1) — Optional area conservation constant for compression. If not given, ‘ka’ will be used.
    • 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.TriangleAreaNonlinearForceCmd()
Computes force per triangle based on local area difference area-area_eq and a global area tension which must be pre-computed (see ComputeGlobalAreaForceCommand) and stored in array 'area_tension'. For each triangle t with area A, a tension is computed as T_t = k_a \ln \frac{ A_t }{ A_t^* } + T_e + \frac{T_g}{2} where * denotes the resting area of the triangle, T_e is an optional externally added tension and T_g is a global tension (kept per parent particle) that is computed by ComputeGlobalAreaForceCommand. The resulting tension is transferred to the F array of the triangle nodes in the direction towards the opposite triangle side: For each node i on triangle t with normal vector n, the force contribution is \vec{F}_{t,i} = T_t ( \vec{x}_k - \vec{x}_j ) \times \vec{\hat{n}}_t, where we have ensured that opposing nodes j and k are sorted in a counter-clock-wise manner.
Default location: ‘loop_cmds/body_force_cmds’
  • Required keywords:
    • ka (kg . s^-2) — Local Area conservation constant. T_local = ka * ln( area_triangle / area0 ) + T_external.
    • nodes — Array Manager containing the nodes of the deformable body.
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • external_tension (default value = None) — Array per triangle that keeps an ‘externally’ computed tension T_external that will be added to the triangle area force.
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • ka_compress (kg . s^-2) (default value = -1) — Optional area conservation constant for compression. If not given, ‘ka’ will be used.
    • 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.TriangleCentersCmd()
Command for computing the center point as the Euclidean mean of the three corner points of the triangle. The center point will be kept in an array ‘x’ which can be used e.g. by single-grid contact detection algorithms. Center position \vec{x}_c = \frac{1}{3} ( \vec{x}_i + \vec{x}_j + \vec{x}_k).
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • x — Array with positions of the Ngon corners
  • 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.TriangleNormalsAndAreaCmd()
Command for computing the normals of the triangles which are stored in the normal array. If the triangle ArrayManager keeps the array ‘area’, also the the area of the triangle is computed (and thus set) by this command. Area A = \frac{1}{2} || ( \vec{x}_j - \vec{x}_i)\times ( \vec{x}_k - \vec{x}_i ) || and normal \vec{\hat{n}} = \frac{1}{2 A} [( \vec{x}_j - \vec{x}_i)\times ( \vec{x}_k - \vec{x}_i )] for counter-clock-wise sorted triangle indices i, j, and k.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • x — Array with positions of the primitives’ corners
  • 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.