Particle System Flame

Particle System Flame preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)


computer science 

Tagged by Reuven M. Lerner about 11 years ago

particle system 

Tagged by Reuven M. Lerner about 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 376 times • Downloaded 72 times • Run 1 time
Download the 'Particle System Flame' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This particle system models a flame as a collection of particles rising up from the bottom of the world.

For basics on particle systems, start with Particle System Basic.


A particle with an initial velocity emerges from the bottom center of world with an INITIAL-VELOCITY-X and INITIAL-VELOCITY-Y around a random INITIAL-POSITION-X. It is subjected to forces of wind from both sides, swaying the particles to left and right of the middle of the world. The particles rise upwards, decrease in size, and become darker as they are swung left and right.

The MAX-NUMBER-OF-PARTICLES, and particle RATE can be changed using the bottom sliders. Finally, the system's STEP-SIZE controls the precision of the system calculations. For example, decreasing the STEP-SIZE will slow down the model's speed since more calculations are needed for a more precise simulation. Below the use of each slider, button and switch is explained.


Press the SETUP followed by the GO button to start the particle flame. You can then modify the settings to change how the flame behaves. Note that if the maximum number of particles is reached, particles will cease to emerge until another particle disappears.

Initial velocities: The INITIAL-VELOCITY-X and INITIAL-VELOCITY-Y sliders control the initial velocity in the x and y axes for each particle.

Initial position in the x axis: To make the particle system appear more realistic, each particle can be given a random starting point. When INITIAL-POSITION-X is set to zero, the particles will emerge from the middle of the screen, however if the initial INITIAL-POSITION-X slider is increased the particles will emerge at a random distance between 0 and INITIAL-POSITION-X from the bottom center of the world.

Wind: The wind force sways the particles of the system towards the center of the world by adding a WIND-CONSTANT force in the x-axis to draw the particle towards the middle of the world.

Step size: A smaller step will increase the precision of the trajectories of each particle, but will also slow down the model computation; A large step will decrease the precision of the trajectories but speed up the model computation. Upon each iteration, the STEP-SIZE scales the velocity and location of the particle.

Maximum particle number: The number of particles in the system is bounded by the MAX-NUMBER-OF-PARTICLES slider. Once the turtle count reaches the MAX-NUMBER-OF-PARTICLES limit the generation of new particles is stopped. Note that each time a particle reaches the edge of the screen it dies, providing room for another particle to be created.

  • Particle rate: The particle RATE sets the rate at which new particles are generated. A rate of 0 will stop the flame.


Note the wind in this model behaves differently than other particle system models: it flows from the left and right to the center of the world.

There is no viscosity and no gravitational force in this model.


Move the sliders and switches to see the behaviors you get from the initial condition and the wind force. For example, move all the sliders except WIND-CONSTANT to a neutral position, to see how wind acts on the particles. After you have seen how the wind force, initial velocities, and initial positions affect the flame shape, combine them to see how they act together.

Move the sliders in order to make the model look the most like a flame to you.

Remember, you can move the sliders while the model is running.


Hide the particles and ask one or a few particles to put their pen down to trace their trajectories.

Change the color of the particles to another color.

Add some randomness to the aging of the particles so they do not darken evenly.

Change the model to emit particles with different shapes, sizes, and colors in order to make the particle system look like air bubbles in water or other physical phenomena.


Particle System Basic
Particle System Fountain
Particle System Waterfall


See Particle System Basic for a list of references on particle systems.

Thanks to Daniel Kornhauser for his work on this model.


If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Kornhauser, D. and Wilensky, U. (2007). NetLogo Particle System Flame model. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.


Copyright 2007 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

  velocity-x             ; particle velocity in the x axis
  velocity-y             ; particle velocity in the y axis
  force-accumulator-x    ; force exerted in the x axis
  force-accumulator-y    ; force exerted in the y axis

to setup
  set-default-shape turtles "circle"

to go
  compute-forces ; calculate the forces and add them to the accumulator
  apply-forces   ; calculate the new location and speed by multiplying the
                 ; forces by the step-size
  age-particles  ; make particles gradually smaller and darker
  tick-advance step-size

to create-particles
  ;; using a Poisson distribution keeps the rate of particle emission
  ;; the same regardless of the step size
  let n random-poisson (rate * step-size)
  if n + count turtles > max-number-of-particles
    [ set n max-number-of-particles - count turtles ]
  crt n
    set color red + 3.5
    set size 0.3 + random-float 1.5
    set mass size ^ 2   ; mass proportional to square of size
    ;; The following few lines place the particle along the bottom of the world
    ;; randomly within a range of initial-position-x around the horizontal center.
    ;; for example, if initial-position-x is set to 1, each particle will be placed
    ;; randomly between -.5 and .5, where 0 is the horizontal center of the world.
    setxy (random-float initial-position-x - initial-position-x / 2)
          (min-pycor + 1)
    set velocity-x  (random-float initial-velocity-x - initial-velocity-x / 2)
    set velocity-y  initial-velocity-y

to compute-forces
  ask turtles
    set force-accumulator-x 0
    set force-accumulator-y 0

to apply-wind  ;; turtle procedure
  ifelse xcor > 0
    [ set force-accumulator-x force-accumulator-x - wind-constant ]
    [ set force-accumulator-x force-accumulator-x + wind-constant ]

; calculates the position of the particles at each step

to apply-forces
  ask turtles
    ; calculate the new velocity of the particle
    set velocity-x velocity-x + (force-accumulator-x * step-size)
    set velocity-y velocity-y + (force-accumulator-y * step-size)
    ; calculate the displacement of the particle
    let step-x velocity-x * step-size
    let step-y velocity-y * step-size
    ;; if the turtle tries to leave the world let it die
    if patch-at step-x step-y = nobody [ die ]
    ;; if the turtle does not go out of bounds
    ;; add the displacement to the current position
    let new-x xcor + step-x
    let new-y ycor + step-y
    facexy new-x new-y
    setxy new-x new-y

to age-particles
  ask turtles
    set color color - step-size
    if color < red - 4 [ die ]
    set size size - step-size / 3
    if size <= 0 [ die ]

; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky about 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky over 11 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky about 14 years ago Particle System Flame Download this version

Attached files

File Type Description Last updated
Particle System Flame.png preview Preview for 'Particle System Flame' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.