[yt-dev] Issue #926: cylindrical_radial_velocity does not look right (yt_analysis/yt)

Suoqing Ji issues-reply at bitbucket.org
Sat Oct 18 23:34:59 PDT 2014


New issue 926: cylindrical_radial_velocity does not look right
https://bitbucket.org/yt_analysis/yt/issue/926/cylindrical_radial_velocity-does-not-look

Suoqing Ji:

Recently I just found that ``cylindrical_radial_velocity`` in yt3 does not give me what I expect. To test this, I setup a 3-D Sedov problem with domain ``[-0.5, 0.5]^3`` and explosion center at ``[0, 0, 0]``, and plot the ``cylindrical_radial_velocity`` as the following image. According to the pattern of the velocity streamline, the cylindrical radial velocity should be positive.

![sedov_hdf5_chk_0001_Slice_z_cylindrical_radial_velocity_original.png](https://bitbucket.org/repo/BXbAb/images/2310642957-sedov_hdf5_chk_0001_Slice_z_cylindrical_radial_velocity_original.png)

I don't understand in the function of ``_cylindrical_radial``  in [yt/fields/vector_operations.py](https://bitbucket.org/yt_analysis/yt/src/1089b61212d7bfd105a109728fb804b6ef84aadf/yt/fields/vector_operations.py?at=yt):


```
#!python

    def _cylindrical_radial(field, data):
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn),
                                "bulk_%s" % basename)
        theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
        return get_cyl_r_component(vectors, theta, normal)
```
what does the line of ``resize_vector`` do. If I replace this simply with line ``theta = data['cylindrical_theta']``, it will give the image I expected as the following.

![sedov_hdf5_chk_0001_Slice_z_cylindrical_radial_velocity_modified.png](https://bitbucket.org/repo/BXbAb/images/2376359990-sedov_hdf5_chk_0001_Slice_z_cylindrical_radial_velocity_modified.png)

In addition, if I want to plot the same field for a 2-D Sedov dataset, the error of ``yt.utilities.exceptions.YTFieldNotFound: Could not find field '('all', 'cylindrical_radial_velocity')'`` will be raised. However, if changing the line

```
#!python
vectors = obtain_rv_vec(data, (xn, yn, zn),
                                "bulk_%s" % basename)
```
into
```
#!python
vectors = obtain_rv_vec(data)
```
the correct image will be generated without raising any error. But I'm not very certain what's the correct way to fix this.






More information about the yt-dev mailing list