Skip to content

ORNL-Fusion/p2f

Repository files navigation

p2f

particle to distribution function

The two example cases have "real" Maxwellian distrubtions, i.e., more particles at the thermal velocity rather than a uniform velocity space grid and variable weight.

These sample particle lists (the "f.nc" files) are created using an IDL script available in the sMC repository using the following command

IDL> create_test_particle_f, /standard_maxwellian_3d, energy_keV=0.5, n_particles=10000, eqdsk='eqdsk', density_m3=1e13, Z=1.0, amu=1.0

This will create a uniform (flat) density / uniform temperature (Maxwellian) particle list with vTh=sqrt(3kT/m)

There are 3 smoothing options that p2f provides ...

  • No smoothing at all, i.e., just a histogram.
DistributeAlongOrbit = .false.
gParticle = .false.
lap101336:Cmod_case dg6$ mpirun -n 4 ~/code/p2f/xp2f.lap101336
...
 Time taken:    1.46319294
 Total number of particles:        10000
Outside the rbbbs/zbbbs box:  0.00%
TookMaxStepsBeforeBounce:       0.00%
   *** this means you need a larger MaxSteps
Wall:       0.00%
Bad:        0.00%
off_vGrid:   0.000%   *** only applicable for gParticle = .false.
badWeight:  0.00%
badEnergy:  0.00%
Suggested eNorm:  46.2 keV
max ( density ): 0.50E+14
TotalNumberOfParticles: 0.91E+13

We can then run the IDL post processing script to look at the result

IDL>plot_p2f
Total number of particles :   9.05862e+12

No smoothing f0

  • Distribute a particle along its guiding center orbit according to how long it spends in each velocity space bin
DistributeAlongOrbit = .true.
gParticle = .false.
lap101336:Cmod_case dg6$ mpirun -n 4 ~/code/p2f/xp2f.lap101336
...
 Time taken:    6.24949074
 Total number of particles:        10000
Outside the rbbbs/zbbbs box:  0.02%
TookMaxStepsBeforeBounce:       0.00%
   *** this means you need a larger MaxSteps
Wall:       4.68%
Bad:        0.00%
off_vGrid:   0.000%   *** only applicable for gParticle = .false.
badWeight:  0.00%
badEnergy:  0.00%
Suggested eNorm:  46.2 keV
max ( density ): 0.17E+14
TotalNumberOfParticles: 0.86E+13
IDL>plot_p2f
Total number of particles :   8.63503e+12

The number of total particles is LOWER here by the 4.69% that were lost due to their orbits going outside the LCFS, i.e., they should never have really been in the particle list in the first place. No smoothing

  • Distribute and use a gaussian particle shape in velocity space
DistributeAlongOrbit = .true.
gParticle = .true.
particleSize = 4.0e-04
lap101336:Cmod_case dg6$ mpirun -n 4 ~/code/p2f/xp2f.lap101336
...
 Time taken:    34.6992073
 Total number of particles:        10000
Outside the rbbbs/zbbbs box:  0.02%
TookMaxStepsBeforeBounce:       0.00%
   *** this means you need a larger MaxSteps
Wall:       4.68%
Bad:        0.00%
off_vGrid:   0.000%   *** only applicable for gParticle = .false.
badWeight:  0.00%
badEnergy:  0.00%
Suggested eNorm:  46.2 keV
max ( density ): 0.17E+14
TotalNumberOfParticles: 0.86E+13
IDL>plot_p2f
Total number of particles :   8.57142e+12

No smoothing