My recent projects! Electric fields, wave equation, and chaos

  1. Models the divergence of a static electric filed. New divergence values form the color map after being solved. Would like to include a Laplacian solver and curl solver.
  2. FDM solves for wave approximation. Would like the waves to decay with time.
  3. Lorenz coupled diffeq. When row is over 20 the system is in chaos. Would like to more efficiently handle the particles, maybe with shader code…

https://chrisboligprojects.pythonanywhere.com/div
https://chrisboligprojects.pythonanywhere.com/fdm
https://chrisboligprojects.pythonanywhere.com/chaos

5 Likes

Thanks for sharing.

Although I cannot grasp fully the physics behind these models, I could still enjoy the graphics! I have the feeling that there are a lot of calculations going under the hood.

I have the impression that some aspects of the models can be optimized both in terms of memory and performance. For example, in the first link only one cone_geometry (defined outside the double loop) is needed. A more advanced step in optimization is to use instancing.

Do you plan to add some more info/descriptions to the models, so that people can understand what is shown. For example, when I change the three sliders, the numerical values stay 0. I did not understand why … until I found by accident that “charges” are the dots in the model and I have to click on them.

image

1 Like

thank you!

the physics may seem complicated, but the code is not! They are all modeled with many simple calculations. Ive always learned and modeled physics with python, but I’ve really enjoyed how threejs lets you build the visualizations yourself and update the models in real time

For the cone geometry, I rotate them all in a loop using coneGroup.children[index].lookAt(x,y,z). I think i noticed the cones rotated oddly, so I quickly put the geometry inside the loop, which I think fixed it but I may be wrong on that…

And a small explanation would be great, I usually share with my coworker who are better physicists than me lol, but if I’m going to post these publicly, a little explanation would be helpful.

1 Like

Awesome visualizations,

Did you solve the equations using JavaScript or did you use Python on server and brought the results to threeJS. Could you give more details on the type of solvers you used for python and how did you run these calculations ?

Did you use parallelism in python or single threaded calculations ?

Any documentation or links on the subject that could help would be much appreciated.

1 Like

thank you! the equations are solved or approximated inside JS loops even though I’m fan of python backed with its libraries! I’m surprised how fast JS iterates through loops though.

If you dig into the code, you will see the loops. The first two use central difference methods and the last uses Euler’s method.

Not sure if I have any documentation I strictly followed. I have been trying to model waves for some time and I learned euler’s method by seeing neat examples using scipy’s RK45 package

this plotly ex. inspired me to do a threejs version for lorenz (chaos). I thought I could just take their update loop logic, but I ended writing up my own using basic Euler method principles.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.RK45.html