[yt-users] YT analysis questions: cylindrical profile and RMS velocity

Jun-Hwan Choi jhchoi at pa.uky.edu
Mon Feb 6 13:00:57 PST 2012


Thank you Britton,

However, what I would like to compute is RMS velocity field respect to 
their local mean velocity.
I found a useful procedure in Matt Turk's YT field presentation.
There is way to make AverageTemperature field using ValidateSpatial.
I would like to do similar procedure to make average velocity field and 
compute the RMS velocity from this local average.
But, in this case I get information for N adjust cell value and average 
them.
But this grid size can vary depending on a given cell's AMR level, while 
I would like to compute local average for uniform spatial volume...
Well, I may need to think a bit more to make this work.

Thank you,
Junhwan


Britton Smith wrote:
> Hi Junhwan,
>
> 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:
> sphere = pf.h.sphere(...)
> bulk_velocity = sphere.quantities['BulkVelocity']()
>
> disk = pf.h.disk(...)
> disk.set_field_parameter('bulk_velocity', bulk_velocity)
>
> 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.
> The source for that is YT_DEST/yt/data_objects/universal_fields.py
>
> Britton
>
> On Sat, Feb 4, 2012 at 1:52 PM, Nathan Goldbaum <goldbaum at ucolick.org 
> <mailto:goldbaum at ucolick.org>> wrote:
>
>     Hi Junhwan,
>
>     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):
>
>     def _CylinderRadius(field, data):
>       center = data.get_field_parameter("center")
>       coords = na.array([data['x'] - center[0],
>                          data['y'] - center[1],
>                          data['z'] - center[2]])
>       J = na.zeros(coords.shape)
>       if len(coords.shape) == 4:
>           J[0,:,:,:] = -1
>       else:
>           J[0,:] = -1
>       JCrossR = na.cross(J,coords,axis=0)
>       return na.sqrt(na.sum(na.square(JCrossR),0))
>     def _ConvertCylinderRadiusCGS(data):
>       return data.convert("cm")
>     add_field("CylinderRadius", function=_CylinderRadius,
>             validators=[ValidateParameter("center")],
>             convert_function = _ConvertCylinderRadiusCGS,
>     units=r"\rm{cm}")
>
>     Note that you need to set the field parameter 'center' before you
>     try to use this field.
>
>     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 ;)
>
>     -Nathan
>
>     On Feb 4, 2012, at 10:46 AM, Jun-Hwan Choi wrote:
>
>     > Hi YT users,
>     >
>     > I have two questions on the YT analysis:
>     >
>     > First, I would like to make profiles (mass, angular momentum) in
>     the cylindrical coordinate.
>     > In other world, the profiles depend on r_xy (x-y is the cylinder
>     plane).
>     > I define disk object and compute Profile as follow:
>     > > disk = pf.h.disk(center, [0, 0, -1], (100., 'pc'), (1., 'pc'))
>     > > profile = BinnedProfile1D(disk, 50, 'Radius', smallest_bin,
>     largest_bin, lazy_reader=True)
>     > ,but I find that Radius is for x,y, and z distance.
>     > Can I get the cylindrical profile, if I simply make derived
>     field for RadiusXY and replace Radius?
>     > And does there any RadiusXY kind of field exist?
>     >
>     > Second, I would like to compute the RMS velocity in my disk.
>     > 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.
>     > Is there a routine (or way) to compute the local mean velocity
>     in YT and compute RMS of it?
>     > 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).
>     >
>     > Thank you in advance,
>     > Junhwan Choi
>     >
>     > --
>     > --------------------------------------------------------------
>     > Jun-Hwan Choi, Ph.D.
>     > Department of Physics and Astronomy, University of Kentucky
>     > Tel: (859) 897-6737 <tel:%28859%29%20897-6737>        Fax: (859)
>     323-2846 <tel:%28859%29%20323-2846>
>     > Email: jhchoi at pa.uky.edu <mailto:jhchoi at pa.uky.edu>   URL:
>     http://www.pa.uky.edu/~jhchoi <http://www.pa.uky.edu/%7Ejhchoi>
>     > --------------------------------------------------------------
>     >
>     >
>     > !DSPAM:10175,4f2d7d1519872718731035!
>     _______________________________________________
>     > yt-users mailing list
>     > yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
>     > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>     >
>     >
>     > !DSPAM:10175,4f2d7d1519872718731035!
>
>     _______________________________________________
>     yt-users mailing list
>     yt-users at lists.spacepope.org <mailto:yt-users at lists.spacepope.org>
>     http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>   


-- 
--------------------------------------------------------------
Jun-Hwan Choi, Ph.D.
Department of Physics and Astronomy, University of Kentucky
Tel: (859) 897-6737        Fax: (859) 323-2846
Email: jhchoi at pa.uky.edu   URL: http://www.pa.uky.edu/~jhchoi
--------------------------------------------------------------




More information about the yt-users mailing list