anderkve / FYS3150

https://anderkve.github.io/FYS3150
26 stars 14 forks source link

About the particle simulation #59

Closed JohanCarlsen closed 1 year ago

JohanCarlsen commented 2 years ago

When we are supposed to simulate the movement for 100 $\mu s$, my particles are more or less coloring the entire figure.. I do int total_time = 100; double dt = 1e-3; int steps = total_time / dt; Is this wrong?

JohanCarlsen commented 2 years ago

animation

This is how it looks for a simulation of $t=1 \mu s$

JohanCarlsen commented 2 years ago

I had forgotten the mass. I was testing, so I had mass equal to 1. Now it looks like this: animation

anderkve commented 1 year ago

Hi @JohanCarlsen!

Nice-looking simulations! (Note that you currently have µs rather than µm as your units.)

As you've probably seen from the message on the web page, I've now updated the project description with exact initial values to the simulations in Problem 8, and changed the total time to 50 µs. But some of the plots will indeed be quite busy. (Adding a marker at the start point might be helpful.)

JohanCarlsen commented 1 year ago

Yes, thank you! Wien I changed the mass from 1 u to 40.078, things were looking much better!

anderkve commented 1 year ago

That's good to hear! (Note that I've discovered another mistake in the initial values I have chosen for Problem 8, so they will be updated once more later this evening... Sorry for the confusion.)

JohanCarlsen commented 1 year ago

May I ask why you have chosen the initial values you have? Is it a specific reason, or just a way of being able to spot if someone has done something wrong?

anderkve commented 1 year ago

Exactly, it's mostly just because it's much easier to spot mistakes when everyone is using the same initial values. Last year many students spent quite some time looking for mistakes in codes that turned out to be perfectly correct, just because the simulation results for particular initial values looked surprising.

And the reason why I had a "mistake" in my original choice of initial values was just that our analytical expression for the single-particle case assumes that y_0 = 0 and v0_x = v0_z = 0, which I forgot about when I chose the initial values for Problem 8.