Streamlines in spherical coordinates

(Gherardo Valori) #1

I am trying to plot streamlines of a 3D vector field in spherical coordinates. I have the three components (Br,Bt,Bp) loaded as separate scalar fields from a netcdf file with standard CF convention (ie with latitude, longitude and radial coordinates). This seems to be recognized by Paraview, ie I get indeed a spherical grid. Next, in order to use the streamline filter, I need first to apply the “Cell to point data” filter, and then to combine the scalar components into a vector using the Calculator filter as
which does not result in the proper vector field (I know what the answer should look like). I guess the problem is that i/j/kHat are the unit vectors of the Cartesian reference system, not the one of the spherical coordinate system. Is there a straightforward way to build the vector field from the scalar components in spherical coordinates?

(Mathieu Westphal (Kitware)) #2

You will need to convert your field to cartesian coordinates first.

(Gherardo Valori) #3

Hi Mathieu,
thanks for your quick reply! Can you shortly elaborate on your suggestion? I am not sure that I understand that correctly: I have a spherical grid, properly recognized by paraview, and in order to visualize streamlines of a vector field given in spherical coordinates I need to convert that to Cartesian? If this is what you suggest, I did try it but the streamlines are still incorrect. I can imagine this is a common configuration, a reference to an example would be equally good.
Thanks for your time

(Mathieu Westphal (Kitware)) #4

There is no automatic way to do this yet.
Some ressources :

(Gherardo Valori) #5

Thank you very much Mathieu, i will work my way through those. Have a nice day