namurphy / SunNEI

Non-equilibrium ionization modeling in the solar corona and wind
MIT License
1 stars 2 forks source link

CHIANTI and ChiantiPy #4

Open wtbarnes opened 7 years ago

wtbarnes commented 7 years ago

This is a very interesting project! Much of my research (coronal loop physics) involves calculating NEI states for impulsively heated loops so I was excited to find another Python project with this same goal.

I noticed that you're storing and maintaining your own set of atomic data. Have you considered using the CHIANTI atomic database via ChiantiPy? (full disclosure: I am one of the maintainers of this project). It is still a bit rough around the edges, but would really benefit from more users, feedback, and contributions!

Do you have any documentation/notebooks/scripts showing how to use SunNEI?

namurphy commented 7 years ago

Your research also sounds very interesting as well! We are very familiar with CHIANTI as that is the database that my collaborator Chengcai Shen has been using for his non-equilibrium ionization calcuations, which have mostly been taking MHD simulations of the solar wind or CMEs (e.g., Shen et al. 2013) and doing a post-processing NEI analysis on them using a Fortran code that he wrote (see Shen et al. 2015) to make predictions about observables. We ported some of his Fortran code to Python for use by a student who worked on a project last summer. Chengcai got his atomic data using the CHIANTI IDL interface, so that is what we used to generate the data rather that re-write code with ChiantiPy. I wasn't able to find any NEI routines within ChiantiPy, and the Python inferface for AtomDB is in a very early stage of development, so we went ahead and wrote our own. I've learned a lot of Python in the last year, so if I had to do this over I would have taken a more object-oriented approach (inspired by the approach taken by Dedalus) and improved the way data was stored since it's a little clunky. I have had to focus on different projects lately so I haven't been able to make these improvements, unfortunately. I'll try to put together some examples/better documentation in the next couple of days.

Just in case I'm missing something...does ChiantiPy have any built-in non-equilibrium ionization modeling capabilities? If not, would it be within the scope of the project to add NEI capabilities to it? That would be great functionality to make sure is included. I personally think ChiantiPy would be a better place to include it rather than a standalone package. What would you think of the possibility of collaborating and incorporating the functionality of SunNEI and/or your NEI codes into ChiantiPy?

wtbarnes commented 7 years ago

The Shen 2013 paper you attached is very interesting. We're doing some similar work, but with loops in AR cores instead of CMEs. I was also not aware of the Shen 2015 paper. Our group maintains a similar code, the details of which can be found in this paper. I've also implemented a version of this algorithm in Python, using Numba, as a part of another package I am working on. It is not well documented and still needs a bit of work.

Neither the IDL interface to CHIANTI nor ChiantiPy provide NEI routines. However, ChiantiPy does provide the interface to the ionization and recombination data needed for the NEI calculation. So in principle, with a package like sunNEI, you could have the CHIANTI database and ChiantiPy as dependencies rather than maintaining your own set of atomic data. I do like the idea of having an easy to use NEI solver in Python and I agree with your point about the standalone package versus ChiantiPy. It does seem a bit strange that this calculation has not been standardized in some package since it is a fairly routine thing to do.

While I do think an NEI solver is in the scope of ChiantiPy, right now we are mainly focusing on fixing and maintaining the features we already have. That being said, I think this should be on the roadmap of things to implement in the future...

Either way, I would be interested in pooling our efforts to create a common NEI solver in Python, perhaps using something like Numba or Cython for speed and ChiantiPy for the data. There's just the question of where this code would live.