-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numerical instability for very small ky rhoref in electrostatic stella #98
Comments
As might be expected from reading Appendix A of the stella paper (https://www.sciencedirect.com/science/article/pii/S002199911930066X ) this particular numerical instability can be stabilised for zed_upwind = 1.0, see the attached input file. (Note that |
Just to check - the appendix of the stella paper shows a damped numerical mode (negative growth rate). Numerical instability only occurs if an explicit numerical scheme is used, and the timestep isn't small enough to resolve the spurious mode (a CFL condition). Given that the input file here indicates a fully implicit approach, I think we're looking at a different instability to that described by the stella paper? |
I've been having a fiddle around with the example input file and have noticed:
This suggests to me that something's going wrong in the mirror term; a next step would be to examine a simulation which advances the mirror term only. |
It turns out that set_bmag_const = .true. doesn't result in dbdzed being equal to zero; the flag just forces bmag to a constant value after all the other geometric terms are calculated. In other words, the mirror term is still doing things even if set_bmag_const = .true. From the comments, set_bmag_const was a temporary flag put in place to test something specific, so I wonder if we still need it (given there are other ways of overwriting bmag.) I'll set up a separate issue to discuss this. |
Does this instability occur with ky = 0 in your set-up? Also, what does the very-long-time behaviour with EDIT: if this is related to #59, maybe that issue needs to be revisited. |
@DenSto I'll take a look, but some additional (possibly relevant) info:
So the result of simulating "mirror term only" is a temporary blowup in phi, caused by the finite vpa grid. I don't know if this would cause issues when the other GKE source terms are included, but it's plausible (and could be remedied by increasing vpa_max). |
Using Michael's cbc input file and setting ky.rho_ref = 0. , kx.rho_ref = 0.1, dt = 0.1, I see a numerical instability manifest after about 100 timesteps. This also occurs when I make the zgrid |
I've tested up to t=1440 (before the simulation timed out) without seeing an instability. How long did you find you had to run before you see a weakly growing instability? |
Re: Bob's theory about the mirror term and finite vpa grid, do you find that increasing vpa_max alleviates the initial phi blowup? If the mirror term is all that's in the equation, then after a sufficiently long time the pdf should should be zero for both species, right? |
I agree (but haven't run simulations long enough to verify this is what happens). |
Running the same simulation in the branch feature/Davies-linear-EM-terms (commit 39822af ) (keeping beta=0), I find that we still have an instability, but this time, it gets worse as dt gets smaller rather than bigger dt. On the EM branch, I find a the simulation is stable for around 2000 timesteps for dt=5.0 before starting to go unstable (stella master quickly blows up with dt=5.0). Given that the same blowup occurs for either "implicit mirror" option in the master branch, but has a different character in the EM branch, I wonder if the issue is in the formulation of the equations rather than a code bug. To test, we could see if the instability still occurs when running explicitly, though we're restricted by the CFL condition on which dt we can test. The EM stella branch's fully implicit beta=0 simulation is different to the master branch's fully implicit simulation in 3 big ways:
In might be interesting to compare this with the maxwellian_inside_zed_derivative option (a third formulation of the equation) but if I understand the code correctly, this isn't fully implemented (it also requires a maxwellian term inside the d/dvpa term of the streaming equation, I think). Feel free to correct me if I've got this wrong though! |
@mabarnes can you remind me why stella uses (vpa, mu) as coordinates rather than (e.g.) (energy, mu)? Does this simplify how trapped particles are simulated, or similar? |
Yes, it’s because in stellarators with multiple wells the velocity space and field line coordinate would get coupled together in a complicated way if using energy rather than vpa |
in case it's helpful, I've created a new branch (development/delphi_response), in which one has the option to choose between using phi^n+1 and (phi^n+1-phi^n) when solving for g_inh in parallel streaming. There is surprisingly little that needed changing in the code! It is controlled by the input flag 'use_deltaphi_for_response_matrix' in the &knobs namelist. From my initial tests with CBC at ky=0.1, there is no difference with the default case. |
In case it is helpful, I have started looking at the CBC with ky=0.001 (using the delphi_response branch, but with options set to mimic the master branch). Here is what I've found so far:
The only other thing of note is vpa_upwind and zed_upwind being reduced to 0.005. |
In trying to understand a numerical instability in a high fidelity linear simulation, I have discovered a numerical instability that affects electrostatic stella. In the attached .zip file is a cyclone base case example which goes numerically unstable after a long period of almost constant amplitude in phi. B is forced to be constant with set_bmag_const = .true., with the intent to remove complications from the mirror term. In the example
fprim = 0
andtprim = 0
, guaranteeing that this instability is numerical rather than physical. The eigenfunction has a high or grid scale k||. Introducing a largerzed_upwind
does delay the instability, but even withzed_upwind = 0.1
the growth of the mode can still be seen.Sharing this here for future reference. May be of interest to @DenSto @mabarnes @d7919 @rd1042 due to similarities to the famous GS2 numerical instability at low ky and dt (https://bitbucket.org/gyrokinetics/gs2/issues/108/linearly-unstable-zonal-modes), although there the issue seems related also to the electromagnetic terms.
cbc.zip
P.S. for avoidance of doubt, the version of stella used was commit 126b599.
The text was updated successfully, but these errors were encountered: