McStasMcXtrace / McCode

The home of the McStas (neutrons) and McXtrace (x-rays) Monte-Carlo ray-tracing instrument simulation codes.
https://github.com/McStasMcXtrace/McCode/wiki
GNU General Public License v3.0
77 stars 54 forks source link

McXtrace:Lens_simple and Lens_parab simulation problem #1632

Closed minghuisvn closed 23 hours ago

minghuisvn commented 2 months ago

I simulated the focusing of X-ray radiated by Cu anode with the Lens_simple and Lens_parab component, but encountered some unexpected issues. The x-ray is generated by "Source_lab" component, and a circle slit of 1e-4 aperture is place after it. Then, "Lens_simple"is placed after slit, the setting is "Lens_simple(material_datafile="Be.txt", f=0.1, T=1) AT(0, 0, 0.1) RELATIVE source", and subsequently x-ray is recorded by viutual PSD detector. But i found the image on the PSD is not circle but confused ellipse. The image is : image . I also used component "Lens_parab", but when N parameter is greater than 1, nothing is found on PSD monitor. The reproducible script is https://gist.github.com/minghuisvn/8fce4230da45357087f6773c7d171a09. I don't know why it will be, could anyone give some explanations? And, my aim is to focus diverged X-ray generated by Cu anode into the parallel x-ray beam. I want to use "Capillary" component, but this component can only focus x-ray into a point. whether is there any component, e.g., single or multiple capillary parallel lens can do that? Thank you!

willend commented 1 month ago

Dear @minghuisvn

Thank you for reporting your findings. I believe most of the things you observed can be easily rectified:

  1. I am certain your observation of a "confused ellipse" is an artefact from non-equal (screen) axis dimensions. mxplot uses the monitor geometry as starting point for the window size, meaning wider than high on most modern displays: Screenshot 2024-06-27 at 11 29 12 Once the window is dragged to become square the same plot looks like this instead: Screenshot 2024-06-27 at 11 29 19

  2. Your instrument places the monitor "psd0" at the "arm1" location at a fixed distance of 0.001 m after the lens. The problem is then that the parabolic lens "array" increases in the z-dimension when you add to N. (If the monitor is placed "inside" or "before" the exit-plane of the lens this will require photons to move "backward" in time to reach it - which by default is not allowed -> the beam gets absorbed.) In the attached a small 5 mm distance is added pr. lens, thereby securing that the monitor is located after the lens.

  3. If you want Lens_simple to use the material datafile (Be.txt) to define focusing properties, then f should NOT be set (i.e. remain at 0.) This has also been rectified in the attached instrument file.

Use LENS=0 for the parabolic lens, use LENS=1 for Lens_simple.

Best and hope this helps, Peter

Lenses.instr.txt