[yt-users] Angular momentum with a general axis

Nathan Goldbaum nathan12343 at gmail.com
Tue Jun 3 21:20:21 PDT 2014


Hi Junhwan,

There might be a better way to do this that I'm not seeing in
universal_fields.py - this is just my first thought about how to do what
you're trying to do.

I think you'd need to define new rotated angular momentum fields that know
about the coordinate system you're specifying.  These will be functions of
the AngularMomentumX, AngularMomentumY, and AngularMomentumZ fields as well
as some field parameters.  In addition to "center" and "bulk_velocity"
which you're already specifying, you'll need to pass in at least one more
and possibly two more field parameters to fix the orientation of the new
coordinate system. We use "normal" and "north_vector" elsewhere in yt to
denote the rotated "z" and "y" axes in the new coordinate system. The
angular momentum fields in universal_fields.py do not ask for "normal" or
"north_vector"

I think this would be a good thing to add to yt in general. For example,
the AngularMomentum[XYZ] fields could detect that the user has specified a
normal vector and a north vector as a field parameter and apply the
appropriate rotation matrix to generate the angular momentum in the rotated
coordinate system.  There is an "Orientation" utility class in
yt/utilities/orientation.py that might be useful here.

Hope that's helpful,

-Nathan





On Tue, Jun 3, 2014 at 8:38 PM, Junhwan Choi (최준환) <choi.junhwan at gmail.com>
wrote:

> Hi yt users,
>
> I wrote basic yt script to make Jz profile of my simulation as follow:
> ======
> import matplotlib as matplotlib
> matplotlib.use('Agg')
> from yt.mods import *
> import matplotlib.pyplot as plt
>
> Nbin = 75
> rmax = 1200 # in pc
> index = 60
>
> pf = load("../DD%04d/DD%04d" % (index,index))
> rmin = [1e-4,2.0*pf.h.get_smallest_dx()*pf.units['pc']]
> sphere = pf.h.sphere(center, (rmax, 'pc'))
> bulk_velocity = sphere.quantities['BulkVelocity']()
> sphere.set_field_parameter('bulk_velocity', bulk_velocity)
>
> profile = BinnedProfile1D(sphere, Nbin, "Radiuspc", max(rmin), rmax,
> log_space=True, lazy_reader=True, end_collect=False)
> profile.add_fields('AngularMomentumZ',weight=None)
> profile.add_fields('Radius',weight=None)
>
> plt.loglog(profile['Radiuspc'],
> profile['AngularMomentumZ'],label='t=%4.2fMyr' %
> (pf.current_time*7.26), linestyle="-",color='b')
> plt.xlabel('r [pc]')
> plt.ylabel(r'j ($\rm{cm}^2/\rm{s}$)',fontsize=17)
> plt.xlim(1e-4,1000)
> plt.legend(loc=4, prop={'size':10})
> plt.savefig('jprof2K_%04d' % index)
> =========
>
> Now I would like to compute the AngularMomentum not according to x,
> y,and z but according to a general axis (i.e. angular momentum axis).
> Is there any simple way in yt to compute the AngularMomentum according
> to the general axis?
>
> Thank you in advance,
> Junhwan
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140603/9bc7694c/attachment.htm>


More information about the yt-users mailing list