13
Peter Willendrup, Kim Lefmann Peter Willendrup, Kim Lefmann A short introduction to A short introduction to 1 Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Peter Willendrup, Kim Lefmann

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Peter Willendrup, Kim LefmannPeter Willendrup, Kim Lefmann

A short introduction toA short introduction to

1Peter 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

AgendaAgenda

2Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

●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

What is it?What is it?

3Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

●Instrumentation

●Planning

●Optimization

●Data analysis

●“I am seeing this strange effect, could it be due to....”

●“Toy” spectrometer for students and novice users

What is it good for?What is it good for?

4Peter 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?How is it done?

5Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Instrument file:

How is it done?How is it done?

6Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Component file:

How is it done?How is it done?

7Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

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.

How is it done?How is it done?

8Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

● 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...

How about the neutron?How about the neutron?

9Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Use?Use?

10Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Use?Use?

Neutron source

Detectors

Detector data

11Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Use?Use?

12Peter 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.

13Peter Willendrup, Kim Lefmann (RISØ) A gentle instroduction to McStas

Lets go :-) ?Lets go :-) ?