fmihpc / vlasiator

Vlasiator - ten letters you can count on
https://www.helsinki.fi/en/researchgroups/vlasiator
Other
45 stars 37 forks source link

MultiPeak (and any other project) does not initialise if T=0 in second population #63

Open ykempf opened 9 years ago

ykempf commented 9 years ago

When one wants to use a single population in MultiPeak and sets T=0 for the second one, the initialisation does not complete. This is an old bug which was fixed for the ionosphere and setmaxwellian iniital conditions but not for the triAxisSearch class of projects. The cause is that the test if the value returned by calcPhaseSpaceDensity() is below the threshold never succeeds if avg = NaN.

galfthan commented 9 years ago

Let's fix it yes. T=0 corresponds to a delta function so it should be just in 1 cell (or a few more position just at interface. But do we have any actual usage of such a case?

If one wants to get rid of the second dist function setting density to zero is easier.

ykempf commented 9 years ago

Now it won't hang in findBlocksToInitialize in triAxisSearch projects any more, that bugfix should have been ported there as well when it was made. However setting T=0 will still cause NaNs, so avoid that value. Use 1e-6 or less... Fixing #64 will avoid trying to get rid of the second population by setting all values to 0.

ykempf commented 9 years ago

In fact it's all projects, one could add a generic temperature sanity check or assume T=0 means a Dirac in that place (but you get that with a very small temperature as well).

sandroos commented 9 years ago

I fixed the triAxisSearch eternal loop issue as well somewhere, but I can't remember if I pushed it to master. I also have adaptive sampling algorithm in amr branch now (Multipeak), the error in volume averages are non-negligible with a fixed number of sampling points (of the order of 10 percent or something). Adaptive sampling is much slower, however..

sandroos commented 9 years ago

@ykempf Did you change MultiPeak.cfg to have 120 spatial cells and 5 nT magnetic field on purpose (the old Multipeak.cfg was very useful for testing)? Another change is max_timesteps=0, which causes vlasiator to exit immediately.

ykempf commented 9 years ago

Sorry, I didn't know that for once an "old" cfg was actually actively being used... We have a track record of having stale cfgs in the repo and not updating them. Shall I restore one with the old contents/setup and new parameters or can you do it?

sandroos commented 9 years ago

I can make a copy of the old one

galfthan commented 9 years ago

@ykempf, this is fixed and the issue can be closed?

sandroos commented 9 years ago

I think this stuff has been taken care of

ykempf commented 9 years ago

Well there probably is cases (not using triAxisSearch) which will hang but we can also assume that users won't set T=0? Otherwise one should quickly check all projects and add a warning to relevant places...