Simulation
Table of Contents
1. Explosion simulator
This QBasic program simulates the propagation of shock waves in a gas within a confined space. It models the behavior of pressure and velocity in a two-dimensional grid, providing a visual representation of how shock waves interact with boundaries and each other.
The program initializes a 100x100 grid to represent pressure and velocity values. It sets up initial conditions, including placing pressure disturbances and defining boundary walls.
The core of the program is a loop that continuously updates the pressure and velocity values. The velocities in the horizontal and vertical directions are updated based on pressure differences between adjacent grid points. The program checks for and corrects negative pressure values to ensure physical realism. The pressure grid is updated based on the current velocities. The program handles boundary conditions by setting velocities to zero at wall boundaries.
2. Gravity in 2D
The Gravitation Simulation program is a simple yet insightful QBasic application that simulates the gravitational interaction between a central mass and an orbiting object in a two-dimensional space. This program provides a visual representation of how gravitational forces influence the motion of celestial bodies, making it an excellent educational tool for understanding basic orbital mechanics.
3. Gravity in 3D
This QBasic program simulates the gravitational interactions between spheres in a three-dimensional space. It provides a visual representation of how spheres might move under the influence of gravitational forces, offering an educational insight into basic physics principles.
When spheres are far apart, gravity is dominating force. When Distance between spheres crosses critical threshold, much stronger repulsive force emerges and becomes dominant.
There is also friction. This ensures that after some bouncing, spheres will reach stable configuration.
4. Interference
This QBasic program simulates the interference pattern created by two sine waves with slightly different frequencies. It visually demonstrates how wave interference works, which is a fundamental concept in physics and engineering, particularly in the study of sound, light, and other wave phenomena.
Program combines two waves to create an interference pattern, which is displayed as a third waveform.
5. Interferogram
This QBasic program simulates the interference pattern created by multiple frequencies interacting with each other. The result is a visual representation known as an interferogram, which is commonly used in physics and engineering to analyze wave interactions.
6. Surface tension
This QBasic program simulates the behavior of water spills and the subsequent effects of surface tension using cellular automata rules. The simulation models how water spreads and how surface tension affects the shape of the water body, particularly smoothing out sharp edges over time.
The main loop continuously calculates the next state of each cell based on the surface tension rules. It uses the Moore neighborhood, which includes all eight surrounding cells, to determine the state of each cell in the next iteration.
The rules dictate that a water cell survives only if surrounded by a moderate density of other water cells, while an empty space becomes a water cell if surrounded by a high density of water cells.
7. Wave 1
This QBasic program simulates the propagation of waves across a surface. It provides a visual representation of wave dynamics, which can be both educational and a source of inspiration for those interested in physics simulations or algorithmic art.
The program updates the velocity and height of each point based on the calculated averages, applying a damping factor to simulate energy loss.
8. Wave 2
This QBasic program simulates and visualizes the behavior of water waves on a 2D surface. It creates a dynamic animation of water disturbed by random rain droplets, demonstrating how waves propagate and interact with each other. The program is an example of a simple physics simulation and can serve as an educational tool for understanding wave mechanics.