-
Notifications
You must be signed in to change notification settings - Fork 40
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
[WIP] Add TGLF transport models and surrogates #477
base: main
Are you sure you want to change the base?
Conversation
5c2a110
to
6a95a95
Compare
@lorenzozanisi could you lend a hand with checking the normalisations? |
@lorenzozanisi ready for your bits to be integrated as and when! |
Nice WIP. It is a pain to get these normalizations & miller geometry. I wonder if using the pyrokinetics would be of interest? Is there a plan to push this through in any of the next few weeks? I've got a TGLF surrogate as well, was thinking to test it in TORAX alongside ASTRA (current approach) to possibly cover model validation/comparison. I think there are also a few tglf inputs missing, namely I would be happy to contribute these. |
@fusionby2030 welcome to this PR! Glad that it might be useful to you!
Good shout - @jcitrin are you aware of pyrokinetics? I've basically been using its documentation (+Bhavin Patel, one of the developers) as my reference for trying to hook these TGLF bits in to TORAX. I feel like if there is interest in TORAX become a one-stop-shop for gyrokinetics surrogates taking advantage of the work done in pyrokinetics would be a bit of a no-brainer.
Super interested in this, keep me posted!
Yep, our surrogate doesn't use the full set of TGLF inputs (for reasons that @lorenzozanisi would be able to explain - I wasn't involved in its development!). Makes sense to extend it to the full load and make some optional or something. Please go ahead with adding whatever you need! Admin-wise, can you add to this PR given it's from a fork? Or would it need to be a branch?
@lorenzozanisi and I were tag-teaming a bit on this PR - I think Lorenzo wanted to connect full TGLF to TORAX, and has made big strides in the week before Christmas on it. Not sure where those commits are - I keep poking him to push them! Along the way, we also found a few bits that were needed to be changed more widely, such as #628 that Jonathan handled. Definitely on the agenda on UKAEA's side for January! |
To add to the pyrokinetics discussion, there are ways (albeit hacky) of passing
I have no idea how @lorenzozanisi is planning on running TGLF from TORAX without lots of IO. Would be nice if there was a python interface to TGLF... Might be best to wait until January then, am trying to coordinate a visit to Culham in February. |
I have pushed my WIP commits, sorry for not doing this earlier @theo-brown. These are not tested yet so don't attempt to use them, they are here so you can see how I am approaching the issue. @fusionby2030 Note that these commits include only the inputs specific to the NNs that I have made - so this is by no means general (and it's @fusionby2030 Note that even for QuaLiKiz not all inputs are used currently. I am not sure whether the plan is to eventually make TORAX capable of handling any number of inputs. @jcitrin how is this being handled to generalise from the 10D to the 11D case? I like the idea of including Pyro, but it sounds like TORAX is not fully IMAS compatible.
I am simply writing to the input files and running TGLF, similarly as it is done for QuaLiKiz. I shall crack on with testing my implementation now. |
fe9be98
to
1b0f261
Compare
With the open-sourcing of IMAS I would hazard a guess that IMAS compatability is moving up the priority list... |
Hi all. Thanks for this great discussion. I am aware of pyrokinetics. Garud Snoep also has gyrokit which is similar but I think he didn't open source it yet.
The QuaLiKizInputs dataclass has all that's needed for the 11D case, of which the 10D is a subset. They both have access to the same dataclass and take what they need. The plan for now is to extend these dataclasses with new inputs when necessary. e.g., we don't have a rotation profile in TORAX (easy to add when needed, although momentum transport is a task) , and when we have it we can extend to the rotation related inputs.
It may be interesting to use pyrokinetics in the future. Best would be to extend pyrokinetics itself to support "TORAX" sources of equilibrium and kinetic data. I suggest this is done after an upcoming API and variable renaming change that we are considering for the next version. Would need to consider performance and JAX compatibility though, especially with TGLF-NN. For TGLF itself this matters less since can run without JAX compilation, but there should be the same interface for TGLF and TGLF-NNs. |
Also includes electron-electron collision formula
0031270
to
08d11d9
Compare
5681d7a
to
6b62f36
Compare
I've updated the TGLFInputs to use the normalized gradients and chiGB functions. For reference, the normalisations in TGLF are as follows. TGLF normalisationIn TGLF [1], where [2], TORAX normalisationwhere Hence, and therefore with I haven't yet checked that the conversion from |
Add support for TGLF-based transport models, including coupling to full TGLF and TGLF-NN surrogates.
Remaining tasks:
TB:
LZ:
Future: