1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*******************************************************************************
* Instrument: Test_Pol_FieldBox
*
* %I
* Written by: Erik B Knudsen <erkn@fysik.dtu.dk>
* Date: Jan 20
* Origin: DTU Physics
* %INSTRUMENT_SITE: Tests_polarization
*
* Unit test instrument for Pol_FieldBox
*
* %D
* An instrument with a single field box with a 1 mT magnetic field along the y-axis.
* A neutron beam polarized aling the x-axis is emitted with central wavelength such
* that the polarization is rotated pihalfturns radians in the field.
*
* %Example: Test_Pol_FieldBox pihalfturns=3 Detector: pl1z_I=2.30783
*
* %P
* pihalfturns: [ ] beam polarization (for the cetral wavelength) is rotated pihalfturns by the field
* BOX: [ ] flag to select between 0:Pol_FieldBox and 1:Pol_constBfield
*
* %E
*******************************************************************************/
DEFINE INSTRUMENT Test_Pol_FieldBox(pihalfturns=1, int BOX=0)
DECLARE
%{
double L0;
double By;
%}
INITIALIZE
%{
By=1e-3; /*1mT field*/
L0=pihalfturns*PI*PI*K2V/(0.02*1.8325e8 * By);
%}
TRACE
COMPONENT origin = Progress_bar()
AT (0, 0, 0) RELATIVE ABSOLUTE
// insert components here (e.g. Insert -> Source -> ...)
COMPONENT source_simple = Source_simple(
dist=2,
focus_xw=0.1,
focus_yh=0.1,
lambda0=L0,
dlambda=0.5*L0)
AT (0, 0, 0) RELATIVE PREVIOUS
COMPONENT set_pol = Set_pol(
px=1)
AT (0, 0, 0.5) RELATIVE PREVIOUS
COMPONENT pl0x = PolLambda_monitor(mx=1, my=0, mz=0,filename="pl0x.dat", nL=101, npol=51, Lmin=0.5*L0, Lmax=L0*1.5)
AT(0,0,0) RELATIVE PREVIOUS
COMPONENT pl0z = COPY(pl0x)(mx=0, my=0, mz=1, filename="pl0z.dat")
AT(0,0,0) RELATIVE PREVIOUS
COMPONENT pf=Pol_FieldBox(By=By, Bx=0, Bz=0, xwidth=0.2, yheight=.2, zdepth=0.02)
WHEN (BOX==0) AT(0,0,0.01+1e-3) RELATIVE pl0z
COMPONENT pf2=Pol_constBfield(B=By*10000, xwidth=0.2, yheight=.2, zdepth=0.02)
WHEN (BOX==1) AT(0,0,0.0+1e-3) RELATIVE pl0z
/*COMPONENT pf2 = Pol_Bfield(By=By,Bx=0, Bz=0, xwidth=0.2, yheight=0.2, zdepth=0.02)*/
/*WHEN(BOX==1) AT(0,0,0.01+1e-3) RELATIVE pl0z*/
COMPONENT pl1x = PolLambda_monitor(mx=1, my=0, mz=0,filename="pl1x.dat", nL=101, npol=51,Lmin=0.5*L0, Lmax=L0*1.5)
AT(0,0,0.02+2e-3) RELATIVE pl0z
COMPONENT pl1z = COPY(pl0x)(mx=0, my=0, mz=1, filename="pl1z.dat")
AT(0,0,0) RELATIVE PREVIOUS
FINALLY
%{
%}
END
|