TidalPy.utilities.spherical_helper package
Submodules
TidalPy.utilities.spherical_helper.mass module
Functions to help calculate the mass and gravity of a spherical body
- TidalPy.utilities.spherical_helper.mass.calculate_mass_gravity_arrays(radius_array: ndarray, density_array: ndarray, gravity_constant: float = 6.6743e-11) Tuple[ndarray, ndarray, ndarray][source]
Calculate the volume, mass, and gravity arrays from a radius and density array.
- Parameters:
radius_array (np.ndarray) – Radius array throughout planet [m or units that match gravity_constant] This does not need to be evenly spaced.
density_array (np.ndarray) – Density array throughout the planet [kg m-3 or units that match gravity_constant] Each element of the array must match the density at the respective elements in radius_array
gravity_constant (float = G (from TidalPy.constants)) – The user can provide an alternative G if they are using a different unit system.
- Returns:
output –
- volume_arraynp.ndarray
Volume of each spherical shell [m3] Defined at each element of the radius_array
- mass_arraynp.ndarray
Mass of each spherical shell [kg] Defined at each element of the radius_array
- gravity_arraynp.ndarray
Acceleration due to gravity at the top of each spherical shell [m s-3] Defined at each element of the radius_array
- Return type:
Tuple[np.ndarray, np.ndarray, np.ndarray]
TidalPy.utilities.spherical_helper.volume module
Functions to help calculate the volume of voxels in a spherical geometry
- TidalPy.utilities.spherical_helper.volume.calculate_voxel_volumes(radius_array: ndarray, longitude_array: ndarray, colatitude_array: ndarray)[source]
Calculate the volume of all voxels within a sphere assuming spherical geometry.
- This function uses loops which are supported by numba. Currently, this function is about 160% faster than the
current numpy implementation above. Setting parallel to False will lead to a drop in performance of about 120%.
Longitude and Colatitude must be provided in radians.
- Parameters:
radius_array (np.ndarray) – Radius array, does not have to be equally spaced [m] Shape: N_r
longitude_array (np.ndarray) – Longitude array, does not have to be equally spaced [rad] Shape: N_long
colatitude_array (np.ndarray) – Colatitude array, does not have to be equally spaced [rad] Shape: N_colat
- Returns:
voxel_volumes – Volume for each voxel assuming spherical geometry [m3] Shape: (N_r, N_long, N_colat)
- Return type:
np.ndarray
- TidalPy.utilities.spherical_helper.volume.calculate_voxel_volumes_npy(radius_array: ndarray, longitude_array: ndarray, colatitude_array: ndarray)[source]
Calculate the volume of all voxels within a sphere assuming spherical geometry.
This function uses numpy functions that are not currently supported by numba.
Longitude and Colatitude must be provided in radians.
- Parameters:
radius_array (np.ndarray) – Radius array, does not have to be equally spaced [m] Shape: N_r
longitude_array (np.ndarray) – Longitude array, does not have to be equally spaced [rad] Shape: N_long
colatitude_array (np.ndarray) – Colatitude array, does not have to be equally spaced [rad] Shape: N_colat
- Returns:
voxel_volumes – Volume for each voxel assuming spherical geometry [m3] Shape: (N_r, N_long, N_colat)
- Return type:
np.ndarray