[yt-users] Angular momentum with a general axis

Matthew Turk matthewturk at gmail.com
Wed Jun 4 09:20:49 PDT 2014


Hi Junhwan,

On Tue, Jun 3, 2014 at 10: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?

My reading of this is that what you want to do is compute:

L = r [x] mv

(provided by yt) and then compute your final L vector as:

L' = L [x] mv

is that right?  This would then be:

(r [x] mv) [x] mv

which I'm not really sure is what you're looking for, right?  Can you
describe your desired result in vector notation?

>
> 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



More information about the yt-users mailing list