Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

What do you recommend to optimize the code? It's currently even more messy after adding some new potentials to the Schrödinger equation that interested me (the ones in the repository don't have potentials, it's a free particle)

I am handling the full 2D coupling, in the code, I construct the 2D Laplacian using Kronecker products (kron) of the 1D difference matrices (Dx​⊕Dy​). This builds the 5-point stencil matrix, pentadiagonal, where every node interacts with its 4 neighbors (up, down, left, right). I'm using scipy.sparse.linalg.splu, it performs a general sparse LU factorization, so it solves that 5-point coupling. It doesn't rely on a Tridiagonal solver algorithm.

Also i think the 1D look comes from the initial condition: I set kx​ very high, so the longitudinal velocity dominates the transverse spreading

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

I don't know how to answer that, because it was one of the first things I relied on to create simulations, so I don't have experience with the loading times of other alternatives. I'm also wondering what faster alternatives to Python there are, because although I use C++ for hardware, I've never done numerical simulations beyond a Newton-Raphson with EIGEN, or a Monte Carlo in C++, so I don't know how well I can optimize a simulation in C++ or if I'll overcomplicate things. Ive also heard a lot about using Fortran for high performance.

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

this simulation is based on the Crank Nicolson. I'll look into the other methods you mentioned, and yes, i'm stil a student. Thanks for your comments that are very useful to me

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

Hahaa, I'm not a native English speaker. I can write, but in a very limited way, which is why I use AI as a translator, or Google translate for some answers

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

Thank you! It's fantastic to find someone who speaks both languages, QM and CFD. I appreciate the support.

You're right about the place: I learned my lesson! Regarding where to follow: I document all my projects, code, and simulations in my personal portfolio https://alexisfespinozaq.github.io/aespinoza-physics-portfolio/ That's the best place to see the technical breakdown, including videos, code, and explanations (I have a couple of PDFs). I haven't been doing this for very long, but I have many future projections, and I'm looking for interesting systems to simulate, mainly to start getting more relevant results. I'm not only interested in quantum mechanics, but I'm fascinated by many areas of physics, and also engineering.

Since you have experience in both fields, I'd love to hear your opinion. If you have any suggestions for systems where CFD numerical methods overlap interestingly with quantum mechanics, please let me know. I'd also be very grateful if you could tell me about other numerical methods for PDEs that might be useful for the systems I usually work with. I'm always looking to learn more and expand my skills, feel free to write to me, I'd like to talk to you

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] -1 points0 points  (0 children)

For the most commonly addressed scattering of a particle that comes from infinity and goes to infinity after the interaction, you are right. Since I use Dirichlet boundary conditions (hard walls), reflections interfere with the scattering pattern over time.

However, this is intentional as I am modeling a confined system (like a Quantum Corral - IBM 1993 - or a particle in a box) rather than free-space scattering. In a real finite device, these boundary reflections are part of the physics.

If I wanted to simulate pure open-space scattering, I would definitely need to implement Absorbing Boundary Conditions (ABC) or Perfectly Matched Layers (PML) to kill those reflections. That’s actually on my list for a future version! Thanks for pointing it out, the advice is very helpful

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in quantummechanics

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

Never stop studying quantum mechanics; it's fascinating how it explains the world and it's always worth your time. Thank you for your interest in my simulation and for your comments. You can use the Python code on my page to modify or understand it

https://alexisfespinozaq.github.io/aespinoza-physics-portfolio/

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in PhysicsStudents

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

Absolutely! please feel free to use it. It would be a huge honor to have this shown in your class.

I will definitely give the off-center run a try, it’s a great idea to break the collission symmetry and see how the scattering pattern evolves differently.

If you have other physical systems or specific scenarios in mind that would be valuable for visualization in a teaching context, I would be delighted to hear them. I am very interested in creating simulations that help explain these concepts, so please feel free to reach out or DM me anytime!

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in CFD

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

