ammarhakim / gkyl

This is the main source repo for the Gkeyll 2.0 code. Please see gkeyll.rtfd.io for details.
https://gkeyll.readthedocs.io/en/latest/
62 stars 18 forks source link

pre-g0: Defining `polyOrder` in the Moments App causes strange behavior #175

Open skylord-a52 opened 8 months ago

skylord-a52 commented 8 months ago

I finally figured out what the issue with the code I linked in https://github.com/ammarhakim/gkyl/issues/174 was, and it's caused by another, entirely separate, mostly-silent error.

The parameter polyOrder is unused in the Moments App, but the app doesn't ignore it or raise an error if it's defined. Instead, it tries to accommodate both the polynomial order you gave it and its own solving methods. This leads to NaNs infesting your higher order moments, and the same cryptic "assertion failed" error I made an issue about a bit ago. Even assuming that that error had a more descriptive message ("Invalid pressure value: NaN"), it would still lead you to think that it was an issue with your initial conditions, and not with a hanging parameter.

A simple check to compare the App type with whether or not this parameter was defined would help a lot -- whether it made sure that polyOrder's value didn't affect the simulation, or if it just raised an error when it was defined. Either would work.

I've been migrating code from a Vlasov-Maxwell setup to the 10-moment app, and I must have missed that one line in the process. The only way I was able to figure out that that was the cause was by copying whole chunks of a working app over piece by piece.