mpacts.commands.onarrays. setvalue

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

import mpacts.commands.onarrays.setvalue
#or assign it to a shorter name
import mpacts.commands.onarrays.setvalue as set

AddValueCommand

class mpacts.commands.onarrays.setvalue.AddValueCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Adding a scalar to a scalar array.
Default location: ‘loop_cmds/body_force_cmds’
  • Required keywords:
    • array — Scalar array to which a random number will be added
    • pc — Particle container on which the command is applied
    • value — Value to add to array, scalar or int
  • 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.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, value, array, [gate, predicate]
AddValueCommand(name, parent, **kwargs)

ClipLeapFrogVelocityAndAdjustPositionCommand

class mpacts.commands.onarrays.setvalue.ClipLeapFrogVelocityAndAdjustPositionCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Only works for leapfrog translation integration! Limits v and v_midstep and moves the position of the particles, as if they had the limited velocity. It thus undoes part of the last movement.This is all in case that the integreated velocity is higher than the velocity limit. | Default location: ‘loop_cmds/post_integration_cmds’
  • Required keywords:
    • limit (m . s^-1) — Maximal value at which the speed is clipped.
    • 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)
    • number_of_clips (default value = 0) — Total nuber of clippings that occured during the simulation.
    • 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.
    • previous_deficit_proportion (default value = 9.9999999999999995e-08) — The previous velocity has to be less than (1-x)*limit to be counted , where x represents this property. This prevents one fast moving particle to be recorded multiple times.

Example: limit = 50 m/s; previous_deficit_proportion = 0.01; ||v|| > ||v_mistep|| > limit If the particle was moving at 45 m/s (< 0.99*50) the timestep before, the new velocity is clipped and it is counted as a new clipping event. If the particle was moving at 49.9 m/s (>0.99*50) the timestep before, its new velocity is clipped but it is not recorded as a new clipping event.

object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, limit, [gate, predicate, number_of_clips, previous_deficit_proportion]
ClipLeapFrogVelocityAndAdjustPositionCommand(name, parent, **kwargs)

ClipValueCommand

class mpacts.commands.onarrays.setvalue.ClipValueCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Limits the value of an array to a given scalar value. In case of vectors, the vector is rescaled so that the norm never exceeds the limit clip value.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array — Array that will be clipped.
    • clip_at — Maximum value, values above this threshold will be clipped and kept at this value. For vectors this needs to be a magnitude.
  • 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 decided whether or not the command is executed for a specific particle index (if omitted, the command is executed for all particle indices)
  • Read only properties:
    • number_of_clips — The number of clips this command has done since the start.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: clip_at, array, [gate, predicate]
ClipValueCommand(name, parent, **kwargs)

ClipWithArrayCommand

class mpacts.commands.onarrays.setvalue.ClipWithArrayCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Limits the value of an array to a given value given by another (possibly scaled) array.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array — Array that will be clipped.
    • clip_array — Maximum value array, values above this threshold will be clipped and kept at this value.
  • Optional keywords:
    • factor (default value = 1) — Factor with which the clip_array will be multiplied to (decide to) clip (default: 1).
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: clip_array, array, [gate, factor]
ClipWithArrayCommand(name, parent, **kwargs)

CopyCppIndexCommand

class mpacts.commands.onarrays.setvalue.CopyCppIndexCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Set an array with the cpp indices .
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • index_array — Array to which the global indices as used internally are saved.
    • 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.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, index_array, [gate, predicate]
CopyCppIndexCommand(name, parent, **kwargs)

RandomScalarCommand

class mpacts.commands.onarrays.setvalue.RandomScalarCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Adding a random number to a scalar array; normally distributed with standard deviation ‘sigma’ in case of sigma>0, uniformly distributed between 0 and 1, otherwise.
Default location: ‘loop_cmds/body_force_cmds’
  • Required keywords:
    • array — Scalar array to which a random number will be added
    • pc — Particle container on which the command is applied
    • sigma — Width of the gaussian; if <0, a uniform value between 0 and 1 is added.
  • 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.
    • use_Maruyama (default value = 0) — Bool deciding if the added value will be divided by the sqrt of the time-step, to be integrated in the Euler-Maruyama way for a typical Wiener process. If True, sim has to be given as well (for the time-step).
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, sigma, array, [gate, predicate, use_Maruyama]
RandomScalarCommand(name, parent, **kwargs)

SetMeanToOriginCommand

class mpacts.commands.onarrays.setvalue.SetMeanToOriginCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Centers the positions of particles in a particle container to a user specified ‘center’.
Default location: ‘loop_cmds/integration_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • center (default value = 0 0 0) — Position at which the x array should be centered
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • omit_axis (default value = -1) — This axis will not be used to center the positions
    • 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.
    • x_centered (default value = None) — Array where the centered positions will be stored. If not provided, the same array as the property ‘x’ will be used
    • x (default value = None) — Array with positions
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate, x, x_centered, center, omit_axis]
SetMeanToOriginCommand(name, parent, **kwargs)

SetValueCommand

class mpacts.commands.onarrays.setvalue.SetValueCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Sets an array with a single value. Used for instance to zero forces and moments every timestep. Properties are ‘value’, and an ‘array’ that needs to be set.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • array — The array that will be set using the given value.
    • value — The value that will be used to set the 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 decided whether or not the command is executed for a specific particle index (if omitted, the command is executed for all particle indices)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: value, array, [gate, predicate]
SetValueCommand(name, parent, **kwargs)