2
$\begingroup$

I am this week learning wave equations, my very first time. I am learning those below. enter image description here enter image description here

Please give examples of how you'd use wave equations with Animation Nodes. Your way, please.

No ideas? How about waves on a long strip of plane below?
enter image description here

With wave movement on a same plane.

enter image description here

$\endgroup$
6
$\begingroup$

Theory

The wave equation is a second order partial differential equation, which means solving it can done by numerical integration, perhaps using the simpler Euler's Method. The one dimensional wave equation is as follows:

$$ \frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2} $$

Where $u$ is the displacement, $t$ is the time, and $x$ is the position. The partial derivative on the right hand side is the one dimensional Laplacian. So, to compute it, we use the Discrete Laplace Operator. In particular, we can use a one dimensional convolution kernel, the kernel have the structure:

$$ \begin{bmatrix} 1 \\ -2 \\ 1 \end{bmatrix} $$

Finally, to be able to solve this, we need to define the initial conditions of the system as well as its boundary conditions. That is, we have to define the initial displacement and the initial velocity. Lets assume that at $t=0$ the velocity was zero ($\left.\frac{\partial u}{\partial t}\right\rvert_{t=0} = 0$) and the displacement was zero everywhere except at a subset of the domain where it was a bell shaped curve. As for the boundary conditions, we shall use a Periodic Boundary Condition.

Implementation

First, give the displacement, we compute the discrete laplacian using the kernel outlined above, this is easily done by vectorization as follows:

Discrete Laplacian

Next, given the initial velocity, lets compute the velocity after $\delta$ time using Euler's method as follows:

Compute Velocity

Next, lets compute the displacement given an initial displacement and the velocity using Euler's method:

Compute Displacement

Next, we make a solver loop that takes the initial velocity and displacement and reassign them at each iteration:

Solver

Finally, we define the initial conditions as discussed before and display the simulation as a circular domain, we also enable per frame caching to get real time results:

Initial Conditions

By running the animation, we get:

Result

Which seems about right. It should be noted that this is not the most physically or mathematically accurate simulation and it is not computationally efficient either, this is just a simplified heuristic implementation to demonstrate the wave equation.

$\endgroup$
  • $\begingroup$ Thank you very much for this. You are always a genius. I wish I can steal your brain and do great many things with it. Imagine all the years of learning gone inside that great brain of yours. $\endgroup$ – Rita Geraghty stands by Monica Mar 3 at 15:44
  • $\begingroup$ "Where u is the displacement, t is the time, and x is the position." I know c is for constant. Now, I have learned what u is. I was previously long stuck on u. Now, I know what it is and thank you for that. I am going to look up others like laplacian, discrete laplace operator, etc. Thanks for mentioning them. $\endgroup$ – Rita Geraghty stands by Monica Mar 3 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.