Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 31 additions & 29 deletions mcstas-comps/contrib/FlatEllipse_finite_mirror.comp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* NMO (nested mirror optic) modules
*
* %D
* Simulates NMO (nested mirror optic) modules as concevied by Böni et al., see
* Simulates NMO (nested mirror optic) modules as concevied by Böni et al., see
* Christoph Herb et al., Nucl. Instrum. Meth. A 1040, 1671564 (1-18) 2022.
*
* The component relies on an updated version of conic.h from MIT.
Expand All @@ -30,10 +30,10 @@
* mirror_sidelength: [m] side length of the individual mirrors
* doubleReflections: [1] binary value determining whether the mirror backside is reflective
* rfront_inner_file: [str] file of distances to the optical axis of the individual mirrors
* R0: [1] Low-angle reflectivity
* R0: [1] Low-angle reflectivity
* Qc: [AA-1] critical scattering vector
* W: [AA-1] width of supermirror cutoff
* alpha: [AA] Slope of reflectivity
* alpha: [AA] Slope of reflectivity
* %L
* Christoph Herb et al., Nucl. Instrum. Meth. A 1040, 1671564 (1-18) 2022.
* %E
Expand All @@ -45,8 +45,8 @@ SETTING PARAMETERS (
sourceDist = 0,
LStart=0.6,
LEnd = 0.6,
lStart = 0.,
lEnd = 0.,
lStart = 0.0,
lEnd = 0.0,
r_0 = 0.02076,
int nummirror= 9,
mf = 4,
Expand Down Expand Up @@ -90,7 +90,7 @@ double * get_r_at_z0(int number, double z_0, double r_0, double z_extract, doubl
fprintf(stderr,"NMO comp function get_r_at_z0: malloc() failed. Exit! \n");
exit(-1);
}
r_zExtracts[0] = r_0;
r_zExtracts[0] = r_0;
//helper variables as in conic_finite_mirror.h and explained in swissneutronics_überlegungen
double k1;
double k2;
Expand Down Expand Up @@ -249,33 +249,35 @@ FINALLY %{

MCDISPLAY//TODO this does not work as of now does not show the orientation of the flat conics
%{
//Enlarge xy-plane when mcdisplay is ran with --zoom
magnify("xy");
// PW 20260112 Suppressed. Cals to rConic make no sense since the flat mirrors are NOT conical...

//Draw xy-axis contour for Conic Surfaces
int i;
for (i = 0; i < s.num_c; i++) {
double step = (s.c[i].ze-s.c[i].zs)/100;
double cz;
for (cz = s.c[i].zs+step; cz <= s.c[i].ze; cz+= step) {
double rp = rConic(cz-step,s.c[i]);
double rc = rConic(cz, s.c[i]);
/* //Enlarge xy-plane when mcdisplay is ran with --zoom */
/* magnify("xy"); */

line(0,rp,cz-step,0,rc,cz);
line(0,-rp,cz-step,0,-rc,cz);
/* //Draw xy-axis contour for Conic Surfaces */
/* int i; */
/* for (i = 0; i < s.num_f; i++) { */
/* double step = (s.f[i].ze-s.f[i].zs)/100; */
/* double cz; */
/* for (cz = s.f[i].zs+step; cz <= s.f[i].ze; cz+= step) { */
/* double rp = rConic(cz-step,s.f[i]); */
/* double rc = rConic(cz, s.f[i]); */

line(rp,0,cz-step,rc,0,cz);
line(-rp,0,cz-step,-rc,0,cz);
}
}
/* line(0,rp,cz-step,0,rc,cz); */
/* line(0,-rp,cz-step,0,-rc,cz); */

//Draw xy-axis cross hairs for Disks
for (i = 0; i < s.num_di; i++) {
line(s.di[i].r0, 0, s.di[i].z0, s.di[i].r1, 0, s.di[i].z0);
line(-s.di[i].r0, 0, s.di[i].z0, -s.di[i].r1, 0, s.di[i].z0);
line(0, s.di[i].r0, s.di[i].z0, 0, s.di[i].r1,s.di[i].z0);
line(0, -s.di[i].r0, s.di[i].z0, 0, -s.di[i].r1,s.di[i].z0);
}
/* line(rp,0,cz-step,rc,0,cz); */
/* line(-rp,0,cz-step,-rc,0,cz); */
/* } */
/* } */

/* //Draw xy-axis cross hairs for Disks */
/* for (i = 0; i < s.num_di; i++) { */
/* line(s.di[i].r0, 0, s.di[i].z0, s.di[i].r1, 0, s.di[i].z0); */
/* line(-s.di[i].r0, 0, s.di[i].z0, -s.di[i].r1, 0, s.di[i].z0); */
/* line(0, s.di[i].r0, s.di[i].z0, 0, s.di[i].r1,s.di[i].z0); */
/* line(0, -s.di[i].r0, s.di[i].z0, 0, -s.di[i].r1,s.di[i].z0); */
/* } */

%}

Expand Down
14 changes: 6 additions & 8 deletions mcstas-comps/examples/Tests_optics/Test_NMO/Test_NMO.instr
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@
* Origin: TUM
* %INSTRUMENT_SITE: Tests_optics
*
* Implements a test instrument for the component FlatEllipse_finite_mirror,
* implementing Nested Mirror Optic (NMO) as suggested by B&ouml;ni et al.
* Implements a test instrument for the component FlatEllipse_finite_mirror.
*
* %D
* <instrument description>
*
* Example: <parameters=values>
* Implements a test instrument for the component FlatEllipse_finite_mirror,
* implementing Nested Mirror Optic (NMO) as suggested by B&ouml;ni et al.
*
* %P
* det_width: [m] Detector width
* source_width: [m] Source width
* source_height: [m] Source height
* det_width: [m] Detector width
* source_width: [m] Source width
* source_height: [m] Source height
* lam_source: [AA] Central source wavelength
* dL: [AA] Source wavelength spread
* v_divergence: [deg] Source vertical divergence
Expand Down