<div dir="ltr"><div>Hi Junhwan,<div><br></div><div>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.</div><div>

<br></div><div>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" </div>

<div><br></div><div>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.</div>

<div><br></div><div>Hope that's helpful,</div><div><br></div><div>-Nathan<br></div></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 3, 2014 at 8:38 PM, Junhwan Choi (최준환) <span dir="ltr"><<a href="mailto:choi.junhwan@gmail.com" target="_blank">choi.junhwan@gmail.com</a>></span> wrote:<br>

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