[ Prev | Index | Next ]
Japanese English
Now Loading...
Download
Please download on PC (not smartphone) and extract the ZIP file. Then double-click VCSSL.bat (batch file) to execute for Microsoft® Windows®, or execute VCSSL.jar (JAR file) on the command line for Linux® and other OSes.
For details, see How to Use.
You are free to use and modify this program and material, even for educational or commercial use. » Details

Circular Wave Animation

This is a VCSSL program that animates circular waves propagating across a plane, based on parameters such as amplitude, wavelength, and period.

- Table of Contents -

In the previous article and the one before that, we visualized sine waves propagating along a line -- in other words, on a one-dimensional medium.

This time, we'll extend the idea to two-dimensional media and look at waves that spread out over a surface. Specifically, we'll animate circular waves that radiate outward in concentric circles from a central source.

[ Related Article ]

Sponsored Link


How to Use

Download and Extract

At first, click the "Download" button at the above of the title of this page by your PC (not smartphone). A ZIP file will be downloaded.

If you are using Windows, right-click the ZIP file and choose "Properties" from the menu, and enable "Unblock" checkbox at the right-bottom (in the line of "Security") of the properties-window. Otherwise, when you extract the ZIP file or when you execute the software, security warning messages may pop up and the extraction/execution may fail.

Then, please extract the ZIP file. On general environment (Windows®, major Linux distributions, etc.), you can extract the ZIP file by selecting "Extract All" and so on from right-clicking menu.

» If the extraction of the downloaded ZIP file is stopped with security warning messages...

Execute this Program

Next, open the extracted folder and execute this VCSSL program.

For Windows

Double-click the following batch file to execute:

VCSSL__Double_Click_This_to_Execute.bat

For Linux, etc.

Execute "VCSSL.jar" on the command-line terminal as follows:

cd <extracted_folder>
java -jar VCSSL.jar

» If the error message about non-availability of "java" command is output...

After Launching the Program

When you launch the program, you'll first be asked whether you want to input wave parameters numerically. Unless you have a specific need like "I want this exact wavelength," feel free to skip this step by selecting "No."

After that, two windows will appear: a 3D graph window and a parameter setting window.

Graph window screenshot

In the graph window, you'll see an animated circular wave spreading out. The parameter setting window allows you to control the wave's properties, such as wavelength, amplitude, and period, using sliders.

Closing either window will terminate the program.

Concept Overview

A circular wave occurs when a vibrating source, known as the wave source, transfers its motion outward through the surrounding medium in concentric circles.

Graph screenshot

If you gently touch the surface of water -- say, in a bathtub -- you'll observe waves radiating outward in a circular shape.

And if you vibrate your finger vertically against the surface, concentric wavefronts will continue to propagate outward. (In that case, your finger acts as the wave source.)

To simplify this motion, let's assume the following:

Each point in the wave performs the exact same motion as the wave source, but delayed in time depending on the distance from the source.
It's like a stadium wave in sports events -- everyone does the same movement, just shifted in timing based on position.
(Strictly speaking, this assumption isn't perfectly accurate -- for instance, it doesn't preserve energy -- but it greatly simplifies the discussion.)

Now, if the wave source performs a simple harmonic motion, this movement propagates outward with delay proportional to distance.

As a result, if you take a cross-section of the wave in the radial direction, what you'll see is a classic sine wave -- just like the one we examined in the first article of this series.

Image of the Cross Section: sine wave

We define the direction of oscillation -- that is, the direction in which the wave source moves up and down -- as the \(z\)-axis, and the horizontal distance from the wave source as \(r\).

Assuming the wave source is located at the origin of the coordinate system, the distance \(r\) from the wave source to a point \((x,y)\) on the surface is given by:

\[ r = \sqrt{x^2 + y^2} \tag{1}\]

Here's how it looks geometrically:

Image of r

To express the motion mathematically, we can now rewrite the horizontal variable \(x\) in the sine wave equation from the earlier article as \(r\), to obtain a formula for a sine wave that propagates radially from the source:

\[ z = A \sin 2 \pi \bigg( \frac{t}{T} - \frac{r}{\lambda} \bigg) \tag{2} \]

This is the mathematical expression for the circular wave shown in the animation. It's a simplified theoretical model that is easy to work with and is often used in introductory explanations of wave interference.

