SmileiPIC / Smilei

Particle-in-cell code for plasma simulation
https://smileipic.github.io/Smilei
335 stars 119 forks source link

Get LaserGaussian2D parameters with happi.openNamelist #590

Closed noreasonatall1 closed 1 year ago

noreasonatall1 commented 1 year ago

Hi! I'm trying to sort through lots of simulations using happi.openNamelist tool. It works for getting the Main variables, what Fields were written, etc., but I don't understand how to return parameters of LaserGaussian2D (a0, waist, focus...). It only returns Laser parameters like box_side, space_envelope. Could you help me with this? Thank you in advance!

mccoys commented 1 year ago

Indeed, LaserGaussian2D is just some sort of macro that creates a Laser object (you can access it using Laser[0] for instance). But this object does not contain a0, waist, focus, etc. It contains a space_envelope profile and a phase profile that account for these parameters indirectly.

Another way to make it work is to define a0, waist etc. directly in the namelist:

a0 = 10
waist = 3 * L
.....
LaserGaussian2D( a0 = a0, waist = waist, .... )

Then access the variables as namelist.a0, etc.

noreasonatall1 commented 1 year ago

Ok, so there was no way to access them directly through openNamelist. The definition in the namelist sounds the easiest, I'll definitely implement it going further. However, if you would consider adding the option to get a0 and other parameters of LaserGaussian2D (and other built-in profiles) it would be the most welcome. Thanks!