[FLASH-USERS] Visualizing 3D Cylindrical grid

Nathan Goldbaum nathan12343 at gmail.com
Sat Jan 28 20:08:55 EST 2017


On Sat, Jan 28, 2017 at 6:47 PM, Rahul Kashyap <rkashyap at umassd.edu> wrote:

> Hi Nathan,
>
> Thanks. I think that was the problem. I was annotating grids. I have yt
> 3.3.2; most recent is 3.3.3.
>
> Is it possible to do so now for cylindrical grids? It might be required
> for my analysis at some point so, may be you could point me towards
> tweaking yt to get it working.
>

That makes sense, thanks for the extra information.

The annotate_grids function corresponds to the GridBoundaryCallback,
defined here:

https://bitbucket.org/yt_analysis/yt/src/23d0e83400c92b26416052a26d89444bdd1de9ed/yt/visualization/plot_modifications.py?at=yt&fileviewer=file-view-default#plot_modifications.py-562

Indeed, it does not yet support non-cartesian geometries.

If you look at the __call__ function of this class, you can see how it
actually does the work of drawing the grid boundaries on the plot. Most of
the code in that function deals with periodic boundary conditions, but if
you look a little bit further you can see that right now it draws the grid
boundaries assuming that they appear to be regular polygons using a
matplotlib PolyCollection (see around line 670).

For curvilinear grids this assumption will need to be relaxed.

Rather than continuing to use PolyCollection, it might be beneficial to to
look at the CellEdgesCallback, defined in the same file. This callback
(which is used to draw lines at the edges of individual cells in a
simulation) delegates the job of drawing the boundaries to the pixelization
routine (the cython routine that does the hard work of actually drawing the
pixelized representation of your AMR data). I suspect that will be a better
approach going forward, since we will be able to support curvilinear
geometries without having to figure out explicitly how to draw the grid
boundaries using matplotlib primitives. That said, right now the
`CellEdgesCallback` also only supports cartesian geometries because no one
has updated the pixelizer for cylindrical geometries to draw cell or grid
boundaries.

For cylindrical geometries, the pixelizer is defined here:

https://bitbucket.org/yt_analysis/yt/src/23d0e83400c92b26416052a26d89444bdd1de9ed/yt/utilities/lib/pixelization_routines.pyx?at=yt&fileviewer=file-view-default#pixelization_routines.pyx-321

This is written in cython, which is a python-like language that compiles to
C and is used heavily in yt for performance critical tasks.

Hopefully that wasn't information overload. Obviously making is so the
GridBoundariesCallback functions correctly for curvilinear geometries is
something we will get around to eventually. Like most things in an open
source project, we are limited by manpower and time. If you (or anyone else
reading this) would like to contribute this feature that would be extremely
appreciated. If you have any questions about how to contribute I'm very
happy to help out.

That said, if you feel like that is too much, that is also ok. We will get
around to adding support for this, and improving support for curvilinear
geometries is definitely on our roadmap.

Sorry to not have an easy solution here, I hope my answer was helpful at
some level.

-Nathan


>
> Best,
> -Rahul
>
>
> %matplotlib inline
> import yt
>
> path='super3d_hdf5_chk_0000'
> ds = yt.load(path)
>
> s = yt.SlicePlot(ds, "r", ["density","temperature"], center=[0,0,0])
> s.zoom(20.0)
> #s.annotate_grids()
> s.show()
> s.save('temp_data/')
> #"""
>
> On Sat, Jan 28, 2017 at 7:10 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> Hi Rahul,
>>
>> I'm not able to reproduce the behavior you're seeing. The particular
>> error you showed indicates that you are using some of the plot annotation
>> functions that are attached to yt plot objects. Not all of these annotation
>> functions support curvilinear geometries. Note that in principle many of
>> these *could* be implemented, that just hasn't happened yet. Unfortunately
>> the error doesn't say which of these functions is triggering the issue, so
>> I can't tell that myself based on the information you've given.
>>
>> Is there any chance you can share a minimal working example that
>> demonstrates the issue you're having?
>>
>> -Nathan
>>
>> On Sat, Jan 28, 2017 at 6:00 PM, Rahul Kashyap <rkashyap at umassd.edu>
>> wrote:
>>
>>> Hi John,
>>>
>>> Thanks. Below is the error along with the call back. I'm using SlicePlot
>>> function here.
>>>
>>> s = yt.SlicePlot(ds, "z", ["density","temperature",
>>> "velocity_magnitude","pressure"], center="max")
>>>
>>> It gives me grid informations but, perhaps treats it as cartesian. The
>>> angles are in radians.
>>> I have provided link to a small FLASH file where data is trivial --
>>> https://www.dropbox.com/s/4e01kp3fsd6e3fh/super3d_hdf5_chk_0000?dl=0
>>>
>>> Appreciated,
>>> -Rahul
>>>
>>> ---------------------------------------------------------------------------YTDataTypeUnsupported                     Traceback (most recent call last)<ipython-input-9-5ab982893667> in <module>()    102 #                weight_field = ("CellMass")).save()    103 #s.show()--> 104 s.save('temp_data/')    105 #"""    106
>>> /home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/yt/visualization/plot_container.pyc in newfunc(*args, **kwargs)     76             # it is the responsibility of _setup_plots to     77             # call args[0].run_callbacks()---> 78             args[0]._setup_plots()     79         rv = f(*args, **kwargs)     80         return rv
>>> /home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/yt/visualization/plot_window.pyc in _setup_plots(self)    954     955         self._set_font_properties()--> 956         self.run_callbacks()    957         self._plot_valid = True    958
>>> /home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/yt/visualization/plot_window.pyc in run_callbacks(self)   1007                     callback(cbw)   1008                 except YTDataTypeUnsupported as e:-> 1009                     six.reraise(YTDataTypeUnsupported, e)   1010                 except Exception as e:   1011                     six.reraise(YTPlotCallbackError,
>>> /home/rkashyap/sw/miniconda2/lib/python2.7/site-packages/six.pyc in reraise(tp, value, tb)
>>> YTDataTypeUnsupported: This operation is not supported for data of geometry cylindrical; It supports data of geometries ('cartesian', 'spectral_cube')
>>>
>>>
>>>
>>> On Sat, Jan 28, 2017 at 6:18 PM, John ZuHone <jzuhone at gmail.com> wrote:
>>>
>>>> Hi Rahul,
>>>>
>>>> Could you detail exactly what the issue with yt was? We'd like to help
>>>> out.
>>>>
>>>> John
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Jan 28, 2017, at 3:12 PM, Rahul Kashyap <rkashyap at umassd.edu> wrote:
>>>>
>>>> Dear FLASH users,
>>>>
>>>> Has anyone come up with visualizing 3D cylindrical data set by FLASH?
>>>>
>>>> I tried VisIt by transforming coordinate from cylindrical to cartesian.
>>>> This sets up the grid with z-coordinate from 0 to 6.28 i.e. 2*pi i.e. does
>>>> not consider it as angle.
>>>> It might be that it's due to the order of coordinates used by visit
>>>> which is r,θ,z​ as opposed to r,z,θ​ in FLASH.
>>>> yt has also not worked.
>>>>
>>>> Any help is highly appreciated.
>>>>
>>>> Thanks,
>>>> -Rahul
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20170128/36d66082/attachment-0001.htm>


More information about the flash-users mailing list