Here, \(A\) is the amplitude, \(\lambda\) the wavelength, and \(T\) the period -- all of which were introduced in this earlier article, so please refer back to that for more detail.

Note: Keep in mind the simplifications made here

In reality, waves may diminish in amplitude as they spread (i.e., attenuation), and they can reflect off boundaries, producing complex interactions. Equation (2) assumes none of that happens -- it's based on a highly idealized model.

For a more physically realistic simulation of surface wave propagation, take a look at this article:

Even in that simplified simulation, you'll notice that the wave's amplitude quickly drops as soon as it starts, and reflected waves soon interfere, producing a complicated pattern.

In real-world cases, while you can sometimes deal with reflection by adjusting boundary conditions, attenuation is much harder to ignore -- it's inherently tied to the law of conservation of energy. Especially near the source, it's practically impossible to create a situation where attenuation is negligible.

In other words, assuming "no attenuation" when modeling waves spreading over a medium is almost equivalent to assuming that "conservation of energy can be ignored" -- which is a strong and potentially problematic simplification.

That said, using a clean, idealized model like equation (2) has its benefits: It makes it easier to understand the distinctive patterns in circular wave interference, which will be explored in the next article. If you include attenuation from the beginning, things get complex quickly, and explanations tend to become vague or purely descriptive.

So even if it's not physically accurate, there's value in first examining the non-attenuating case. You can understand the core behavior in a simplified setting, and then consider how adding attenuation changes things. Just be sure to keep in mind that this model does not reflect actual physical behavior in its entirety.

Code Overview

This program is written in VCSSL.

Let's go over the contents of the code briefly. VCSSL has a simple C-like syntax, so if you've had any exposure to C or similar languages, you should find it easy to follow.

If you'd like to customize things -- such as the graph's range or other behavior -- just open the program file, CircularWave.vcssl, in a text editor and modify it freely. Since VCSSL is a scripting language, there's no need for a separate compiler or build step -- just save your changes and run.

Full Code

Let's start by looking at the entire code:

That's it! The program is just under 250 lines long.

Each section is explained in the comments within the code itself, but let's go over a few key parts in more detail, especially those that differ from the sine wave animation program two articles ago.

The overall structure is nearly identical to the previous version -- the only major changes are that:

  • The wave data is now two-dimensional instead of one-dimensional.
  • A 3D graph is used instead of a 2D graph.

If you haven't already, reviewing the previous sine wave animation article is highly recommended to understand the basics.

In this article, we'll focus on the differences from that version.

Variable Declarations

The variable declarations at the top of the code are mostly the same as before, but we've added new variables to handle the Z-direction, which wasn't needed for 1D waves.

The arrays "waveX", "waveY", and "waveZ" store the coordinates of each point on the mesh grid where the wave is defined.

In the earlier sine wave version, the wave was confined to a one-dimensional line along the X-axis, so a 1D array was sufficient.

Here, the wave exists on a 2D surface (the X-Y plane), so we use **2D arrays** to define a mesh grid of points.

The mesh consists of N grid points along both X and Y, meaning there are (N-1) intervals along each axis. The spacing of those intervals is given by "DX" and "DY", respectively.

main Function

Now let's take a look at the main() function:

This structure is also nearly identical to the earlier sine wave version.

Inside the animation loop ( "while (continuesLoop)" ), the program advances time step-by-step, calculates the wave height for each point on the 2D surface, stores it in an array, and passes the result to the 3D graph renderer.

The key part is where the wave values are calculated and stored in the arrays:

Here, the 3rd and 7th lines directly correspond to the equations (1) and (2) shown earlier in this article:

\[ r = \sqrt{x^2 + y^2} \tag{1} \] \[ z = A \sin 2 \pi \bigg( \frac{t}{T} - \frac{r}{\lambda} \bigg) \tag{2} \]

That's the equation of a circular sine wave expressed in code form.

The program works like a flipbook: it repeatedly computes equation (2) for increasing values of \(t\), sending the result to the 3D graph for animation.

This part forms the core logic of the simulation. The rest of the code is mostly concerned with building the GUI, managing the graph display, and general setup.

As for graph-related parts: VCSSL makes it easy to switch between 2D and 3D graphs using a nearly identical interface. Most of the changes are just replacing "2D" with "3D" in the function names. GUI setup and event handling also follow the same pattern as before.

