Home
Help
Resources
Extensions
FAQ
NetLogo Publications
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

## NetLogo User Community Models

## WHAT IS IT?

This model simulates in two dimensions the motion of air around an airfoil shape, such as an airplane wing. It uses the motion of individual particles according to the Ideal Gas Law and elastic collisions, which are similar to the behavior of molecules in the real world.

This model can be used to analyze the effects of different airfoil shapes or environmental conditions, such as altitude or airspeed, on the forces on the airfoil and the turbulence patterns it creates. It also shows how the general principles of fluid dynamics come from the motion of individual particles.

## HOW IT WORKS

Particles begin on the left side of the screen, with a velocity consisting of the vector sum of the airspeed, directed to the right, and a random velocity determined by the temperature. They move in straight lines until the collide with walls, the airfoil, or other particles.

When two particles collide, they exchange velocity along a random vector, and thereby change direction. They bounce off walls and the airfoil like balls reflecting off a solid surface, but when they collide with the airfoil, the impulse they apply to it is tracked in order to to calculate the overall lift and drag. When particles reach the right edge of the view, they are removed from the simulation.

The motion of particles through each patch is also tracked to provide information for the overlays, as described under Visualization Options below.

## HOW TO USE IT

To run the model, press the `setup` button, then press the `go` button. Press the `go` button again to pause. After changing any options other than the Visualization Options, press the `setup` button to reset the model.

#### Environmental options

- `altitude` The altitude this airfoil is flying at, which affects the ambient pressure and temperature. Normal cruising altitude is approximately 9000 meters.

- `airspeed` The speed the airfoil is flying at, which is simulated as the average velocity of the air entering the view. Normal cruising speed is approximately 220 meters per second.

- `num-particles` Number of particles the model simulates at a time. This should not affect overall results, but higher values will produce more stable output at the expense of slower updates.

#### Airfoil options

These options specify the airfoil using shapes in the NACA-4 series, see the last link in the Credits and References.

- `airfoil-length` The distance from the leading edge of the airfoil to its trailing edge.

- `max-camber` The maximum deviation from a straight line in the airfoil's camber line (shown in gray), specified as a percent of `airfoil-length`.

- `max-camber-position` The position of the camber line's maximum deviation, specified as a percent of `airfoil-length`.

- `max-thickness` Maximum distance the airfoil skin can be from the camber line, specified as a percent of `airfoil-length`.

- `angle-of-attack` Rotation of the entire airfoil, relative to the orientation where the two ends of the camber line lie on a horizontal line.

#### Visualization options

- `num-visible-particles` How many particles appear in the view, must be less than or equal to `num-particles`.

- `num-trace-particles` How many particles to trace when `trace-particles` is clicked.

- `trace-particles` Ask `num-trace-particles` visible particles to enable their pens, meaning they will leave orange lines showing their paths until they leave the view.

- `clear-traces` Clear all lines from traced particles.

- `show-pressure?` Whether to show the overlay of pressure at each patch, which is enabled after `5000 / num-particles` ticks. Patches are colored shades of blue, where darker shades are higher pressures.

- `show-streamlines?` Whether to show the overlay of streamlines, which is enabled after `5000 / num-particles` ticks. The angle of each streamline shows the direction of the average velocity of particles near it.

#### Plots

- `Lift of airfoil` Shows the lift that would be applied to one meter of the displayed airfoil shape if its was in three-dimensional space. Values will fluctuate, but should approach a long-term average. Enabled after `5000 / num-particles` ticks.

- `Drag of airfoil` Shows the drag that would be applied to one meter of the displayed airfoil shape if its was in three-dimensional space. Values will fluctuate, but should approach a long-term average. Enabled after `5000 / num-particles` ticks.

## THINGS TO NOTICE

Notice how the streamlines have an upward slope behind the trailing edge, showing the "uplift" that is a significant cause of turbulence behind wings.

Trace a few particles. Notice how their motion does not closely reflect the overall motion of the air as shown by the streamlines.

Notice how the airfoil changes the pressure and streamlines for a quite large area around it.

Notice that due to the limited number of particles we can simulate, the forces on the airfoil fluctuate significantly, while in the real world they would be much steadier.

Notice how variations in the lift and drag plots tend to roughly track each other, possibly because of variations in the overall number of particles hitting the airfoil at any particular time.

## THINGS TO TRY

Change the altitude slider. What happens to the forces on the airfoil? Why do airplanes fly at high altitude?

Change the airspeed slider. What happens to the forces on the airfoil? How could this be used to determine the speed a particular airplane needs to take off?

Change the airfoil's angle of attack. What tradeoffs might this decision bring?

Try designing your own airfoils with the Airfoil Options. What seems like a good design? How might this vary for different kinds of airplanes?

## EXTENDING THE MODEL

This model doesn't properly deal with supersonic effects. Why not? Implement the speed of sound. How does this change afffect supersonic flight?

Add a more detailed view of air motion than the five-patch streamlines offer. What new effects are visible? Is there turbulence near the airfoil's trailing edge?

Make this model into an evolutionary design where a generation of random airfoils is tested, and the ones which perform best are more likely to pass their parameters to the next generation. How do you define which airfoils perform best? How does this affect the results after many generations?

## NETLOGO FEATURES

This model uses the `tick-advance` feature to divide time in fractions of ticks, ensuring that particles can never glitch through barriers by moving more than one patch per processing cycle, no matter their speed. This technique comes from the GasLab models.

As NetLogo does not have a data structure similar to a map, corresponding lists were used instead, where the first element of one list is paired with the first element of the other, the second is paired with the second, and so on. This structure can be seen with the airfoil impulse lists and their expiration times, and with the patch speed/heading lists and their expiration times.

## RELATED MODELS

The GasLab example models under the Chemistry and Physics section of the Models Library provided some of the particle collision code for this model and explore in more detail various aspects of gas behavior.

## CREDITS AND REFERENCES

This model was created as a final project for John Pickle's course "Computer Modeling in Science" at Concord Academy. His advice and suggestions are gratefully acknowledged.

The core particle motion code comes from the GasLab Free Gas example model, by Uri Wilensky. Algorithms used in this model come from: