Hi Matt,<br><br>Got it, my fault for not reading the entire thread.  Sorry!  (And, I like that it'll be in the code one day, protecting us from our weird datasets.)<br><br>--Brian<br><br><div class="gmail_quote">On Mon, Jun 13, 2011 at 7:10 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com">matthewturk@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 Brian,<br>
<br>
That's what the routine Elizabeth was calling does -- it utilizes a<br>
CIC_Deposit routine that Britton wrote to deposit the particles.  The<br>
problem was that the particles were located in coarse grids inside<br>
regions covered by finer grids.  So their deposited densities were<br>
overwritten in the projection routine because the were in cells that<br>
were "child masked."<br>
<br>
The solution to this problem I prefer is to have well-posed datasets,<br>
where the fluid quantities and the particle quantities are expected to<br>
respect the same implicit understanding that higher-resolution regions<br>
have the better solution to the underlying equations.  However, one<br>
could imagine solving this through a set of solution-projection<br>
routines that ensure consistency between coarse and fine grids.<br>
<br>
Such routines will ultimately be part of yt.<br>
<br>
-Matt<br>
<div><div></div><div class="h5"><br>
On Mon, Jun 13, 2011 at 4:06 PM, Brian O'Shea <<a href="mailto:bwoshea@gmail.com">bwoshea@gmail.com</a>> wrote:<br>
> Hi Matt,<br>
><br>
> There is a mechanism within yt for the dark matter density to be<br>
> recalculated for some (all?) Enzo simulations.  Could this be extended to<br>
> star particles as well?  That way, the user could specify "recalculate this<br>
> field even if it already exists.  Just trust me, yt!"<br>
><br>
> --Brian<br>
><br>
> On Mon, Jun 13, 2011 at 6:25 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br>
>><br>
>> Hi all,<br>
>><br>
>> Elizabeth, Britton and I worked on this off-list on IRC.<br>
>><br>
>> What I have deduced is that the star particles in her simulation are<br>
>> not located at the finest resolution element.  After discussing it<br>
>> with her, this seems to me to be likely related to how she generated<br>
>> the data, by restarting data written by an older version of Enzo with<br>
>> a recent version of Enzo, having it write the potential field, and<br>
>> then outputting again.  What happens with data in a projection, or a<br>
>> slice for instance, is that higher-resolution grids are assumed to<br>
>> contain *better* data than the lower-resolution grids.  So while<br>
>> actual plots of the *particles* looked fine (I verified this) the<br>
>> fluid quantities, particle_density etc etc, were being generated for<br>
>> coarse level grids and then overwritten by finer level grids.<br>
>><br>
>> Unfortunately, those finer level grids did not contain any particles.<br>
>> So their fluid values were zero, and were overwriting coarser level<br>
>> information which was non-zero.  This is desired behavior; but I<br>
>> cannot think of any solution to this problem that will work in all<br>
>> cases.  So, this will continue to go 'unfixed' for now, as well-formed<br>
>> outputs are assumed to have their particles located at the<br>
>> locally-finest level of resolution, and this dataset does not meet<br>
>> that criterion.<br>
>><br>
>> Best,<br>
>><br>
>> Matt<br>
>><br>
>> On Mon, Jun 13, 2011 at 11:04 AM, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
>> wrote:<br>
>> > Ok, that at least tells us it's not a problem with the filter that's<br>
>> > looking<br>
>> > for just the star particles.  Can you run this script:<br>
>> > <a href="http://paste.enzotools.org/show/1704/" target="_blank">http://paste.enzotools.org/show/1704/</a><br>
>> > on your data, pipe the output to a file and send that back?  Just give<br>
>> > the<br>
>> > path to your dataset on the command line.  This should check to see if<br>
>> > there<br>
>> > are any inconsistencies in the grid dx's and positions.<br>
>> ><br>
>> > Britton<br>
>> ><br>
>> > On Mon, Jun 13, 2011 at 1:38 PM, Elizabeth Tasker <<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi,<br>
>> >><br>
>> >> Doesn't dm_density require the particle creation time to be less than<br>
>> >> or<br>
>> >> equal to zero? That is:<br>
>> >><br>
>> >><br>
>> >> field = pf.field_info["dm_density"]<br>
>> >> ------> print(field.get_source())<br>
>> >> def _dmpdensity(field, data):<br>
>> >>   blank = na.zeros(data.ActiveDimensions, dtype='float32')<br>
>> >>   if data.NumberOfParticles == 0: return blank<br>
>> >>   filter = data['creation_time'] <= 0.0<br>
>> >>   if not filter.any(): return blank<br>
>> >><br>
>> >><br>
>> >> amr_utils.CICDeposit_3(data["particle_position_x"][filter].astype(na.float64),<br>
>> >><br>
>> >>  data["particle_position_y"][filter].astype(na.float64),<br>
>> >><br>
>> >>  data["particle_position_z"][filter].astype(na.float64),<br>
>> >><br>
>> >>  data["particle_mass"][filter].astype(na.float32),<br>
>> >>                          na.int64(na.where(filter)[0].size),<br>
>> >>                          blank,<br>
>> >> na.array(data.LeftEdge).astype(na.float64),<br>
>> >><br>
>> >>  na.array(data.ActiveDimensions).astype(na.int32),<br>
>> >>                          na.float64(data['dx']))<br>
>> >>   return blank<br>
>> >><br>
>> >><br>
>> >> It is zero in my simulation; I checked.<br>
>> >><br>
>> >> The particle_density field though works ok (well.... it looks the same<br>
>> >> as<br>
>> >> the stars!) and I've attached a projection of it.<br>
>> >><br>
>> >> Elizabeth<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> Matthew Turk wrote:<br>
>> >>><br>
>> >>> Hi Elizabeth,<br>
>> >>><br>
>> >>> We're basically trying to break down where the problem is.<br>
>> >>><br>
>> >>> Here are the definitions of star_density:<br>
>> >>><br>
>> >>> <a href="http://hg.enzotools.org/yt/src/tip/yt/frontends/enzo/fields.py#cl-269" target="_blank">http://hg.enzotools.org/yt/src/tip/yt/frontends/enzo/fields.py#cl-269</a><br>
>> >>><br>
>> >>><br>
>> >>> <a href="http://hg.enzotools.org/yt/src/tip/yt/data_objects/universal_fields.py#cl-384" target="_blank">http://hg.enzotools.org/yt/src/tip/yt/data_objects/universal_fields.py#cl-384</a><br>
>> >>><br>
>> >>> Alternately to plotting the dm_density would just be particle_density:<br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> <a href="http://hg.enzotools.org/yt/src/tip/yt/data_objects/universal_fields.py#cl-906" target="_blank">http://hg.enzotools.org/yt/src/tip/yt/data_objects/universal_fields.py#cl-906</a><br>
>> >>><br>
>> >>> Additionally, trying without the grid overplot would also be helpful.<br>
>> >>> The specific item we're focusing on with the particle_density etc is<br>
>> >>> whether it's the grids that are causing a problem or the particle<br>
>> >>> selection.<br>
>> >>><br>
>> >>> Thanks,<br>
>> >>><br>
>> >>> -Matt<br>
>> >>><br>
>> >>> On Mon, Jun 13, 2011 at 9:11 AM, Elizabeth Tasker<br>
>> >>> <<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a>><br>
>> >>> wrote:<br>
>> >>><br>
>> >>>><br>
>> >>>> Hi Britton,<br>
>> >>>><br>
>> >>>> I don't have any DM in my simulations, so I don't think that will<br>
>> >>>> produce<br>
>> >>>> anything?<br>
>> >>>><br>
>> >>>> Elizabeth<br>
>> >>>><br>
>> >>>><br>
>> >>>> Britton Smith wrote:<br>
>> >>>><br>
>> >>>>><br>
>> >>>>> Hi Elizabeth,<br>
>> >>>>><br>
>> >>>>> Matt and I are still puzzling over this.  It's not clear right now<br>
>> >>>>> if<br>
>> >>>>> the<br>
>> >>>>> issue is related to projecting particles in general in your data or<br>
>> >>>>> projecting star particles specifically.  Can you do another full box<br>
>> >>>>> projection for us, but this time with the field dm_density?  That<br>
>> >>>>> should<br>
>> >>>>> help us to narrow down the problem.<br>
>> >>>>><br>
>> >>>>> Britton<br>
>> >>>>><br>
>> >>>>> On Mon, Jun 13, 2011 at 10:31 AM, Elizabeth Tasker<br>
>> >>>>> <<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a><br>
>> >>>>> <mailto:<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a>>> wrote:<br>
>> >>>>><br>
>> >>>>>   Hi Matt and Britton,<br>
>> >>>>><br>
>> >>>>>   I've attached the image for the stars over the whole disk; it<br>
>> >>>>>   shows the same issue, with the grids (and also any gas property)<br>
>> >>>>>   showing the region correctly, but the stars only appearing in a<br>
>> >>>>>   small patch.<br>
>> >>>>><br>
>> >>>>>   Matt, your script gives:<br>
>> >>>>><br>
>> >>>>>   Min: [('x', 5.6774955112245706), ('y', 5.7878015648296586), ('z',<br>
>> >>>>>   15.07668303734844)]<br>
>> >>>>>   Max: [('x', 26.537083788811703), ('y', 25.802074691296504), ('z',<br>
>> >>>>>   17.201602159672426)]<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>   Which are the values I expect.<br>
>> >>>>><br>
>> >>>>>   It could be, as Britton suggests, a problem with the box size not<br>
>> >>>>>   being 0-1. Although, that is a particularly random patch it's<br>
>> >>>>>   decided to fill in.<br>
>> >>>>><br>
>> >>>>>   Elizabeth<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>   Matthew Turk wrote:<br>
>> >>>>><br>
>> >>>>>       Hi Elizabeth,<br>
>> >>>>><br>
>> >>>>>       Weird.<br>
>> >>>>><br>
>> >>>>>       This script should help us find out where the stars live.<br>
>> >>>>>        What's it<br>
>> >>>>>       give you?  (Replace the loaded dataset with your own.)<br>
>> >>>>><br>
>> >>>>>       <a href="http://paste.enzotools.org/show/1696/" target="_blank">http://paste.enzotools.org/show/1696/</a><br>
>> >>>>><br>
>> >>>>>       Also, it'd be nice to see that image Britton requested.<br>
>> >>>>><br>
>> >>>>>       -Matt<br>
>> >>>>><br>
>> >>>>>       On Fri, Jun 10, 2011 at 2:02 PM, Elizabeth Tasker<br>
>> >>>>>       <<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a> <mailto:<a href="mailto:taskere@mcmaster.ca">taskere@mcmaster.ca</a>>> wrote:<br>
>> >>>>><br>
>> >>>>>           Oddly, neither of those make any difference.<br>
>> >>>>><br>
>> >>>>>           Elizabeth<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>           Britton Smith wrote:<br>
>> >>>>><br>
>> >>>>>               I would also suggest trying some projections instead<br>
>> >>>>>               of slices as well.<br>
>> >>>>>                Both of those fields are created using the<br>
>> >>>>>               CIC_deposit interpolation method<br>
>> >>>>>               with just the star particles.  I could see a field<br>
>> >>>>>               like that being<br>
>> >>>>>               problematic when doing slices.<br>
>> >>>>><br>
>> >>>>>               Britton<br>
>> >>>>><br>
>> >>>>>               On Fri, Jun 10, 2011 at 4:10 PM, Cameron Hummels<br>
>> >>>>>               <<a href="mailto:chummels@astro.columbia.edu">chummels@astro.columbia.edu</a><br>
>> >>>>>               <mailto:<a href="mailto:chummels@astro.columbia.edu">chummels@astro.columbia.edu</a>><br>
>> >>>>>               <mailto:<a href="mailto:chummels@astro.columbia.edu">chummels@astro.columbia.edu</a><br>
>> >>>>>               <mailto:<a href="mailto:chummels@astro.columbia.edu">chummels@astro.columbia.edu</a>>>> wrote:<br>
>> >>>>><br>
>> >>>>>                 Try using the field StarMassMsun instead of<br>
>> >>>>>               star_density and see<br>
>> >>>>>                 what it yields.  I've had better luck with that<br>
>> >>>>> field.<br>
>> >>>>><br>
>> >>>>>                 Cameron<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>                 On 6/10/11 4:00 PM, Elizabeth Tasker wrote:<br>
>> >>>>><br>
>> >>>>>                     Hi,<br>
>> >>>>><br>
>> >>>>>                     Slices of the star_density field are only<br>
>> >>>>>                   showing a tiny patch of<br>
>> >>>>>                     the area in the corner, rather than the whole<br>
>> >>>>>                   region. My script<br>
>> >>>>>                     looks like:<br>
>> >>>>><br>
>> >>>>>                     pc = PlotCollection(pf, center=[17.,11.5, 16])<br>
>> >>>>>                     p = pc.add_slice("star_density", 2)<br>
>> >>>>>                     pc.set_width(10, 'kpc')<br>
>> >>>>>                     p.modify["grids"]()<br>
>> >>>>><br>
>> >>>>>                     Density comes out fine and the grids are drawn<br>
>> >>>>>                   in but then only a<br>
>> >>>>>                     few of them get stars.<br>
>> >>>>><br>
>> >>>>>                     Elizabeth<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>                     _______________________________________________<br>
>> >>>>>                     yt-users mailing list<br>
>> >>>>>                     <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>>                   <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
>> >>>>>                   <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>>                   <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>>><br>
>> >>>>><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>
>> >>>>>                 _______________________________________________<br>
>> >>>>>                 yt-users mailing list<br>
>> >>>>>                 <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>>               <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
>> >>>>>               <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>>               <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>>><br>
>> >>>>><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>
>> >>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>  ------------------------------------------------------------------------<br>
>> >>>>><br>
>> >>>>>               _______________________________________________<br>
>> >>>>>               yt-users mailing list<br>
>> >>>>>               <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>>               <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
>> >>>>><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>
>> >>>>>           _______________________________________________<br>
>> >>>>>           yt-users mailing list<br>
>> >>>>>           <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>>           <mailto:<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
>> >>>>><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>
>> >>>>>       _______________________________________________<br>
>> >>>>>       yt-users mailing list<br>
>> >>>>>       <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>> >>>>> <mailto:<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>
>> >>>>><br>
>> >>>>>   _______________________________________________<br>
>> >>>>>   yt-users mailing list<br>
>> >>>>>   <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a> <mailto:<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>
>> >>>>><br>
>> >>>>><br>
>> >>>>> ------------------------------------------------------------------------<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>
>> >>>>><br>
>> >>>>><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>
>> >>>><br>
>> >>>><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>
>> >>><br>
>> >><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>
>> >><br>
>> ><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>
>> ><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>
><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>
><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>
</div></div></blockquote></div><br>