Scoring energy-dependent neutron flux through a cylindrical surface

_Geant4 Version:_11.1.2
_Operating System:_Ubuntu 22.04.4 LTS
_Compiler/Version:_11.4.0
_CMake Version:_3.22.1

Hello,

I’m trying to score the neutron flux through a cylindrical surface using command-based scoring. I have the following syntax in my macro

/score/create/cylinderMesh scoringMesh
/score/mesh/cylinderSize 29.5275 44.5 cm
/score/mesh/translate/xyz 0.0 0.0 -20.5 cm
/score/mesh/nBin 1 1 1
/score/quantity/flatSurfaceFlux cSFn
/score/filter/particle neutronFilt neutron
/score/dumpQuantityToFile scoringMesh cSFn neuFlux.txt
/score/close

but I’m getting zero results in the neuFlux.txt file. I tried the solution in Scoring output with zeros from dumpQuantityToFile - #5 by Rohit_Yadav by putting the scoring syntax after the /run/beamOn line but this doesn’t make a difference. What am I doing wrong?

I also wanted to ask if it’s possible to do energy-binning for the flux this way?

Thanks in advance,

Emma

The command line
/score/dumpQuantityToFile scoringMesh cSFn neuFlux.txt
should be applied AFTER you complete the run (i.e. after /run/beamOn).

As you are using a cylindrical mesh, you must use cylinderSurfaceFlux scorer rather than flatSurfaceScorer.

In addition, please note that cylinderSurfaceFlux scores the flux of the inner surface of the cylinder. So, if the number of bins in R is 1 (i.e. the inner radius is zero), it scores the flux of particles that are crossing the z-axis (technically it is zero). Thus, if you want to score the flux at r = 29.5275 cm, you need to add
/score/mesh/cylinderRMin 29.5275 cm
and the radius of the cylindrical mesh should be larger than this inner radius.

Taking all of above, you may try the following.

/score/create/cylinderMesh scoringMesh
/score/mesh/cylinderSize 30.0 44.5 cm
/score/mesh/cylinderRMin 29.5275 cm
/score/mesh/translate/xyz 0.0 0.0 -20.5 cm
/score/mesh/nBin 1 1 1
/score/quantity/cylinderSurfaceFlux cSFn
/score/filter/particle neutronFilt neutron
/score/close

/run/beamOn nnnnn
/score/dumpQuantityToFile scoringMesh cSFn neuFlux.txt

Concerning about “energy binning”, cylinderSurfaceFlux scorer supports the filling of 1-D histogram to plot energy spectrum, but it works only if it is assigned to a volume in the real world. It cannot fill a histogram if it is assigned to a mesh.

If you are OK to score a flux on a flat surface of a small cube (we call it “probe”), you can plot energy spectrum. For example.

/score/create/probe Probe 5.0 cm <== half width of probe
/score/probe/locate
/score/quantity/volumeFlux neutronFlux
/score/filter/particle neutronFilter neutron
/score/close

/analysis/h1/create neutronFlux NeutronEnergyFlux 100 0.01 1000. MeV ! log
/score/fill1D 1 Probe neutronFlux <=== “1” means the histogram ID

/run/beamOn nnnnn

Then use some analysis UI commands to dump the histogram or directly plot it to a Postscript file.

Hi Makoto

Thank you for your response. I have done as suggested and modified the macro, but now I’m getting a segmentation fault when I try to run. My macro is as follows:

/control/cout/ignoreThreadsExcept 0
/control/verbose 0

/gps/particle proton

/gps/pos/type Plane
/gps/pos/shape Annulus
/gps/pos/centre 0.0 0.0 0.0 cm
/gps/pos/inner_radius 49.3 cm
/gps/pos/radius 49.4 cm
/gps/pos/halfz 64.82 cm

/gps/ang/type iso
/gps/ene/type Arb
/gps/ene/diffspec false

/gps/hist/type arb
/gps/hist/point 1.00E+00 1.1768E-02

/gps/hist/point 1.00E+05 4.9885E-05
/gps/hist/inter Lin

define scoring

/score/create/cylinderMesh scoringMesh
/score/mesh/cylinderSize 30.0 44.5 cm
/score/mesh/cylinderRMin 29.5275 cm
/score/mesh/translate/xyz 0.0 0.0 -20.5 cm
/score/mesh/nBin 1 1 1
/score/quantity/cylinderSurfaceFlux cSFn
/score/filter/particle neutronFilt neutron
/score/close

/tracking/verbose 0

/run/verbose 0
/run/beamOn 10000

/score/dumpAllQuantitiesToFile scoringMesh neuFlux.txt

So I’ve defined an energy-dependent cylindrical proton flux outside the geometry. Could the segmentation fault possibly be caused by the way I have defined the GPS source?

Thanks in advance,

Emma

Hi Makoto

Just an update, I changed the physics list to the pre-defined list QGSP_BIC_AllHP since I think this will be more suitable for my application, now when I run with the above macro I get:

***** COMMAND NOT FOUND </score/quantity/cylinderSurfaceFlux cSFn> *****

I understand that cylinderSurfaceFlux is no longer available?

Thanks,

Emma