In a cosmological hydrodynamic zoom-in simulation, we happen to know both the position and 3d velocity of gas particles in the simulated volume. However, I am interested only in a column of gas along some line-of-sight which has a fixed square cross section. I want to calculate the mean velocity of all gas particles inside this column along the line-of-sight. How to do this analytically?
1 Answer
If you know the orientation of the column as a unit vector $\hat u = a \hat x + b \hat y + c\hat z$, then the velocity of a particle $i$ down the line of sight is $\vec v_i\cdot\hat u$. Compute this for each particle whose positions lie in the column, and find the mean. Depending on context, you may actually want to find the mean of $|\vec v_i\cdot\hat u|$; it is a question of whether or not you want to distinguish between particles moving "up" or "down" the column.
-
$\begingroup$ Orientation is either along x, y or z in each projection. And fortunately these are already given in each direction. And yes it's really important to distinguish between positive velocity (towards observer) and negative velocity (away from observer). I actually have problem defining the formula to calculate the mean for all particles inside the beam. $\endgroup$– RebelCommented Jun 7, 2018 at 19:37
-
$\begingroup$ Is there any reason not to just sum the values and divide by the number of particles in the column? $\endgroup$– EndulumCommented Jun 7, 2018 at 22:31
-
$\begingroup$ No, I was overthinking. You're right! Now, I am trying to write it in python where I have problem translating the words into code. Specifically constraining particles to lie inside the cigar-shaped beam. $\endgroup$– RebelCommented Jun 7, 2018 at 22:51