tabulated cosmology calculations

6 views
Skip to first unread message

Britton Smith

unread,
Jan 30, 2018, 1:56:28 PM1/30/18
to enzo...@googlegroups.com
Hi everyone,

I recently wanted to include the radiation component of the energy density of the universe in Enzo's cosmology calculations (converting between time and redshift).  I did this by creating a lookup table and integrating numerically instead of with analytical expressions.  For the time being, I've set it up so that this method is only used when OmegaRadiationNow is greater than zero, but it should really work in all cases.

Before I issue any pull requests, I would like to gauge opinions on whether it would be a good idea to replace all of the functionality in, for example, CosmologyComputeExpansionFactor.C, with this tabulated method.  The up side is that it removes about 80 lines of code that includes a #define.  The down side is that it will change the redshift/time conversion a tiny amount.  The tests I've run show the difference to be in the 7th decimal place or so.  An additional option would be to leave the existing functionality in place and add a UseCosmologyTable flag that could optionally bypass it.  This makes the source a bit more complicated, but leaves the old ways in place.

This is a rather fundamental change to the code, so I would appreciate any comments before moving forward.

Britton

Greg Bryan

unread,
Jan 30, 2018, 4:55:38 PM1/30/18
to enzo...@googlegroups.com
Sounds great!  I assume you also change CosmologyComputeTimeFromRedshift?  This will break the tests, but I am in favor of just using it (no new flag) if it makes it easier to add non-standard components in the future.

Greg

--
You received this message because you are subscribed to the Google Groups "enzo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enzo-dev+u...@googlegroups.com.
To post to this group, send email to enzo...@googlegroups.com.
Visit this group at https://groups.google.com/group/enzo-dev.
For more options, visit https://groups.google.com/d/optout.

Britton Smith

unread,
Jan 30, 2018, 4:57:51 PM1/30/18
to enzo...@googlegroups.com
Hi Greg,

Yeah, I've changed that one as well.  If there is continued support (or lack of dissent) I will PR this and provide some comparisons with the analytic formulae.

Britton

On Tue, Jan 30, 2018 at 1:23 PM, Greg Bryan <gbry...@gmail.com> wrote:
Sounds great!  I assume you also change CosmologyComputeTimeFromRedshift?  This will break the tests, but I am in favor of just using it (no new flag) if it makes it easier to add non-standard components in the future.

Greg

On Jan 30, 2018, at 1:56 PM, Britton Smith <britto...@gmail.com> wrote:

Hi everyone,

I recently wanted to include the radiation component of the energy density of the universe in Enzo's cosmology calculations (converting between time and redshift).  I did this by creating a lookup table and integrating numerically instead of with analytical expressions.  For the time being, I've set it up so that this method is only used when OmegaRadiationNow is greater than zero, but it should really work in all cases.

Before I issue any pull requests, I would like to gauge opinions on whether it would be a good idea to replace all of the functionality in, for example, CosmologyComputeExpansionFactor.C, with this tabulated method.  The up side is that it removes about 80 lines of code that includes a #define.  The down side is that it will change the redshift/time conversion a tiny amount.  The tests I've run show the difference to be in the 7th decimal place or so.  An additional option would be to leave the existing functionality in place and add a UseCosmologyTable flag that could optionally bypass it.  This makes the source a bit more complicated, but leaves the old ways in place.

This is a rather fundamental change to the code, so I would appreciate any comments before moving forward.

Britton

--
You received this message because you are subscribed to the Google Groups "enzo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enzo-dev+unsubscribe@googlegroups.com.

To post to this group, send email to enzo...@googlegroups.com.
Visit this group at https://groups.google.com/group/enzo-dev.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "enzo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enzo-dev+unsubscribe@googlegroups.com.

John Wise

unread,
Jan 31, 2018, 11:03:04 AM1/31/18
to enzo...@googlegroups.com
Hi Britton,

I'm in favor of totally replacing the old source with the lookup table
and not including a UseCosmologyTable if the only differences are in the
7th decimal.

I'm curious about the table. Is it a function of Omega_m, Omega_r, and
Omega_Lambda? Then it will return a and dadt? Is it interpolated
between the nearest neighbors in the table?

I guess this proposed change will finally address this comment in the
source!

/* Someday, we'll implement the general case... */

Thanks,
John
> --
> You received this message because you are subscribed to the Google
> Groups "enzo-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to enzo-dev+u...@googlegroups.com
> <mailto:enzo-dev+u...@googlegroups.com>.
> To post to this group, send email to enzo...@googlegroups.com
> <mailto:enzo...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/enzo-dev.
> For more options, visit https://groups.google.com/d/optout.

--
John Wise
Associate Professor of Physics
Center for Relativistic Astrophysics, Georgia Tech
http://cosmo.gatech.edu

Britton Smith

unread,
Jan 31, 2018, 1:31:51 PM1/31/18
to enzo...@googlegroups.com
Hi John,

I construct a table of a and t, given the omegas, and just do linear interpolation from that.  I'll PR it as soon as I can.

That comment made me chuckle.

Britton

On Wed, Jan 31, 2018 at 8:02 AM, John Wise <jw...@physics.gatech.edu> wrote:
Hi Britton,

I'm in favor of totally replacing the old source with the lookup table and not including a UseCosmologyTable if the only differences are in the 7th decimal.

I'm curious about the table.  Is it a function of Omega_m, Omega_r, and Omega_Lambda?  Then it will return a and dadt?  Is it interpolated between the nearest neighbors in the table?

I guess this proposed change will finally address this comment in the source!

/* Someday, we'll implement the general case... */

Thanks,
John


On 01/30/2018 01:56 PM, Britton Smith wrote:
Hi everyone,

I recently wanted to include the radiation component of the energy density of the universe in Enzo's cosmology calculations (converting between time and redshift).  I did this by creating a lookup table and integrating numerically instead of with analytical expressions.  For the time being, I've set it up so that this method is only used when OmegaRadiationNow is greater than zero, but it should really work in all cases.

Before I issue any pull requests, I would like to gauge opinions on whether it would be a good idea to replace all of the functionality in, for example, CosmologyComputeExpansionFactor.C, with this tabulated method.  The up side is that it removes about 80 lines of code that includes a #define.  The down side is that it will change the redshift/time conversion a tiny amount.  The tests I've run show the difference to be in the 7th decimal place or so.  An additional option would be to leave the existing functionality in place and add a UseCosmologyTable flag that could optionally bypass it.  This makes the source a bit more complicated, but leaves the old ways in place.

This is a rather fundamental change to the code, so I would appreciate any comments before moving forward.

Britton

--
You received this message because you are subscribed to the Google Groups "enzo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enzo-dev+unsubscribe@googlegroups.com <mailto:enzo-dev+unsubscribe@googlegroups.com>.
To post to this group, send email to enzo...@googlegroups.com <mailto:enzo-dev@googlegroups.com>.

--
John Wise
Associate Professor of Physics
Center for Relativistic Astrophysics, Georgia Tech
http://cosmo.gatech.edu
--
You received this message because you are subscribed to the Google Groups "enzo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enzo-dev+unsubscribe@googlegroups.com.
To post to this group, send email to enzo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages