IN6 Monochromators
Markus Poehlmann
poehlman at ill.fr
Mon Mar 6 17:34:59 CET 2000
Dear Kristian,
thank you very much for your detailled help. I think, I succeeded now
with the simplest method of rotating 7 Mosaic_anistropic components
three times. We tried the same method some weeks ago by defining a
certain Arm() for each of the 7 monochromators. But that did not work,
as Helmut wrote to you. The result was that McStas was trying to force
the neutrons from one plate to another.
Now I rotated not the arms but the Mosaic_anisotropics themselves and it
seems that it works. But in the visualisation with mcdisplay a neutron
passes still one plate after another and is not propagated before having
passed each of the seven plates in each of the 3 monochromators.
Is that only a problem of mcdisplay or is the calculation itsself like
this ? Our results seem to be correct now.
Would you plaese find attached the file in62.instr and could you please
have a look on it in respect to the problem described above.
Thanks a lot again
Markus Poehlmann
-------------- next part --------------
%include "mono2.comp"
/*%include "monoscatt.comp"
%include "monoscatt1.comp"%*/
DEFINE INSTRUMENT IN6 (lamda_i,dlamda_i)
/* A template IN6 simulation for McStas. M. Poehlmann <poehlman at ill.fr> feb 00
* input parameters :
* lamda_i : incident n-wavevector [Angs-1]
* dlamda_i: spread of incident n-wavevector [Angs-1]*/
DECLARE
%{
/* all variables defined here can be used, and modified, in the whole instrument */
/* variables used in instrument definition and for user computations */
double DM = 3.355; /* mono d-spacing (Angs) */
double DA = 3.355; /* ana d-spacing */
/* Bragg angles of the 3 monochromators */
double A1;
double A1half;
double A1strich;
double A2;
double A2half;
double A2strich;
double A3;
double A3half;
double A3,A4,A5,A6; /* geometrical angles (deg) */
double Ki; /*incident wave vector corresponding to lamda_i */
double dKi; /*spread of incident wave vector <--> dlamda_i */
double mono_q; /* Q vector for bragg scattering with monochromator */
double ana_q; /* Q vector for bragg scattering with analyzer */
double Ei = 0; /* incident n-energy */
double dEi = 0; /* energy spread of source neutrons*/
double Ef = 0; /* out-going n-energy */
double Kf = 0; /* out-going n-wavevector */
double Q = 0;
double d1 = 3.0; /*distance guide 2 <--> monochromator*/
double l2 = 2.1; /*distance monochromator 2 <--> sample*/
double li = 0.03; /*distance between 2 monochromators*/
double position_m1; /*position of monochromator 1 relative end of guide 2*/
double position_m2; /* 2 */
double position_m3; /* 3 */
char flag_scattered;
/* defintion of variables for calculation of positions of 7 monochromators*/
double r = 3.0;
int i;
double phi[7];
double z[7];
double y[7];
double x[7];
double PHI1, PHI2, PHI3, PHI4, PHI5, PHI6, PHI7;
double x_1, x_2, x_3, x_4, x_5, x_6, x_7;
double y_1, y_2, y_3, y_4, y_5, y_6, y_7;
double z_1, z_2, z_3, z_4, z_5, z_6, z_7;
%}
/* end of DECLARE */
INITIALIZE
%{
/* variables defined here are local (only in INIT section) */
/* can be computed / displayed (see below) */
double Vi = 0; /* incident n-velocity (m/s) */
double dVi; /* incident spread of n-velocity */
double Vf = 0; /* out-going n-velocity */
int SM,SS,SA; /* rotation sign */
double arg = 0; /* tempo var */
int ORDER = 1;
/* dealing with ORDERth Bragg one-neutron diffraction on mono/ana */
/* SM : scattering at mono to the right (-1)/left(+1) */
/* SS : scattering at sample to the right (-1)/left(+1) */
/* SA : scattering at analyser to the right (-1)/left(+1) */
SM = -1; SS = -1; SA = 1;
mono_q = 2*PI*ORDER/DM; /* Q mono in Angs-1 */
position_m1 = d1-li;
position_m2 = d1;
position_m3 = d1+li;
Ki = 2*PI/lamda_i;
dKi = 2*PI*dlamda_i/(lamda_i*lamda_i);
Vi = K2V*fabs(Ki);
Ei = VS2E*Vi*Vi;
dVi = K2V*dKi;
dEi = 2*VS2E*Vi*dVi;
printf("Ki=%lf\tdKi=%lf\tEi=%lf\tdEi=%lf\n",Ki,dKi,Ei,dEi);
if (dEi>Ei)
{
printf("The energy spread dEi is greater than the energy Ei.\n");
printf("Please insert a smaller dlamda_i.\n");
exit(-1);
}
/*calculate theta angles for 3 monochromators*/
A2 = asin(mono_q/2/Ki)*2;
A2 *= SM; /* A : mono theta (crystal) */
A1 = atan(l2*sin(A2)/(li+l2*cos(A2)))*RAD2DEG;
A1 *= -SM;
A1half = A1/2.0;
A3 = atan(l2*sin(A2)/(l2*cos(A2)-li))*RAD2DEG;
A3 *= -SM;
A3half = A3/2.0;
A2 *=RAD2DEG;
A2strich=-A2;
A2half = A2/2.0;
printf("A1=%lf\tA2=%lf\tA3=%lf\n",A1,A2,A3);
/* Analyzer characteristics (A5,A6 from Kf, DA) */
Vf = SE2V*sqrt(Ei); /* final energy from energy transfert */
Kf = V2K*Vf;
if (DA <= 0.1)
{
printf("TAS: Ana DA = %f Angs, too small\n", DM);
exit(-1);
}
ana_q = 2*PI*ORDER/DA; /* Q ana in Angs-1 */
if ((Kf == 0) || (fabs(mono_q/2/Kf) > 1))
{
printf("TAS: Can not reach this out-going wavevector\n");
printf(" with such an analyzer (A6)\n");
printf("Mono DA = %f Angs, requested Kf = %f Angs-1\n", DA, Kf);
exit(-1);
}
A6 = asin(ana_q/2/Kf)*RAD2DEG*2;
A6 *= SA; /* A5 : analyser theta (crystal) */
A5 = A6/2; /* A6 : analyser 2 theta (arm to detector) */
/* Sample characteristics */
arg = (Ki*Ki + Kf*Kf - Q*Q)/2/fabs(Ki*Kf);
/*if (fabs(arg) > 1)
{
printf("TAS: Can not close wavevector triangle (A4)\n");
printf("Incident Ki = %f Angs-1, Exchange Q=%f Angs-1, Final Kf = %f Angs-1\n",Ki,Q,Kf);
exit(-1);
} */
A4 = acos(arg)*RAD2DEG;
A4 *= SS; /* A4 : sample 2 theta (arm to analyser) */
/* computing of A3 requires sample reciprocal axes characteristics */
A3 = A4/2; /* A3 : sample theta
printf("IN14 at ILL 3-axis spectrometer\n");
printf("Angles (deg) A1 = %f ; A4 = %f ; A6 = %f\n",A2,A4,A6);*/
for(i=0;i<=6;i++)
{
phi[i]=(-0.087+0.029*i)/r;
x[i]=-r*(1-cos(phi[i]));
y[i]=r*sin(phi[i]);
z[i]=-r*(1-cos(phi[i]));
phi[i]*=RAD2DEG;
}
PHI1=phi[0]; PHI2=phi[1]; PHI3=phi[2];
PHI4=phi[3]; PHI5=phi[4]; PHI6=phi[5]; PHI7=phi[6];
x_1=x[0]; x_2=x[1]; x_3=x[2]; x_4=x[3]; x_5=x[4]; x_6=x[5]; x_7=x[6];
y_1=y[0]; y_2=y[1]; y_3=y[2]; y_4=y[3]; y_5=y[4]; y_6=y[5]; y_7=y[6];
z_1=z[0]; z_2=z[1]; z_3=z[2]; z_4=z[3]; z_5=z[4]; z_6=z[5]; z_7=z[6];
%}
TRACE
/* Source description */
COMPONENT source = Source_flux( /* a flat constant source */
radius = 0.20,
dist =2.27,
xw = 0.038, yh = 0.2,
E0 = Ei,
dE = dEi,
flux=1e13)
AT (0,0,0) ABSOLUTE
/*COMPONENT PSD_source = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="source.psd")
AT (0, 0, 0) RELATIVE source
COMPONENT E_source= E_monitor(
xmin=-.1, xmax=.1,
ymin=-.1, ymax=.1,
Emin=0, Emax=10,
nchan=100,
filename="E_source.emo")
AT (0,0,0.000001) RELATIVE source
COMPONENT PSD_3_12 = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="3_12.psd")
AT (0, 0, 3.12) RELATIVE source
COMPONENT E_3_12 = E_monitor(
xmin=-.1, xmax=.1,
ymin=-.1, ymax=.1,
Emin=0, Emax=10,
nchan=100,
filename="E_vor_guide_1.emo")
AT (0,0,0.00001) RELATIVE PSD_3_12*/
COMPONENT guide_1 = Guide(
w1=0.038, h1=0.2,
w2=0.032, h2=0.2,
l=3.68,
R0=1,
Qc=0.02176,
alpha=2.33,
m=1.2,
W=2e-3)
AT (0,0,3.12001) RELATIVE source
COMPONENT PSD_guide_1 = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="guide_1.psd")
AT (0, 0, 6.8) RELATIVE source
COMPONENT E_guide_1 = E_monitor(
xmin=-.1, xmax=.1,
ymin=-.1, ymax=.1,
Emin=0, Emax=10,
nchan=100,
filename="E_guide_1.emo")
AT (0,0,0) RELATIVE PSD_guide_1
COMPONENT bender1 = Bender(
w=0.03,
h=0.2,
r=2700.0,
d=0,
Win=0.0101851,
k=1,
R0a=1, Qca=0.02176, alphaa=2.33, ma=1.2, Wa=2e-3,
R0i=1, Qci=0.02176, alphai=2.33, mi=1.2, Wi=2e-3,
R0s=1, Qcs=0.02176, alphas=2.33, ms=1.2, Ws=2e-3)
AT (0,0,3.68) RELATIVE guide_1
COMPONENT PSD_bender1 = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="bender1.psd")
AT (0, 0, 27.5) RELATIVE bender1
COMPONENT E_bender1 = E_monitor(
xmin=-.1, xmax=.1,
ymin=-.1, ymax=.1,
Emin=0, Emax=10,
nchan=100,
filename="E_bender1.emo")
AT (0,0,0) RELATIVE PSD_bender1
COMPONENT guide_2 = Guide(
w1=0.032, h1=0.2,
w2=0.032, h2=0.2,
l=27,
R0=1,
Qc=0.02176,
alpha=2.33,
m=1.2,
W=2e-3)
AT (0,0,27.5) RELATIVE bender1
COMPONENT PSD_guide_2 = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="guide_2.psd")
AT (0, 0, 27) RELATIVE guide_2
COMPONENT E_guide_2 = E_monitor(
xmin=-.1, xmax=.1,
ymin=-.1, ymax=.1,
Emin=0, Emax=10,
nchan=100,
filename="E_guide_2.emo")
AT (0,0,0) RELATIVE PSD_guide_2
COMPONENT a1 = Arm() AT (0,0,27) RELATIVE guide_2
COMPONENT arm_M1 = Arm() AT (0,0,position_m1) RELATIVE a1
ROTATED (0,A1half,0) RELATIVE a1
COMPONENT m11 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_1,y_1,0) RELATIVE arm_M1 ROTATED (0,0,PHI1) RELATIVE arm_M1
COMPONENT m12 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_2,y_2,0) RELATIVE arm_M1 ROTATED (0,0,PHI2) RELATIVE arm_M1
COMPONENT m13 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_3,y_3,0) RELATIVE arm_M1 ROTATED (0,0,PHI3) RELATIVE arm_M1
COMPONENT m14 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_4,y_4,0) RELATIVE arm_M1 ROTATED (0,0,PHI4) RELATIVE arm_M1
COMPONENT m15 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_5,y_5,0) RELATIVE arm_M1 ROTATED (0,0,PHI5) RELATIVE arm_M1
COMPONENT m16 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_6,y_6,0) RELATIVE arm_M1 ROTATED (0,0,PHI6) RELATIVE arm_M1
COMPONENT m17 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_7,y_7,0) RELATIVE arm_M1 ROTATED (0,0,PHI7) RELATIVE arm_M1
COMPONENT arm_M2 = Arm() AT (0,0,position_m2) RELATIVE a1
ROTATED (0,A2half,0) RELATIVE a1
COMPONENT m21 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_1,y_1,0) RELATIVE arm_M2 ROTATED (0,0,PHI1) RELATIVE arm_M2
COMPONENT m22 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_2,y_2,0) RELATIVE arm_M2 ROTATED (0,0,PHI2) RELATIVE arm_M2
COMPONENT m23 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_3,y_3,0) RELATIVE arm_M2 ROTATED (0,0,PHI3) RELATIVE arm_M2
COMPONENT m24 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_4,y_4,0) RELATIVE arm_M2 ROTATED (0,0,PHI4) RELATIVE arm_M2
COMPONENT m25 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_5,y_5,0) RELATIVE arm_M2 ROTATED (0,0,PHI5) RELATIVE arm_M2
COMPONENT m26 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_6,y_6,0) RELATIVE arm_M2 ROTATED (0,0,PHI6) RELATIVE arm_M2
COMPONENT m27 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_7,y_7,0) RELATIVE arm_M2 ROTATED (0,0,PHI7) RELATIVE arm_M2
COMPONENT arm_M3 = Arm() AT (0,0,position_m3) RELATIVE a1
ROTATED (0,A3half,0) RELATIVE a1
COMPONENT m31 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_1,y_1,0) RELATIVE arm_M3 ROTATED (0,0,PHI1) RELATIVE arm_M3
COMPONENT m32 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_2,y_2,0) RELATIVE arm_M3 ROTATED (0,0,PHI2) RELATIVE arm_M3
COMPONENT m33 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_3,y_3,0) RELATIVE arm_M3 ROTATED (0,0,PHI3) RELATIVE arm_M3
COMPONENT m34 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_4,y_4,0) RELATIVE arm_M3 ROTATED (0,0,PHI4) RELATIVE arm_M3
COMPONENT m35 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_5,y_5,0) RELATIVE arm_M3 ROTATED (0,0,PHI5) RELATIVE arm_M3
COMPONENT m36 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_6,y_6,0) RELATIVE arm_M3 ROTATED (0,0,PHI6) RELATIVE arm_M3
COMPONENT m37 = Mosaic_anisotropic(
zmin=-0.015, zmax=0.015, ymin=-0.014, ymax=0.014,
mosaich=50, mosaicv=50,
r0=0.95,
Q=mono_q)
AT (x_7,y_7,0) RELATIVE arm_M3 ROTATED (0,0,PHI7) RELATIVE arm_M3
COMPONENT 4PI_mono = PSD_monitor_4PI(
radius=2.1,
nx=100, ny=100,
filename="4PI_mono.psd")
AT (0,0,d1) relative a1
COMPONENT focus_sample = Arm()
AT (0,0,d1) RELATIVE a1 ROTATED (0,A2,0) RELATIVE a1
COMPONENT anti_focus_sample = Arm()
AT (0,0,d1) RELATIVE a1 ROTATED (0,A2strich,0) RELATIVE a1
COMPONENT PSD_mono = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="mono.psd")
AT (0, 0, l2) RELATIVE focus_sample
/*COMPONENT anti_PSD_mono = PSD_monitor(
xmin = -0.1, xmax = 0.1,
ymin = -0.1, ymax = 0.1,
nx = 100, ny = 100,
filename="anti_mono.psd")
AT (0, 0, l2) RELATIVE anti_focus_sample*/
/*COMPONENT dreh_PSD_mono = PSD_monitor(
xmin = -30, xmax = 30,
ymin = -30, ymax = 30,
nx = 100, ny = 100,
filename="dreh_mono.psd")
AT (0, 0, 3) RELATIVE arm_M1_2 */
COMPONENT E_mono = E_monitor(
xmin=-0.1, xmax=0.1,
ymin=-0.1, ymax=0.1,
Emin=3, Emax=4.5,
nchan=100,
filename="E_mono.emo")
AT (0,0,0) RELATIVE PSD_mono
COMPONENT PSD_mono_test = PSD_monitor(
xmin = -1, xmax = 1,
ymin = -1, ymax = 1,
nx = 100, ny = 100,
filename="mono_test.psd")
AT (0, 0, 3.3) RELATIVE a1
/*COMPONENT mono_1 = Monochromator(
zmin=-*/
END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poehlman.vcf
Type: text/x-vcard
Size: 288 bytes
Desc: Card for Markus Poehlmann
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20000306/8005aa76/attachment.vcf>
More information about the mcstas-users
mailing list