Questions about arbitrary distribution functions (species block) #631
-
How can one create a piece wise distribution in the species block and is the distribution supposed to be normalized (integrated to 1)? For example, I want to implement a "semi-quadratic" distribution in energy (kinetic energy) (I want the slope to be steeper on right side when E > 10 MeV). Is there a way to do this in EPOCH with the IF function? An example would be very helpful, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @wnguyen1312, This can be done using a similar method to that outlined in our momentum distribution demo. In my attached input.deck, I create a kinetic-energy variable This example isn't perfect, as I haven't accounted for something important. EPOCH randomly draws To do this properly, you would need to divide the distribution function by the probability of drawing a kinetic energy with a certain value from 3 uniformly sampled momenta. Hopefully this is enough to get you started - if you're still having problems I might be able to spare some time later on to look over how to do this properly. Cheers,
|
Beta Was this translation helpful? Give feedback.
Hey @wnguyen1312,
This can be done using a similar method to that outlined in our momentum distribution demo. In my attached input.deck, I create a kinetic-energy variable
part_ke
, and I use this to construct two quardratic distribution functions, both of which peak at 1 for a kinetic energyKE_edge
. The first function rises from 0 at 0 KE, and the second drops back to 0 atKE_max
.This example isn't perfect, as I haven't accounted for something important. EPOCH randomly draws
px
,py
andpz
values, compares it to the distribution function (assumed between 0 and 1), and draws a random number to see if we keep thispx
,py
andpz
set or not. However, this would only work for a KE distributio…