How does YT create the gas velocity field from particle data (e.g., EAGLE, or SPH in general)?
Hi, I am trying to understand how YT creates the field: ['gas', 'velocity'] (or ['deposit', 'PartType0_smoothed_velocity_x'] or y/z) from EAGLE, or generally from SPH datasets. I am tracing the code to yt/fields/field_info_container.py, yt/fields/particle_fields.py, which then they would somehow link to yt/geometry/particle_deposit.pyx and yt/geometry/particle_smooth.pyx. However, I am still not sure where and how the velocity field is created. The main reason for doing so, is to understand what does the output gas velocity represent, and how is it calculated, e.g., is it weighted by the all gas density (or mass), is it weighted by HI density (or mass) etc. It would be a great help if anyone can point to the relevant codes for the calculation. Thanks, Stephanie
Hi Stephanie,
In the current version of yt, for SPH datasets in general, the smoothed
fields are created on a global octree structure, using the SPH smoothing
operation to assign field value at each octree node's center. The main
processing happens in VolumeWeightedSmooth.process
https://github.com/yt-project/yt/blob/657f47c63cbd049d9bcadd9ee628e40b222cbf....
Basically, it's looping over all the neighboring particles and adding up
their contributions to the cell center. Field values are weighted in the
standard SPH way. Look at how the `weight` variable is calculated.
For the ['deposit', 'PartType0_smoothed_velocity_x'] field in particular,
it is calculated from ['PartType0', 'velocity_x'] using the procedure
described above. Hope it helps.
Best,
Bili
On Wed, May 9, 2018 at 2:06 PM, Stephanie Ho
Hi,
I am trying to understand how YT creates the field: ['gas', 'velocity'] (or ['deposit', 'PartType0_smoothed_velocity_x'] or y/z) from EAGLE, or generally from SPH datasets. I am tracing the code to yt/fields/field_info_container.py, yt/fields/particle_fields.py, which then they would somehow link to yt/geometry/particle_deposit.pyx and yt/geometry/particle_smooth.pyx. However, I am still not sure where and how the velocity field is created.
The main reason for doing so, is to understand what does the output gas velocity represent, and how is it calculated, e.g., is it weighted by the all gas density (or mass), is it weighted by HI density (or mass) etc. It would be a great help if anyone can point to the relevant codes for the calculation.
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Bili did a good job of describing it, but just to add, at a high level in
Python the SPH smoothed fields are generated via the
add_volume_weighted_smoothed_field function. The specific call to that
function that generates the velocity field for Eagle data happens here:
https://github.com/yt-project/yt/blob/master/yt/fields/field_info_container....
And you can see the definition of add_volume_weighted_smoothed_field here:
https://github.com/yt-project/yt/blob/master/yt/fields/particle_fields.py#L7...
That function in turn calls the low-level function that Bili linked to.
Finally, you may be interested in the in-development yt 4.0, where we are
making substantial changes to how yt deals with particle data. Rather than
smoothing data onto an octree, in yt 4.0 we will return the velocity data
defined at the particle locations when you ask for the ('gas',
'velocity_x') field (i.e. you'll get back a copy of the ('Ptype0',
'velocity_x') field). For visualization purposes, the data get smoothed
directly onto images. We are currently working on adding support for
smoothing data onto uniform resolution 3D grids as well as an octree.
I can share more details about getting set up with yt 4.0 if you're
interested. I know a a number of people are using it in production because
it scales much better than yt's current support for particle data. It also
avoids forcing you to work with interpolated data, which I've been told is
not very natural for most users of SPH codes.
Hope that helps,
Nathan
On Wed, May 9, 2018 at 5:13 PM Bili Dong - Gmail
Hi Stephanie,
In the current version of yt, for SPH datasets in general, the smoothed fields are created on a global octree structure, using the SPH smoothing operation to assign field value at each octree node's center. The main processing happens in VolumeWeightedSmooth.process https://github.com/yt-project/yt/blob/657f47c63cbd049d9bcadd9ee628e40b222cbf.... Basically, it's looping over all the neighboring particles and adding up their contributions to the cell center. Field values are weighted in the standard SPH way. Look at how the `weight` variable is calculated.
For the ['deposit', 'PartType0_smoothed_velocity_x'] field in particular, it is calculated from ['PartType0', 'velocity_x'] using the procedure described above. Hope it helps.
Best, Bili
On Wed, May 9, 2018 at 2:06 PM, Stephanie Ho
wrote: Hi,
I am trying to understand how YT creates the field: ['gas', 'velocity'] (or ['deposit', 'PartType0_smoothed_velocity_x'] or y/z) from EAGLE, or generally from SPH datasets. I am tracing the code to yt/fields/field_info_container.py, yt/fields/particle_fields.py, which then they would somehow link to yt/geometry/particle_deposit.pyx and yt/geometry/particle_smooth.pyx. However, I am still not sure where and how the velocity field is created.
The main reason for doing so, is to understand what does the output gas velocity represent, and how is it calculated, e.g., is it weighted by the all gas density (or mass), is it weighted by HI density (or mass) etc. It would be a great help if anyone can point to the relevant codes for the calculation.
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Thanks both Bili and Nathan for the nice explanation, and point me to the
relevant pieces of code. This really helps me understand what is being
done in creating the smoothing fields from SPH.
And Nathan, I will definitely be interested in trying out yt 4.0,
especially for smoothing data onto a uniform resolution grid. While having
the flexibility of not being forced to work with interpolated data would be
nice, actually I somehow need the interpolated data: to mimic some
sightline observations (but not as sophisticated as creating spectra). And
I would be interested to see, how different would it be between smoothing
data onto an octree and a uniform 3D grid.
But that said, I also want to make sure I can switch between the
yt-3.5dev0, and yt-4.0, just in case if my OS isn't compatible with yt-4.0
(or whatever issues occur after the update).
Thanks,
Stephanie
On Wed, May 9, 2018 at 3:18 PM, Nathan Goldbaum
Bili did a good job of describing it, but just to add, at a high level in Python the SPH smoothed fields are generated via the add_volume_weighted_smoothed_field function. The specific call to that function that generates the velocity field for Eagle data happens here:
https://github.com/yt-project/yt/blob/master/yt/fields/ field_info_container.py#L165
And you can see the definition of add_volume_weighted_smoothed_field here:
https://github.com/yt-project/yt/blob/master/yt/fields/ particle_fields.py#L769
That function in turn calls the low-level function that Bili linked to.
Finally, you may be interested in the in-development yt 4.0, where we are making substantial changes to how yt deals with particle data. Rather than smoothing data onto an octree, in yt 4.0 we will return the velocity data defined at the particle locations when you ask for the ('gas', 'velocity_x') field (i.e. you'll get back a copy of the ('Ptype0', 'velocity_x') field). For visualization purposes, the data get smoothed directly onto images. We are currently working on adding support for smoothing data onto uniform resolution 3D grids as well as an octree.
I can share more details about getting set up with yt 4.0 if you're interested. I know a a number of people are using it in production because it scales much better than yt's current support for particle data. It also avoids forcing you to work with interpolated data, which I've been told is not very natural for most users of SPH codes.
Hope that helps,
Nathan
On Wed, May 9, 2018 at 5:13 PM Bili Dong - Gmail
wrote: Hi Stephanie,
In the current version of yt, for SPH datasets in general, the smoothed fields are created on a global octree structure, using the SPH smoothing operation to assign field value at each octree node's center. The main processing happens in VolumeWeightedSmooth.process https://github.com/yt-project/yt/blob/657f47c63cbd049d9bcadd9ee628e40b222cbf.... Basically, it's looping over all the neighboring particles and adding up their contributions to the cell center. Field values are weighted in the standard SPH way. Look at how the `weight` variable is calculated.
For the ['deposit', 'PartType0_smoothed_velocity_x'] field in particular, it is calculated from ['PartType0', 'velocity_x'] using the procedure described above. Hope it helps.
Best, Bili
On Wed, May 9, 2018 at 2:06 PM, Stephanie Ho
wrote: Hi,
I am trying to understand how YT creates the field: ['gas', 'velocity'] (or ['deposit', 'PartType0_smoothed_velocity_x'] or y/z) from EAGLE, or generally from SPH datasets. I am tracing the code to yt/fields/field_info_container.py, yt/fields/particle_fields.py, which then they would somehow link to yt/geometry/particle_deposit.pyx and yt/geometry/particle_smooth.pyx. However, I am still not sure where and how the velocity field is created.
The main reason for doing so, is to understand what does the output gas velocity represent, and how is it calculated, e.g., is it weighted by the all gas density (or mass), is it weighted by HI density (or mass) etc. It would be a great help if anyone can point to the relevant codes for the calculation.
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Just to chime in on this. I don't know what you're trying to do in terms
of mimicking sightline observations, but the Trident code operates on top
of yt (and can use the yt-4.0 native particle treatment) for making
sightline observations appropriate for IGM and CGM (and other) studies. It
can do both simple column densities of ions as well as full absorption-line
spectra. I have put together a whole notebook on installing both the
pre-version of yt-4.0 (tentatively called the demeshening, since it removes
the mesh interpolation for particle data) as well as Trident to work with
it here:
https://nbviewer.jupyter.org/url/trident-project.org/notebooks/trident_demes...
. For more about Trident, see: http://trident-project.org/
Presumably this should all work with EAGLE data--a few of us have been
using it for production level work with Gizmo FIRE and ChaNGa datasets.
Good luck and let us know if you have more questions!
Cameron
On Wed, May 9, 2018 at 11:41 PM, Stephanie Ho
Thanks both Bili and Nathan for the nice explanation, and point me to the relevant pieces of code. This really helps me understand what is being done in creating the smoothing fields from SPH.
And Nathan, I will definitely be interested in trying out yt 4.0, especially for smoothing data onto a uniform resolution grid. While having the flexibility of not being forced to work with interpolated data would be nice, actually I somehow need the interpolated data: to mimic some sightline observations (but not as sophisticated as creating spectra). And I would be interested to see, how different would it be between smoothing data onto an octree and a uniform 3D grid. But that said, I also want to make sure I can switch between the yt-3.5dev0, and yt-4.0, just in case if my OS isn't compatible with yt-4.0 (or whatever issues occur after the update).
Thanks, Stephanie
On Wed, May 9, 2018 at 3:18 PM, Nathan Goldbaum
wrote: Bili did a good job of describing it, but just to add, at a high level in Python the SPH smoothed fields are generated via the add_volume_weighted_smoothed_field function. The specific call to that function that generates the velocity field for Eagle data happens here:
https://github.com/yt-project/yt/blob/master/yt/fields/field _info_container.py#L165
And you can see the definition of add_volume_weighted_smoothed_field here:
https://github.com/yt-project/yt/blob/master/yt/fields/parti cle_fields.py#L769
That function in turn calls the low-level function that Bili linked to.
Finally, you may be interested in the in-development yt 4.0, where we are making substantial changes to how yt deals with particle data. Rather than smoothing data onto an octree, in yt 4.0 we will return the velocity data defined at the particle locations when you ask for the ('gas', 'velocity_x') field (i.e. you'll get back a copy of the ('Ptype0', 'velocity_x') field). For visualization purposes, the data get smoothed directly onto images. We are currently working on adding support for smoothing data onto uniform resolution 3D grids as well as an octree.
I can share more details about getting set up with yt 4.0 if you're interested. I know a a number of people are using it in production because it scales much better than yt's current support for particle data. It also avoids forcing you to work with interpolated data, which I've been told is not very natural for most users of SPH codes.
Hope that helps,
Nathan
On Wed, May 9, 2018 at 5:13 PM Bili Dong - Gmail
wrote: Hi Stephanie,
In the current version of yt, for SPH datasets in general, the smoothed fields are created on a global octree structure, using the SPH smoothing operation to assign field value at each octree node's center. The main processing happens in VolumeWeightedSmooth.process https://github.com/yt-project/yt/blob/657f47c63cbd049d9bcadd9ee628e40b222cbf.... Basically, it's looping over all the neighboring particles and adding up their contributions to the cell center. Field values are weighted in the standard SPH way. Look at how the `weight` variable is calculated.
For the ['deposit', 'PartType0_smoothed_velocity_x'] field in particular, it is calculated from ['PartType0', 'velocity_x'] using the procedure described above. Hope it helps.
Best, Bili
On Wed, May 9, 2018 at 2:06 PM, Stephanie Ho
wrote: Hi,
I am trying to understand how YT creates the field: ['gas', 'velocity'] (or ['deposit', 'PartType0_smoothed_velocity_x'] or y/z) from EAGLE, or generally from SPH datasets. I am tracing the code to yt/fields/field_info_container.py, yt/fields/particle_fields.py, which then they would somehow link to yt/geometry/particle_deposit.pyx and yt/geometry/particle_smooth.pyx. However, I am still not sure where and how the velocity field is created.
The main reason for doing so, is to understand what does the output gas velocity represent, and how is it calculated, e.g., is it weighted by the all gas density (or mass), is it weighted by HI density (or mass) etc. It would be a great help if anyone can point to the relevant codes for the calculation.
Thanks, Stephanie _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
-- Cameron Hummels NSF Postdoctoral Fellow Department of Astronomy California Institute of Technology http://chummels.org
participants (4)
-
Bili Dong - Gmail
-
Cameron Hummels
-
Nathan Goldbaum
-
Stephanie Ho