[mcstas-users] [BULK] Virtual source with fixed-m divergence

Peter Kjær Willendrup pkwi at fysik.dtu.dk
Thu Mar 11 11:37:47 CET 2021


Hi Jörg,

Yes, this sort of thing is entirely possible. :-)

The EXTEND block is simply glued on “at the end” of the other stuff the component does within TRACE.

Relevant building blocks are these:

1) The neutron state,
x,y,z,vx,vy,vz,sx,sy,sz,t,p

2) Conversion factors from mcstas-r.h:
#define AA2MS    629.622368        /* Convert k[1/AA] to v[m/s] */
#define MS2AA    1.58825361e-3     /* Convert v[m/s] to k[1/AA] */
#define K2V      AA2MS
#define V2K      MS2AA
#define Q2V      AA2MS
#define V2Q      MS2AA
#define SE2V     437.393377        /* Convert sqrt(E)[meV] to v[m/s] */
#define VS2E     5.22703725e-6     /* Convert (v[m/s])**2 to E[meV] */

3) Our RNG functions like these
rand01()
rand0max()
randpm1()
randnorm()
randtriangle()
randminmax()
randvec_target… functions like they are e.g. used in sources and samples

Best
Peter

On 11 Mar 2021, at 11.09, Voigt, Jörg <j.voigt at fz-juelich.de<mailto:j.voigt at fz-juelich.de>> wrote:

Hi Thierry,

can one realize this by a source that selects the transverse momentum k_x and k_y by a Monte Carlo choice?
Simply “Extending” the source component?

Regards

Jörg

On 11. Mar 2021, at 10:20, Andrew Wildes <wildes at ill.fr<mailto:wildes at ill.fr>> wrote:

Hi Thierry,

I’m a big fan of making relative comparisons using the simplest possible source.  I first simulate a “reference” instrument before playing with parameters.  So long as the source characteristics stay the same, any changes in performance can be expressed by dividing the monitor counts for the modified instrument by the monitor counts for the reference instrument.

Consequently, I’d solve your problem by using the Source_div component and have the focus as a variable defined in the INITIALIZE section, e.g.:

DEFINE INSTRUMENT Thierry(lambda=6, dlambda=0.1,m=1)

DECLARE
%{
  double DivSource_m;
  double SourceWid = 0.1;
  double SourceHi = 0.1;

%}

INITIALIZE
%{
  DivSource_m=m*0.1*lambda;
%}

TRACE
COMPONENT Centre = Progress_bar()
  AT (0, 0, 0) ABSOLUTE

/*******************************************************/
/******************* Source ****************************/
/*******************************************************/
COMPONENT source = Source_div(
xwidth   = SourceWid,
yheight  = SourceHi,
focus_aw = DivSource_m,
focus_ah = DivSource_m,
lambda0  = lambda,
dlambda  = dlambda,
gauss    = 0)
 AT (0,0,0) ABSOLUTE

END

(Please forgive any direct programming errors).

I suspect that there might be a problem with my relative comparisons if you change the source divergence between instruments as the flux at your target might change.  Someone might be able to advise on that.

Cheers,

Andrew



On 10 Mar 2021, at 16:46, Thierry Bigault <bigault at ill.fr<mailto:bigault at ill.fr>> wrote:

Dear McStas,

Here is my problem:
I would like to simulate the exit of a cold neutron guide with a source. The aim is to concentrate on the instrument optics, without having to calculate all the guide from the reactor.
A simplified and quite general description of a guide exit is a beam with a fixed "m-value" divergence: for a given wavelength, the width of the angular divergence (either box-type, Gaussian or whatever) is essentially proportional to the m-value of the guide coating and to the wavelength.
If the guide has different supermirror coatings on horizontal and on vertical faces, this leads to different angular widths.
I assume the beam characteristics does not depend on the position at the guide exit in this approach.
My question is : what is the simplest way to simulate such a secondary (or virtual) source in McStas ? I only found components where the angular width is geometrically fixed (in degrees), therefore wavelength-independent.
Ideally I would also like to include a non-flat wavelength intensity distribution, but this can probably be done by adding a Filter_gen after the source.
I am thinking of making several calculations at different wavelengths, but if anyone knows a all-in-one solution I am interested.

Thierry

_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users

_______________________________________________
mcstas-users mailing list
mcstas-users at mcstas.org<mailto:mcstas-users at mcstas.org>
https://mailman2.mcstas.org/mailman/listinfo/mcstas-users


Peter Kjær Willendrup
Forskningsingeniør, Specialkonsulent
Næstformand for DTU Fysik LSU

DTU Physics


[cid:b6339554-7f28-441d-9f31-5944f811397c at win.dtu.dk]


Technical University of Denmark


[cid:e108e480-fcab-46e2-9531-b38165079572 at win.dtu.dk]



Department of Physics
Fysikvej
Building 307
DK-2800 Kongens Lyngby
Direct +45 2125 4612
Mobil +45 2125 4612
Fax +45 4593 2399
pkwi at fysik.dtu.dk<mailto:pkwi at fysik.dtu.dk>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20210311/39011fc0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 58 bytes
Desc: image001.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20210311/39011fc0/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 1055 bytes
Desc: image002.gif
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20210311/39011fc0/attachment-0003.gif>


More information about the mcstas-users mailing list