130 likes | 224 Views
Peter Willendrup, Kim Lefmann. A short introduction to. 1. Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas. McStas What is it? What is it good for? How is it done? Use? Tutorial examples. Agenda. 2.
E N D
Peter Willendrup, Kim Lefmann A short introduction to 1 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
McStas What is it? What is it good for? How is it done? Use? Tutorial examples Agenda 2 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
What is it? • Flexible, general simulation utility for neutron scattering experiments. • Originally designed for Monte Carlo Simulation of triple axis spectrometers • Developed at • RISØ National Laboratory, Roskilde, Denmark – primary (2 people) • ILL (Institute Laue Langevin), Grenoble, France – primary (2 people) • Apx. 100+ users worldwide, some making contributions • Original developer/maintainer Kristian Nielsen (KU), MSc Computer Science and Physics 3 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
What is it good for? • Instrumentation • Planning • Optimization • Data analysis • “I am seeing this strange effect, could it be due to....” • “Toy” spectrometer for students and novice users 4 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
Three levels of source code: Instrument file (All users) Component files (Some users) ANSI c code (no users) How is it done? 5 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
How is it done? Instrument file: 6 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
How is it done? Component file: 7 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
How is it done? Resulting ANSI-C file: McStas is a (pre)compiler! Input is .comp and .instr files + runtime functions for e.g. random numbers Output is a single c-file, which can be compiled using e.g. gcc. Can take input arguments if needed. 8 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
How about the neutron? • Neutrons in McStas are neutron 'rays' or 'packages', representing a large number of neutrons emitted by the source (Initial Monte Carlo weight). • Each As the neutron package carries the physical properties, reflecting interaction with components in the instrument Spatial coordinates: x,y,z Velocity components:vx,,vy,vz Time: t Spin components: sx,sy,sz Monte Carlo weight: p • As physics take place, e.g. scattering in a sample or reflection on a monochromator, the weight is adjusted accordingly (taking local probabilities in the component into account). • Coordinate systems: Global and local Global: Normally, neutrons originate at the origin... ;-) z axis is initial travelling dirction, y is gravitational axis Local: z axis is directed towards the 'next' component • Focusing: Monte Carlo 'trick' to not spend time on 'useless' neutrons, e.g. send all neutrons in the direction that we are interested in, adjusting the weight accordingly... 9 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
Use? 10 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
Use? Detectors Detector data Neutron source 11 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
Use? 12 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas
Let's go through the tutorial... McStas crash course, 2 independent sessions on sept 14th/15th @ILL 6 registrees for session 1 – Still room for more people 5 registrees for session 2 – Still room for more people -> If you are interested in attending, please come see us, a maximum of 12 people pr. session can attend. Lets go :-) ? 13 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas