"LIGGGHTS(R)-PUBLIC WWW Site"_liws - "LIGGGHTS(R)-PUBLIC Documentation"_ld - "LIGGGHTS(R)-PUBLIC Commands"_lc :c

:link(liws,http://www.cfdem.com)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)

:line

fix insert/stream command :h3
[Syntax:]

fix ID group-ID insert/stream seed seed_value distributiontemplate dist-ID general_keywords general_values stream_keywords stream_values ... :pre

ID, group-ID are documented in "fix"_fix.html command :ulb,l
insert/stream = style name of this fix command :l
seed = obligatory keyword :l
seed_value = random # seed (prime number greater 1000) :l
distributiontemplate = obligatory keyword :l
dist-ID = ID of a "fix_particledistribution_discrete"_fix_particledistribution_discrete.html to be used for particle insertion :l
one or more general keyword/value pairs can be appended :l
general_keywords = {verbose} or {maxattampt} or {nparticles} or {mass} or {particlerate} or {massrate} or {insert_every} or {overlapcheck} or {all_in} or {random_distribute} or{vel constant} or {vel uniform} or {vel gaussian} or {orientation} or {omega} or {set_property} :l
  {verbose} = yes or no
  {maxattempt} value = ma
    ma = max # of insertion attempts per atom (positive integer)
  {nparticles} values = np or INF
    np =  number of particles to insert (positive integer)
    INF =  insert as many particles as possible
  {mass} values = mp
    mp = mass of particles to be inserted (positive float)
    INF =  insert as many particles as possible
  {particlerate} values = pr
    pr = particle insertion rate (particles/time units)
  {massrate} values = mr
    mr = mass insertion rate (mass/time units)
  {insert_every} value = ie
    ie = every how many time-steps particles are inserted - insertion happens periodically (positive integer)
  {start} value = ts
    ts = time-step at which insertion should start (positive integer larger than current time-step)
  {overlapcheck} value = yes or no
  {all_in} value = yes or no
  {random_distribute} value = exact or uncorrelated
  {compress_tags} value = yes or no
  {vel constant} values = vx vy vz
    vx = x-velocity at insertion (velocity units)
    vy = y-velocity at insertion (velocity units)
    vz = z-velocity at insertion (velocity units)
  {vel uniform} values = vx vy vz vFluctx vFlucty vFluctz
    vx = mean x-velocity at insertion (velocity units)
    vy = mean y-velocity at insertion (velocity units)
    vz = mean z-velocity at insertion (velocity units)
    vFluctx = amplitude of uniform x-velocity fluctuation at insertion (velocity units)
    vFlucty = amplitude of uniform y-velocity fluctuation at insertion (velocity units)
    vFluctz = amplitude of uniform z-velocity fluctuation at insertion (velocity units)
  {vel gaussian} values = vx vy vz vFluctx vFlucty vFluctz
    vx = mean x-velocity at insertion (velocity units)
    vy = mean y-velocity at insertion (velocity units)
    vz = mean z-velocity at insertion (velocity units)
    vFluctx = standard deviation of Gaussian x-velocity fluctuation at insertion (velocity units)
    vFlucty = standard deviation of Gaussian y-velocity fluctuation at insertion (velocity units)
    vFluctz = standard deviation of Gaussian z-velocity fluctuation at insertion (velocity units)
  {orientation} values = random or template or constant q1 q2 q3 q4
    random = randomize rotational orientation
    template = use orientation from particle template
    constant = use constant quaternion for orientation
    q1 q2 q3 q4 = quaternion values for constant orientation
  {omega} values = constant omegax omegay omegaz
    constant = obligatory word
    omegax = x-component of angular velocity (1/time units)
    omegay = y-component of angular velocity (1/time units)
    omegaz = z-component of angular velocity (1/time units)
  {set_property} values = property-varname val
    property-varname = variable name of a "fix property/atom"_fix_property.html holding a scalar value for each particle
    val = value to initialize the property with upon insertion  :pre

following the general keyword/value section, one or more stream keyword/value pairs can be appended for the fix insert/stream command :l
stream_keywords = {duration} or {parallel} or {insertion_face} or {extrude_length} :l
  {insertion_face} value = mesh-ID
    mesh-ID = ID of the "fix mesh/surface or fix mesh/surface/planar"_fix_mesh_surface.html to use as starting face for particle generation
  {extrude_length} values = L
    L =  length for extruding the insertion face in normal direction so to generate in insertion volume
  {parallel} values = yes or no
    yes, no = pre-calculate location of overlap of processor subdomains and extrusion volume to some extent
  {duration} values = du
    du =  duration of insertion in time-steps :pre
:ule

[Examples:]

fix ins all insert/stream seed 123457 distributiontemplate pdd1 nparticles 5000 vel constant 0. -0.5 -2. particlerate 1000 overlapcheck yes insertion_face ins_mesh extrude_length 0.6

[Description:]

Insert particles into a granular run either once or every few timesteps
within a specified region until either np particles have been inserted
or the desired particle mass (mp) has been reached.

The {verbose} keyword controls whether statistics about particle
insertion is output to the screen each time particles are inserted.

Each timestep particles are inserted, they are placed randomly inside
the insertion volume so as to mimic a stream of poured particles. The
insertion volume is generated by extruding the insertion face as
specified via {insertion_face} in the direction of the face normal.
The sign of this face normal is automatically flipped so that it
is opposite to the normal component of the insertion velocity.

To specify the number of particles to be inserted, you must use either
the {nparticles} or the {mass} keyword (but not both). In the latter
case, the number of particles to be inserted is calculated from the
mass expectancy given by the particle distribution. The {start} keyword
can be used to set the time-step at which the insertion should start.

Likewise, you can use the {particlerate} or the {massrate} keyword (but not both)
to control the insertion rate. Particles are not inserted continuously,
but in packets (for efficiency reasons). Particles are inserted again
after enough time has elapsed that the previously inserted particles
have left the insertion volume.

One of the two keywords {insert_every} and {extrude_length} must be
provided by the user (but not both).

In case {insert_every} is defined, this sets the frequency of the particle
insertion directly, i.e. the number of time-steps between two insertions.
The number of particles to be inserted at each insertion event is calculated
from the insertion rate and {insert_every}.

If {extrude_length} is specified, the amount of extrusion is fixed and
the insertion frequency is calculated from {extrude_length} and the insertion
velocity normal to the insertion face.

When defining {insert_every}, you have the possibility to define the duration
of each insertion via the {duration} keyword. {duration} < {insert_every}
will generate a "pulsed" stream as opposed to a continuous stream.
Example: Setting {insert_every} = 1000 and {duration} = 600 will produce
a stream that pours material for 600 time-steps, will pause for 400 time-steps,
pour for another 600 time-steps etc.

As mentioned above, particles are inserted again after enough time has
elapsed that the previously inserted particles have left the insertion
volume. Until the time these particles reach the insertion face, no
other forces affect the particles (pair forces, gravity etc.). Fix
insert/stream internally issues a special integrator to take care
of this. This procedure guarantees that the specified velocity,
omega etc. values are perfectly met at the specified insertion face.

The larger the volume, the more particles that can be inserted at one
insertion step. Insertions will continue until the desired # of particles
has been inserted.

NOTE: The insertion face must be a planar face, and the insertion
velocity projected on the face normal must be non-zero.

NOTE: Keywords {insert_every} and {extrude_length} may not be used
together

NOTE: Keywords {duration} and {extrude_length} cannot be used together.

This command must use the distributiontemplate keyword to refer to a
"fix_particledistribution_discrete"_fix_particledistribution_discrete.html (defined by dist-fix-ID) that defines the properties of the
inserted particles.

Inserted particles are assigned the atom type specified by the
particledistribution defined via the
"fix_particledistribution_discrete"_fix_particledistribution_discrete.html and
are assigned to 4 groups: the default group "all" and the group
specified in the fix insert command, as well as the groups specified
in the "fix_particledistribution_discrete"_fix_particledistribution_discrete.html
and "fix_particletemplate_sphere"_fix_particletemplate_sphere.html
command (all of which can also be "all").

The keyword {overlapcheck} controls if overlap is checked for at insertion,
both within the inserted particle package and with other existing particles.
If this option is turned off, insertion will scale very well in parallel,
otherwise not. Be aware that in case of no overlap check, highly overlapping
configurations will be produced, so you will have to relax these configurations.

If overlapcheck if performed, the number of insertion attempts per
particle can be specified via the {maxattempt} keyword. Each timestep
particles are inserted, the command will make up to a total of M tries
to insert the new particles without overlaps, where
M = # of inserted particles * ma.  If unsuccessful at completing all
insertions, a warning will be printed.

The {all_in} flag determines if the particle is completely contained
in the insertion region ({all_in = yes}) or only the particle center
({all_in = no}).Using {all_in} = yes requires you to use an insertion
face of style "fix mesh/surface/planar"_fix_mesh_surface.html

NOTE: You also have to use "fix mesh/surface/planar"_fix_mesh_surface.html
if there is a "run"_run.html command between the definition of the
insertion face and the fix insert/stream command. Otherwise, a
"fix mesh/surface/planar"_fix_mesh_surface.html will do.

Keyword {random_distribute} controls how the number of particles to
be inserted is distributed among parallel processors and among the
particle templates in the particle distribution. For style {exact},
the number of particles to be inserted each step is matched exactly.
For style {uncorrelated}, the number of particles to be inserted
for each particle template will be rounded in an uncorrelated way,
so the total number of inserted particles may vary for each insertion
step. However, statistically both ways should produce the same
result. Style {uncorrelated} may be faster in parallel since it
does not need global MPI operations.
Please note that if the # of particles to be inserted is calculated
e.g. from a particle mass to be inserted, the number of particles
to be inserted each insertion step will vary by 1, irrespective of
the {random_distribute} settings. This is because in this case the
# of particles to insert in each step will be a floating point number,
and applying a simple floor/ceil rounding operation would lead to a
statistical bias.

If keyword {parallel} is set to 'yes', LIGGGHTS(R)-PUBLIC tries to pre-calculate
more accurately the overlap of process subdomains and extrusion volume.
For cases where the insertion volume is highly divided between different
processes, this can lead to a speed-up of insertion as random number generation
is more efficient. For cases where the extrusion volume is divided
among few processes this will impose a small computation overhead.

If keyword {compress_tags} is set to 'yes', then atom IDs are re-assigned
after each insertion procedure. The default is 'no'. This is typically
only recommended if some models internally store arrays which have the
length defined via the max ID of any atom. 

IMPORTANT NOTE: Setting {compress_tags} to 'yes' will result in all contact
history to be lost at that point in time. External post-processing tools
will give wrong results because they typically track atoms via their IDs.

The initial velocity and rotational velocity can be controlled via the
{vel} and {omega} keywords. {vel constant} simply patches a constant
velocity to the inserted particles, {vel uniform} sets uniformly distributed
velocities with mean and amplitude. {vel gaussian} sets Gaussian
distributed particle velocities with mean and std. deviation.
The insertion velocity must be non-zero.

The {set_property} option can be used to initialize scalar per-particle
properties such as temperatures, which are stored in a 
a "fix property/atom"_fix_property.html.

The setting of {compress_tags} will trigger a periodic re-tagging of
atom ids. This is usefull in case the simulation domain is used to
model a periodic in and outflow of particles. If this switch is set,
the global ids of the particles will remain in a certain range,
and no "holes" in the arrays holding the global atom ids exist.
IMPORTANT NOTE: This functionality may confuse external tools which 
perform post-processing based on atom IDs!

[Restart, fix_modify, output, run start/stop, minimize info:]

Information about this fix is written to "binary restart
files"_restart.html.  This means you can restart a simulation simulation
while inserting particles, when the restart file was written during the
insertion operation.

None of the "fix_modify"_fix_modify.html options are relevant to this
fix. A global vector is stored by this fix for access by various "output
commands"_Section_howto.html#4_15. The first component of the vector is the
number of particles already inserted, the second component is the mass
of particles already inserted. No parameter of this fix can be
used with the {start/stop} keywords of the "run"_run.html command.
This fix is not invoked during "energy minimization"_minimize.html.

[Restrictions:]

Keywords {duration} and {extrude_length} can not be used together.
The insertion face cannot move.

[Related commands:]

"fix_insert_pack"_fix_insert_pack.html, 
"fix_insert_rate_region"_fix_insert_rate_region.html,

[Default:]

The defaults are maxattempt = 50, all_in = no, overlapcheck = yes
vel = 0.0 0.0 0.0, omega = 0.0 0.0 0.0, start = next time-step,
duration = insert_every, random_distribute = exact, parallel = no,
{compress_tags} = no
