[yt-users] Default Units for new Enzo Fields

Andrew James Emerick aje2123 at columbia.edu
Tue Feb 16 16:30:44 PST 2016


Great. Thanks Nathan. I'll add the fields in a plugin for now (no need to
send an example).

I'd be happy to modify yt's Enzo frontend and submit a pull request for it.
But the new fields are tied to new functionality I'm putting into Enzo.
I'll wait on doing this until around the time I submit a pull request for
the Enzo modifications.



Andrew

On Tuesday, February 16, 2016, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

>
>
> On Tue, Feb 16, 2016 at 4:38 PM, Andrew James Emerick <
> emerick at astro.columbia.edu
> <javascript:_e(%7B%7D,'cvml','emerick at astro.columbia.edu');>> wrote:
>
>> Hi all,
>>
>> I wasn't sure if this should go in the yt-users list or Enzo-dev, as I'm
>> not sure where the solution lies.
>>
>> I've defined some new fields in Enzo that have units of density that yt
>> is reading as having dimensionless units.
>>
>> Are the units for fields defined and outputted somewhere in Enzo (to be
>> read by yt)? Or does yt assume units depending on the name of the field?
>>
>
> The conversions to CGS for the fields are written out by Enzo, but not the
> dimensions of the units. Taking an example parameter file (IsolatedGalaxy
> from yt-project.org/data), you'll see the following lines in the
> parameter file:
>
> DataLabel[0]              = Density
> DataUnits[0]              = none
> #DataCGSConversionFactor[0] = 2.76112e-30
>
> From which yt is able to infer the conversion from code density units to
> CGS.  yt is *not* able to read in that Density has dimensions of
> code_mass/code_length**3, that is hard-coded into yt in the enzo frontend:
>
>
> https://bitbucket.org/yt_analysis/yt/src/ee29ca6d81c95d55073d4cf9db89e9486c40156d/yt/frontends/enzo/fields.py?at=yt&fileviewer=file-view-default#fields.py-75
>
>
>
>>
>> If the former, where do I tell the code that my field has density units
>> when its written to file? I see "DataUnits" throughout the code, but I'm
>> not sure if this is relevant or how to use it.
>>
>> If this is a yt-side thing, is there an easy way to just have yt read in
>> my new fields with the correct units without me manually changing them once
>> I've loaded a dataset?
>>
>>
> I think the easiest way to accomplish this without modifying yt is to
> define new derived fields that apply the correct units to the fields you've
> added to Enzo. You could include these fields in a plugin file (
> http://yt-project.org/doc/reference/configuration.html#the-plugin-file)
> or just at the top of your analysis scripts. You'll need to strip the
> incorrect dimensionless units from the data read in by yt from the Enzo
> output files and "by hand" attach the correct units. I'll happily write up
> an example if you need a hand with this.
>
> In addition, I think it's likely we would accept a pull request adding
> support for your new fields to yt's Enzo frontend - you'll need to modify
> the yt/frontends/enzo/fields.py file to include new entries for your fields
> in the known_other_fields list for mesh fields and known_particle_fields
> list for particle fields. The only reason why we wouldn't do so is if
> adding support for your fields would somehow inhibit adding support for
> fields in the public distribution of Enzo in the future, which I think is
> unlikely.
>
> -Nathan
>
>
>>
>>
>> Andrew
>>
>> --
>> Graduate Student
>> Columbia University
>> Department of Astronomy
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> <javascript:_e(%7B%7D,'cvml','yt-users at lists.spacepope.org');>
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>

-- 
NSF Graduate Fellow
Columbia University
Department of Astronomy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160216/05fe155b/attachment.html>


More information about the yt-users mailing list