<div dir="ltr">Hi all,<div><br></div><div>I just issued a PR to Matt's fork for adding a new metallicity field.  Currently, this works by defining a fluid field "metal_density", which is aliased to (in Enzo) the field Metal_Density.  To give it units, I created a metallicity symbol and associated it with the Zsun unit.  This may need some polishing depending on how other codes handle metal fields, but please have a look here:</div>
<div><a href="https://bitbucket.org/MatthewTurk/yt/pull-request/3/metallicity-field-and-units/diff">https://bitbucket.org/MatthewTurk/yt/pull-request/3/metallicity-field-and-units/diff</a><br></div><div><br></div><div>Britton</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 6, 2013 at 2:58 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">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"><div class="im">On Fri, Dec 6, 2013 at 9:55 AM, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>> wrote:<br>

> Hi Matt,<br>
><br>
> So I jumped ahead of this and created a metallicity unit and defined Zsun<br>
> relative to that and it seems to work.  Maybe you're right that this will<br>
> cause more trouble, but maybe I'll issue a PR to your fork with the open PR<br>
> and you can check it out.<br>
<br>
</div>We'll let it shake out; I may just be alarmist.<br>
<div class="im"><br>
><br>
> I put the metallicity field in yt/fields/fluid_fields.py.  Does that not<br>
> seem like the correct place?<br>
<br>
</div>No, that should be fine.  We may eventually split fluid_fields.py up<br>
into "astro" fields, but it's a good place at the moment.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Britton<br>
><br>
><br>
> On Fri, Dec 6, 2013 at 2:43 PM, Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>> wrote:<br>
>><br>
>> Hi Bitton,<br>
>><br>
>> On Fri, Dec 6, 2013 at 9:10 AM, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
>> wrote:<br>
>> > Hi all,<br>
>> ><br>
>> > I trying to add the metallicity field back to the enzo frontend and am<br>
>> > wondering what field registry it would be appropriate to put it in.<br>
>> > Anyone<br>
>> > have any thoughts on this?<br>
>><br>
>> So -- the way it's currently set up is that each frontend has a set of<br>
>> fields defined like so:<br>
>><br>
>>     known_other_fields = (<br>
>>         ("Cooling_Time", ("code_time", ["cooling_time"], None)),<br>
>>         ("HI_kph", ("1/code_time", [], None)),<br>
>>         ("HeI_kph", ("1/code_time", [], None)),<br>
>> ...<br>
>><br>
>> (Note that in breaking with tradition, this includes a mutable in the<br>
>> class definition.  I think it's okay.)<br>
>><br>
>> The format of these tuples is:<br>
>><br>
>> ("FieldNameOnDisk", ("units_on_disk", ["alias_to_this_yt_field",<br>
>> "and_this_one"], "display_name_or_none")<br>
>><br>
>> So what I think you would want is a generic metallicity field, and an<br>
>> alias to that.  For now, I've been putting "generic yt field" names in<br>
>> yt/frontends/stream/fields.py but I would eventually like to move them<br>
>> elsewhere, so that there can be a collection of fields that yt knows<br>
>> about and that people can utilize.  Right now this is a poor<br>
>> reference.  RAMSES has a "Metallicity" field aliased as "metallicity"<br>
>> presently, but no units.<br>
>><br>
>> I'm glad this came up, since this is a design decision that hasn't<br>
>> been reviewed or commented on.  Feedback?<br>
>><br>
>> ><br>
>> > Additionally, I noticed that the particle field metallicity_fraction<br>
>> > currently has units of Zsun.  As far as I know, this is not correct.  I<br>
>> > believe the field is actually unitless and would have to be divided by<br>
>> > ~0.02<br>
>> > to be in units of Zsun.  How can I set this up correctly to make it<br>
>> > aware of<br>
>> > these units?<br>
>><br>
>> My understanding is that you can set the units to be "Zsun / 0.02" in that<br>
>> case.<br>
>><br>
>> ><br>
>> > Should I make a "code_metallicity" unit?  This might actually be usable<br>
>> > for<br>
>> > the gas metallicity field as well.<br>
>><br>
>> Potentially, but I'm not certain, as we may then step into the mess of<br>
>> defining interoperability with other units.<br>
>><br>
>> -Matt<br>
>><br>
>> ><br>
>> > _______________________________________________<br>
>> > yt-dev mailing list<br>
>> > <a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
>> > <a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
>> ><br>
>> _______________________________________________<br>
>> yt-dev mailing list<br>
>> <a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> yt-dev mailing list<br>
> <a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
><br>
_______________________________________________<br>
yt-dev mailing list<br>
<a href="mailto:yt-dev@lists.spacepope.org">yt-dev@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org</a><br>
</div></div></blockquote></div><br></div>