[yt-dev] Enzo frontend

Brian Crosby crosby.bd at gmail.com
Mon Jan 27 11:01:29 PST 2014


Cool, thanks Matt, that did the trick.

-Brian

On Jan 27, 2014, at 11:55 AM, Matthew Turk <matthewturk at gmail.com> wrote:

> On Mon, Jan 27, 2014 at 1:53 PM, Brian Crosby <crosby.bd at gmail.com> wrote:
>> Hi yt dev,
>> 
>> I’ve been working with the Enzo frontend for running yt inline during
>> simulations, and have come across a strange problem that I can’t seem to
>> sort out.  I ported a handful of functions in yt/frontends/enzo/io.py from
>> the IOHandlerPackedHDF5 class to IOHandlerInMemory, and clearly messed
>> something up in the _read_particle_fields function.  In particular,
>> converting the mass from Enzo’s internal units (actually a density) with the
>> line
>> 
>> data *= g.dds.prod(dtype="f8”)
>> 
>> (where g.dds.prod() gives the cell volume, a step that can be seen in Enzo’s
>> code mass to actual mass conversion, see:
>> https://enzo.readthedocs.org/en/latest/reference/EnzoParticleMass.html#enzoparticlemass).
>> 
>> What’s problematic is that this is actually changing the particle mass in
>> Enzo every time yt is called.  I’m testing this on a 128^3, DM only unigrid
>> simulation, and this results in reducing the particle masses by a factor of
>> 1/128^3 each time.  Simply removing this line, on the other hand, results in
>> the particle masses being a factor of 128^3 too large.  I’m concerned that
>> this calculation is actually modifying the Enzo particle masses (which I
>> confirmed by checking the DD* and RD* outputs), I think that this conversion
>> should only happen on the yt side, without pushing back to Enzo at this
>> stage, but I’m not totally clear on how the Enzo/yt communication works.
>> Does anyone have some suggestions about what would be the best course of
>> action?  Am I simply misunderstanding the intended flow of communications
>> between yt and Enzo when running yt inline, or did my errors in porting this
>> function actually cause something more insidious to happen?
> 
> Ah, the inline frontend for enzo avoids copying data until it
> absolutely has to.  So you're actually modifying, in place, the
> original arrays from Enzo.
> 
> You can just do:
> 
> data = data * g.dds.prod(dtype="f8")
> 
> which should create a new array (out of place) and assign it to the
> variable data.
> 
> -Matt
> 
>> 
>> Thanks,
>> Brian
>> 
>> _______________________________________________
>> yt-dev mailing list
>> yt-dev at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>> 
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org




More information about the yt-dev mailing list