ustajan / grasshopper

GNU General Public License v3.0
6 stars 4 forks source link

Fixing bin bias with input_spectrum.txt + allowing for a discrete input energy spectrum #9

Closed plalor closed 4 years ago

plalor commented 4 years ago

When sampling from input_spectrum.txt, rather than use the value of one bin edge, adds logic for improved Interpolation between bin edges. There are three modes, set by specifying beam energy, i.e.

quantity name="BeamEnergy" type="energy" value="-2" unit="MeV"

energy = -1 MeV ⇒ 1st order interpolation energy = -2 MeV ⇒ 2nd order interpolation energy = -3 MeV ⇒ no interpolation (for discrete energy spectra) All other negative values default to 1st order interpolation.

As an illustrative example, consider an neutron source using a (relatively coarse) Watt spectrum in a vaccum geometry (visualization of geometry at bottom).

Current grasshopper version: Old

1st order interpolation: 1st order interpolation

2nd order interpolation: 2nd order interpolation

No interpolation: No interpolation

The no interpolation option is useful for spectra that take on discrete values, such as with gammas. In this case, the structure of input_spectrum.txt is the same, but energies are sampled at exactly the values given (weighted appropriately) with no interpolation between bins.

Simple geometry from above simulations: geom

ustajan commented 4 years ago

Thank you for the detailed documentation.