Skip to main content

WaveGuide Mode Visualizer

·5 mins
Physics Electrodynamics Visualization Simulation Computation
Table of Contents

WaveGuide Mode Visualizer

Warning! This article is one among many salvaged from my previous blog! It is not on par with my demands of quality but I didn’t feel like abandoning it. Please don’t disappoint me by becoming fond of this.

Prelude #

A few years back, I was in a rush to visualize some fields(electromagnetic to be precise) using computers. It sounded like I will be a cool kid in the lot if I will be able to accomplish that. I asked my prof what could be a good starter; him being an astrophysicist specializing in solar studies, told me about the dark spots on the surface of the sun; which was not very exciting for me. I said that sounds like a lot, can I get a simple version? He thought for a moment which seemed to stretch for a long time and said Waveguides.

What? was the only thing that came out of my mouth when things inside my head kicked in. I realised how infuriating I was when he was teaching about Waveguides in Electrodynamics-II. I didn’t get why we are doing that in the first place as we were not square with the concept of radiation; second, a lot of approximations made me feel bad-I hate approximations as much as I love to use it. He then broke the awkward silence and said I should try to visualize the electric and magnetic fields travelling in the waveguide.

I said that sounds no cool, give me something more difficult. He replied, “You will know this is difficult enough to accomplish once you get started; once you are done with this, we can move to more complicated ones”. Little did I know he was right, studying physics from an engineering school has taught me a wide variety of things; and that came to my rescue.

Interlude #

I had no idea where to start, which tools should I use or learn to use etc. This is where the rudimentary engineering skills dive in. I researched the plotting libraries and frameworks, the load this program might take to run on a PC, programming language of choice etc. That was a lot of shopping for such simple visualization work! Being a scientist is not this overwhelming as being an engineer!! We have a lot of limits set by nature, experiments and previous successful and unsuccessful theories. Most of the choices are made for us, we just have to move further with them, and that is the reason I believe I went down the theoretical physics rabbit hole. Engineering is another name for shopping for your next recipe. It goes like this, a gourmet recipe or blend-all-what-you-got, stir-fry or bake, simple dish or complex infusions etc. You have a tiresome job of choosing before getting started.

I did all the choosing and ended up using mayavi and python3 for the same. I opened up the famous book in Electrodynamics which I have referring to for almost 4 years back then. Griffiths. Ask any physics student his choice of Electrodynamics book for undergraduate, this is it. But it wasn’t enough. I went back to him and said I have difficulties, he gave me a copy of “Field and wave electromagnetics by David K Cheng”. By god’s grace, this book was down to earth full of nitty-gritty calculations and fine details I was exactly looking for. This set me up in the path and what happened afterwards was …

I procrastinated for a long time, hoping for that surge of energy to kick in to start implementing and working on it. There I came across a contest for scientific visualization. I don’t want to mention details about the contest, but this helped me crank up those knobs in me to full and start working. I did it all in just a couple of hours, it was such an intense session. All seemed perfect and I showed my prof thinking that he needs to verify. Of course, he was stuck due to dependency issues.

I shared with him some screenshots from my side and told him, he needs to install certain packages before he can run that. When he did that, this is what he was looking at …

Source Code

Postlude #

I never wanted to bring this simple thing into my writing, until I hit the tip of an iceberg. I was browsing through all the old stuff, and when I stumbled upon this petty thing, the muses of science and philosophy knocked on my door. They started speaking to me about something I missed but I couldn’t comprehend. What can I say? I missed the miss I guess?

It was saddening that such a sudden surge in inspiration goes uncomprehended and irrecoverable, then when I also looked at the email correspondence I had with my prof, the muses spoke back, only this time very clearly. They made me realize the fact that theory is like poetry, it floats in our minds and not ourselves. The calculations and hard effort to realistically simulate the whole thing inside a computer hold the key to further understanding. This is it. This made my track clear for me, I understood that the first experimentation ground for theoretical physics is simulations. This is where I departed to look into some serious topics to dwell in. Loop Quantum Gravity, Cosmic Microwave Background Radiation, String Theory, Lattice Gauge Theory and a few more popped up. If you know me in person, you know that I’m obsessed with the concept of time as it appears in physics, philosophy and theology. It makes me not sleep and dig for more.

The simulation exercise has also given me ground and reason to keep moving forward the way I see things. I hope in future if I revisit this article again, I would have learnt more about the time.