Message Boards Message Boards

GROUPS:

[GIF] Gravity wave visualization

Posted 7 years ago
24048 Views
|
6 Replies
|
31 Total Likes
|

enter image description here

With all of the rumors and excitement about the gravity wave press release tomorrow, I was reminded of this code I've had lying around for years for creating a gravity wave visualization (seen above) for illustrative purposes. You can find also a video here. It was inspired by an interaction I had years ago (unfortunately I can't find the interaction in my email) with someone on the LISA project wanting to use Mathematica to re-create a visualization they had. This code was the result of that interaction.

First, the primary goal was to generate a "space-time" surface and mesh that had a double-armed spiral wave on it. The following code generates that. Its dependent on a rotation angle Theta which is not specified here:

Plot3D[(60 Cos[
   2 ArcTan[y/(x + 0.00001)] - \[Theta] + 0.544331 Sqrt[x^2 + y^2]])/(
 20 + Sqrt[x^2 + y^2]), {x, -45, 45}, {y, -45, 45}, PlotPoints -> 100,
  Mesh -> 20, MeshStyle -> {RGBColor[.5, .5, .5, .5]}, Boxed -> False,
  BoxRatios -> Automatic, Axes -> False, 
 PlotStyle -> {RGBColor[.3, .3, .8]}, ImageSize -> {1024, 768}, 
 Lighting -> {{"Directional", White, ImageScaled[{0, 0, 2.}]}}, 
 ViewPoint -> {-0.011, -3.043, 1.479}, Background -> Black, 
 BoundaryStyle -> RGBColor[.5, .5, .5, .5]]

I wanted to overlay 2 stars or black holes on top of the surface. Combining the above with this overlay and giving a value to the angle Theta we get:

With[{\[Theta] = 0}, 
 Show[Plot3D[(
   60 Cos[2 ArcTan[y/(x + 0.00001)] - \[Theta] + 
      0.544331 Sqrt[x^2 + y^2]])/(
   20 + Sqrt[x^2 + y^2]), {x, -45, 45}, {y, -45, 45}, 
   PlotPoints -> 100, Mesh -> 20, 
   MeshStyle -> {RGBColor[.5, .5, .5, .5]}, Boxed -> False, 
   BoxRatios -> Automatic, Axes -> False, 
   PlotStyle -> {RGBColor[.3, .3, .8]}, ImageSize -> {1024, 768}, 
   Lighting -> {{"Directional", White, ImageScaled[{0, 0, 2.}]}}, 
   ViewPoint -> {-0.011, -3.043, 1.479}, Background -> Black, 
   BoundaryStyle -> RGBColor[.5, .5, .5, .5]], 
  Graphics3D[{Directive[Hue[.58, 0, 1], 
     Lighting -> 
      Join[{{"Ambient", Black}}, 
       Table[{"Directional", Hue[.58, .5, 1], 
         ImageScaled[{Sin[x], Cos[x], -.5}]}, {x, 0, 2 Pi - 2 Pi/8, 
         2 Pi/8}]]], 
    Sphere[{2 Cos[\[Theta] - \[Pi]/2], 2 Sin[\[Theta] - \[Pi]/2], 3}, 
     1], Sphere[{Cos[\[Theta] + \[Pi]/2], Sin[\[Theta] + \[Pi]/2], 3},
      1]}], PlotRange -> All]]

enter image description here

Next, I wanted to animate this to give the effect that the spiral arms are rotating outwards. That's done by incrementing the angle Theta and generating a list of frames that can then be exported.

anim = Table[
  Rasterize[
   Show[Plot3D[(
     60 Cos[2 ArcTan[y/(x + 0.00001)] - \[Theta] + 
        0.544331 Sqrt[x^2 + y^2]])/(
     20 + Sqrt[x^2 + y^2]), {x, -45, 45}, {y, -45, 45}, 
     PlotPoints -> 100, Mesh -> 20, 
     MeshStyle -> {RGBColor[.5, .5, .5, .5]}, Boxed -> False, 
     BoxRatios -> Automatic, Axes -> False, 
     PlotStyle -> {RGBColor[.3, .3, .8]}, ImageSize -> {800, 450}, 
     Lighting -> {{White, ImageScaled[{0, 0, 2.}]}}, 
     ViewPoint -> {-0.011, -3.043, 1.479}, 
     Background -> RGBColor[0, 0, 0], BoundaryStyle -> Gray], 
    Graphics3D[{Directive[Hue[.58, 0, 1], 
       Lighting -> 
        Join[{{"Ambient", Black}}, 
         Table[{"Directional", Hue[.58, .5, 1], 
           ImageScaled[{Sin[x], Cos[x], -.5}]}, {x, 0, 2 Pi - 2 Pi/8, 
           2 Pi/8}]]], 
      Sphere[{2 Cos[\[Theta] - \[Pi]/2], 2 Sin[\[Theta] - \[Pi]/2], 
        3}, 1], Sphere[{Cos[\[Theta] + \[Pi]/2], 
        Sin[\[Theta] + \[Pi]/2], 3}, 1]}], 
    PlotRange -> All]], {\[Theta], 0, 2 \[Pi], .1}];

And then to export it to an animated GIF:

Export["GravityWave.gif", anim]

The result is the animation at the top of this post.

POSTED BY: Jeff Bryant
6 Replies

enter image description here - another post of yours has been selected for the Staff Picks group, congratulations !

We are happy to see you at the tops of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!

POSTED BY: Moderation Team

Wow, this is great! With this one animation I finally have some intuitive context for what all the gravity wave talk is about...

POSTED BY: Andre Kuzniarek

I don't see that Jeff plugged the LIGO press conference here.

POSTED BY: Jason Grigsby

For clarification, this visualization is for illustrative purposes, as mentioned in the first sentence. The function being plotted is not derived from any general relativity equations. Its a very similar surface to the one used on the Wikipedia page for eLISA, and in fact was designed to try to emulate this

https://en.wikipedia.org/wiki/Evolved_Laser_Interferometer_Space_Antenna

POSTED BY: Jeff Bryant

Thought I'd plug the blog where I used Jeff's visualization:

http://blog.wolfram.com/2016/02/11/on-the-detection-of-gravitational-waves-by-ligo/

POSTED BY: Jason Grigsby

I have tried the aforementioned Plot3D[...] function in V11.3 and V12 Prerelease. Now Exclusion->None is needed to avoid crack along ArcTan's line of singularity:

crack

POSTED BY: Shenghui Yang
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract