1 stratified sampling this method involves reducing variance by forcing more order onto the random...

39
1 Stratified sampling This method involves reducing variance by forcing more order onto the random number stream used as input As the simplest example, it can be implemented by FORCING the random number stream to produce EXACTLY half the numbers below 0.5 and half above 0.5 In effect, you are dividing the problem into two subproblems with ½ the width of the domain each This reduces the discrepancy (proportional to the STANDARD DEVIATION) of each to ½ its previous value, which cuts the variance (per history) in half. If time permits, we will work an example in class like the one in the course notes

Upload: blaze-george

Post on 21-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

1

Stratified samplingStratified sampling

• This method involves reducing variance by forcing more order onto the random number stream used as input

• As the simplest example, it can be implemented by FORCING the random number stream to produce EXACTLY half the numbers below 0.5 and half above 0.5

• In effect, you are dividing the problem into two subproblems with ½ the width of the domain each

• This reduces the discrepancy (proportional to the STANDARD DEVIATION) of each to ½ its previous value, which cuts the variance (per history) in half.

• If time permits, we will work an example in class like the one in the course notes

2

“Other”: Two alternate“Other”: Two alternate• Choose x fromChoose x from

using:using:

• Choose x from Choose x from

(Gaussian/normal) using: (Gaussian/normal) using:

(Why 12?)(Why 12?)

1,0,)(~ xxx n

1 2 1max , ,...,i nx

612

1

j

jix

2

21

( ) , 2

xx e x

3

Homework from textHomework from text

4

Homework from textHomework from text

5

Homework from textHomework from text

6

Lesson 4: Application to transport distributionsLesson 4: Application to transport distributions

• Choosing from multidimensional distributionsChoosing from multidimensional distributions• Transport distributionsTransport distributions

• Initial particle positionInitial particle position• Initial particle directionInitial particle direction• Initial particle energyInitial particle energy• Distance to next collisionDistance to next collision• Type of collisionType of collision• Outcome of scattering event (new energy and direction)Outcome of scattering event (new energy and direction)

• Flux estimationFlux estimation• Collision based (2 flavors)Collision based (2 flavors)• Tracklength basedTracklength based

7

Choosing from a multi-D pdfChoosing from a multi-D pdf

• Starting withStarting with• Normalize to get:Normalize to get:

• Integrate y out to get pdf in x only:Integrate y out to get pdf in x only:

• Choose x from Choose x from • Choose y fromChoose y from

xuxlybaxyx ,),,(,,~

b

a

xu

xl

dxdyyx

yxyx )(

)(

,~

,~,

)(

)(

,xu

xl

y dyyxx

xy iii xuxlyyx ,,,~

8

Examples of interest to transportExamples of interest to transport

• To keep the material real, here are some To keep the material real, here are some details about how the decisions are made for details about how the decisions are made for outcomes of neutral particle tranport “events”outcomes of neutral particle tranport “events”

• As you will see, all of the tools are used: As you will see, all of the tools are used: discrete, direct, rejection, probability mixingdiscrete, direct, rejection, probability mixing

• We will go over these in class as time We will go over these in class as time permits, but you should study them (i.e., likely permits, but you should study them (i.e., likely examples that will show up on the test!)examples that will show up on the test!)

9

Examples from transport “events”Examples from transport “events”

The lifecycle decisions that we will look at are:  The lifecycle decisions that we will look at are:  1.1. Particle initial position Particle initial position

2.2. Particle initial direction Particle initial direction

3.3. Particle initial energy Particle initial energy

4.4. Distance to next collision Distance to next collision

5.5. Type of collision Type of collision

6.6. Outcome of a scattering eventOutcome of a scattering event

10

Decision 1: Particle initial positionDecision 1: Particle initial position

• Decisions about the initial position of a particle is Decisions about the initial position of a particle is usually a multidimensional parameter determination usually a multidimensional parameter determination based on a given position distribution over volume.  based on a given position distribution over volume. 

• The mathematical approach to this is to define this The mathematical approach to this is to define this function in terms of an appropriate coordinate system function in terms of an appropriate coordinate system and then independently choose random numbers in and then independently choose random numbers in each of the dimensions according to that dimension's each of the dimensions according to that dimension's "part" of the total distribution.  "part" of the total distribution. 

• We will look at: Cartesian, cylindrical, and spherical.We will look at: Cartesian, cylindrical, and spherical.

11

Cartesian coordinate systemCartesian coordinate system

• The classic shape in Cartesian coordinate system is a right The classic shape in Cartesian coordinate system is a right parallelpiped:parallelpiped:

• A differential volume element is defined by: A differential volume element is defined by:

dzdydxdV

12

Cartesian coordinate system (2)Cartesian coordinate system (2)

• If we want to pick a point with a flat If we want to pick a point with a flat distribution (i.e., each volume element equally distribution (i.e., each volume element equally likely), then the total distribution would be: likely), then the total distribution would be:

010

010

010

1)(

1)(

1)(

)()()(

zzzzzf

yyyyyf

xxxxxf

dzzfdyyfdxxfdV

13

Cylindrical coordinate systemCylindrical coordinate system

• The classic shape in Cylindrical coordinate system is a right The classic shape in Cylindrical coordinate system is a right cylinder with z axis:cylinder with z axis:

• A differential volume element is defined by: A differential volume element is defined by:

dzdrrddV

14

Cylindrical coordinate system (2)Cylindrical coordinate system (2)

• If we want to pick a point with a flat If we want to pick a point with a flat distribution (i.e., each volume element equally distribution (i.e., each volume element equally likely), then the total distribution would be: likely), then the total distribution would be:

010

0

1)(

)(

21)(

)()()(

zzzzzf

rrrrf

f

dzzfdrrfdfdV

15

Translation to CartesianTranslation to Cartesian

• In the Cartesian coordinate system (that most In the Cartesian coordinate system (that most Monte Carlo codes run in) these would be Monte Carlo codes run in) these would be translated into: translated into:

zz

ry

rx

sin

cos

16

Spherical coordinate systemSpherical coordinate system

• The classic shape in spherical coordinate system:The classic shape in spherical coordinate system:

• A differential volume element is defined by: A differential volume element is defined by:

drrddrdV sin

17

Spherical coordinate system (2)Spherical coordinate system (2)

• If we want to pick a point with a flat If we want to pick a point with a flat distribution (i.e., each volume element equally distribution (i.e., each volume element equally likely), then the total distribution would be: likely), then the total distribution would be:

21)(

)(

21cossin)(

)()()(

30

2

1

f

rrrrf

f

dfdrrfdfdV

18

Translation to CartesianTranslation to Cartesian

• In the Cartesian coordinate system (that most In the Cartesian coordinate system (that most Monte Carlo codes run in) these would be Monte Carlo codes run in) these would be translated into: translated into:

cos

sinsin

cossin

rz

ry

rx

19

Other shapesOther shapes

• In this development, I have followed the convention from MCNP, In this development, I have followed the convention from MCNP, that allows the user to specify a volume source directly that allows the user to specify a volume source directly onlyonly if it is if it is one of the 3 shapes discussed: Cartesian, Cylinder, Sphere.one of the 3 shapes discussed: Cartesian, Cylinder, Sphere.

• For a situation in which the source has another shape, MCNP uses For a situation in which the source has another shape, MCNP uses a rejection technique that requires the user to:a rejection technique that requires the user to:

• Build a 3D region (“cell” in MCNP terminology) that is shaped Build a 3D region (“cell” in MCNP terminology) that is shaped the way that is desiredthe way that is desired

• Specify the number of the cell on the source definition input lineSpecify the number of the cell on the source definition input line• AlsoAlso create a shape of one of the three preferred shapes that create a shape of one of the three preferred shapes that

completely encloses the properly-shaped cellcompletely encloses the properly-shaped cell• MCNP will implement a rejection technique: Pick a point in the MCNP will implement a rejection technique: Pick a point in the

enclosing cell but only use it if it is also in the properly shaped cellenclosing cell but only use it if it is also in the properly shaped cell

20

Choosing from multiple sourcesChoosing from multiple sources

• For a situation in which source particles are chosen For a situation in which source particles are chosen from multiple source (possibly of various shapes, from multiple source (possibly of various shapes, sizes, and source rate density), the user should sizes, and source rate density), the user should apply a probability mixing strategy whereby: apply a probability mixing strategy whereby:

1.1. A source is chosen from the multiple sources using the A source is chosen from the multiple sources using the total source rates in each source (in units of particles/sec) total source rates in each source (in units of particles/sec) to choose among the sources. to choose among the sources.

2.2. The point within the chosen source is picked using the The point within the chosen source is picked using the appropriate shape's equations from above.appropriate shape's equations from above.

21

Non-uniform spatial distributionsNon-uniform spatial distributions

• One additional consideration is what should One additional consideration is what should be done if the spatial source distribution is not be done if the spatial source distribution is not uniform.  In this case, the PDFs for the uniform.  In this case, the PDFs for the individual dimensions would be multiplied by individual dimensions would be multiplied by the non-uniform distribution.  the non-uniform distribution. 

• Example: Example:  How would you choose a point How would you choose a point inside a spherical source if the source is inside a spherical source if the source is distributed in volume according to  distributed in volume according to 

22

Decision 2: Particle initial directionDecision 2: Particle initial direction

• The choice of direction is The choice of direction is based on probabilities based on probabilities on  , which is a on  , which is a differential element of differential element of solid angle on the solid angle on the surface of a unit sphere: surface of a unit sphere:

d

ddd sin

23

Particle initial direction (2)Particle initial direction (2)

• Note that the specification of the polar axis to be the Note that the specification of the polar axis to be the z axis in this figure isz axis in this figure is completely arbitrary completely arbitrary.  The .  The polar axis can be oriented in any direction that the polar axis can be oriented in any direction that the analyst desires.  analyst desires. 

• If we define  , the solid angle becomes: If we define  , the solid angle becomes:

• where the minus sign is present because  where the minus sign is present because  decreases as  increases. decreases as  increases.

cos

ddd

24

Particle initial direction (3)Particle initial direction (3)

• This gives us a dimensional PDFs of: This gives us a dimensional PDFs of:

• Generally, Monte Carlo methods require Generally, Monte Carlo methods require directions in the form of direction cosines, directions in the form of direction cosines, which would be: which would be:

21)(

211)(

)()(

f

f

dfdfd

z

y

x

sin1

cos1

2

2

25

Decision 3: Particle initial energyDecision 3: Particle initial energy

Generally, choice of the initial particle energy is based on Generally, choice of the initial particle energy is based on either a continuous, discrete, or multigroup source spectrum.  either a continuous, discrete, or multigroup source spectrum. 

• Continuous:Continuous: Particular distribution must be dealt with in the Particular distribution must be dealt with in the usual ways – direct or rejection usual ways – direct or rejection

• Discrete:Discrete: (common for (common for ) Particular particle energies coupled ) Particular particle energies coupled with thewith the yields yields as as

• Multigroup:Multigroup: Group source is the integrated source over the Group source is the integrated source over the group. Therefore, the individual group source values are group. Therefore, the individual group source values are exactly analogous to discrete yields, so would be used as exactly analogous to discrete yields, so would be used as the  probabilities in a discrete distribution. (Then the the  probabilities in a discrete distribution. (Then the starting energy is chosen starting energy is chosen uniformlyuniformly within the chosen group.) within the chosen group.)        ip

ip

26

Decision 4: Distance to next collisionDecision 4: Distance to next collision

• For infinite material with , the probability distribution for collision dx is:

• Therefore the PDF is:

which is already normalized over the range 

t

dxe

dxxf

txt

collision x without totravelsdxin CollidesPr

collision x without toTravelsPr

xt

texf ,0

27

Expected distance to collision (2)Expected distance to collision (2)

• The associated CDF is:

• which inverts to give us the formula:

• In terms of the optical path length,

we can use:  

xtexF 1

t

x

1ln

xt

ln1ln OR

28

Expected distance to collision (3)Expected distance to collision (3)

• Translating mean free path to actual distance is just governed by the relationship:

• Applied by translating the distance to the closest boundary in to a number of mean free paths that is “spent” to get there (if there is enough) or else you “buy” a fraction of the distance to the boundary

t

t

x

x

29

Expected distance to collision (4)Expected distance to collision (4)

30

Decision 5: Type of collisionDecision 5: Type of collision• Once a collision is known to have occurred, the choice of reaction

type is based on the reaction macroscopic cross sections:

• This gives us probabilities of:

• We make the choice between reaction types by using these probabilities as a discrete distribution.  

EEEE cfst

EE

pE

Ep

E

Ep

t

cc

t

ff

t

ss

31

Decision 6: Outcome of Scattering EventDecision 6: Outcome of Scattering Event

• The outcome of a scattering event by a particle with initial energy E is given by the multi-dimensional distribution:

where M = material and the primed variables are associated with the particle after the collision.

• Sample using:

• Sample using:

ˆˆ, 00 EEMs

0 EdEEf M

s

0

00 ,

E

iMs EEEf 0,

32

Outcome of Scattering Event (2)Outcome of Scattering Event (2)

• For some elastic scattering events (and inelastic scattering from known nuclear levels) there is a unique relationship between the scattering deflection angle and fractional energy loss. This would reduce this last problem to just a problem of finding new energy OR deflection angle.

• For multigroup, the angular dependence of the group-to-group scattering is represented by a Legendre expansion in deflection angle OR by equal-probability ranges 0

33

Flux estimationFlux estimation

• Basic question: Why do we want to know Basic question: Why do we want to know the group flux in a cell?the group flux in a cell?

• Only reason: So that we can later turn it into some Only reason: So that we can later turn it into some measurable (reaction rate, power distribution, dose)measurable (reaction rate, power distribution, dose)

• Monte Carlo (rather perversely) is rather better at getting Monte Carlo (rather perversely) is rather better at getting the reactions rates THEMSELVESthe reactions rates THEMSELVES

• Two ways to get it:Two ways to get it:• After Monte Carlo gives you an incremental contribution to After Monte Carlo gives you an incremental contribution to

a reaction rate, back out the incremental flux that would a reaction rate, back out the incremental flux that would have caused that contribution and add it to a running totalhave caused that contribution and add it to a running total

• Use an alternative flux definition to get flux directlyUse an alternative flux definition to get flux directly

34

Flux estimation (2)Flux estimation (2)• The first way to score flux is to add an The first way to score flux is to add an

incremental contribution every time there IS a incremental contribution every time there IS a collision in cell in by energy group (g):collision in cell in by energy group (g):

• then a collision contributes an “incremental” then a collision contributes an “incremental” RR addition of 1 and an incremental flux RR addition of 1 and an incremental flux addition of:addition of:

• This is referred to as a “collision estimator”This is referred to as a “collision estimator”

cellcellgcelltgcellg VRR ,,,

cellcelltgcellcelltg

cellgcellg VV

RR

,,

,,

1

35

Flux estimation (3)Flux estimation (3)

• Variation on this them is to score on particular Variation on this them is to score on particular TYPES of reactions and then score an amount TYPES of reactions and then score an amount depending on that REACTION’s cross sectiondepending on that REACTION’s cross section

• Most common is an ABSORPTION estimator, which Most common is an ABSORPTION estimator, which on each absorption event scores:on each absorption event scores:

• Another way to score flux is to go back to the basic Another way to score flux is to go back to the basic definition of total macroscopic cross section:definition of total macroscopic cross section:

cellcellagcellcellag

cellagcellg VV

RR

,,

,,

1

particlesby travelleddistance Total

reactions ofnumber Expectedt

36

Flux estimation (4)Flux estimation (4)

• Substituting this into the reaction rate equation gives Substituting this into the reaction rate equation gives us:us:

• This is a “track length estimator”This is a “track length estimator”• Notice that the number of reactions has Notice that the number of reactions has

CANCELLED.CANCELLED.• This estimator not only does NOT depend on an actual This estimator not only does NOT depend on an actual

reaction occurring, but can even be used in a VACUUMreaction occurring, but can even be used in a VACUUM

cellcellg V

cellg, groupin particlesby travelleddistance Total,

cellcellgcellg VRR ,, cellgroup,in particlesby travelleddistance Total

cellgroup,in reactions ofNumber

37

Flux estimation (5)Flux estimation (5)

• When to use which? General rules of thumb: When to use which? General rules of thumb: • Track length estimator in thin regionsTrack length estimator in thin regions• Collision estimator in high collision regions (especially Collision estimator in high collision regions (especially

scattering) regionsscattering) regions• Absorption estimator in high absorption regionsAbsorption estimator in high absorption regions

• Examples. Which estimator is most efficient for a:Examples. Which estimator is most efficient for a:• Thin foils Thin foils • Thick control rod (and thermal neutrons)Thick control rod (and thermal neutrons)• Diffusive low-absorber (e.g., D2O, graphite)Diffusive low-absorber (e.g., D2O, graphite)

38

HomeworkHomework

39

HomeworkHomework