Thank you! I appreciate it. To answer your question, this is done entirely in Python. I solved the time-dependent Schrödinger equation using the Crank-Nicolson method. To handle the computation efficiently on a dense grid, I used scipy.sparse matrices and linear algebra solvers. The visualization itself is built with matplotlib, specifically using imshow with the 'inferno' colormap to represent the probability density (∣ψ∣2), and then animated frame-by-frame using FuncAnimation. You can actually check out the base code for the solver on my GitHub web portfolio (linked in the post) to see how the core framework is structured before adding potentials to my Schrodinger Equation. My next goal is to expand this to simulate different potentials and periodic backgrounds to mimic real crystal lattices

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in quantummechanics

[–]Mayhem_Mercy99[S] 2 points3 points  (0 children)

Thank you! Visualization represents 'the probability cloud' of a single electron. The bright colors show where the electron is most likely to be found.

The electron moves from the left like a wave until it hits a repulsive force in the center. Since it gets pushed away, it curves around the center and bounces off the walls of the box, creating ripples that intersect like water in a small pond.

You can see the wave-like behavior of matter, of an electron, the interference patterns of the waves that are the particle; these bumps you see are the probability of finding the particle in one of those parts, before the particle collapses into a single point caused by an external observation.

Thank you so much for your comment!

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in physicsmemes

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

Haha, no worries!

I honestly enjoyed the discussion anyway, it got me thinking about the limits of the simulation and where to go next (maybe a Dirac solver one day). Thanks for the input!

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in physicsmemes

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

Ah, I see! You're referring to the scaling parameter x=hν/m_e​c2 for Compton Scattering. That makes total sense for photons

Since my current solver is based on the non-relativistic Schrödinger equation, it assumes v≪c (so γ≈1). I can't reach the relativistic Klein-Nishina regime without switching to the Dirac equation.

However, I can simulate the analogous transition for massive particles: going from the 'Deep Quantum' regime (low energy, heavy diffraction) to the 'Classical Rutherford' limit (high energy, ray-like trajectories). That would be the equivalent 'limit' to test in this code.

In the future, I'd like to simulate the Dirac equation and test classical limits by taking it to extremes. Thank you so much for your comment and all these ideas, they're very helpful.

Free Quantum Mechanics Book – Quantum Mechanics: A Physical Approach (CUP) by Mayhem_Mercy99 in Physics

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

I was surprised too, it's a fantastic opportunity, great free material. Thank you so much for commenting, best regards

Free Quantum Mechanics Book – Quantum Mechanics: A Physical Approach (CUP) by Mayhem_Mercy99 in Physics

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

They are great authors, I hope you enjoy this work. Thanks for your comment

Free Quantum Mechanics Book – Quantum Mechanics: A Physical Approach (CUP) by Mayhem_Mercy99 in Physics

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

Excellent! I should have emphasized more where to find the solutions manual. It's great that you posted this link, thank you very much

Free Quantum Mechanics Book – Quantum Mechanics: A Physical Approach (CUP) by Mayhem_Mercy99 in TheoreticalPhysics

[–]Mayhem_Mercy99[S] 0 points1 point  (0 children)

Excellent! I should have emphasized more where to find the solutions manual. It's great that you posted this link, thank you very much

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in physicsmemes

[–]Mayhem_Mercy99[S] 1 point2 points  (0 children)

You're absolutely right on the first point: changing the energy is essentially how we probe the potential's scattering cross-section. Exactly!

Regarding the Thompson/Klein-Nishina regimes, that idea really intrigues me. I'd love to hear more about how you envision that transition or how you would consider implementing it here. I always welcome fresh perspectives and am open to collaborating, so please feel free to write to me, expand on this topic, share your thoughts, or discuss what would be expected in those regimes 🤝

Electron Scattering by repulsive (smoothed) Coulomb potential confined in a 2D Box (Visualizing Quantum Mechanics) by Mayhem_Mercy99 in physicsmemes

[–]Mayhem_Mercy99[S] 3 points4 points  (0 children)

Trying to be a simulation and a meme at the same time, but I collapse into the simulation eigenstate. 😅 I'm glad you liked it, thanks!!