License

This VCSSL/Vnano code (files with the ".vcssl" or ".vnano" extensions) is released under the CC0 license, effectively placing it in the public domain. If any sample code in C, C++, or Java is included in this article, it is also released under the same terms. You are free to use, modify, or repurpose it as you wish.

* The distribution folder also includes the VCSSL runtime environment, so you can run the program immediately after downloading. The license for the runtime is included in the gLicenseh folder.
(In short, it can be used freely for both commercial and non-commercial purposes, but the developers take no responsibility for any consequences arising from its use.) For details on the files and licenses included in the distribution folder, please refer to "ReadMe.txt".

* The Vnano runtime environment is also available as open-source, so you can embed it in other software if needed. For more information, see here.



Sponsored Link



Japanese English
[ Prev | Index | Next ]
Wave Interference Animation (Two Circular Waves on a Plane)

Interactive simulator for visualizing wave interference between two circular waves on a plane.
Circular Wave Animation

Interactive simulator for animating circular waves on a plane with adjustable parameters.
Wave Interference Animation (Two Sine Waves on a Line)

Interactive simulation of wave interference between two 1D sine waves.
Sine Wave Animation

Interactive simulator for animating sine waves with adjustable parameters.
Vnano | Solve The Lorenz Equations Numerically

Solve the Lorenz equations, and output data to plot the solution curve (well-known as the "Lorenz Attractor") on a 3D graph.
Index
[ Prev | Index | Next ]
Wave Interference Animation (Two Circular Waves on a Plane)

Interactive simulator for visualizing wave interference between two circular waves on a plane.
Circular Wave Animation

Interactive simulator for animating circular waves on a plane with adjustable parameters.
Wave Interference Animation (Two Sine Waves on a Line)

Interactive simulation of wave interference between two 1D sine waves.
Sine Wave Animation

Interactive simulator for animating sine waves with adjustable parameters.
Vnano | Solve The Lorenz Equations Numerically

Solve the Lorenz equations, and output data to plot the solution curve (well-known as the "Lorenz Attractor") on a 3D graph.
News From RINEARN
* VCSSL is developed by RINEARN.

Released: Latest Version of VCSSL with Fixes for Behavioral Changes on Java 24
2025-04-22 - VCSSL 3.4.50 released with a fix for a subtle behavioral change in absolute path resolution on network drives, introduced in Java 24. Details inside.

Released the Latest Versions of RINEARN Graph and VCSSL - Now Supporting Customizable Tick Positions and Labels!
2024-11-24 - Starting with this update, a new "MANUAL" tick mode is now supported, allowing users to freely specify the positions and labels of ticks on the graph. We'll explain the details and how to use it.

Released Exevalator 2.2: Now Compatible with TypeScript and Usable in Web Browsers
2024-10-22 - The open-source expression evaluation library, Exevalator, has been updated to version 2.2. It now supports TypeScript and can be used for evaluating expressions directly in web browsers. Explains the details.

Behind the Scenes of Creating an Assistant AI (Part 1: Fundamental Knowledge)
2024-10-07 - The first part of a series on how to create an Assistant AI. In this article, we introduce the essential knowledge you need to grasp before building an Assistant AI. What exactly is an LLM-based AI? What is RAG? And more.

Launching an Assistant AI to Support Software Usage!
2024-09-20 - We've launched an Assistant AI that answers questions about how to use RINEARN software and helps with certain tasks. Anyone with a ChatGPT account can use it for free. We'll explain how to use it.

Software Updates: Command Expansion in RINEARN Graph, and English Support in VCSSL
2024-02-05 - We updated our apps. This updates include "Enhancing the Command-Line Features of RINEARN Graph" and "Adding English Support to VCSSL." Dives into each of them!

Inside the Repetitive Execution Speedup Impremented in Vnano Ver.1.1
2024-01-17 - Delves into the update in Vnano 1.1 from a developer's viewpoint, providing detailed insights into the specific improvements made to the internal structure of the script engine.

Scripting Engine Vnano Ver.1.1 Released: Dramatic Speed Improvement for Repetitive Executions of the Same Content
2023-12-22 - Released the Vnano script engine Ver.1.1. In this version, we've made significant enhancements in processing speed by reducing the overhead of handling requests. Explains the details.