small error in temperature units

6 views
Skip to first unread message

Michael Kuhlen

unread,
Feb 22, 2012, 2:03:43 PM2/22/12
to Enzo Developers List
Ryan O'Leary recently pointed out to me that there's a few percent
error in TemperatureUnits. In CosmologyGetUnits.C we currently have

*TemperatureUnits = 1.88e6*POW(ComovingBoxSize,2)*OmegaMatterNow*
(1 + InitialRedshift);

But the correct pre-factor is actually 1.81723e6.

[T] = [P] / [rho] * m_H / k
= [u] * m_H / k
= [v]^2 * m_H / k
= (1.22475e7)**2 * 1.67262158e-24 / 1.3806503e-23 *
ComovingBoxSize**2 * OmegaMatterNow * (1 + InitialRedshift)
= 1.81723e6 * ComovingBoxSize**2 * OmegaMatterNow * (1 + InitialRedshift)

So that's a 3.5% error. Not a big deal, but we might as well fix it,
right? It will, however, probably break the gold standard on a few
tests...

Should I submit a pull request to fix this?

Mike

--
*********************************************************************
*                                                                   *
*  Dr. Michael Kuhlen              Theoretical Astrophysics Center  *
*  email: m...@astro.berkeley.edu   UC Berkeley                      *
*  cell phone: (831) 588-1468      B-116 Hearst Field Annex # 3411  *
*  skype username: mikekuhlen      Berkeley, CA 94720               *
*                                                                   *
*********************************************************************

Daniel R. Reynolds

unread,
Feb 22, 2012, 2:20:17 PM2/22/12
to enzo...@googlegroups.com
I definitely think we should fix this. It is in line with the
modifications that Elizabeth Tasker and I did a little while back where
we moved typical constants into header files so that everyone would be
using the same values with all relevant digits (e.g. instead of places
in the code where pi = 3.14).

Of course, it could definitely change results from the gold standard,
but I'd maintain that if things change due to an improvement, the
previous standard should be revised.

------------------------------------
Dr. Daniel R. Reynolds
Assistant Professor of Mathematics
Southern Methodist University

214-768-4339
http://faculty.smu.edu/reynolds/
------------------------------------

Brian O'Shea

unread,
Feb 22, 2012, 2:40:44 PM2/22/12
to enzo...@googlegroups.com
Yeah, +1 on fixing this.  It's ok to change the result from the gold standard if we're making it MORE correct - the test suite (and gold standard sims) are intended to help us, not be an anchor keeping us back!  :-)

--
You received this message because you are subscribed to the Google Groups "enzo-dev" group.
To post to this group, send email to enzo...@googlegroups.com.
To unsubscribe from this group, send email to enzo-dev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/enzo-dev?hl=en.


Reply all
Reply to author
Forward
0 new messages