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

Error in materials using Absortion_sample #1534

Closed vribgar closed 9 months ago

vribgar commented 10 months ago

I have made an "instrument file" where the components are: a source (Source_flat), the sample (Absorption_sample) which are two concentric cylinders of different materials, a base support (Arm) where a transmission grid (Grating_trans) is placed and finally a detector (PSD_monitor).

When I try to change the materials of de cylinders, for example, H2O in the outer cylinder and Pb in the inner one, I get exactly the same results as when I put Glass in the inner cylinder and Al in the outer. The same happens when I try any combination of materials. I don't know what's wrong because when I run the simulation it seems to read the correct material files.

Test_6_con_rejilla Test_6_vidrio_Pb_rejilla

Thanks!

willend commented 10 months ago

@vribgar thanks for creating the issue! Absorption_sample sounds like we are talking McXtrace here?

Please provide

farhi commented 10 months ago

You may try the Fluorescence sample, which uses XRayLib as an alternative. It does not require to prepare data files, and only needs a chemical formula.

vribgar commented 10 months ago

@vribgar thanks for creating the issue! Absorption_sample sounds like we are talking McXtrace here?

Please provide

  • Information on version of the McStas/McXtrace code used
  • Information on OS and version
  • e.g. a .zip file including your instrumentfile, any needed other bits like local components or datafiles
  • An output dataset or input parameters needed to reproduce the issue

Version of the McXtrace: 3.2 OS: Windows 11 Here are the instrument file (Test_6.instr) and the results file (psd_giant.dat) Test_6_results.zip

Thank you!

willend commented 10 months ago

@vribgar, just had an evening session together with @farhi and we believe we identified the issue:

In the chosen geometry, your signal will be dominated by the direct (non-attenuated) beam - which is why your intensity does not change much.

We propose to put a circular slit to only look at the attenuated signal, find an example attached derived from Test_Absorption. instr.

I also attach output from the final monitor in material combinations of C in O and Cu in C.

Screenshot 2023-12-19 at 20 12 38 Screenshot 2023-12-19 at 20 12 10

Test_Absorption.instr.txt

(Or do as you would at an actual experiment: "data reduction", i.e. subtract / normalise by the "empty" beam)

vribgar commented 10 months ago

Hi, it was very helpful. We have managed to get the simulation to work and have obtained the expected results. But now we would like to resize the components parameters to simulate larger objects and we have a question: why for such small samples as the example you have provided (Test_Absorption) the distances between the components are so large? (3m between thr source and the sample)

We also have the doubt if this program (McXtrace) can simulate at that scale (sample size 20 -50 cm) or is it only for smaller scales?

I attach the code in .txt extension as I cannot upload the .zip with the .instr file and the results because they take too much space (>30 MB). Test_6_Slit_Grating.txt

Test_6_slit_rejilla_2

, thank you very much for your attention!

willend commented 10 months ago

@vribgar the reason that e.g. material sizes are mostly small and distances long in the provided examples is that many of the examples relate to synchrotron X-ray beam lines. :-)

Nothing should however prevent that you use McXtrace in other settings, there are for instance people in the astronomy domain that use McXtrace. :-)

vribgar commented 10 months ago

Thank you so much!!! :)

willend commented 9 months ago

@vribgar I believe the issue was resolved? I am closing it now.