A component that optimizes the neutron flux passing through the Source_Optimizer in order to have the maximum flux at the <b>Monitor_Optimizer</b> position.
Author: <a href="mailto:farhi@ill.fr">Emmanuel Farhi</a>
Origin: <a href="http://www.ill.fr">ILL (France)</a>
Date: 17 Sept 1999
Principle: The optimizer first (step 1) computes neutron state parameter limits passing in the Source_Optimizer, and then (step 2) records a Reference source as well as the state (at Source_Optimizer position) of neutrons reaching Monitor. The optimized source is defined as a fraction of the Reference source plus the distribution of ’good’ neutrons reaching the Monitor. The optimization then starts (step 3), and focuses new neutrons on the Monitor_Optimizer. In fact it changes ’bad’ neutrons into ’good’ ones (that reach the Monitor), acting on their position, spin and divergence or velocity. The overall Monitor flux is kept during process. The energy and polarisation distributions are kept during optimization as far as possible during optimisation. The optimization method considers that all neutron parameters - (x,y), (vx,vy,vz) or (vx/v2,vy/v2,v2), (sx,sy,sz) or (sx/s2,sy/s2,s2) - are independent.
Options: The optimized source can be computed regularly (’continuous’ option) or only once (’not continuous’). The time spent in steps 1 and 2 can be reduced for a shorter optimization (’auto’). The neutrons passing during steps 1 and 2 can be smoothed for a better neutron weight distribution (’smooth’ option).
Source_optimizer can be placed at any position where you want to act on the flux, for instance just after the source. Monitor_Optimizer should be placed at position(s) to optimize. I prefer to put one just before the sample.
Default parameters bins, step, and keep are 10, 10% and 10% respectively. The option string can be empty (""), which stands for default configuration that works fine in usual cases:
options="continuous optimization, auto mode, smooth, SetXY+SetDivV+SetDivS"
Possible options are
continuous for continuous source optimization (default). verbose displays optimization process (debug purpose). auto uses the shortest possible ’step 1’ and ’step 2’ and sets ’step’ value as required (default). smooth remove possible spikes generated in steps 1 and 2 (default is smooth). inactivate to inactivate the Optimizer. no or not revert next option
bins=[value=10] set the Number of cells for sampling neutron states step=[value=10] Optimizer step in % of simulation. keep=[value=10] Percentage of initial source distribution that is kept
file=[name] Filename where to save optimized source distributions (no file is generated if not given. Default ext. is .src)
SetXY Keywords to indicate what may be changed during
SetV optimisation. Default is position, divergence and spin
SetS direction ("SetXY+SetDivV+SetdivS"). Choosing the speed
SetDivV or spin optimization (SetV or SetS) may modify the energy
SetDivS or polarisation distribution (norm of V and S) as the three components are then independent.
Parameters bins, step and keep can also be entered as optional parameters.
EXAMPLE: I use the following settings
optim_s = Source_Optimizer(options="please be clever") (same as empty) (...) Monitor_Optimizer(xmin=-0.05, xmax=0.05, ymin=-0.05, ymax=0.05, optim_comp = "optim_s")
A good optimization needs to record enough non optimized neutrons on Monitor during step 2. Typical enhancement in computation speed is by a factor 20. This component usually works well.
NOTE: You must be aware that in some cases (SetV and SetS), the optimization might sligtly afect the energy or spin distribution of the source. The optimizer tries to do its best anyway. Also, some ’spikes’ may sometime appear in monitor signals in the course of the optimization, coming from non-optimized neutrons with original weight. The ’smooth’ option minimises this effect (on by default).
Parameters in boldface are required; the others are optional.
|
Name |
Unit |
Description |
Default |
|
|
|||
|
bins |
1 |
Number of cells for sampling neutron states. |
10 |
|
step |
0-100 |
Optimizer step in percent of simulation. |
0.1 |
|
keep |
0-100 |
Percentage of initial source distribution that is kept. |
0.1 |
|
options |
str |
string of options. See <b>Description<b> |
0 |
|
|
|||
|
|
|||
|
|
|||
Component source code found in file Source_Optimizer.comp.
The component Source_Optimizer is not exactly a source, but rather a neutron beam modifier. It should be positioned after the source, anywhere in the instrument description. The component optimizes the whole neutron flux in order to achieve better statistics at each Monitor_Optimizer location(s) (see section 3.9 for this latter component). It acts on any incoming neutron beam (from any source type), and more than one optimization criteria location can be placed along the instrument.
The usage of the optimizer is very simple, and usually does not require any configuration parameter. Anyway the user can still customize the optimization through various options.
In contrast to Source_adapt, this optimizer does not record correlations between neutron parameters. Nevertheless it is rather efficient, enabling the user to increase the number of events at optimization criteria locations by typically a factor of 20. Hence, the signal error bars will decrease by a factor 4.5, since the overall flux remains unchanged.
When a neutron reaches the Monitor_Optimizer location(s), the component records its previous position (\(x\), \(y\)) and speed (\(v_x, v_y, v_z\)) when it passed in the Source_Optimizer. Some distribution tables of good neutrons characteristics are then built.
When a bad neutron comes to the Source_Optimizer (it would then have few chances to reach Monitor_Optimizer), it is changed into a better one. That means that its position and velocity coordinates are translated to better values according to the good neutrons distribution tables. The neutron energy (\(\sqrt {v_x^2 + v_y^2 + v_z^2}\)) is kept (as far as possible).
The Source_Optimizer works as follow:
First of all, the Source_Optimizer determines some limits (min and max) for variables \(x, y, v_x, v_y, v_z\).
Then the component records the non-optimized flux distributions in arrays with bins cells (default is 10 cells). This constitutes the Reference source.
The Monitor_Optimizer records the good neutrons (that reach it) and communicate an Optimized beam requirement to the Source_Optimizer. However, retains ’ keep’ percent of the original Reference source is sent unmodified (default is 10 %). The Optimized source is thus:
| Optimized | = | keep * Reference |
| + | (1 - keep) [Neutrons that will reach monitor]. |
The Source_Optimizer transforms the bad neutrons into good ones from the Optimized source. The resulting optimised flux is normalised to the non-optimized one: \begin {equation} p_{optimized} = p_{initial} \frac {\mbox {Reference}}{\mbox {Optimized}}, \end {equation} and thus the overall flux at Monitor_Optimizer location is the same as without the optimizer. Usually, the process sends more good neutrons from the Optimized source than that in the Reference one. The energy (and velocity) spectra of neutron beam is also kept, as far as possible. For instance, an optimization of \(v_z\) will induce a modification of \(v_x\) or \(v_y\) to try to keep \(|\textbf {v}|\) constant.
When the continuous optimization option is activated (by default), the process loops to Step (3) every ’step’ percent of the simulation. This parameter is computed automatically (usually around 10 %) in auto mode, but can also be set by user.
During steps (1) and (2), some non-optimized neutrons with original weight \(p_{initial}\) may lead to spikes on detector signals. This is greatly improved by lowering the weight \(p\) during these steps, with the smooth option. The component optimizes the neutron parameters on the basis of independant variables (1D phase-space optimization). However, it usually does work fine when these variables are correlated (which is often the case in the course of the instrument simulation). The memory requirements of the component are very low, as no big \(n\)-dimensional array is needed.
To use this component, just install the Source_Optimizer after a source (but any location is possible afterwards in principle), and use the Monitor_Optimizer at a location where you want to reach better statistics.
1 /* where to act on neutron beam */ 2 COMPONENT optim_s = Source_Optimizer(options="") 3 ... 4 /* where to have better statistics */ 5 COMPONENT optim_m = Monitor_Optimizer( 6 xmin = -0.05, xmax = 0.05, 7 ymin = -0.05, ymax = 0.05, 8 optim_comp = optim_s) 9 ... 10 /* using more than one Monitor_Optimizer is possible */
The input parameter for Source_Optimizer is a single options string that can contain some specific optimizer configuration settings in clear language. The formatting of the options parameter is free, as long as it contains some specific keywords, that can be sometimes followed by values.
The default configuration (equivalent to options = "") is
| options | = | "continuous optimization, auto setting, keep = 0.1, bins = 0.1, |
| smooth spikes, SetXY+SetDivV+SetDivS". |
Parameters keep and step should be between 0 and 1. Additionally, you may restrict the optimization to only some of the neutron parameters, using the SetXY, SetV, SetS, SetDivV, SetDivS keywords. The keyword modifiers no or not revert the next option. Other options not shown here are:
1verbose displays optimization process (debug purpose). 2inactivate to inactivate the Optimizer. 3file=[name] Filename where to save optimized source distributions
The file option will save the source distributions at the end of the optimization. If no name is given the component name will be used, and a ’.src’ extension will be added. By default, no file is generated. The file format is in a McStas 2D record style.
As an alternative, you may use the Source_adapt component (see section 3.6) which performs a 3D phase-space optimization.