Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ConversionConstants.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
19namespace shamunits {
20
23 template<class T>
25
26 static constexpr T au_to_m = 149597870700; //(m)
27 static constexpr T ly_to_m = 9460730472580800; //(m)
28 static constexpr T pc_to_m = 3.0857e16; //(m)
29 static constexpr T rsol_to_m = 6.957e8; //(m)
30 static constexpr T rearth_to_m = 6.378137e6; // Earth equatorial radius (m)
31
32 static constexpr T mn_to_s = 60; //(s)
33 static constexpr T hr_to_s = 3600; //(s)
34 static constexpr T dy_to_s = 24 * hr_to_s; //(s)
35 static constexpr T yr_to_s = 31557600; //(s)
36 static constexpr T Myr_to_s = 1e6 * yr_to_s; //(s)
37 static constexpr T Gyr_to_s = 1e9 * yr_to_s; //(s)
38
39 static constexpr T eV_to_J = 1.602176634e-19; // (J)
40 static constexpr T erg_to_J = 1e-7; // (J)
41
42 static constexpr T K_degC_offset = 273.15;
43
44 static constexpr T litre_to_pint = 0.568;
45
59 static constexpr T gcm3_to_guiness_density = 1.017; // in g.cm-3
60 };
61
62} // namespace shamunits
63
namespace containing the units library
static constexpr T pc_to_m
conversion factor from parsecs to meters
static constexpr T K_degC_offset
conversion offset from kelvin degrees to celsius
static constexpr T dy_to_s
conversion factor from days to seconds
static constexpr T erg_to_J
conversion factor from ergs to joules
static constexpr T Gyr_to_s
conversion factor from $10^9$ years to seconds
static constexpr T litre_to_pint
conversion offset from litre to british pint
static constexpr T hr_to_s
conversion factor from hours to seconds
static constexpr T ly_to_m
conversion factor from light years to meters
static constexpr T yr_to_s
conversion factor from years to seconds
static constexpr T Myr_to_s
conversion factor from $10^6$ years to seconds
static constexpr T eV_to_J
conversion factor from electron volts to joules
static constexpr T rsol_to_m
conversion factor from solar radii to meters
static constexpr T rearth_to_m
conversion factor from earth equatorial radii to meters
static constexpr T au_to_m
conversion factor from au to meters
static constexpr T mn_to_s
conversion factor from minutes to seconds