Skip to content

Cholla unit system #401

@brantr

Description

@brantr

One issue that I need to address in resolving problems with the cosmology runs and in merging in the RT is the unit system. This issue could affect others, so I thought I'd describe what I'm thinking and request discussion.

There are several of the unit systems defined in the code. Many of these units are defined in global.h. However, there are internal inconsistencies. For instance:

MYR                                  3.153600000e+13. [myr in s]
TIME_UNIT                            3.155690000e+10. [kyr in s]

Neither of these are what I expected, although TIME_UNIT is close.

Also, this:

#define MP          1.672622e-24  // mass of proton, grams
#define MH       1.67262171e-24    // Mass of hydrogen [g]

Also GN is defined in kpc^3 / M_sun / kyr^2 but there's a commented-out CGS version.

There are other unit system questions I have with the cosmology and chemistry unit systems. Some units are set inline in functions.

Here are the things I would like to pursue:

  1. Refining the unit systems defined in global.h. Clearly this could impact everyone and unit tests, so this would not be taken lightly and would need input from everyone. Relabel all units that are in CGS with a _CGS suffix. Label everything unit in the kpc|km|s|Msun system and the kpc|kyr|Msun system with distinct suffixes.

  2. Writing a Grid3D member function that will print the actual unit system to stdout at the beginning of a simulation, called in main(). This could be couched in a preproc def and set at compile time to print or not, but really it would be helpful. Or it could be written to a separate text output file.

  3. Write functions for cosmology and chemistry where all the units for those modules are set in function members of Cosmology and Chem.

  4. Write functions that print the cosmology and chemistry units when they are defined, which would be called by the grid member function.

While I listed 1-4, 2-4 is actually a tractable and small change that should impact no one. I am planning to submit a PR that addresses 2-4, but 1) probably requires discussion and so I thought I'd submit this issue. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions