[yt-users] Angular momentum with a general axis

Junhwan Choi (최준환) choi.junhwan at gmail.com
Tue Jun 3 20:38:49 PDT 2014


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



More information about the yt-users mailing list