Implement pure Braginskii closure in diffusive processes, fix bugs in conductivity, add more sheath diagnostics
Intro Closure refers to, among other things, the formulations for particle diffusion, conduction and viscosity. Standard Braginskii closure is only valid when there is only one heavy ion in the system (i.e. no impurities or other species like He and T). The current gold standard is Zhdanov closure (see Makarov 2021, 2023) which is implemented in all the other leading edge codes. Zhdanov is complicated and we don't have it yet.
In order to do a bit better than Braginskii, Hermes-3 currently keeps the Braginskii formulations but considers all enabled collisions (en, nn, ni) and charge exchange for a particular species. This at least enables some accounting of secondary ion species. However, it is likely really no substitute for Zhdanov and we must implement it as soon as we can.
While the current closure setup is better than Braginskii in a multispecies scenario, it makes code comparison and verification tricky. This PR implements the ability to switch to pure Braginskii for this reason. For neutral diffusion, the SOLPS AFN (see Horsten 2017) model considers CX and IZ rates and this is also reproduced here. Note: To preserve reasonable collisionality in a multi-ion setup, ei and ii collisions as well as charge exchange consider all available ions.
Here are the Braginskii collision choices for each process:
- Neutral diffusion: CX, IZ
- Electron conduction: ee
- Ion conduction: ii
- Ion viscosity: ii
This PR
This PR modifies the ways collisions are saved. Instead of dumping everything into a sum in species["collision_frequency"], each collisional process is now registered under its own name, e.g. species["collision_frequencies"]["d_d+_iz"] and each process that requires collisions must pick specific collisions out depending on whether we want to have the multispecies model or the Braginskii model.
There are additional changes:
- Resolved the sqrt(2) mistake in the electron collision time: https://github.com/bendudson/hermes-3/issues/234
- Resolved incorrect kappa constant in neutral parallel conduction (previously assumed same as ions which is not correct, see Power 2023 thesis)
- Added sheath diagnostics for particle and heat flux in source form
Note: the collision selector has been done in a really awful way - it needs refactoring. Unfortunately I have no time to do this right now and even though it's ugly it works, so let's merge it and raise an issue.
To do:
- [x] Allow
collisions.cxxto save individual frequencies - [x] Allow hydrogenic ionisation and CX to save individual frequencies
- ~[ ] Implement for Ne and ADAS reactions?~
- [x] Allow conduction and viscosity to pick individual frequencies
- [x] Allow the neutral transport model to pick individual frequencies in 1D
- [x] Allow the neutral transport model to pick individual frequencies in 2D
- [x] Make sure this handles lack of collisions with an Exception
- [x] Test
- [x] Add to
evolve_energy.cxx - [x] Test with evolve_energy
- [x] Add documentation
- [x] Add documentation on tau_ee choice and references
- [x] Rename "legacy" to "multispecies", also in docs
- [x] Merge master into this PR
- [x] Separate neutral and ion parallel conduction collisionalities in evolve_pressure
- [ ] Separate neutral and ion parallel conduction collisionalities in evolve_energy
- [ ] Test on evolve_energy
- [ ] Check ion_viscosity in multispecies mode
To check: ensure there are any instances of recombination/ionisation adding collision frequencies towards the electrons
Currently if no collisions are found, there will be a console print going forever like this:
e conduction collisionality mode: 'braginskii' using
The code needs to handle the lack of collisions with an exception when Braginskii is chosen.
Need to decide whether Braginskii or legacy should be default. Arguably fewer people do multi-ion stuff, so maybe Braginskii should be the default setting?
I think we should implement the collisions so that the rates are Braginskii when only one ion species is used. Charged particle collisions in the collisions component uses the Hinton formula (https://hermes3.readthedocs.io/en/latest/components.html#collisions) that is the same as Fitzpatrick's Braginskii collision frequency for e-i and i-i collisions.
Agreed. Implementing that on top of the way I've currently implemented the collision selector may get even more messy though. Could you take a look at what I've done and see how it can be simplified? My C++ is still not great yet. I am wary of merging this PR because of how janky the system is. Maybe the collision selector class needs to perform all of the selection within it, and evolve_pressure could just ask for a conduction rate, reducing its footprint there to one line.
The issue is that I don't have a lot of time for refactoring at the moment - I am behind on a lot of stuff.
@bendudson ready for review/merge
Wondering if renaming legacy to multispecies would be better.
This isn't trivial to merge - it's been merged with sheath-diagnostics and had the suppress_outflow functionality implemented which have now been superseded by the implementation in parallel-sheath. I need to untangle that bit from it before we merge it in.
Also note that this PR features a lot of line changes; I refactored the flux/flow calculations so that they are more clear (just like in neutral_boundary)
Enabling ion viscosity with viscosity_collisions_mode = multispecies leads to an error where no collisionalities are found. I'm using CX and IZ along with the following collision set:
[collisions] diagnose = true electron_electron = true ion_ion = true electron_ion = true
EN
electron_neutral = false
IN
ion_neutral = false # double counting with CX if true
NN
neutral_neutral = false