-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add simple impurity radiation model (P_imp as a fraction of P_tot_in) #572
Conversation
@Nush395 if you've got time, could you lend a hand with this? I have a couple of questions about implicit sources and sources that link back. At the moment I'm finding that my implementation is nonzero when I inspect it during runtime but has no effect on the state. In the output, it is 0. |
Yes for sure! Happy to answer questions, feel free to drop them on this PR or we can go over on a call if that's easier :) |
Just took a quick look at the change. Just a sanity check, have you run the
? |
Ah, thanks for spotting that. That would be why it wasn't being used! I'll do that and then see where I get to. Sorry for not spotting the obvious thing! |
No worries at all, I've run into that gotcha myself! |
As of 69f5ada, unit tests fail because I've added a term to post_processed_outputs that is not present in all of the current |
There is, there is a |
@Nush395 it now makes sense to ask my questions!
|
Required regenerating some integration tests with new Prad output
Use source_builder in all tests, except from BootstrapCurrentSource and QeiSource
3cd6cad
to
7a0936a
Compare
For the time being I've gone for only inheriting from
I couldn't quite figure out why |
f737ad0
to
601cde4
Compare
Hey Theo, sorry for the slow response on this.
In the general case I'd advise inheriting from
That's a good question. Taking a quick look now it doesn't seem there is one which is something we can rectify. Thanks for raising this. |
For |
I'm more than happy to tackle this in a separate PR if you want to have a look at the ohmic source? Unless you'd rather do both! |
That would be great if you have time, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really great, thanks!
Appreciate also the extensive testing + extensions to the tests.
torax/tests/test_data/test_changing_config_before_BASE_171788.nc
Outdated
Show resolved
Hide resolved
torax/tests/test_data/test_changing_config_before_LOCAL_171788.nc
Outdated
Show resolved
Hide resolved
torax/tests/test_data/test_changing_config_before_REMOTE_171788.nc
Outdated
Show resolved
Hide resolved
6318b87
to
fab79cf
Compare
Rename to impurity_radiation_heat_sink Exclude all sinks from the Ptot calculation Use geo.volume_face[-1] rather than recalculating the integral
fab79cf
to
0d242e4
Compare
283730c
to
576c995
Compare
Regarding the changed .nc files: these are due to From what I can tell, tests in this file produce output .nc with all of the post-processed outputs, regardless of whether the corresponding source etc are enabled. I couldn't quite pinpoint why this is the case. It's most likely a bug. As I've added |
3435c5b
to
31c6971
Compare
31c6971
to
73efa05
Compare
This is a feature not a bug :) . Having zero integrated powers written even when the source isn't included in the simulation was part of the design. The idea was more robust analysis routines and avoiding needing to handle non-existing attributes. However this is not the case for the non-integrated source outputs, so it's a bit inconsistent. We will consider revisiting this in the near future as part of an ongoing output overhaul, and make a single convention. |
|
||
CONFIG = copy.deepcopy(test_iterhybrid_predictor_corrector.CONFIG) | ||
|
||
CONFIG['sources']['impurity_radiation_heat_sink'] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: while there is a default, in practice users will almost always set the specific fraction. So maybe good to demonstrate that with adding the runtime_param here.
@@ -145,8 +145,8 @@ | |||
suppress_zero_values=True, # Do not plot all-zero data | |||
), | |||
plotruns_lib.PlotProperties( | |||
attrs=('q_brems', 'q_rad'), | |||
labels=(r'$Q_\mathrm{brems}$', r'$Q_\mathrm{rad}$'), | |||
attrs=('q_brems', 'q_imp'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: sorry for being so nitpicky, but while the source name is impurity_radiation_heat_sink , I think it's OK to maintain the shorthand q_rad, P_rad, Q_rad on the user-facing plotting and output level, since it is the standard convention
We'll then have say q_rad, q_brems, q_cycl (coming soon) and this will be clear enough for fusion physicists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A couple of small nits. Will bring it in on our end once they're done.
Great thanks. Bringing it in. That failing test is due to the next JAX release, see #591 . No worries, should be fine in the final merge |
Merged by 0d66813 |
Add a simplified radiation sink model,
P_rad = α*(P_aux + P_alpha + P_ohmic)
This is based on the functionality in JETTO:
Todo: