<div dir="ltr">Hi Matt,<div><br></div><div>So I jumped ahead of this and created a metallicity unit and defined Zsun relative to that and it seems to work.  Maybe you're right that this will cause more trouble, but maybe I'll issue a PR to your fork with the open PR and you can check it out.</div>
<div><br></div><div>I put the metallicity field in yt/fields/fluid_fields.py.  Does that not seem like the correct place?</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:43 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">
Hi Bitton,<br>
<div class="im"><br>
On Fri, Dec 6, 2013 at 9:10 AM, Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>> 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.  Anyone<br>
> have any thoughts on this?<br>
<br>
</div>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>
<div class="im"><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 ~0.02<br>
> to be in units of Zsun.  How can I set this up correctly to make it aware of<br>
> these units?<br>
<br>
</div>My understanding is that you can set the units to be "Zsun / 0.02" in that case.<br>
<div class="im"><br>
><br>
> Should I make a "code_metallicity" unit?  This might actually be usable for<br>
> the gas metallicity field as well.<br>
<br>
</div>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>
</blockquote></div><br></div>