diff --git a/mcstas-comps/contrib/PSD_spinDmon.comp b/mcstas-comps/contrib/PSD_spinDmon.comp new file mode 100644 index 0000000000..db4bdf07b8 --- /dev/null +++ b/mcstas-comps/contrib/PSD_spinDmon.comp @@ -0,0 +1,136 @@ +/******************************************************************************* +* +* 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=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 + %{ + DArray2d PSD_N; + DArray2d PSD_p; + DArray2d PSD_p2; + %} +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; + + if (sy > 0) + {SCATTER;} + else + { + PROP_Z0; + if (x>xmin && xymin && y 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; + + if (sy < 0) + {SCATTER;} + else + { + PROP_Z0; + if (x>xmin && 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 0000000000..3ee2cfb813 --- /dev/null +++ b/mcstas-comps/contrib/Transmission_V_polarisator.comp @@ -0,0 +1,517 @@ +/******************************************************************************* +* +* %I +* Component: Transmission_V_polarisator +* +* Written by: Andreas Ostermann (additions from Michael Schneider, SNAG) +* Date: 2024 +* Origin: TUM +* +* 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, +* 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] +* +* %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 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 diff --git a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp index 5897eec7dd..a933a2646b 100644 --- a/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp +++ b/mcstas-comps/contrib/Transmission_polarisatorABSnT.comp @@ -4,9 +4,13 @@ * 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) +* Date: 2004 +* Origin: TUM * +* Transmission V-polarisator including absorption by Fe in the supermirror. +* +* %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) @@ -19,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: * 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 0000000000..74892884be --- /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 0000000000..da3243ac46 --- /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 0000000000..bff13dfc4b --- /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 0000000000..94f8422f38 --- /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 new file mode 100644 index 0000000000..5264a6cb76 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_double_side/Test_V_cavity_SNAG_double_side.instr @@ -0,0 +1,305 @@ +/****************************************************************************** +* 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_double_side.instr Lam=7 Detector: div_lambda_hor_I=1.0e+13 +* +* %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_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 + 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_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 0000000000..74892884be --- /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 0000000000..da3243ac46 --- /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 0000000000..bff13dfc4b --- /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 0000000000..94f8422f38 --- /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 new file mode 100644 index 0000000000..258afb38d3 --- /dev/null +++ b/mcstas-comps/examples/Tests_polarization/Test_V_cavity_SNAG_single_side/Test_V_cavity_SNAG_single_side.instr @@ -0,0 +1,305 @@ +/****************************************************************************** +* 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, single layer reflectivity. +* +* %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 +* 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 + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +