fusion-energy / openmc-plasma-source

Creates a plasma source as an openmc.source object from input parameters that describe the plasma
MIT License
26 stars 11 forks source link

What do you think? #1

Closed RemDelaporteMathurin closed 2 years ago

RemDelaporteMathurin commented 2 years ago

@Shimwell what do you think of this?

I've implemented the method of this paper in this python code

What I didn't realise at first is that it's in fact what Andy did in parametric-plasma-source....

image

RemDelaporteMathurin commented 2 years ago

image And this is H-mode

shimwell commented 2 years ago

That is super, very handy for plotting the neutron distribution within a tokamak plasma.

Yep that is the same set of equations implemented in the parametric plasma source (which I believe is currently not working).

RemDelaporteMathurin commented 2 years ago

I mean we could also use it for neutronics simulations (not only for plotting) instead of a single ring source

I suppose these would be the ring sources locations? and the neutron source density would be the openmc.source.strength.

Shall I try and wrap up an example?

shimwell commented 2 years ago

Could do, it might not scale well to large numbers of points.

The memory requirements of a simulation with 1e9 particles might be quite large and the use of python to generate the source means the coordinates and potentially also the energy would be written to the xml file as plan text. One could avoid writing out the energy by using the Muir distribution and assume an even temperature across the volume or nested subsections of the volume.

We have previously implemented a plasma source from a h5 file which was a collection of points and it resulted in a large Gb size file.

The parametric-plasma-source makes the points on the fly which is probably the correct way to go but tricky to get it working.

So yes I think it would be worth a try, might not be ideal for large numbers of particles but perhaps low particle high batches would work reasonably well.

RemDelaporteMathurin commented 2 years ago

Ok I've added this example.

What do you think? It doesn't seem that it's writing any file though? EDIT: oops yes it is writing files...

RemDelaporteMathurin commented 2 years ago

Could do, it might not scale well to large numbers of points.

Well if we don't use XYZ points but rather RZ points for ring sources, it greatly reduces the number of points required (down to only 1000 on the figures above).

RemDelaporteMathurin commented 2 years ago

The memory requirements of a simulation with 1e9 particles might be quite large and the use of python to generate the source means the coordinates and potentially also the energy would be written to the xml file as plan text. One could avoid writing out the energy by using the Muir distribution and assume an even temperature across the volume or nested subsections of the volume.

Well the ion temperature in the Muir distribution for each ring source can directly be taken from the Plasma() object. I've modified the example script accordingly: https://github.com/fusion-energy/plasma-source/blob/f9e80220b191bdf4bad6a94cc5ff8954168ccf76/openmc_example.py#L41

shimwell commented 2 years ago

It looks like you have got a nice source here. The use of Muir is a bit of an approximation as the temperature varies across the plasma but I would keep it as is. RZ instead of XYZ saves a nice amount of space.

The example looks nice, perhaps another function that returns an openmc.Source and then it can accept arguments like fuel (DD or DT), number of particles in sample

RemDelaporteMathurin commented 2 years ago

It looks like you have got a nice source here. The use of Muir is a bit of an approximation as the temperature varies across the plasma but I would keep it as is.

But in the example I show, the temperature also varies accross the plasma. See below image So it should not be such an approximation right?

The example looks nice, perhaps another function that returns an openmc.Source and then it can accept arguments like fuel (DD or DT), number of particles in sample

I'm working on adding an openmc.Source method (or rather a list of openmc.Source)

shimwell commented 2 years ago

oh sorry yes you have a nice distribution of temperature there. Sorry I misunderstood the .strength part, I have reread it. Yep this looks great. Happy to help package (pip installer, testing etc) it up if that helps.

RemDelaporteMathurin commented 2 years ago

So strengths is the neutron source density (left) and temperatures is the ion temperature in keV (right)