From dae436b967f85eee6a2ca5d26caa4f7f57063b83 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 13:55:04 +0200 Subject: [PATCH 01/17] Initial import of (3.x-ported) V-cavity test instruments from Michael Schneider / SNAG --- .../Test_V_cavity_SNAG_double_side.instr | 271 ++++++++++++++++++ .../Test_V_cavity_SNAG_single_side.instr | 271 ++++++++++++++++++ 2 files changed, 542 insertions(+) create mode 100644 mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr create mode 100644 mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr diff --git a/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr b/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr new file mode 100644 index 000000000..2af86a949 --- /dev/null +++ b/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr @@ -0,0 +1,271 @@ +DEFINE INSTRUMENT cavity_QU24003_DiffScattSpect_CSNS( + Lam=7.0, dLam=6.0, + // Simulationen mit FeSi m = 5.0, 1.4 Angstroem + // Version from 28-Dec-2023 runs with McStas Version 2.7.1 + l_guide0=2, // length of feeding guide (m) + m_hori=1.0, // m of feeding guide + m_vert=3.0, // m of feeding guide + m_pol_h=1.0, // m of guide body (m of FeSi is defined by data files) + m_pol_v=3.0, // m of guide body (m of FeSi is defined by data files) + W=0.024, // width of guide and cavity (m) + H=0.058, // height of guide and cavity (m) + Length_C=1.300, // length of guide body (m) + tap_ang=0.55, // taper angle with respect to optical axis of V-cavity (deg) + distK=1.23864, // distance between V-cavities (m) (applicable, if 2 cavities are installed) + d_Fe=6.95e-6, // thickness of Fe in one supermirror coating (m) + d=2.0 // distance source to guide entrance (m) +) +DECLARE +%{ + + double ldm; + double ldx; + double D_W; + double D_H; + +%} +INITIALIZE +%{ + +ldm = Lam-dLam; +ldx = Lam+dLam; +D_W = 1.2*W; +D_H = 1.2*H; + +%} + +TRACE +COMPONENT Origin = Progress_bar() + AT (0,0,0) ABSOLUTE + +/********************************** source *************************************/ +COMPONENT source = +Source_simple(yheight = 0.2, xwidth=0.2, dist = d, focus_xw = W, focus_yh = H, lambda0 = Lam, + dlambda = dLam, flux = 1e14) + AT (0, 0, 0) RELATIVE Origin + +/*****************************************************************************************************/ +COMPONENT makeSpin = Spin_random() + AT (0,0,0.001) RELATIVE source + ROTATED (0,0,0) RELATIVE source + +/********************************** monitors in distance d after source *************************************/ +COMPONENT lamStart = +L_monitor(nL = 40, filename = "lambdaStart.dat", + xwidth = D_W, yheight = D_H, + Lmin = Lam-dLam-1, Lmax = Lam+dLam+1, + restore_neutron=1) + AT (0, 0, d+0.001) RELATIVE Origin + +COMPONENT psdStart = +PSD_monitor(xwidth=D_W, yheight=D_H, + nx=40, ny=40, filename="psdStart.dat", + restore_neutron=1) + AT (0, 0, d+0.001) RELATIVE Origin + +COMPONENT div_s = Divergence_monitor( + nh = 100, nv = 100, filename = "divsource", xwidth = D_W, + yheight = D_H, maxdiv_h = 4, maxdiv_v = 4, + restore_neutron=1) + AT (0, 0, d+0.001) RELATIVE source + + + +/********************************* guide in front *****************************************/ + +COMPONENT guide_1 = Guide_gravity(w1=W, h1=H, w2=W, h2=H, l= l_guide0, + R0=1, Qc=0.02174, alpha=2.7, W=0.003, nslit=1, + mleft=m_hori, mright=m_hori, mtop=m_vert, mbottom=m_vert) + AT (0, 0, d+0.0011) RELATIVE Origin + ROTATED (0, 0, 0) RELATIVE Origin + + + + +/* ******************************* Polarisation *************************************/ +COMPONENT a_POL = Arm() + AT (0, 0, d+0.06 + l_guide0) RELATIVE Origin + ROTATED (0,0,0) RELATIVE Origin + + + +/* ******************************* V-cavity *************************************/ + +/********************************* one side coated with FeSi m=5.0 ************************/ +/* +COMPONENT cavity = Transmission_V_polarisator( + w1=W, h1=H, w2=W, h2=H, l=Length_C, + waferD=0.0003, FeD= d_Fe, + Si_i=0.2, Si_a=0.215, + R0=0.99, Qc=0.02174, alpha=3.6, W=0.001, + mleft=m_pol_h, mright=m_pol_h, mtop=m_pol_v, mbottom=m_pol_v, + reflectUP="FeSi_m50_up.dat",reflectDW="FeSi_m50_down.dat") + AT (0,0,0.00001) RELATIVE a_POL + ROTATED (0,0,0) RELATIVE a_POL +*/ + + +/********************************* both sides coated with FeSi m=5.0 ************************/ +/***** this approach does not take into account the multireflections within the wafer *******/ + + +COMPONENT cavity = Transmission_V_polarisator( + w1=W, h1=H, w2=W, h2=H, l=Length_C, + waferD=0.0003, FeD= 2*d_Fe, + Si_i=0.2, Si_a=0.215, + R0=0.99, Qc=0.02174, alpha=3.6, W=0.001, + mleft=m_pol_h, mright=m_pol_h, mtop=m_pol_v, mbottom=m_pol_v, + reflectUP="FeSi_m50_up_R2.dat",reflectDW="FeSi_m50_down_R2.dat") + AT (0,0,0.00001) RELATIVE a_POL + ROTATED (0,0,0) RELATIVE a_POL + + + + +/******************* only guide gravity DB - for transmission determination*************************************/ +/* +COMPONENT guide_DB = Guide_gravity( + w1=W, h1=H, w2=W, h2=H, l= Length_C, + R0=0.99, Qc=0.02174, alpha=3.6, W=0.001, nslit=1, + mleft=m_pol_h, mright=m_pol_h, mtop=m_pol_v, mbottom=m_pol_v) + AT (0,0,0.00001) RELATIVE a_POL + ROTATED (0,0,0) RELATIVE a_POL +*/ + + + + + +/**********************************monitors after cavity**************************************************/ +COMPONENT armLambdaStop = Arm() + AT (0, 0, 0.001+Length_C) + RELATIVE a_POL + +COMPONENT lamStopPolGuide = +L_monitor(nL = 40, filename = "lambda_after_cav.dat", + xwidth = D_W, yheight = D_H, + Lmin = Lam-dLam-1, Lmax = Lam+dLam+1, + restore_neutron=1) + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT psdPolGuide = +PSD_monitor(xwidth=D_W, yheight= D_H, + nx=100, ny=100, filename="psd_after_cav.dat", + restore_neutron=1) + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT PSD_sU_2m = PSD_spinUmon(xmin=-D_W/2, xmax=D_W/2, ymin=-D_H/2, ymax=D_H/2, + nx=200, ny=25, filename="PSD_sU.psd") + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT PSD_sD_2m = PSD_spinDmon(xmin=-D_W/2, xmax=D_W/2, ymin=-D_H/2, ymax=D_H/2, + nx=200, ny=25, filename="PSD_sD.psd") + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT MPLMon2Y = +MeanPolLambda_monitor(xwidth=D_W, yheight=D_H, + nL=100, Lmin = Lam-dLam-1, Lmax = Lam+dLam+1, + mx=0, my=-1, mz=0, filename="MPLMon2Y.data", + restore_neutron=1) + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT div_lambda_hor = DivLambda_monitor( + nL=100, + nh=100, + filename="div_lambda_hor.dat", + xwidth = D_W, + yheight= D_H, + maxdiv_h=2.0, + Lmin= Lam-dLam-1, + Lmax= Lam+dLam+1, + restore_neutron=1) +AT (0, 0, 0) RELATIVE armLambdaStop +ROTATED (0, 0, 0) RELATIVE armLambdaStop + + + + +/* This section is executed when the simulation ends (C code). Other */ +/* optional sections are : SAVE */ +FINALLY +%{ +%} +/* The END token marks the instrument definition end */ +END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr b/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr new file mode 100644 index 000000000..355482b11 --- /dev/null +++ b/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr @@ -0,0 +1,271 @@ +DEFINE INSTRUMENT cavity_QU24003_DiffScattSpect_CSNS( + Lam=7.0, dLam=6.0, + // Simulationen mit FeSi m = 5.0, 1.4 Angstroem + // Version from 28-Dec-2023 runs with McStas Version 2.7.1 + l_guide0=2, // length of feeding guide (m) + m_hori=1.0, // m of feeding guide + m_vert=3.0, // m of feeding guide + m_pol_h=1.0, // m of guide body (m of FeSi is defined by data files) + m_pol_v=3.0, // m of guide body (m of FeSi is defined by data files) + W=0.024, // width of guide and cavity (m) + H=0.058, // height of guide and cavity (m) + Length_C=1.300, // length of guide body (m) + tap_ang=0.55, // taper angle with respect to optical axis of V-cavity (deg) + distK=1.23864, // distance between V-cavities (m) (applicable, if 2 cavities are installed) + d_Fe=6.95e-6, // thickness of Fe in one supermirror coating (m) + d=2.0 // distance source to guide entrance (m) +) +DECLARE +%{ + + double ldm; + double ldx; + double D_W; + double D_H; + +%} +INITIALIZE +%{ + +ldm = Lam-dLam; +ldx = Lam+dLam; +D_W = 1.2*W; +D_H = 1.2*H; + +%} + +TRACE +COMPONENT Origin = Progress_bar() + AT (0,0,0) ABSOLUTE + +/********************************** source *************************************/ +COMPONENT source = +Source_simple(yheight = 0.2, xwidth=0.2, dist = d, focus_xw = W, focus_yh = H, lambda0 = Lam, + dlambda = dLam, flux = 1e14) + AT (0, 0, 0) RELATIVE Origin + +/*****************************************************************************************************/ +COMPONENT makeSpin = Spin_random() + AT (0,0,0.001) RELATIVE source + ROTATED (0,0,0) RELATIVE source + +/********************************** monitors in distance d after source *************************************/ +COMPONENT lamStart = +L_monitor(nL = 40, filename = "lambdaStart.dat", + xwidth = D_W, yheight = D_H, + Lmin = Lam-dLam-1, Lmax = Lam+dLam+1, + restore_neutron=1) + AT (0, 0, d+0.001) RELATIVE Origin + +COMPONENT psdStart = +PSD_monitor(xwidth=D_W, yheight=D_H, + nx=40, ny=40, filename="psdStart.dat", + restore_neutron=1) + AT (0, 0, d+0.001) RELATIVE Origin + +COMPONENT div_s = Divergence_monitor( + nh = 100, nv = 100, filename = "divsource", xwidth = D_W, + yheight = D_H, maxdiv_h = 4, maxdiv_v = 4, + restore_neutron=1) + AT (0, 0, d+0.001) RELATIVE source + + + +/********************************* guide in front *****************************************/ + +COMPONENT guide_1 = Guide_gravity(w1=W, h1=H, w2=W, h2=H, l= l_guide0, + R0=1, Qc=0.02174, alpha=2.7, W=0.003, nslit=1, + mleft=m_hori, mright=m_hori, mtop=m_vert, mbottom=m_vert) + AT (0, 0, d+0.0011) RELATIVE Origin + ROTATED (0, 0, 0) RELATIVE Origin + + + + +/* ******************************* Polarisation *************************************/ +COMPONENT a_POL = Arm() + AT (0, 0, d+0.06 + l_guide0) RELATIVE Origin + ROTATED (0,0,0) RELATIVE Origin + + + +/* ******************************* V-cavity *************************************/ + +/********************************* one side coated with FeSi m=5.0 ************************/ + +COMPONENT cavity = Transmission_V_polarisator( + w1=W, h1=H, w2=W, h2=H, l=Length_C, + waferD=0.0003, FeD= d_Fe, + Si_i=0.2, Si_a=0.215, + R0=0.99, Qc=0.02174, alpha=3.6, W=0.001, + mleft=m_pol_h, mright=m_pol_h, mtop=m_pol_v, mbottom=m_pol_v, + reflectUP="FeSi_m50_up.dat",reflectDW="FeSi_m50_down.dat") + AT (0,0,0.00001) RELATIVE a_POL + ROTATED (0,0,0) RELATIVE a_POL + + + +/********************************* both sides coated with FeSi m=5.0 ************************/ +/***** this approach does not take into account the multireflections within the wafer *******/ +/* + +COMPONENT cavity = Transmission_V_polarisator( + w1=W, h1=H, w2=W, h2=H, l=Length_C, + waferD=0.0003, FeD= 2*d_Fe, + Si_i=0.2, Si_a=0.215, + R0=0.99, Qc=0.02174, alpha=3.6, W=0.001, + mleft=m_pol_h, mright=m_pol_h, mtop=m_pol_v, mbottom=m_pol_v, + reflectUP="FeSi_m50_up_R2.dat",reflectDW="FeSi_m50_down_R2.dat") + AT (0,0,0.00001) RELATIVE a_POL + ROTATED (0,0,0) RELATIVE a_POL +*/ + + + +/******************* only guide gravity DB - for transmission determination*************************************/ +/* +COMPONENT guide_DB = Guide_gravity( + w1=W, h1=H, w2=W, h2=H, l= Length_C, + R0=0.99, Qc=0.02174, alpha=3.6, W=0.001, nslit=1, + mleft=m_pol_h, mright=m_pol_h, mtop=m_pol_v, mbottom=m_pol_v) + AT (0,0,0.00001) RELATIVE a_POL + ROTATED (0,0,0) RELATIVE a_POL +*/ + + + + + +/**********************************monitors after cavity**************************************************/ +COMPONENT armLambdaStop = Arm() + AT (0, 0, 0.001+Length_C) + RELATIVE a_POL + +COMPONENT lamStopPolGuide = +L_monitor(nL = 40, filename = "lambda_after_cav.dat", + xwidth = D_W, yheight = D_H, + Lmin = Lam-dLam-1, Lmax = Lam+dLam+1, + restore_neutron=1) + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT psdPolGuide = +PSD_monitor(xwidth=D_W, yheight= D_H, + nx=100, ny=100, filename="psd_after_cav.dat", + restore_neutron=1) + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT PSD_sU_2m = PSD_spinUmon(xmin=-D_W/2, xmax=D_W/2, ymin=-D_H/2, ymax=D_H/2, + nx=200, ny=25, filename="PSD_sU.psd") + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT PSD_sD_2m = PSD_spinDmon(xmin=-D_W/2, xmax=D_W/2, ymin=-D_H/2, ymax=D_H/2, + nx=200, ny=25, filename="PSD_sD.psd") + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT MPLMon2Y = +MeanPolLambda_monitor(xwidth=D_W, yheight=D_H, + nL=100, Lmin = Lam-dLam-1, Lmax = Lam+dLam+1, + mx=0, my=-1, mz=0, filename="MPLMon2Y.data", + restore_neutron=1) + AT (0, 0, 0.000) RELATIVE armLambdaStop + +COMPONENT div_lambda_hor = DivLambda_monitor( + nL=100, + nh=100, + filename="div_lambda_hor.dat", + xwidth = D_W, + yheight= D_H, + maxdiv_h=2.0, + Lmin= Lam-dLam-1, + Lmax= Lam+dLam+1, + restore_neutron=1) +AT (0, 0, 0) RELATIVE armLambdaStop +ROTATED (0, 0, 0) RELATIVE armLambdaStop + + + + +/* This section is executed when the simulation ends (C code). Other */ +/* optional sections are : SAVE */ +FINALLY +%{ +%} +/* The END token marks the instrument definition end */ +END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 277f25773999313f2297fedcb9d7e670cc5aba27 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 13:56:14 +0200 Subject: [PATCH 02/17] Initial import of (3.x-ported) contributed comps from Michael Schneider / SNAG --- mcstas-comps/contrib/PSD_spinDmon.comp | 69 +++ mcstas-comps/contrib/PSD_spinUmon.comp | 69 +++ mcstas-comps/contrib/Spin_random.comp | 24 + .../contrib/Transmission_V_polarisator.comp | 514 ++++++++++++++++++ 4 files changed, 676 insertions(+) create mode 100644 mcstas-comps/contrib/PSD_spinDmon.comp create mode 100644 mcstas-comps/contrib/PSD_spinUmon.comp create mode 100644 mcstas-comps/contrib/Spin_random.comp create mode 100644 mcstas-comps/contrib/Transmission_V_polarisator.comp diff --git a/mcstas-comps/contrib/PSD_spinDmon.comp b/mcstas-comps/contrib/PSD_spinDmon.comp new file mode 100644 index 000000000..1d73e0876 --- /dev/null +++ b/mcstas-comps/contrib/PSD_spinDmon.comp @@ -0,0 +1,69 @@ +DEFINE COMPONENT PSD_spinDmon +DEFINITION PARAMETERS () +SETTING PARAMETERS (int nx=90, int ny=90, string filename, xmin, xmax, ymin, ymax) + +DECLARE + %{ + DArray2d PSD_N; + DArray2d PSD_p; + DArray2d PSD_p2; + %} +INITIALIZE + %{ + PSD_N = create_darr2d(nx, ny); + PSD_p = create_darr2d(nx, ny); + PSD_p2 = create_darr2d(nx, ny); + %} +TRACE + %{ + int i,j; + + if (sy > 0) + {SCATTER;} + else + { + PROP_Z0; + if (x>xmin && xymin && yxmin && xymin && y 0) + {sy = 1.0; S_check=1;} + }while (S_check == 0); +%} + +END + diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp new file mode 100644 index 000000000..a30eaea75 --- /dev/null +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -0,0 +1,514 @@ +/******************************************************************************* +* +* Component: Transmission_V_polarisator +* +* Written by: Andreas Ostermann +* Modified by Michael Schneider, SNAG, includes absorption by Fe in supermirror +* Origin: McStas 1.8/ILL (France). +* (The main source code was taken from Gravity_guide (ver 1.6ill)) +* +* +* Example: Transmission_V_polarisator(w1=0.050, h1=0.050, +* w2=0.050, h2=0.050, l=2.700, +* waferD=0.0003, FeD=2.16e-06, +* Si_i=0.2, Si_a=0.215, +* R0=0.99, Qc=0.02174, alpha=4.25, W=0.001, +* mleft=1.2, mright=1.2, mtop=1.2, mbottom=1.2, +* reflectUP="measured_up_q.dat",reflectDW="measured_dw_q.dat") +* +* +* %P +* INPUT PARAMETERS: +* +* w1: (m) Width at the polarizer entry +* h1: (m) Height at the polarizer entry +* w2: (m) Width at the polarizer exit +* h2: (m) Height at the polarizer exit +* l: (m) length of polarizer +* R0: (1) Low-angle reflectivity of the outer guide +* Qc: (AA-1) Critical scattering vector of the outer guide +* W: (AA-1) Width of supermirror cut-off of the outer guide +* alpha: (AA) Slope of reflectivity of the outer guide +* mleft: (1) m-value of material for left. vert. mirror of the outer guide +* mright: (1) m-value of material for right. vert. mirror of the outer guide +* mtop: (1) m-value of material for top. horz. mirror of the outer guide +* mbottom: (1) m-value of material for bottom. horz. mirror of the outer guide +* waferD (m) Thickness of Si wafer +* FeD: (m) Thickness of Fe in supermirror, Ti is neglected +* Si_i (barns) Scattering cross section per atom (barns) +* Si_a (barns) Absorption cross section per atom (barns) at 2200m/s +* reflectUP (str) Reflectivity profile of the FeSi-wafer for spin-up neutrons; columns [q,R] +* reflectDW (str) Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] +* +* %D +* +* +* %E +*******************************************************************************/ + +DEFINE COMPONENT Transmission_V_polarisator +DEFINITION PARAMETERS () +SETTING PARAMETERS (string reflectUP=0, string reflectDW=0, + w1, h1, w2, h2, l, waferD, Si_i, Si_a, FeD, + R0=0.99, Qc=0.02174, alpha=4.25, W=0.001, + mleft=-1, mright=-1, mtop=-1, mbottom=-1) +SHARE +%{ + + + typedef struct Polarizer_guide_Vars + { + double nx[8], ny[8], nz[8]; + double wx[8], wy[8], wz[8]; + double A[8], norm_n2[8], norm_n[8]; + long N_reflection[9]; + double M[8]; + double w1c; + double w2c; + double n_dot_v[8]; + char compcurname[256]; + } Polarizer_guide_Vars_type; + + void Polarizer_guide_Init(Polarizer_guide_Vars_type *aVars, + MCNUM a_w1, MCNUM a_h1, MCNUM a_w2, MCNUM a_h2, MCNUM a_l, + MCNUM a_R0, MCNUM a_Qc, MCNUM a_alpha, MCNUM a_W, + MCNUM a_mleft, MCNUM a_mright, MCNUM a_mtop, MCNUM a_mbottom) + { + int i; + + for (i=0; i<9; aVars->N_reflection[i++] = 0); + for (i=0; i<8; aVars->M[i++] = 0); + + aVars->w1c = a_w1; + aVars->w2c = a_w2; + + if (a_mleft >= 0) aVars->M[1] =a_mleft ; + if (a_mright >= 0) aVars->M[2] =a_mright ; + if (a_mtop >= 0) aVars->M[3] =a_mtop ; + if (a_mbottom >= 0) aVars->M[4] =a_mbottom; + + + aVars->nx[1] = a_l; aVars->ny[1] = 0; aVars->nz[1] = -0.5*(aVars->w2c-aVars->w1c); /* 1:+X left */ + aVars->nx[2] = -a_l; aVars->ny[2] = 0; aVars->nz[2] = -aVars->nz[1]; /* 2:-X right */ + aVars->nx[3] = 0; aVars->ny[3] = a_l; aVars->nz[3] = -0.5*(a_h2-a_h1); /* 3:+Y top */ + aVars->nx[4] = 0; aVars->ny[4] = -a_l; aVars->nz[4] = aVars->nz[3]; /* 4:-Y bottom */ + aVars->nx[5] = 0; aVars->ny[5] = 0; aVars->nz[5] = a_l; /* 5:+Z exit */ + aVars->nx[0] = 0; aVars->ny[0] = 0; aVars->nz[0] = -a_l; /* 0:Z0 input */ + aVars->nx[6] = a_l; aVars->ny[6] = 0; aVars->nz[6] = -0.5*(aVars->w2c); /* 1:+X left FeSi waver */ + aVars->nx[7] = -a_l; aVars->ny[7] = 0; aVars->nz[7] = -0.5*(aVars->w2c); /* 1:+X right FeSi waver */ + + + aVars->wx[1] = +(aVars->w1c)/2; aVars->wy[1] = 0; aVars->wz[1] = 0; /* 1:+X left */ + aVars->wx[2] = -(aVars->w1c)/2; aVars->wy[2] = 0; aVars->wz[2] = 0; /* 2:-X right */ + aVars->wx[3] = 0; aVars->wy[3] = +a_h1/2; aVars->wz[3] = 0; /* 3:+Y top */ + aVars->wx[4] = 0; aVars->wy[4] = -a_h1/2; aVars->wz[4] = 0; /* 4:-Y bottom */ + aVars->wx[5] = 0; aVars->wy[5] = 0; aVars->wz[5] = a_l; /* 5:+Z exit */ + aVars->wx[0] = 0; aVars->wy[0] = 0; aVars->wz[0] = 0; /* 0:Z0 input */ + aVars->wx[6] = 0; aVars->wy[6] = 0; aVars->wz[6] = 0; /* 1:+X left FeSi waver */ + aVars->wx[7] = 0; aVars->wy[7] = 0; aVars->wz[7] = 0; /* 1:+X right FeSi waver */ + + + for (i=0; i <= 7; i++) + { + aVars->A[i] = 0; /* gravitation is not taken into account A.O.*/ + aVars->norm_n2[i] = aVars->nx[i]*aVars->nx[i] + aVars->ny[i]*aVars->ny[i] + aVars->nz[i]*aVars->nz[i]; + if (aVars->norm_n2[i] <= 0) + { fprintf(stderr,"%s: Fatal: normal vector norm %i is null/negative ! Check guide dimensions.\n", aVars->compcurname, i); exit(-1); } /* should never occur */ + else + aVars->norm_n[i] = sqrt(aVars->norm_n2[i]); + } + + } + + int Polarizer_guide_Trace(double *dt, double *dt0, + Polarizer_guide_Vars_type *aVars, + double cx, double cy, double cz, + double cvx, double cvy, double cvz) + { + double B, C, ret; + int side=0; + double n1,n2; + + + /* 3=+Y side: n=(0, l, -0.5*(h2-h1)) ; W = (0, +h1/2, 0) (up) */ + + B = aVars->ny[3]*cvy + aVars->nz[3]*cvz; C = aVars->ny[3]*(cy-aVars->wy[3]) + aVars->nz[3]*cz; /* aVars->nx=aVars->wz=0 */ + ret = solve_2nd_order(&*dt0, NULL, aVars->A[3], B, C); + if (ret && *dt0>10e-10 && *dt0<*dt) + { *dt = *dt0; side=3; aVars->n_dot_v[3] = B; } + + + /* 4=-Y side: n=(0, l, +0.5*(h2-h1)) ; W = (0, -h1/2, 0) (down) */ + + B = aVars->ny[4]*cvy + aVars->nz[4]*cvz; C = aVars->ny[4]*(cy-aVars->wy[4]) + aVars->nz[4]*cz; /* aVars->nx=aVars->wz=0 */ + ret = solve_2nd_order(&*dt0, NULL, aVars->A[4], B, C); + if (ret && *dt0>10e-10 && *dt0<*dt) + { *dt = *dt0; side=4; aVars->n_dot_v[4] = B; } + + + /* 1=+X side: n=(l, 0, -0.5*(w2-w1)) ; W = (+w1/2, 0, 0) (left)*/ + + B = aVars->nx[1]*cvx + aVars->nz[1]*cvz; C = aVars->nx[1]*(cx-aVars->wx[1]) + aVars->nz[1]*cz; /* aVars->ny=aVars->wz=0 */ + ret = solve_2nd_order(&*dt0, NULL, aVars->A[1], B, C); + if (ret && *dt0>10e-10 && *dt0<*dt) + { *dt = *dt0; side=1; aVars->n_dot_v[1] = B; } + + + /* 2=-X side: n=(l, 0, +0.5*(w2-w1)) ; W = (-w1/2, 0, 0) (right) */ + + B = aVars->nx[2]*cvx + aVars->nz[2]*cvz; C = aVars->nx[2]*(cx-aVars->wx[2]) + aVars->nz[2]*cz; /* aVars->ny=aVars->wz=0 */ + ret = solve_2nd_order(&*dt0, NULL, aVars->A[2], B, C); + if (ret && *dt0>10e-10 && *dt0<*dt) + { *dt = *dt0; side=2; aVars->n_dot_v[2] = B; } + + + /* 6=+X side: n=(l, 0, -0.5*w2) ; W = (0, 0, 0) (left FeSi waver) */ + + B = aVars->nx[6]*cvx + aVars->nz[6]*cvz; C = aVars->nx[6]*(cx-aVars->wx[6]) + aVars->nz[6]*cz; + ret = solve_2nd_order(&*dt0, NULL, aVars->A[6], B, C); + if (ret && *dt0>10e-10 && *dt0<*dt) + { *dt = *dt0; side=6; aVars->n_dot_v[6] = B; } + + + /* 7=-X side: n=(-l, 0, -0.5*w2) ; W = (0, 0, 0) (right FeSi waver) */ + + B = aVars->nx[7]*cvx + aVars->nz[7]*cvz; C = aVars->nx[7]*(cx-aVars->wx[7]) + aVars->nz[7]*cz; /* aVars->ny=aVars->wz=0 */ + ret = solve_2nd_order(&*dt0, NULL, aVars->A[7], B, C); + if (ret && *dt0>10e-10 && *dt0<*dt) + { *dt = *dt0; side=7; aVars->n_dot_v[7] = B; } + + + return (side); + } +%include "read_table-lib" +%} + +DECLARE +%{ + Polarizer_guide_Vars_type Vars; + + double Si_sig_i; + double Si_sig_a; + double Si_cross_i; + double Si_cros_av; + double Si_cross_a_v; + double Si_cross_tot; + double lwafer_Si; + double Fe_sig_i; + double Fe_sig_a; + double Fe_cross_i; + double Fe_cros_av; + double Fe_cross_a_v; + double Fe_cross_tot; + double lwafer_Fe; + + t_Table upTable; + t_Table dwTable; +%} + +INITIALIZE +%{ + + if (W < 0 || R0 < 0 || Qc < 0) + { fprintf(stderr,"Polarizer_guide: %s W R0 Qc must be >0.\n", NAME_CURRENT_COMP); + exit(-1); } + + strcpy(Vars.compcurname, NAME_CURRENT_COMP); + Polarizer_guide_Init(&Vars, + w1, h1, w2, h2, l, R0, + Qc, alpha, W, + mleft, mright, mtop, mbottom); + + Si_sig_i=Si_i; + Si_sig_a=Si_a; + Si_cross_i= 2.33 / 28.09 * Si_sig_i * 6.022 * 10; + Si_cross_a_v= 2.33 / 28.09 * Si_sig_a * 6.022 * 10 * 2200.0; + + Fe_sig_i=0.4; + Fe_sig_a=3.4; + Fe_cross_i= 7.87 / 55.85 * Fe_sig_i * 6.022 * 10; + Fe_cross_a_v= 7.87 / 55.85 * Fe_sig_a * 6.022 * 10 * 2200.0; + /** (density / rel. atomic mass * sig * 6.022 * 10 * v(1.8A)) **/ + + if (reflectUP != NULL) + { + Table_Read(&upTable, reflectUP, 1); /* read 1st block data from file into upTable */ + Table_Rebin(&upTable); /* rebin as evenly, increasing array */ + if (upTable.rows < 2) Table_Free(&upTable); + Table_Info(upTable); + } else upTable.data = NULL; + + if (reflectDW != NULL) + { + Table_Read(&dwTable, reflectDW, 1); /* read 1st block data from file into dwTable */ + Table_Rebin(&dwTable); /* rebin as evenly, increasing array */ + if (dwTable.rows < 2) Table_Free(&dwTable); + Table_Info(dwTable); + } else dwTable.data = NULL; + + +%} + + + +TRACE +%{ + double B, C, dt0, dt; + double q, arg, selectF, Rtemp; + int ret, side, side0; + double edge; + double n1, n2; + int bounces = 0; + double v, L, sinW, Wlen_Si, Wlen_Fe; + + + dt = -1; dt0 = -1; + /* propagate to box input (with gravitation) in comp local coords */ + /* 0=Z0 side: n=(0, 0, 1) ; W = (0, 0, 0) (at z=0, guide input)*/ + B = -vz; C = -z; + + ret = solve_2nd_order(&dt0, NULL, Vars.A[0], B, C); + if (ret && dt0>0) + { + dt = dt0; + PROP_DT(dt); + Vars.N_reflection[8]++; + } + /* check if we are in the box input, else absorb */ + if(dt > 0 && fabs(x) <= w1/2 && fabs(y) <= h1/2) + { + /* neutron is now in the input window of the guide */ + + /* do loops on reflections in the box */ + + + + + for(;;) + { + /* get intersections for all box sides */ + /* A = 0; B = n.v; C = n.(r-W); */ + + bounces++; + + side = 0; + + /* starts with the exit side intersection (the last one !)*/ + /* 5=+Z side: n=(0, 0, 1) ; W = (0, 0, l) (at z=l, guide exit)*/ + + B = vz; C = z - Vars.wz[5]; + ret = solve_2nd_order(&dt0, NULL, Vars.A[5], B, C); + if (ret && dt0>0) + { dt = dt0; side=5; + Vars.n_dot_v[5] = B; } + else + { fprintf(stderr,"%s: warning: neutron trajectory is parallel to guide exit, and thus can not exit\n", Vars.compcurname); ABSORB; } + + + + /* now look if there is a previous intersection with guide sides */ + + side0 = Polarizer_guide_Trace(&dt, &dt0, &Vars, x, y, z, vx, vy, vz); + if (side0) side= side0; + + /* only positive dt are valid */ + /* exit reflection loops if no intersection (neutron is after box) */ + + if (side == 0 || dt < 0) + { fprintf(stderr,"%s: warning: neutron has entered guide, but can not exit !\n", Vars.compcurname); ABSORB; } /* should never occur */ + + + /* propagate to dt */ + + PROP_DT(dt); + + + /* do reflection on speed for l/r/u/d sides */ + + if (side == 5) /* neutron reaches end of guide: end loop and exit comp */ + { Vars.N_reflection[side]++; SCATTER; break; } + + /* else reflection on a guide wall */ + + if (side == 1 || side == 2 || side == 3 || side == 4) + { + if(Vars.M[side] == 0 || Qc == 0) /* walls are absorbing */ + { ABSORB; } + } + + + if (side == 6 || side == 7 ) + { + + if (sy < 0) /* spin down */ + { + q = 2*V2Q*fabs(Vars.n_dot_v[side])/Vars.norm_n[side]; + v = sqrt(vx*vx + vy*vy + vz*vz); + L = (2*PI/V2K)/v; + sinW=(q*L)/(4*PI); + Wlen_Si=(waferD/sinW); + Wlen_Fe=(FeD/sinW); + Si_cross_tot=Si_cross_i + Si_cross_a_v / v; + Fe_cross_tot=Fe_cross_i + Fe_cross_a_v / v; + + + + selectF = rand01(); + if(selectF <= Table_Value(dwTable, q, 1)) + { + Vars.N_reflection[side]++; + dt0 = 2*Vars.n_dot_v[side]/Vars.norm_n2[side]; + vx -= Vars.nx[side]*dt0; + vy -= Vars.ny[side]*dt0; + vz -= Vars.nz[side]*dt0; + SCATTER; + } + + if(selectF > Table_Value(dwTable, q, 1)) + { + SCATTER; + p=p*exp(-1.0*((Si_cross_tot*Wlen_Si)+(Fe_cross_tot*Wlen_Fe))); + } + + Vars.N_reflection[0]++; + + } /* sy<0 */ + + + + + if (sy > 0) /* spin up */ + { + q = 2*V2Q*fabs(Vars.n_dot_v[side])/Vars.norm_n[side]; + v = sqrt(vx*vx + vy*vy + vz*vz); + L = (2*PI/V2K)/v; + sinW=(q*L)/(4*PI); + Wlen_Si=(waferD/sinW); + Wlen_Fe=(FeD/sinW); + Si_cross_tot=Si_cross_i + Si_cross_a_v / v; + Fe_cross_tot=Fe_cross_i + Fe_cross_a_v / v; + + + + selectF = rand01(); + if(selectF <= Table_Value(upTable, q, 1)) + { + Vars.N_reflection[side]++; + dt0 = 2*Vars.n_dot_v[side]/Vars.norm_n2[side]; + vx -= Vars.nx[side]*dt0; + vy -= Vars.ny[side]*dt0; + vz -= Vars.nz[side]*dt0; + SCATTER; + } + + if(selectF > Table_Value(upTable, q, 1)) + { + SCATTER; + p=p*exp(-1.0*((Si_cross_tot*Wlen_Si)+(Fe_cross_tot*Wlen_Fe))); + } + + Vars.N_reflection[0]++; + + } /* sy>0 */ + + + } /* side 6,7 */ + + else + { + /*************************************************************************************************/ + + /* change/mirror velocity: v_f = v - n.2*n.v/|n|^2 */ + + Vars.N_reflection[side]++; /* Vars.norm_n2 > 0 was checked at INIT */ + dt0 = 2*Vars.n_dot_v[side]/Vars.norm_n2[side]; /* 2*n.v/|n|^2 */ + vx -= Vars.nx[side]*dt0; + vy -= Vars.ny[side]*dt0; + vz -= Vars.nz[side]*dt0; + + /* compute q and modify neutron weight */ + /* scattering q=|k_i-k_f| = V2Q*|vf - v| = V2Q*2*n.v/|n| */ + + q = 2*V2Q*fabs(Vars.n_dot_v[side])/Vars.norm_n[side]; + + B = R0; + + if(q > Qc) + { + if (W>0) + arg = (q-Vars.M[side]*Qc)/W; + else + arg = (q-Vars.M[side]*Qc)*10000; /* W = 0.00001 */ + + if(arg < 10) + { + B *= .5*(1-tanh(arg))*(1-alpha*(q-Qc)); + } + else + { ABSORB; }; /* Cutoff ~ 1E-10 */ + } + if (B < 0) B=0; + if (B > 1) B=1; + p *= B; + SCATTER; + + Vars.N_reflection[0]++; + /*************************************************************************************************/ + } + + + /* go to the next reflection */ + if (bounces > 1000) ABSORB; + } /* end for */ + } + else + ABSORB; +%} + + + +FINALLY +%{ + Table_Free(&upTable); + Table_Free(&dwTable); +%} + + + +MCDISPLAY +%{ + double x; + int i; + + magnify("xy"); + multiline(5, + -w1/2.0, -h1/2.0, 0.0, + w1/2.0, -h1/2.0, 0.0, + w1/2.0, h1/2.0, 0.0, + -w1/2.0, h1/2.0, 0.0, + -w1/2.0, -h1/2.0, 0.0); + multiline(5, + -w2/2.0, -h2/2.0, (double)l, + w2/2.0, -h2/2.0, (double)l, + w2/2.0, h2/2.0, (double)l, + -w2/2.0, h2/2.0, (double)l, + -w2/2.0, -h2/2.0, (double)l); + multiline(5, + 0.0, -h1/2.0, 0.0, + 0.0, h1/2.0, 0.0, + -w2/2.0, h1/2.0, (double)l, + -w2/2.0, -h1/2.0, (double)l, + 0.0, -h1/2.0, 0.0); + multiline(5, + 0.0, -h1/2.0, 0.0, + 0.0, h1/2.0, 0.0, + w2/2.0, h1/2.0, (double)l, + w2/2.0, -h1/2.0, (double)l, + 0.0, -h1/2.0, 0.0); + line(-w1/2.0, -h1/2.0, 0, -w2/2.0, -h2/2.0, (double)l); + line( w1/2.0, -h1/2.0, 0, w2/2.0, -h2/2.0, (double)l); + line( w1/2.0, h1/2.0, 0, w2/2.0, h2/2.0, (double)l); + line(-w1/2.0, h1/2.0, 0, -w2/2.0, h2/2.0, (double)l); +%} + +END From f6851a6997442ecc550597ceb78b124b95e07a7b Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:13:15 +0200 Subject: [PATCH 03/17] Rectify header for mcdoc --- mcstas-comps/contrib/Spin_random.comp | 29 ++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/mcstas-comps/contrib/Spin_random.comp b/mcstas-comps/contrib/Spin_random.comp index 8fe453ca2..ec50587db 100644 --- a/mcstas-comps/contrib/Spin_random.comp +++ b/mcstas-comps/contrib/Spin_random.comp @@ -1,4 +1,31 @@ -/* Set polarisation to random value. */ +/***************************************************************************** +* +* McStas, neutron ray-tracing package +* Copyright 1997-2006, All rights reserved +* Risoe National Laboratory, Roskilde, Denmark +* Institut Laue Langevin, Grenoble, France +* +* Component: Spin_random +* +* %I +* Written by: Michael Schneider (SNAG) +* Date: 2024 +* Origin: SNAG +* +* Set a random polarisation +* +* %D +* +* This component has no physical size or extent, it simply asign polaristion +* randomly to either spin-up or spin-down. +* +* %P +* INPUT PARAMETERS: +* +* OUTPUT PARAMETERS: +* +* %E +*******************************************************************************/ DEFINE COMPONENT Spin_random DEFINITION PARAMETERS () SETTING PARAMETERS () From c2bbecb8d6275b0c8dd817cdf2a2c008d75fddb8 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:16:12 +0200 Subject: [PATCH 04/17] Grammar correction --- mcstas-comps/contrib/Spin_random.comp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcstas-comps/contrib/Spin_random.comp b/mcstas-comps/contrib/Spin_random.comp index ec50587db..f506797ec 100644 --- a/mcstas-comps/contrib/Spin_random.comp +++ b/mcstas-comps/contrib/Spin_random.comp @@ -16,8 +16,8 @@ * * %D * -* This component has no physical size or extent, it simply asign polaristion -* randomly to either spin-up or spin-down. +* This component has no physical size or extent, it simply asigns the neutron +* ray polarisation randomly to either spin-up or spin-down. * * %P * INPUT PARAMETERS: From f0b42faea0eee1d39da77c69cba4106a53c46503 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:34:38 +0200 Subject: [PATCH 05/17] More header updates and feature completion for the PSD's --- mcstas-comps/contrib/PSD_spinDmon.comp | 72 ++++++++++++++++++++++++-- mcstas-comps/contrib/PSD_spinUmon.comp | 72 ++++++++++++++++++++++++-- mcstas-comps/contrib/Spin_random.comp | 4 +- 3 files changed, 138 insertions(+), 10 deletions(-) diff --git a/mcstas-comps/contrib/PSD_spinDmon.comp b/mcstas-comps/contrib/PSD_spinDmon.comp index 1d73e0876..01cc12612 100644 --- a/mcstas-comps/contrib/PSD_spinDmon.comp +++ b/mcstas-comps/contrib/PSD_spinDmon.comp @@ -1,6 +1,51 @@ +/******************************************************************************* +* +* McStas, neutron ray-tracing package +* Copyright 1997-2024, All rights reserved +* Technical University of Denmark, Kongens Lyngby, Denmark +* Institut Laue Langevin, Grenoble, France +* +* Component: PSD_spinDmon +* +* %I +* Written by: Michael Schneider (SNAG) +* Date: 2024 +* Origin: SNAG +* +* Position-sensitive monitor, measuring the spin-down component of the neutron beam. +* +* %D +* An (n times m) pixel PSD monitor, measuring the spin-down component of the neutron beam. +* +* Example: PSD_monitor(xmin=-0.1, xmax=0.1, ymin=-0.1, ymax=0.1, nx=90, ny=90, filename="Output.psd") +* +* %P +* INPUT PARAMETERS: +* +* xmin: [m] Lower x bound of detector opening +* xmax: [m] Upper x bound of detector opening +* ymin: [m] Lower y bound of detector opening +* ymax: [m] Upper y bound of detector opening +* xwidth: [m] Width of detector. Overrides xmin, xmax +* yheight: [m] Height of detector. Overrides ymin, ymax +* nx: [1] Number of pixel columns +* ny: [1] Number of pixel rows +* filename: [string] Name of file in which to store the detector image +* restore_neutron: [1] If set, the monitor does not influence the neutron state +* nowritefile: [1] If set, monitor will skip writing to disk +* +* OUTPUT PARAMETERS: +* +* PSD_N: [] Array of neutron counts +* PSD_p: [] Array of neutron weight counts +* PSD_p2: [] Array of second moments +* +* %E +*******************************************************************************/ DEFINE COMPONENT PSD_spinDmon DEFINITION PARAMETERS () -SETTING PARAMETERS (int nx=90, int ny=90, string filename, xmin, xmax, ymin, ymax) +SETTING PARAMETERS (int nx=90, int ny=90, string filename=0, +int restore_neutron=0, int nowritefile=0) DECLARE %{ @@ -10,10 +55,24 @@ DECLARE %} INITIALIZE %{ + if (xwidth > 0) { xmax = xwidth/2; xmin = -xmax; } + if (yheight > 0) { ymax = yheight/2; ymin = -ymax; } + + if ((xmin >= xmax) || (ymin >= ymax)){ + printf("PSD_monitor: %s: Null detection area !\n" + "ERROR (xwidth,yheight,xmin,xmax,ymin,ymax). Exiting", + NAME_CURRENT_COMP); + exit(0); + } + PSD_N = create_darr2d(nx, ny); PSD_p = create_darr2d(nx, ny); PSD_p2 = create_darr2d(nx, ny); - %} + + // Use instance name for monitor output if no input was given + if (!strcmp(filename,"\0")) sprintf(filename,"%s",NAME_CURRENT_COMP); +%} + TRACE %{ int i,j; @@ -34,12 +93,16 @@ TRACE PSD_p[i][j] = PSD_p[i][j] + p; #pragma acc atomic PSD_p2[i][j] = PSD_p2[i][j] + p2; + SCATTER; } + if (restore_neutron) { + RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); } %} SAVE - %{ +%{ + if (!nowritefile) { DETECTOR_OUT_2D( "PSD monitor", "X position [cm]", @@ -48,6 +111,7 @@ SAVE nx, ny, &PSD_N[0][0],&PSD_p[0][0],&PSD_p2[0][0], filename); + } %} FINALLY %{ @@ -58,7 +122,7 @@ FINALLY %{ MCDISPLAY %{ - magnify("xy"); + multiline(5, (double)xmin, (double)ymin, 0.0, (double)xmax, (double)ymin, 0.0, (double)xmax, (double)ymax, 0.0, diff --git a/mcstas-comps/contrib/PSD_spinUmon.comp b/mcstas-comps/contrib/PSD_spinUmon.comp index 90e39c1f5..a9652f3cf 100644 --- a/mcstas-comps/contrib/PSD_spinUmon.comp +++ b/mcstas-comps/contrib/PSD_spinUmon.comp @@ -1,6 +1,51 @@ +/******************************************************************************* +* +* McStas, neutron ray-tracing package +* Copyright 1997-2024, All rights reserved +* Technical University of Denmark, Kongens Lyngby, Denmark +* Institut Laue Langevin, Grenoble, France +* +* Component: PSD_spinUmon +* +* %I +* Written by: Michael Schneider (SNAG) +* Date: 2024 +* Origin: SNAG +* +* Position-sensitive monitor, measuring the spin-up component of the neutron beam. +* +* %D +* An (n times m) pixel PSD monitor, measuring the spin-up component of the neutron beam. +* +* Example: PSD_monitor(xmin=-0.1, xmax=0.1, ymin=-0.1, ymax=0.1, nx=90, ny=90, filename="Output.psd") +* +* %P +* INPUT PARAMETERS: +* +* xmin: [m] Lower x bound of detector opening +* xmax: [m] Upper x bound of detector opening +* ymin: [m] Lower y bound of detector opening +* ymax: [m] Upper y bound of detector opening +* xwidth: [m] Width of detector. Overrides xmin, xmax +* yheight: [m] Height of detector. Overrides ymin, ymax +* nx: [1] Number of pixel columns +* ny: [1] Number of pixel rows +* filename: [string] Name of file in which to store the detector image +* restore_neutron: [1] If set, the monitor does not influence the neutron state +* nowritefile: [1] If set, monitor will skip writing to disk +* +* OUTPUT PARAMETERS: +* +* PSD_N: [] Array of neutron counts +* PSD_p: [] Array of neutron weight counts +* PSD_p2: [] Array of second moments +* +* %E +*******************************************************************************/ DEFINE COMPONENT PSD_spinUmon DEFINITION PARAMETERS () -SETTING PARAMETERS (int nx=90, int ny=90, string filename, xmin, xmax, ymin, ymax) +SETTING PARAMETERS (int nx=90, int ny=90, string filename=0, +int restore_neutron=0, int nowritefile=0) DECLARE %{ @@ -10,10 +55,24 @@ DECLARE %} INITIALIZE %{ + if (xwidth > 0) { xmax = xwidth/2; xmin = -xmax; } + if (yheight > 0) { ymax = yheight/2; ymin = -ymax; } + + if ((xmin >= xmax) || (ymin >= ymax)){ + printf("PSD_monitor: %s: Null detection area !\n" + "ERROR (xwidth,yheight,xmin,xmax,ymin,ymax). Exiting", + NAME_CURRENT_COMP); + exit(0); + } + PSD_N = create_darr2d(nx, ny); PSD_p = create_darr2d(nx, ny); PSD_p2 = create_darr2d(nx, ny); - %} + + // Use instance name for monitor output if no input was given + if (!strcmp(filename,"\0")) sprintf(filename,"%s",NAME_CURRENT_COMP); +%} + TRACE %{ int i,j; @@ -34,12 +93,16 @@ TRACE PSD_p[i][j] = PSD_p[i][j] + p; #pragma acc atomic PSD_p2[i][j] = PSD_p2[i][j] + p2; + SCATTER; } + if (restore_neutron) { + RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); } %} SAVE - %{ +%{ + if (!nowritefile) { DETECTOR_OUT_2D( "PSD monitor", "X position [cm]", @@ -48,6 +111,7 @@ SAVE nx, ny, &PSD_N[0][0],&PSD_p[0][0],&PSD_p2[0][0], filename); + } %} FINALLY %{ @@ -58,7 +122,7 @@ FINALLY %{ MCDISPLAY %{ - magnify("xy"); + multiline(5, (double)xmin, (double)ymin, 0.0, (double)xmax, (double)ymin, 0.0, (double)xmax, (double)ymax, 0.0, diff --git a/mcstas-comps/contrib/Spin_random.comp b/mcstas-comps/contrib/Spin_random.comp index f506797ec..dff4e7f82 100644 --- a/mcstas-comps/contrib/Spin_random.comp +++ b/mcstas-comps/contrib/Spin_random.comp @@ -1,8 +1,8 @@ /***************************************************************************** * * McStas, neutron ray-tracing package -* Copyright 1997-2006, All rights reserved -* Risoe National Laboratory, Roskilde, Denmark +* Copyright 1997-2024, All rights reserved +* Technical University of Denmark, Kongens Lyngby, Denmark * Institut Laue Langevin, Grenoble, France * * Component: Spin_random From a5b9340acc67b17c2dd424e34123f8e3cae39b84 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:39:06 +0200 Subject: [PATCH 06/17] Fix header --- .../contrib/Transmission_V_polarisator.comp | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index a30eaea75..78eac77c8 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -1,11 +1,11 @@ /******************************************************************************* * +* %I * Component: Transmission_V_polarisator * * Written by: Andreas Ostermann * Modified by Michael Schneider, SNAG, includes absorption by Fe in supermirror -* Origin: McStas 1.8/ILL (France). -* (The main source code was taken from Gravity_guide (ver 1.6ill)) +* Origin: SNAG * * * Example: Transmission_V_polarisator(w1=0.050, h1=0.050, @@ -16,31 +16,31 @@ * mleft=1.2, mright=1.2, mtop=1.2, mbottom=1.2, * reflectUP="measured_up_q.dat",reflectDW="measured_dw_q.dat") * +* %D +* Transmission V-polarisator including by Fe in the supermirror. * * %P * INPUT PARAMETERS: * -* w1: (m) Width at the polarizer entry -* h1: (m) Height at the polarizer entry -* w2: (m) Width at the polarizer exit -* h2: (m) Height at the polarizer exit -* l: (m) length of polarizer -* R0: (1) Low-angle reflectivity of the outer guide -* Qc: (AA-1) Critical scattering vector of the outer guide -* W: (AA-1) Width of supermirror cut-off of the outer guide -* alpha: (AA) Slope of reflectivity of the outer guide -* mleft: (1) m-value of material for left. vert. mirror of the outer guide -* mright: (1) m-value of material for right. vert. mirror of the outer guide -* mtop: (1) m-value of material for top. horz. mirror of the outer guide -* mbottom: (1) m-value of material for bottom. horz. mirror of the outer guide -* waferD (m) Thickness of Si wafer -* FeD: (m) Thickness of Fe in supermirror, Ti is neglected -* Si_i (barns) Scattering cross section per atom (barns) -* Si_a (barns) Absorption cross section per atom (barns) at 2200m/s -* reflectUP (str) Reflectivity profile of the FeSi-wafer for spin-up neutrons; columns [q,R] -* reflectDW (str) Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] -* -* %D +* w1: [m] Width at the polarizer entry +* h1: [m] Height at the polarizer entry +* w2: [m] Width at the polarizer exit +* h2: [m] Height at the polarizer exit +* l: [m] length of polarizer +* R0: [1] Low-angle reflectivity of the outer guide +* Qc: [AA-1] Critical scattering vector of the outer guide +* W: [AA-1] Width of supermirror cut-off of the outer guide +* alpha: [AA] Slope of reflectivity of the outer guide +* mleft: [1] m-value of material for left. vert. mirror of the outer guide +* mright: [1] m-value of material for right. vert. mirror of the outer guide +* mtop: [1] m-value of material for top. horz. mirror of the outer guide +* mbottom: [1] m-value of material for bottom. horz. mirror of the outer guide +* waferD: [m] Thickness of Si wafer +* FeD: [m] Thickness of Fe in supermirror, Ti is neglected +* Si_i: [barns] Scattering cross section per atom (barns) +* Si_a: [barns] Absorption cross section per atom (barns) at 2200m/s +* reflectUP [str] Reflectivity profile of the FeSi-wafer for spin-up neutrons; columns [q,R] +* reflectDW [str] Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] * * * %E From 3ad5284ab64ce9aec8765546e0666af316181b77 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:44:36 +0200 Subject: [PATCH 07/17] Further header fixes --- mcstas-comps/contrib/Transmission_V_polarisator.comp | 12 +++++------- .../contrib/Transmission_polarisatorABSnT.comp | 5 +++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index 78eac77c8..5093698e8 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -3,11 +3,11 @@ * %I * Component: Transmission_V_polarisator * -* Written by: Andreas Ostermann -* Modified by Michael Schneider, SNAG, includes absorption by Fe in supermirror +* Written by: Michael Schneider (from Andreas Ostermann comp) * Origin: SNAG * -* +* %D +* Transmission V-polarisator including absorption by Fe in the supermirror. * Example: Transmission_V_polarisator(w1=0.050, h1=0.050, * w2=0.050, h2=0.050, l=2.700, * waferD=0.0003, FeD=2.16e-06, @@ -15,9 +15,6 @@ * R0=0.99, Qc=0.02174, alpha=4.25, W=0.001, * mleft=1.2, mright=1.2, mtop=1.2, mbottom=1.2, * reflectUP="measured_up_q.dat",reflectDW="measured_dw_q.dat") -* -* %D -* Transmission V-polarisator including by Fe in the supermirror. * * %P * INPUT PARAMETERS: @@ -41,7 +38,8 @@ * Si_a: [barns] Absorption cross section per atom (barns) at 2200m/s * reflectUP [str] Reflectivity profile of the FeSi-wafer for spin-up neutrons; columns [q,R] * reflectDW [str] Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] -* +* +* %L * * %E *******************************************************************************/ diff --git a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp index 5897eec7d..2d1229211 100644 --- a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp +++ b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp @@ -4,9 +4,10 @@ * Component: Transmission_polarisatorABSnT * * Written by: Andreas Ostermann -* Origin: McStas 1.8/ILL (France). -* The main source code was taken from Gravity_guide (ver 1.6ill) +* Origin: TUM * +* %D +* Transmission V-polarisator including absorption by Fe in the supermirror. * * Example: Gravity_guide(w1=0.1, h1=0.1, w2=0.1, h2=0.1, l=12, * R0=0.99, Qc=0.021, alpha=6.07, m=1.0, W=0.003, k=1, d=0.0005) From 403897676cbf8f143cc62f532d895f00ee489d31 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:46:56 +0200 Subject: [PATCH 08/17] Further header fixes --- mcstas-comps/contrib/Transmission_V_polarisator.comp | 4 +++- mcstas-comps/contrib/Transmission_polarisatorABSnT.comp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index 5093698e8..907c8c3e8 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -3,9 +3,11 @@ * %I * Component: Transmission_V_polarisator * -* Written by: Michael Schneider (from Andreas Ostermann comp) +* Written by: Michael Schneider (adapted from Andreas Ostermann comp) * Origin: SNAG * +* Transmission V-polarisator including absorption by Fe in the supermirror. Experimentally benchmarked +* * %D * Transmission V-polarisator including absorption by Fe in the supermirror. * Example: Transmission_V_polarisator(w1=0.050, h1=0.050, diff --git a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp index 2d1229211..ce9445e82 100644 --- a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp +++ b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp @@ -6,6 +6,8 @@ * Written by: Andreas Ostermann * Origin: TUM * +* Transmission V-polarisator including absorption by Fe in the supermirror. +* * %D * Transmission V-polarisator including absorption by Fe in the supermirror. * From 66cbf162aea373289c7cbb7044c2102881c22508 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 14:58:24 +0200 Subject: [PATCH 09/17] Add colons --- mcstas-comps/contrib/Transmission_V_polarisator.comp | 8 +++++--- mcstas-comps/contrib/Transmission_polarisatorABSnT.comp | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index 907c8c3e8..e54f53974 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -4,9 +4,10 @@ * Component: Transmission_V_polarisator * * Written by: Michael Schneider (adapted from Andreas Ostermann comp) +* Date: 2024 * Origin: SNAG * -* Transmission V-polarisator including absorption by Fe in the supermirror. Experimentally benchmarked +* Transmission V-polarisator including absorption by Fe in the supermirror. Experimentally benchmarked. * * %D * Transmission V-polarisator including absorption by Fe in the supermirror. @@ -38,10 +39,11 @@ * FeD: [m] Thickness of Fe in supermirror, Ti is neglected * Si_i: [barns] Scattering cross section per atom (barns) * Si_a: [barns] Absorption cross section per atom (barns) at 2200m/s -* reflectUP [str] Reflectivity profile of the FeSi-wafer for spin-up neutrons; columns [q,R] -* reflectDW [str] Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] +* reflectUP: [str] Reflectivity profile of the FeSi-wafer for spin-up neutrons; columns [q,R] +* reflectDW: [str] Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] * * %L +* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 * * %E *******************************************************************************/ diff --git a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp index ce9445e82..a933a2646 100644 --- a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp +++ b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp @@ -4,6 +4,7 @@ * Component: Transmission_polarisatorABSnT * * Written by: Andreas Ostermann +* Date: 2004 * Origin: TUM * * Transmission V-polarisator including absorption by Fe in the supermirror. @@ -22,8 +23,6 @@ * R0_up=0.99, Qc_up=0.014, alpha_up=2.25, W_up=0.0025, mup=1.0, * R0_down=0.99, Qc_down=0.02174, alpha_down=3.8, W_down=0.00235, mdown=2.5) * -* %D -* * %P * INPUT PARAMETERS: * From e652e87a33311b9020da4bd007a7123afc5cd0ee Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 15:00:49 +0200 Subject: [PATCH 10/17] A little more formatting --- mcstas-comps/contrib/Transmission_V_polarisator.comp | 1 + 1 file changed, 1 insertion(+) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index e54f53974..cdca82f6b 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -11,6 +11,7 @@ * * %D * Transmission V-polarisator including absorption by Fe in the supermirror. +* * Example: Transmission_V_polarisator(w1=0.050, h1=0.050, * w2=0.050, h2=0.050, l=2.700, * waferD=0.0003, FeD=2.16e-06, From d456b8422888b8f0613bb2c2dbb5acd53a4417c6 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 15:23:43 +0200 Subject: [PATCH 11/17] Put in right place --- .../Test_V_cavity_SNAG_double_side.instr | 41 ++++++++++++++++- .../Test_V_cavity_SNAG_single_side.instr | 45 ++++++++++++++++--- 2 files changed, 78 insertions(+), 8 deletions(-) rename mcstas-comps/examples/{Tests_optics => Tests_polarization}/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr (80%) rename mcstas-comps/examples/{Tests_optics => Tests_polarization}/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr (80%) diff --git a/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr similarity index 80% rename from mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr rename to mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr index 2af86a949..feb098807 100644 --- a/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr @@ -1,5 +1,42 @@ -DEFINE INSTRUMENT cavity_QU24003_DiffScattSpect_CSNS( - Lam=7.0, dLam=6.0, +/****************************************************************************** +* McStas instrument definition URL=http://www.mcstas.org +* +* Instrument: Test_V_cavity_SNAG_double_side +* +* %I +* Written by: Michael Schneider (SNAG) +* Date: 2024 +* Origin: SNAG +* %INSTRUMENT_SITE: Tests_polarization +* +* Test instrument for Transmission_V_polarisator, double layer reflectivity. +* +* %D +* Test instrument for Transmission_V_polarisator, double layer reflectivity. +* +* %Example: Test_V_cavity_SNAG_single_side.instr Lam=7 +* +* %P +* Lam: [AA] Central wavelength produced at source +* dLam: [AA] Wavelength spread produced at source +* l_guide: [m] Length of feeding guide +* m_hori: [1] m-value of feeding guide, horizontal mirrors +* m_vert: [1] m-value of feeding guide, vertical mirrors +* m_pol_h: [1] m-value of guide body, horizontal (m of FeSi is defined by data files) +* m_pol_v: [1] m-value of guide body, vertical (m of FeSi is defined by data files) +* W: [m] Width of guide and cavity +* H: [m] Height of guide and cavity +* Length_C: [m] Length of guide body +* tap_ang: [deg] Taper angle with respect to optical axis of V-cavity +* distK: [m] Distance between V-cavities (applicable, if 2 cavities are installed) +* d_Fe: [m] Thickness of Fe in one supermirror coating +* d: [m] Distance from source to guide entrance +* +* %L * P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* +* %E +******************************************************************************/ +DEFINE INSTRUMENT Test_V_cavity_SNAG_double_side(Lam=7.0, dLam=6.0, // Simulationen mit FeSi m = 5.0, 1.4 Angstroem // Version from 28-Dec-2023 runs with McStas Version 2.7.1 l_guide0=2, // length of feeding guide (m) diff --git a/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr similarity index 80% rename from mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr rename to mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr index 355482b11..c9b7fe6d5 100644 --- a/mcstas-comps/examples/Tests_optics/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr @@ -1,7 +1,40 @@ -DEFINE INSTRUMENT cavity_QU24003_DiffScattSpect_CSNS( - Lam=7.0, dLam=6.0, - // Simulationen mit FeSi m = 5.0, 1.4 Angstroem - // Version from 28-Dec-2023 runs with McStas Version 2.7.1 +/****************************************************************************** +* Instrument: Test_V_cavity_SNAG_single_side +* +* %I +* Written by: Michael Schneider (SNAG) +* Date: 2024 +* Origin: SNAG +* %INSTRUMENT_SITE: Tests_polarization +* +* Test instrument for Transmission_V_polarisator, single layer reflectivity. +* +* %D +* Test instrument for Transmission_V_polarisator, signle layer reflectivity. +* +* %Example: Test_V_cavity_SNAG_single_side.instr Lam=7 +* +* %P +* Lam: [AA] Central wavelength produced at source +* dLam: [AA] Wavelength spread produced at source +* l_guide: [m] Length of feeding guide +* m_hori: [1] m-value of feeding guide, horizontal mirrors +* m_vert: [1] m-value of feeding guide, vertical mirrors +* m_pol_h: [1] m-value of guide body, horizontal (m of FeSi is defined by data files) +* m_pol_v: [1] m-value of guide body, vertical (m of FeSi is defined by data files) +* W: [m] Width of guide and cavity +* H: [m] Height of guide and cavity +* Length_C: [m] Length of guide body +* tap_ang: [deg] Taper angle with respect to optical axis of V-cavity +* distK: [m] Distance between V-cavities (applicable, if 2 cavities are installed) +* d_Fe: [m] Thickness of Fe in one supermirror coating +* d: [m] Distance from source to guide entrance +* +* %L * P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* +* %E +******************************************************************************/ +DEFINE INSTRUMENT Test_V_cavity_SNAG_single_side(Lam=7.0, dLam=6.0, l_guide0=2, // length of feeding guide (m) m_hori=1.0, // m of feeding guide m_vert=3.0, // m of feeding guide @@ -13,8 +46,8 @@ DEFINE INSTRUMENT cavity_QU24003_DiffScattSpect_CSNS( tap_ang=0.55, // taper angle with respect to optical axis of V-cavity (deg) distK=1.23864, // distance between V-cavities (m) (applicable, if 2 cavities are installed) d_Fe=6.95e-6, // thickness of Fe in one supermirror coating (m) - d=2.0 // distance source to guide entrance (m) -) + d=2.0) // distance source to guide entrance (m) + DECLARE %{ From 882192f4cadc1223280ce36e964a9d677a995b24 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 15:26:01 +0200 Subject: [PATCH 12/17] Minor header adjustments --- .../Test_V_cavity_SNAG_double_side.instr | 13 +++++-------- .../Test_V_cavity_SNAG_single_side.instr | 3 ++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr index feb098807..fb0f74281 100644 --- a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr @@ -1,6 +1,4 @@ /****************************************************************************** -* McStas instrument definition URL=http://www.mcstas.org -* * Instrument: Test_V_cavity_SNAG_double_side * * %I @@ -32,13 +30,12 @@ * d_Fe: [m] Thickness of Fe in one supermirror coating * d: [m] Distance from source to guide entrance * -* %L * P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* %L +* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 * * %E ******************************************************************************/ -DEFINE INSTRUMENT Test_V_cavity_SNAG_double_side(Lam=7.0, dLam=6.0, - // Simulationen mit FeSi m = 5.0, 1.4 Angstroem - // Version from 28-Dec-2023 runs with McStas Version 2.7.1 +DEFINE INSTRUMENT Test_V_cavity_double_double_side(Lam=7.0, dLam=6.0, l_guide0=2, // length of feeding guide (m) m_hori=1.0, // m of feeding guide m_vert=3.0, // m of feeding guide @@ -50,8 +47,8 @@ DEFINE INSTRUMENT Test_V_cavity_SNAG_double_side(Lam=7.0, dLam=6.0, tap_ang=0.55, // taper angle with respect to optical axis of V-cavity (deg) distK=1.23864, // distance between V-cavities (m) (applicable, if 2 cavities are installed) d_Fe=6.95e-6, // thickness of Fe in one supermirror coating (m) - d=2.0 // distance source to guide entrance (m) -) + d=2.0) // distance source to guide entrance (m) + DECLARE %{ diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr index c9b7fe6d5..4896e1d36 100644 --- a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr @@ -30,7 +30,8 @@ * d_Fe: [m] Thickness of Fe in one supermirror coating * d: [m] Distance from source to guide entrance * -* %L * P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* %L +* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 * * %E ******************************************************************************/ From 7aa43ab05f62d2c8293be73938b682e095013bf6 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 15:34:59 +0200 Subject: [PATCH 13/17] Reinstate input parameters lost in translation... --- mcstas-comps/contrib/PSD_spinDmon.comp | 6 +++++- mcstas-comps/contrib/PSD_spinUmon.comp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mcstas-comps/contrib/PSD_spinDmon.comp b/mcstas-comps/contrib/PSD_spinDmon.comp index 01cc12612..44b2e6d8b 100644 --- a/mcstas-comps/contrib/PSD_spinDmon.comp +++ b/mcstas-comps/contrib/PSD_spinDmon.comp @@ -45,7 +45,11 @@ DEFINE COMPONENT PSD_spinDmon DEFINITION PARAMETERS () SETTING PARAMETERS (int nx=90, int ny=90, string filename=0, -int restore_neutron=0, int nowritefile=0) + xmin=-0.05, xmax=0.05, ymin=-0.05, ymax=0.05, xwidth=0, yheight=0, + int restore_neutron=0, int nowritefile=0) + +OUTPUT PARAMETERS () +/* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */ DECLARE %{ diff --git a/mcstas-comps/contrib/PSD_spinUmon.comp b/mcstas-comps/contrib/PSD_spinUmon.comp index a9652f3cf..b1ec5f747 100644 --- a/mcstas-comps/contrib/PSD_spinUmon.comp +++ b/mcstas-comps/contrib/PSD_spinUmon.comp @@ -45,7 +45,11 @@ DEFINE COMPONENT PSD_spinUmon DEFINITION PARAMETERS () SETTING PARAMETERS (int nx=90, int ny=90, string filename=0, -int restore_neutron=0, int nowritefile=0) + xmin=-0.05, xmax=0.05, ymin=-0.05, ymax=0.05, xwidth=0, yheight=0, + int restore_neutron=0, int nowritefile=0) + +OUTPUT PARAMETERS () +/* Neutron parameters: (x,y,z,vx,vy,vz,t,sx,sy,sz,p) */ DECLARE %{ From 893725d4c6f862f30c56198f965d383860d5477f Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 4 Sep 2024 15:50:17 +0200 Subject: [PATCH 14/17] Add test targed values --- .../FeSi_m50_down.dat | 66 +++++++++++++++++++ .../FeSi_m50_down_R2.dat | 66 +++++++++++++++++++ .../FeSi_m50_up.dat | 66 +++++++++++++++++++ .../FeSi_m50_up_R2.dat | 66 +++++++++++++++++++ .../Test_V_cavity_SNAG_double_side.instr | 2 +- .../FeSi_m50_down.dat | 66 +++++++++++++++++++ .../FeSi_m50_down_R2.dat | 66 +++++++++++++++++++ .../FeSi_m50_up.dat | 66 +++++++++++++++++++ .../FeSi_m50_up_R2.dat | 66 +++++++++++++++++++ .../Test_V_cavity_SNAG_single_side.instr | 4 +- 10 files changed, 531 insertions(+), 3 deletions(-) create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down_R2.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up_R2.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down_R2.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up.dat create mode 100644 mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up_R2.dat diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down.dat new file mode 100644 index 000000000..74892884b --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics FeSi supermirror coating on glass +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin down +# date 23-May-13 +# reflectivity single-layer +# FeSi_m50_down +# for McStas input +# Data: q [AA-1], R[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 0.15814 +0.01919 0.03303 +0.02193 0.00959 +0.02467 0.00571 +0.02742 0.00505 +0.03016 0.00491 +0.03290 0.00485 +0.03564 0.00480 +0.03838 0.00476 +0.04112 0.00471 +0.04386 0.00467 +0.04660 0.00463 +0.04934 0.00458 +0.05209 0.00454 +0.05483 0.00449 +0.05757 0.00445 +0.06031 0.00440 +0.06305 0.00436 +0.06579 0.00432 +0.06853 0.00427 +0.07127 0.00423 +0.07401 0.00418 +0.07675 0.00414 +0.07949 0.00410 +0.08223 0.00405 +0.08497 0.00401 +0.08771 0.00396 +0.09045 0.00392 +0.09319 0.00388 +0.09593 0.00383 +0.09867 0.00379 +0.10141 0.00374 +0.10415 0.00369 +0.10689 0.00340 +0.10963 0.00076 +0.11237 0.00002 +0.11511 0.00000 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down_R2.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down_R2.dat new file mode 100644 index 000000000..da3243ac4 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_down_R2.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics FeSi supermirror coating on glass +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin down +# date 23-May-13 +# reflectivity double-layer R'=1-(1-R)^2 +# FeSi_m50_down_R2 +# for McStas input +# Data: q [AA-1], R'[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 0.29127 +0.01919 0.06497 +0.02193 0.01909 +0.02467 0.01138 +0.02742 0.01007 +0.03016 0.00979 +0.03290 0.00967 +0.03564 0.00958 +0.03838 0.00949 +0.04112 0.00940 +0.04386 0.00932 +0.04660 0.00923 +0.04934 0.00914 +0.05209 0.00905 +0.05483 0.00897 +0.05757 0.00888 +0.06031 0.00879 +0.06305 0.00870 +0.06579 0.00861 +0.06853 0.00853 +0.07127 0.00844 +0.07401 0.00835 +0.07675 0.00826 +0.07949 0.00818 +0.08223 0.00809 +0.08497 0.00800 +0.08771 0.00791 +0.09045 0.00783 +0.09319 0.00774 +0.09593 0.00765 +0.09867 0.00756 +0.10141 0.00747 +0.10415 0.00738 +0.10689 0.00679 +0.10963 0.00151 +0.11237 0.00004 +0.11511 0.00000 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up.dat new file mode 100644 index 000000000..bff13dfc4 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics supermirror coating +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin up +# date 23-May-13 +# reflectivity single-layer +# FeSi_m50_up +# for McStas input +# Data: q [AA-1], R[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 1.00000 +0.01919 1.00000 +0.02193 0.99938 +0.02467 0.99061 +0.02742 0.98184 +0.03016 0.97307 +0.03290 0.96429 +0.03564 0.95552 +0.03838 0.94675 +0.04112 0.93798 +0.04386 0.92921 +0.04660 0.92044 +0.04934 0.91166 +0.05209 0.90289 +0.05483 0.89412 +0.05757 0.88535 +0.06031 0.87658 +0.06305 0.86781 +0.06579 0.85904 +0.06853 0.85027 +0.07127 0.84150 +0.07401 0.83273 +0.07675 0.82396 +0.07949 0.81519 +0.08223 0.80642 +0.08497 0.79766 +0.08771 0.78889 +0.09045 0.78012 +0.09319 0.77135 +0.09593 0.76259 +0.09867 0.75382 +0.10141 0.74503 +0.10415 0.73520 +0.10689 0.67689 +0.10963 0.15039 +0.11237 0.00370 +0.11511 0.00007 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up_R2.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up_R2.dat new file mode 100644 index 000000000..94f8422f3 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/FeSi_m50_up_R2.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics FeSi supermirror coating on glass +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin up +# date 23-May-13 +# reflectivity double-layer R'=1-(1-R)^2 +# FeSi_m50_up_R2 +# for McStas input +# Data: q [AA-1], R'[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 1.00000 +0.01919 1.00000 +0.02193 1.00000 +0.02467 0.99991 +0.02742 0.99967 +0.03016 0.99927 +0.03290 0.99873 +0.03564 0.99802 +0.03838 0.99716 +0.04112 0.99615 +0.04386 0.99499 +0.04660 0.99367 +0.04934 0.99220 +0.05209 0.99057 +0.05483 0.98879 +0.05757 0.98686 +0.06031 0.98477 +0.06305 0.98253 +0.06579 0.98013 +0.06853 0.97758 +0.07127 0.97488 +0.07401 0.97202 +0.07675 0.96901 +0.07949 0.96585 +0.08223 0.96253 +0.08497 0.95906 +0.08771 0.95543 +0.09045 0.95165 +0.09319 0.94772 +0.09593 0.94364 +0.09867 0.93940 +0.10141 0.93499 +0.10415 0.92988 +0.10689 0.89560 +0.10963 0.27817 +0.11237 0.00739 +0.11511 0.00015 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr index fb0f74281..3ec9e919e 100644 --- a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr @@ -12,7 +12,7 @@ * %D * Test instrument for Transmission_V_polarisator, double layer reflectivity. * -* %Example: Test_V_cavity_SNAG_single_side.instr Lam=7 +* %Example: Test_V_cavity_SNAG_double_side.instr Lam=7 Detector: div_lambda_hor_I=1.0e+13 * * %P * Lam: [AA] Central wavelength produced at source diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down.dat new file mode 100644 index 000000000..74892884b --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics FeSi supermirror coating on glass +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin down +# date 23-May-13 +# reflectivity single-layer +# FeSi_m50_down +# for McStas input +# Data: q [AA-1], R[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 0.15814 +0.01919 0.03303 +0.02193 0.00959 +0.02467 0.00571 +0.02742 0.00505 +0.03016 0.00491 +0.03290 0.00485 +0.03564 0.00480 +0.03838 0.00476 +0.04112 0.00471 +0.04386 0.00467 +0.04660 0.00463 +0.04934 0.00458 +0.05209 0.00454 +0.05483 0.00449 +0.05757 0.00445 +0.06031 0.00440 +0.06305 0.00436 +0.06579 0.00432 +0.06853 0.00427 +0.07127 0.00423 +0.07401 0.00418 +0.07675 0.00414 +0.07949 0.00410 +0.08223 0.00405 +0.08497 0.00401 +0.08771 0.00396 +0.09045 0.00392 +0.09319 0.00388 +0.09593 0.00383 +0.09867 0.00379 +0.10141 0.00374 +0.10415 0.00369 +0.10689 0.00340 +0.10963 0.00076 +0.11237 0.00002 +0.11511 0.00000 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down_R2.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down_R2.dat new file mode 100644 index 000000000..da3243ac4 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_down_R2.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics FeSi supermirror coating on glass +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin down +# date 23-May-13 +# reflectivity double-layer R'=1-(1-R)^2 +# FeSi_m50_down_R2 +# for McStas input +# Data: q [AA-1], R'[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 0.29127 +0.01919 0.06497 +0.02193 0.01909 +0.02467 0.01138 +0.02742 0.01007 +0.03016 0.00979 +0.03290 0.00967 +0.03564 0.00958 +0.03838 0.00949 +0.04112 0.00940 +0.04386 0.00932 +0.04660 0.00923 +0.04934 0.00914 +0.05209 0.00905 +0.05483 0.00897 +0.05757 0.00888 +0.06031 0.00879 +0.06305 0.00870 +0.06579 0.00861 +0.06853 0.00853 +0.07127 0.00844 +0.07401 0.00835 +0.07675 0.00826 +0.07949 0.00818 +0.08223 0.00809 +0.08497 0.00800 +0.08771 0.00791 +0.09045 0.00783 +0.09319 0.00774 +0.09593 0.00765 +0.09867 0.00756 +0.10141 0.00747 +0.10415 0.00738 +0.10689 0.00679 +0.10963 0.00151 +0.11237 0.00004 +0.11511 0.00000 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up.dat new file mode 100644 index 000000000..bff13dfc4 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics supermirror coating +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin up +# date 23-May-13 +# reflectivity single-layer +# FeSi_m50_up +# for McStas input +# Data: q [AA-1], R[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 1.00000 +0.01919 1.00000 +0.02193 0.99938 +0.02467 0.99061 +0.02742 0.98184 +0.03016 0.97307 +0.03290 0.96429 +0.03564 0.95552 +0.03838 0.94675 +0.04112 0.93798 +0.04386 0.92921 +0.04660 0.92044 +0.04934 0.91166 +0.05209 0.90289 +0.05483 0.89412 +0.05757 0.88535 +0.06031 0.87658 +0.06305 0.86781 +0.06579 0.85904 +0.06853 0.85027 +0.07127 0.84150 +0.07401 0.83273 +0.07675 0.82396 +0.07949 0.81519 +0.08223 0.80642 +0.08497 0.79766 +0.08771 0.78889 +0.09045 0.78012 +0.09319 0.77135 +0.09593 0.76259 +0.09867 0.75382 +0.10141 0.74503 +0.10415 0.73520 +0.10689 0.67689 +0.10963 0.15039 +0.11237 0.00370 +0.11511 0.00007 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up_R2.dat b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up_R2.dat new file mode 100644 index 000000000..94f8422f3 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/FeSi_m50_up_R2.dat @@ -0,0 +1,66 @@ +# Swiss Neutronics FeSi supermirror coating on glass +# FeSi +# Reference: http://www.swissneutronics.ch/ +# m 5 +# alpha 3.2 +# polarisation 0.99 +# spin up +# date 23-May-13 +# reflectivity double-layer R'=1-(1-R)^2 +# FeSi_m50_up_R2 +# for McStas input +# Data: q [AA-1], R'[0-1] +# +0.00000 1.00000 +0.00274 1.00000 +0.00548 1.00000 +0.00822 1.00000 +0.01097 1.00000 +0.01371 1.00000 +0.01645 1.00000 +0.01919 1.00000 +0.02193 1.00000 +0.02467 0.99991 +0.02742 0.99967 +0.03016 0.99927 +0.03290 0.99873 +0.03564 0.99802 +0.03838 0.99716 +0.04112 0.99615 +0.04386 0.99499 +0.04660 0.99367 +0.04934 0.99220 +0.05209 0.99057 +0.05483 0.98879 +0.05757 0.98686 +0.06031 0.98477 +0.06305 0.98253 +0.06579 0.98013 +0.06853 0.97758 +0.07127 0.97488 +0.07401 0.97202 +0.07675 0.96901 +0.07949 0.96585 +0.08223 0.96253 +0.08497 0.95906 +0.08771 0.95543 +0.09045 0.95165 +0.09319 0.94772 +0.09593 0.94364 +0.09867 0.93940 +0.10141 0.93499 +0.10415 0.92988 +0.10689 0.89560 +0.10963 0.27817 +0.11237 0.00739 +0.11511 0.00015 +0.11784 0.00000 +0.12058 0.00000 +0.12332 0.00000 +0.12606 0.00000 +0.12880 0.00000 +0.13153 0.00000 +0.13427 0.00000 +0.13701 0.00000 +0.13975 0.00000 +0.14248 0.00000 \ No newline at end of file diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr index 4896e1d36..bf1e1fb57 100644 --- a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr @@ -10,9 +10,9 @@ * Test instrument for Transmission_V_polarisator, single layer reflectivity. * * %D -* Test instrument for Transmission_V_polarisator, signle layer reflectivity. +* Test instrument for Transmission_V_polarisator, single layer reflectivity. * -* %Example: Test_V_cavity_SNAG_single_side.instr Lam=7 +* %Example: Test_V_cavity_SNAG_single_side.instr Lam=7 Detector: div_lambda_hor_I=1.1e+13 * * %P * Lam: [AA] Central wavelength produced at source From b6851c45d048caa7f2ab2835775d84e1e3fc224f Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Thu, 5 Sep 2024 16:32:38 +0200 Subject: [PATCH 15/17] Add missing } and correct tabulation --- mcstas-comps/contrib/PSD_spinDmon.comp | 15 +++++++-------- mcstas-comps/contrib/PSD_spinUmon.comp | 17 ++++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/mcstas-comps/contrib/PSD_spinDmon.comp b/mcstas-comps/contrib/PSD_spinDmon.comp index 44b2e6d8b..db4bdf07b 100644 --- a/mcstas-comps/contrib/PSD_spinDmon.comp +++ b/mcstas-comps/contrib/PSD_spinDmon.comp @@ -78,7 +78,7 @@ INITIALIZE %} TRACE - %{ +%{ int i,j; if (sy > 0) @@ -100,13 +100,13 @@ TRACE SCATTER; } - if (restore_neutron) { - RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); + if (restore_neutron) { + RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); } - %} + } +%} SAVE %{ - if (!nowritefile) { DETECTOR_OUT_2D( "PSD monitor", "X position [cm]", @@ -115,8 +115,7 @@ SAVE nx, ny, &PSD_N[0][0],&PSD_p[0][0],&PSD_p2[0][0], filename); - } - %} +%} FINALLY %{ destroy_darr2d(PSD_N); @@ -126,7 +125,7 @@ FINALLY %{ MCDISPLAY %{ - + magnify("xy"); multiline(5, (double)xmin, (double)ymin, 0.0, (double)xmax, (double)ymin, 0.0, (double)xmax, (double)ymax, 0.0, diff --git a/mcstas-comps/contrib/PSD_spinUmon.comp b/mcstas-comps/contrib/PSD_spinUmon.comp index b1ec5f747..d39874f2e 100644 --- a/mcstas-comps/contrib/PSD_spinUmon.comp +++ b/mcstas-comps/contrib/PSD_spinUmon.comp @@ -78,7 +78,7 @@ INITIALIZE %} TRACE - %{ +%{ int i,j; if (sy < 0) @@ -100,13 +100,13 @@ TRACE SCATTER; } - if (restore_neutron) { - RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); - } - %} + if (restore_neutron) { + RESTORE_NEUTRON(INDEX_CURRENT_COMP, x, y, z, vx, vy, vz, t, sx, sy, sz, p); + } + } +%} SAVE %{ - if (!nowritefile) { DETECTOR_OUT_2D( "PSD monitor", "X position [cm]", @@ -115,8 +115,7 @@ SAVE nx, ny, &PSD_N[0][0],&PSD_p[0][0],&PSD_p2[0][0], filename); - } - %} +%} FINALLY %{ destroy_darr2d(PSD_N); @@ -126,7 +125,7 @@ FINALLY %{ MCDISPLAY %{ - + magnify("xy"); multiline(5, (double)xmin, (double)ymin, 0.0, (double)xmax, (double)ymin, 0.0, (double)xmax, (double)ymax, 0.0, From 643bbb7221749d30d66fdaac8d1c6032c8f6e1c1 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 6 Sep 2024 13:45:19 +0200 Subject: [PATCH 16/17] Andreas Ostermann main author --- mcstas-comps/contrib/Transmission_V_polarisator.comp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index cdca82f6b..e7ea7e0c1 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -3,9 +3,9 @@ * %I * Component: Transmission_V_polarisator * -* Written by: Michael Schneider (adapted from Andreas Ostermann comp) +* Written by: Andreas Ostermann (additions from Michael Schneider, SNAG) * Date: 2024 -* Origin: SNAG +* Origin: TUM * * Transmission V-polarisator including absorption by Fe in the supermirror. Experimentally benchmarked. * From 4e0c9936e404f2a056e0def21cc9f989afa411ed Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Fri, 6 Sep 2024 14:08:23 +0200 Subject: [PATCH 17/17] Add links to https://doi.org/10.1016/j.physb.2009.06.03 --- mcstas-comps/contrib/Transmission_V_polarisator.comp | 2 +- .../Test_V_cavity_SNAG_double_side.instr | 2 +- .../Test_V_cavity_SNAG_single_side.instr | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mcstas-comps/contrib/Transmission_V_polarisator.comp b/mcstas-comps/contrib/Transmission_V_polarisator.comp index e7ea7e0c1..3ee2cfb81 100644 --- a/mcstas-comps/contrib/Transmission_V_polarisator.comp +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -44,7 +44,7 @@ * reflectDW: [str] Reflectivity profile of the FeSi-wafer for spin-down neutrons; columns [q,R] * * %L -* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 * * %E *******************************************************************************/ diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr index 3ec9e919e..5264a6cb7 100644 --- a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr @@ -31,7 +31,7 @@ * d: [m] Distance from source to guide entrance * * %L -* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 * * %E ******************************************************************************/ diff --git a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr index bf1e1fb57..258afb38d 100644 --- a/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr @@ -31,7 +31,7 @@ * d: [m] Distance from source to guide entrance * * %L -* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 +* P. Böni, W. Mü&nzer and A. Ostermann: Physica B: Condensed Matter Volume 404, Issue 17, 1 September 2009, Pages 2620-2623 * * %E ******************************************************************************/