-
Notifications
You must be signed in to change notification settings - Fork 18
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
Consistent face fields less accurate & stable in KHARMA #79
Comments
Oh, no. Oh, no. Turns out my problem setup for AthenaK was a little easier than the KHARMA one. When I standardize them, I get the same results! Above is the same donor cell/LLF/low CFL blast wave as KHARMA ran, and below I simply switch to PPM/HLLE and enable FOFC. Note these are "velx" ~ U1, but share a scale so you can tell the top image is not reaching full velocity. So, half of this mystery is solved: using the same algorithm (and problem!) KHARMA and AthenaK agree... and are both wrong, though in wonderfully similar ways. Bug-for-bug compatible! Exciting. This means I can stop searching for gremlins that make face-B replacement not work "for me." I can also be pretty confident in my implementations of FOFC, Kastaun inversion, and the S&G '07 and G&S '05 "0" CT schemes, which is nice. So, expect those to come down the line pretty quick here when I get Kastaun working for curved spacetimes. What this doesn't solve is the unreasonable effectiveness of reconstructed B fields: I don't get it, and I don't like it. Frankly, until and even when all the Kastaun/FOFC changes land, my advice is going to be that if you're having trouble with face-centered B, try reconstructing it. I don't know why, I don't know how, but it works. |
Closing this since we now understand:
|
tl;dr people using
face_ct
in KHARMA might consider setting the upcoming optionflux/consistent_face_b=false
, if they are seeing instabilities peculiar to the magnetic field -- with the understanding that the resulting scheme is not ideal. I hope to better determine how and why this works, and better characterize the potential consequences of this choice, in the future.Most face-centered transport schemes have a clause which looks something like this (from Stone & Gardiner 2009):
That is, they set e.g. B1 at face F1 to be the actual face-centered split value, rather than one reconstructed from cell centers (which values themselves were reconstructed from faces). This is logical, as it circumvents a whole game of telephone from faces to centers to faces again (though, it shouldn't have an effect on formal convergence).
However, disabling this feature in KHARMA appears to be more stable and more accurate. To be clear, I'm not claiming this is true in general, I'm claiming there's an issue in KHARMA making it true for us. Speculation on that issue later.
Re: stability, here's a blast wave using donor cell reconstruction, LLF fluxes, Kastaun inverter, Gardiner & Stone '07 simple upwinding, and CFL=0.3 of stability limit, with "consistent faces" i.e. true values. I'm plotting Lorentz factor, because it's the hardest thing to get right & good-looking.
![frame_t3 90](https://private-user-images.githubusercontent.com/3892634/310207728-6c9e3408-cf8c-477f-8ebc-5e8168b3de43.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIwNzcyOC02YzllMzQwOC1jZjhjLTQ3N2YtOGViYy01ZTgxNjhiM2RlNDMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzdlYTMzZDNjNDIwMTU1ZmQ2MjA3NWIwM2ZmYTYxM2ViNTFkNDY1YWEyZGFkMzY3Njg2YTkzYWVkNmZjMTcwMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ERme3ZxgtsAt2dzXBiZfaQmdPaW-XkhxXrpQxIoLvuU)
And here's the same but with reconstructed face values:
![recon_sg07_donor_cell](https://private-user-images.githubusercontent.com/3892634/310208257-02653027-1a05-4242-b9fa-91ee3439ea88.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIwODI1Ny0wMjY1MzAyNy0xYTA1LTQyNDItYjlmYS05MWVlMzQzOWVhODgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWIxM2IzZTU3ZTc4MGY2ZTIyNmIxMmU4OTE0NWQwOTAwZTIxY2E5OTQ4NTIzMWY3MWU2Yzg1Mjg2N2I1MzY5YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.vYXDluF_tRyu-g3bYUR4etRggSUf5uI2Phzu8-hMJOw)
The "wings" of very high velocity disappear! These "wings" are nasty pieces to integrate and bear every mark of the traditional failure modes of HARM & KHARMA: high velocity and internal energy, and checkerboarding at higher Courant numbers (meaning more than half the stability limit).
But wait, that clean blast wave still only hits Gamma=3! Doesn't that mean reconstructing these values is less accurate? Well, the lower velocity appears to be more an issue of the constrained transport scheme & reconstruction than of consistent faces. Here's the same problem with Balsara & Spicer reconstruction, and with the true centered upwinded fluxes from Gardiner & Stone '05. Both problems generate some nasty high velocities when the density and internal energy get low, but they get the point across that the B field can be accurate even when reconstructed.
![recon_bs99_donor_cell](https://private-user-images.githubusercontent.com/3892634/310208542-888a6ed7-cb3d-4da5-96b3-e198d9176bf0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIwODU0Mi04ODhhNmVkNy1jYjNkLTRkYTUtOTZiMy1lMTk4ZDkxNzZiZjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWM3OTljMTVmYjQ5MDY1NTMxNTI0OTE1MThiZjhhNTZiNzk4MjMxYzhiZjdmOTRlZjAwMGNlMjJkODgwZjYwYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.d2VLVA2wX7QdD3RS1KoselwKhi_1KOKAV10O96Jg3MY)
Balsara & Spicer:
Gardiner & Stone '05 upwinded (not sure of my implementation here, grain of salt):
![recon_gs05_c_donor_cell](https://private-user-images.githubusercontent.com/3892634/310208826-2a32e81a-b16e-4e65-ab06-881e0d8fe6f4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIwODgyNi0yYTMyZTgxYS1iMTZlLTRlNjUtYWIwNi04ODFlMGQ4ZmU2ZjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTM5NWI2ODI1MDljNzdkMmQ2NDNiMzJlNzAwZDkzYmM1MDg1NmQ1MWZmM2IzODc5MmM2YmRkZDI4NzFlNmVhMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.uPJgs3G6idx3cCKPwxYozYcRjBAXJyiSXSto-9v2WYE)
Note Balsara & Spicer looks exactly the same as using cell-centered Flux-CT, as we might hope:
![flux_ct_donor_cell](https://private-user-images.githubusercontent.com/3892634/310209277-74001516-0392-4c06-bb30-8414e34412ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIwOTI3Ny03NDAwMTUxNi0wMzkyLTRjMDYtYmIzMC04NDE0ZTM0NDEyYWQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjNmZjZiYjE4NzZhNGQ3YjVkM2EzOWQwM2E0YjIxNTk1ODNhMjkwMTYwNzQzODJkNmZiZDAwZjFkNDg1YmZlNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.HWwNbjxzMczkUx6PKcrL3uj5cGh6TpNh6yOBGW-VFf4)
Okay, what about with reconstruction schemes people actually use? Here's a blast wave with KHARMA's tried & true WENO5 with first-order fallback (FOFC) to Donor Cell, both original and fallback using consistent faces:
![true_sg07_weno5_fofc](https://private-user-images.githubusercontent.com/3892634/310209836-041171c7-4ffa-42c7-9859-2b4af3e02418.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIwOTgzNi0wNDExNzFjNy00ZmZhLTQyYzctOTg1OS0yYjRhZjNlMDI0MTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmQ4OGEzMjBkNmE1NDI2NmRjNDEzZmZhNzdhMGVjNzNiMzViYjQ2NzRkYjNjNGYzM2I5MzBhZjExODNlZDlmNSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.HsfTz28jfYF7G6cnvtlONnRb8rOOz8sWcziGf87yvSY)
And here with reconstructed faces:
![recon_sg07_weno5_fofc](https://private-user-images.githubusercontent.com/3892634/310210334-7e1281aa-a043-4243-9cbf-f6b9df9a1d69.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIxMDMzNC03ZTEyODFhYS1hMDQzLTQyNDMtOWNiZi1mNmI5ZGY5YTFkNjkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzM2OGY3NmJjMWNkZTcwMmZiMzhjOTMyMDcxZmU0ODFiM2Q2NTQyZWJkODBkNTc4NzhiYmQzMmY2NjljODhhMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.O2fpeL2VxwO3s8dbOGVSdoCHCzKB5_l5deuw_wyV3ec)
And the reference figure from Komissarov (1999) (not quite comparable time, but it gets the point across):
![Screenshot 2024-03-05 at 9 56 45 AM](https://private-user-images.githubusercontent.com/3892634/310210580-401a9281-eb07-4d0c-80b1-797b1ae45359.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg3NjMsIm5iZiI6MTczOTYyODQ2MywicGF0aCI6Ii8zODkyNjM0LzMxMDIxMDU4MC00MDFhOTI4MS1lYjA3LTRkMGMtODBiMS03OTdiMWFlNDUzNTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTVUMTQwNzQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODllNTZiYmQ0MGFlZWJiNTY0YmRjZjM2M2U2OTYyOWYxNzU3NmNhOWVlYzZlOWMwYjQwNzI0NjFkMzcyYTliMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.CMnWRiuojSBvxhx_laAfakprSYUBtyFW3I_GYefEjDY)
So, is any of this perfect? Clearly not. But barring a full solution to the underlying issue, there seems to be a significant stability and accuracy gain in KHARMA from using reconstructed B field values at faces, rather than replacing them with the "true" values, which is why I wanted to open this combo bug/PSA. I'll be adding an option
flux/consistent_face_b
to dev, which can be set to false to use the reconstructed values.The validity of the resulting scheme is hard to gauge, since the values really only differ outside the regime where it's easy to test convergence. I'd be happy to know a) if the reconstructed-faces scheme is clearly bad from a theoretical perspective, or if not, how to verify it better, b) any speculation as to why replacement doesn't work well in KHARMA, when clearly it does in AthenaK, despite using a supposedly identical algorithm for this test (same inversion, B field upwinding, reconstruction, integrator, and floor values, at least).
The text was updated successfully, but these errors were encountered: