Hi Junhwan,<br><br>For your second question, you can calculate the mean velocity within that sphere and use that to set the bulk velocity for your disk object.  You can do something like:<br>sphere = pf.h.sphere(...)<br>bulk_velocity = sphere.quantities['BulkVelocity']()<br>
<br>disk = pf.h.disk(...)<br>disk.set_field_parameter('bulk_velocity', bulk_velocity)<br><br>If you look at the source for the field VelocityMagnitude, it subtracts off this bulk velocity, so I think that would do what you need.<br>
The source for that is YT_DEST/yt/data_objects/universal_fields.py<br><br>Britton<br><br><div class="gmail_quote">On Sat, Feb 4, 2012 at 1:52 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:goldbaum@ucolick.org">goldbaum@ucolick.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Junhwan,<br>
<br>
You will need to define a cylindrical radius field.  Here's how I've done it in the past (copied from some old messages on the newsgroup from last September):<br>
<br>
def _CylinderRadius(field, data):<br>
   center = data.get_field_parameter("center")<br>
   coords = na.array([data['x'] - center[0],<br>
                      data['y'] - center[1],<br>
                      data['z'] - center[2]])<br>
   J = na.zeros(coords.shape)<br>
   if len(coords.shape) == 4:<br>
       J[0,:,:,:] = -1<br>
   else:<br>
       J[0,:] = -1<br>
   JCrossR = na.cross(J,coords,axis=0)<br>
   return na.sqrt(na.sum(na.square(JCrossR),0))<br>
def _ConvertCylinderRadiusCGS(data):<br>
   return data.convert("cm")<br>
add_field("CylinderRadius", function=_CylinderRadius,<br>
         validators=[ValidateParameter("center")],<br>
         convert_function = _ConvertCylinderRadiusCGS, units=r"\rm{cm}")<br>
<br>
Note that you need to set the field parameter 'center' before you try to use this field.<br>
<br>
I'm not sure if there is a good way to answer your second question.  It's a good bet Kitsuk and Wise did not use yt as it did not exist yet ;)<br>
<br>
-Nathan<br>
<div><div class="h5"><br>
On Feb 4, 2012, at 10:46 AM, Jun-Hwan Choi wrote:<br>
<br>
> Hi YT users,<br>
><br>
> I have two questions on the YT analysis:<br>
><br>
> First, I would like to make profiles (mass, angular momentum) in the cylindrical coordinate.<br>
> In other world, the profiles depend on r_xy (x-y is the cylinder plane).<br>
> I define disk object and compute Profile as follow:<br>
> > disk = pf.h.disk(center, [0, 0, -1], (100., 'pc'), (1., 'pc'))<br>
> > profile = BinnedProfile1D(disk, 50, 'Radius', smallest_bin, largest_bin, lazy_reader=True)<br>
> ,but I find that Radius is for x,y, and z distance.<br>
> Can I get the cylindrical profile, if I simply make derived field for RadiusXY and replace Radius?<br>
> And does there any RadiusXY kind of field exist?<br>
><br>
> Second, I would like to compute the RMS velocity in my disk.<br>
> However, I would like to compute RMS velocity according to local mean velocity (e.g. mean velocity inside 0.1 pc sphere center on a given position), instead of compute according to global mean velocity.<br>
> Is there a routine (or way) to compute the local mean velocity in YT and compute RMS of it?<br>
> I found that some papers with Enzo simulation compute the RMS velocity (such as Kitsuk et al 2007 and Wise et al 2008 although I am not sure whether they use YT or not).<br>
><br>
> Thank you in advance,<br>
> Junhwan Choi<br>
><br>
> --<br>
> --------------------------------------------------------------<br>
> Jun-Hwan Choi, Ph.D.<br>
> Department of Physics and Astronomy, University of Kentucky<br>
> Tel: <a href="tel:%28859%29%20897-6737" value="+18598976737">(859) 897-6737</a>        Fax: <a href="tel:%28859%29%20323-2846" value="+18593232846">(859) 323-2846</a><br>
> Email: <a href="mailto:jhchoi@pa.uky.edu">jhchoi@pa.uky.edu</a>   URL: <a href="http://www.pa.uky.edu/%7Ejhchoi" target="_blank">http://www.pa.uky.edu/~jhchoi</a><br>
> --------------------------------------------------------------<br>
><br>
><br>
</div></div>> !DSPAM:10175,4f2d7d1519872718731035! _______________________________________________<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>
><br>
><br>
> !DSPAM:10175,4f2d7d1519872718731035!<br>
<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>