Soller_trans.comp
Dr. Georg Artus
Georg_Artus at Physik.TU-Muenchen.DE
Fri Jun 25 11:10:42 CEST 1999
Hello Kristian,
I just modified the component Soller to Soller_trans. The new component
has an additional parameter transmission, which is a general
multiplicator for the transmission probability. The true transmission of
a Soller is not 1 also with a non divergent beam. For calculations of
absolute fluxes this is important.
Because I am not experience with C (I just checked Soller.comp by
mathematical undterstanding) I don´t want to send the new component to
the mailing-list directly. I also didn´t add a check whether the given
parameter ´transmission´ lies between 0 and 1.
Our tests indicate that the component works correctly. May be you can
have a look at the file.
Georg
--
*********************************************
Dr. Georg Artus
Technische Universitaet Muenchen
Neue Forschungs-Neutronenquelle Garching
D-85747 Garching
Tel: +49 (0)89/289-14675
Fax: +49 (0)89/289-14666 or 12112
E-mail: gartus at ph.tum.de
-------------- next part --------------
/*******************************************************************************
*
* McStas, version 1.0, released October 26, 1998
* Maintained by Kristian Nielsen and Kim Lefmann,
* Risoe National Laboratory, Roskilde, Denmark
*
* Component: Soller_trans
*
* Written by: KN, August 1998
* Modified by: GA, June 1999
*
* Soller collimator with rectangular opening and specified length. The
* transmission function is an average and does not utilize knowledge of the
* actual neutron trajectory.
* A zero divergence disables collimation (then the component works as a double slit).
* Added is an additional parameter ´transmission´ to take into account the
* transmission probability.
*
* INPUT PARAMETERS:
*
* xmin: (m) Lower x bound on slits
* xmax: (m) Upper x bound on slits
* ymin: (m) Lower y bound on slits
* ymax: (m) Upper y bound on slits
* len: (m) Distance between slits
* divergence: (minutes of arc) Divergence angle (calculated as atan(d/len),
* where d is the blade spacing)
* transmission: (1) 0<=transmission<=1)
*
*******************************************************************************/
DEFINE COMPONENT Soller_trans
DEFINITION PARAMETERS (xmin, xmax, ymin, ymax, len, divergence, transmission)
SETTING PARAMETERS ()
OUTPUT PARAMETERS (slope)
STATE PARAMETERS (x,y,z,vx,vy,vz,t,s1,s2,p)
DECLARE
%{
double slope;
%}
INITIALIZE
%{
slope = tan(MIN2RAD*divergence);
%}
TRACE
%{
double phi, dt;
PROP_Z0;
if (x<xmin || x>xmax || y<ymin || y>ymax)
ABSORB;
dt = len/vz;
PROP_DT(dt);
if (x<xmin || x>xmax || y<ymin || y>ymax)
ABSORB;
if(slope > 0.0)
{
phi = fabs(vx/vz);
if (phi > slope)
ABSORB;
else
p *= transmission*(1.0 - phi/slope);
}
%}
MCDISPLAY
%{
double x;
int i;
magnify("xy");
for(x = xmin, i = 0; i <= 3; i++, x += (xmax - xmin)/3.0)
multiline(5, x, (double)ymin, 0.0, x, (double)ymax, 0.0,
x, (double)ymax, (double)len, x, (double)ymin, (double)len,
x, (double)ymin, 0.0);
line(xmin, ymin, 0, xmax, ymin, 0);
line(xmin, ymax, 0, xmax, ymax, 0);
line(xmin, ymin, len, xmax, ymin, len);
line(xmin, ymax, len, xmax, ymax, len);
%}
END
More information about the mcstas-users
mailing list