MatthewGrim / plasma_physics

0 stars 0 forks source link

Re-assess single particle motion #27

Closed MatthewGrim closed 5 years ago

MatthewGrim commented 6 years ago

Based on feedback, several things should be done to test, and validate the single particle model I have been using.

Regenerate figures from Gummersall

Re-considering the plots I've already generated, there seems to be a discrepancy between the results. Figure 6 shows shorter confinement times, while 2 and 5 show longer. To get to the bottom of this, I need to regenerate the plots. The reason for this may be because I changed the stopping condition halfway through generating these results.

Change stopping condition and particle initialisation

This should be done in such a way that the particles are initialised within the non-adiabatic region of simulations, and the stopping distance extends beyond the coil faces to the point of highest magnetic field.

Plot vectors of magnetic field

Though the contours for the shell-like structure I expect, I should figure out how to store the velocity components in vti files, so that I can visualise them better.

Re-assess timestep

Maybe this should be lower than 1e-5 delta_x for high energy to field ratios. I need to check.

This issue documents the the above tests.

MatthewGrim commented 6 years ago

The first thing I am going to do is replicate Figure 2, 5, and 6 with the code as it stands. Let's just see where we are right now.

MatthewGrim commented 6 years ago

First Attempts at Replicating Figures

figure_1-5

figure_1-6

figure_1-7

I still observe the order of magnitude slower time scale in figure 2 and 5, while seeing a faster timescale for the plot of electron energy. I am not sure why.

MatthewGrim commented 6 years ago

Current tests

I'm going to run the sims again with two separate changes. One is to change the time step so that it is an order of magnitude lower. The other is to change the particle distribution so that it is uniformly distributed across a sphere (this should be identical to the Gummersall paper). Let's see what these two tests show.

MatthewGrim commented 6 years ago

Smaller dt

spherical_2

Spherically Distributed

figure_1-8

Neither change seems to have fixed the problem. Naively I'll try a combination of both, and fix the simulation time to be larger

It's also interesting that the spherical distribution didn't change my result. The points of the cube that I was initialising particles in before, might have been stuck in the high magnetic field lines.

MatthewGrim commented 6 years ago

Exact distribution from Gummersall

The next thing to do is vary the particles in exactly the way Gummersall does them. I should have done this a while back as it is the clearest test of whether it's the initial conditions or something else.

MatthewGrim commented 6 years ago

figure_1-9

Still overshooting with the gummersall initialisation...

MatthewGrim commented 6 years ago

Magnetic Field assessment

Single current loop

Going back to my original code, for a single loop, I validated the magnetic field along axis with the following plot:

figure_1-10

There are variations in the x and y direction, but the z axis matches the analytic theory very well.

Polywell field

XY

magnetic_field_sample_xy

XZ

magnetic_field_sample_xz

YZ

magnetic_field_sample_yz

The fields here generally make sense. The lines move out through the rings, whereas in Carr 2011, they move inward, but this should not make a difference. I am not surprised that the cusps are clearer for the coils that are close together, as the B field magnitude should have a sharper gradient when it reaches the coils. Overall, the qualitative result seems reasonable. I don't know if the magnitude is off.

MatthewGrim commented 6 years ago

Remaining tests

My remaining tests are the visualisation of single particle trajectories, a smaller initialisation region, and a two order of magnitude smaller time step.

MatthewGrim commented 6 years ago

Initialisation in a/16

figure_1-11

No change - it doesn't look like it can be me exceeding the magnetic null. It looks like the time step or the magnetic field is still the main theory but I can't see how I've gone wrong.

MatthewGrim commented 6 years ago

Gummersall normalisation

I added a scripts to compare against the normalisation Gummersall carries out on his fields. The difference between mine and his magnetic fields is close to zero. This should not affect the result for the same resolution.

Field difference in the x direction

figure_1-12

So our magnetic fields are the same. The resolution of his fields is about half that of mine, so it could be to do with resolution.

MatthewGrim commented 6 years ago

Closed by accident - I still don't know the cause for discrepancy

MatthewGrim commented 6 years ago

Resolution study on magnetic field

A comparison of the unit field produced at 56 grid points per dimension and 130 shows there is some deviation but it isn't the orders of magnitude expected to make a difference.

figure_1-13

MatthewGrim commented 6 years ago

Normalised B field

figure_1-14

No change again. I'm going to create a mesh with less loop points than I used previously.

MatthewGrim commented 6 years ago

Variable dt between 1e-9 and 1e-12 times radius

figure_1-16

Low resolution of loop points - 50

figure_1-17

I exclude the 100kA curves because the simulation is too slow.

MatthewGrim commented 6 years ago

Time step fixed at 1e-11 times radius

figure_1-18

Even with the time step fixed. The results converge to the same value. The values have move slightly from other plots but not as would be necessary.

MatthewGrim commented 6 years ago

Review of validation

The results above have shown that, despite all my tests, my results are not aligning with previous work. The magnetic field calculation seems to match mine (at least the normalisation works). The change in distribution does not help, even with the biasing that is in Gummersall's initialisation.

  1. No change from smaller dt
  2. No change from normalised magnetic field.
  3. No change from spherical initialisation.
  4. No change from biased initialisation.

There is not much more I can go on with the information I have. I need to know the exact initialisation used to get the field in previous work, and the stopping criterion. It's really strange that my plots line so well with results that are an order of magnitude below in current.

There's limited gains in flogging this any more.

MatthewGrim commented 6 years ago

Re-run of Gummersall initialisation

figure_1-19

The green curve decays more quickly in this initalisation, where I have made the initialisation a wedge not a cube. This makes me think it could be something to do with the way we set up the particles.

MatthewGrim commented 6 years ago

Final small dt results

figure_1 figure_1-1 figure_1-2

Even at a high resolution (1e-11) the results do not diverge. It's not a timestep issue.

MatthewGrim commented 6 years ago

Results presented at conference

The results below are what I presented at a conference on the IEC:

rgcep

Bug in magnetic field

I just committed a bug in the magnetic field that makes the face cusps have a slight gradient in the radial direction near the face. Hopefully this can be used to explain the current discrepancy my results have with past work. I will need to regenerate the conference plots...

MatthewGrim commented 6 years ago

I'm now going to re-run the validation with the fix to the magnetic field. The first run is at 60 points, and I will do another over the weekend with 130. I have fixed the time step to 1e-9 * radius as in the original paper.

MatthewGrim commented 6 years ago

Results of validation with fix

Even with the fix to the B field, the results still differ ...

gummersall_fig2 gummersall_fig5

So it's seriously not the magnetic field ... and I've already tried to lower the timestep several orders of magnitude with no change... now I'm lost.

MatthewGrim commented 6 years ago

The results are pretty much exactly an order of magnitude off - where could I have lost an order of magnitude?

MatthewGrim commented 6 years ago

My mu_0 is correct. Is line 83 of generic_b_fields correct? That is a factor of 10 but it reduces the confining force by having it...

MatthewGrim commented 6 years ago

The other thing is that my currents are running in the opposite direction, but this should not change anything.

MatthewGrim commented 6 years ago

I'm going to look at the global trends and see what I can see after that.

MatthewGrim commented 6 years ago

Need for a re-run

Because of a mistake in my code on the remote repository, the mesh generator for the final validation above is not correct. This needs to be re-run.

MatthewGrim commented 5 years ago

I've done everything I can to replicate the results, but still find a discrepancy. At least in the closed loop of my simulations, everything seems to be validated, so I cannot waste any more time on this. I have to move on.