temperature_dependence module

class temperature_dependence.Geotherm(geotherm_type='linear', uncertainty_constants=None, **kwargs)[source]

Bases: GeothermConstants

A class used to represent a Geotherm.

A Geotherm is a model for calculating the temperature profile in the Earth’s crust. This class provides several different geotherm models, which can be selected using the geotherm_type parameter.

The class inherits from GeothermConstants, which provides default values for various geothermal properties. These defaults can be overridden by providing keyword arguments when creating a Geotherm instance.

Parameters:
  • geotherm_type (str, optional) – The type of geotherm model to use. Default is “linear”.

  • uncertainty_constants (GeothermConstantUncertainties, optional) – An instance of GeothermConstantUncertainties that stores the uncertainties related to each geothermal property. Default is an instance of GeothermConstantUncertainties with default values.

  • **kwargs – Additional keyword arguments to override constants.

geotherm_type

The type of geotherm model to use.

Type:

str

uncertainties

An instance of GeothermConstantUncertainties that stores the uncertainties related to each geothermal property.

Type:

GeothermConstantUncertainties

__call__(z)[source]

Evaluate the geothermal model at a given depth or depths.

linear(z)[source]

Calculate the temperature at a given depth or depths using a linear geothermal model.

single_layer_internal_heat(z)[source]

Calculate the temperature at a given depth or depths using a single-layer internal heat geothermal model.

single_layer_flux_difference(z)[source]

Calculate the temperature at a given depth or depths using a single-layer flux difference geothermal model.

single_layer_temperature_difference(z)[source]

Calculate the temperature at a given depth or depths using a single-layer temperature difference geothermal model.

generate_geotherm(z_slices)[source]

Generate the geotherm for the current set of parameters.

generate_geotherm_distribution(n_geotherms, z_slices)[source]

Generate a family of geothermal models based on the mean and uncertainty values of the constants using Monte Carlo sampling of parameter uncertainties. uncertainty_constants must not be set to None when calling this method.

Examples

Using a linear geothermal model to evaluate temperature at 10 km depth.

>>> geotherm = Geotherm(geotherm_type="linear")
>>> temperature = geotherm(10000)
>>> print(temperature)

Using a single-layer internal heat geotherm model to generate a geotherm with 150 depth slices.

>>> geotherm = Geotherm(geotherm_type="single_layer_internal_heat")
>>> temperatures = geotherm.generate_geotherm(z_slices = 150)
>>> print(temperatures)

Using a single-layer temperature difference geotherm model to generate a family of geotherms with 200 depth slices each.

>>> geotherm = Geotherm(
...     geotherm_type="single_layer_temperature_difference",
...     uncertainty_constants=GeothermConstantUncertainties(),
...     tc=30000)
>>> geotherm.generate_geotherm_distribution(n_geotherms=100, z_slices=200)
>>> print(geotherm.T_family)
generate_geotherm(z_slices=100)[source]

Generate a geothermal model based on the constants provided.

Parameters:

z_slices (int, optional) – Number of depth slices at which to evaluate the model. Default is 100.

Returns:

  • np.ndarray – Array of depths at which to evaluate the model.

  • np.ndarray – Array of temperatures at the given depths.

generate_geotherm_distribution(n_geotherms=100, z_slices=100)[source]

Generate a family of geothermal models based on the mean and uncertainty values of the constants.

Parameters:
  • n_geotherms (int, optional) – Number of geotherms to generate. Default is 100.

  • z_slices (int, optional) – Number of slices to divide the depth into. Default is 100.

Returns:

  • np.ndarray – Array of depths at which to evaluate the models.

  • np.ndarray – Array of temperatures at the given depths for each model.

linear(z)[source]

Linear geothermal model.

Parameters:

z (Union[float, np.ndarray]) – Depth or depths at which to evaluate the model.

Returns:

Result of the linear geothermal model at the given depth or depths.

Return type:

Union[float, np.ndarray]

single_layer_flux_difference(z)[source]

Single-layer model with internal heat generation based on heat flux at the surface and at the moho. Does not require internal heat production or crustal thickness as arguments.

Parameters:

z (Union[float, np.ndarray]) – Depth or depths at which to evaluate the model.

Returns:

Result of the single-layer flux difference geothermal model at the given depth or depths.

Return type:

Union[float, np.ndarray]

single_layer_internal_heat(z)[source]

Single-layer model with internal heat generation and heat flux at the moho.

Parameters:

z (Union[float, np.ndarray]) – Depth or depths at which to evaluate the model.

Returns:

Result of the single-layer internal heat geothermal model at the given depth or depths.

Return type:

Union[float, np.ndarray]

single_layer_temperature_difference(z)[source]

Single-layer model including internal heat generation based on the temperature at the surface and at the moho.

Parameters:

z (Union[float, np.ndarray]) – Depth or depths at which to evaluate the model.

Returns:

Result of the single-layer temperature difference geothermal model at the given depth or depths.

Return type:

Union[float, np.ndarray]

class temperature_dependence.GeothermConstantUncertainties(tc_unc: float = 0.0, T0_unc: float = 0.0, T1_unc: float = 200.0, q0_unc: float = 0.014, qm_unc: float = 0.01, k_unc: float = 0, H0_unc: float = 2e-10, hr_unc: float = 5.0, rho_unc: float = 0.0)[source]

Bases: object

This data class stores uncertainties related to geothermal properties. Each property is represented as a float value.

Parameters:
  • tc_unc (float) – Uncertainty in crustal thickness, km

  • T0_unc (float) – Uncertainty in temperature at the surface, C

  • T1_unc (float) – Uncertainty in temperature at the base of the crust, C

  • q0_unc (float) – Uncertainty in heat flux at the surface, W/m2

  • qm_unc (float) – Uncertainty in heat flux at the base, W/m2

  • k_unc (float) – Uncertainty in thermal conductivity, W/(m K)

  • H0_unc (float) – Uncertainty in internal heat production at the surface W/(kg m3)

  • hr_unc (float) – Uncertainty in decay lengthscale of heat production, km

  • rho_unc (float) – Uncertainty in density, g/cm3

H0_unc: float = 2e-10
T0_unc: float = 0.0
T1_unc: float = 200.0
hr_unc: float = 5.0
k_unc: float = 0
q0_unc: float = 0.014
qm_unc: float = 0.01
rho_unc: float = 0.0
tc_unc: float = 0.0
class temperature_dependence.GeothermConstants(tc: float = None, T0: float = 10.0, T1: float = 600.0, q0: float = 0.059, qm: float = 0.03, k: float = 2.5, H0: float = 7e-10, hr: float = 10.0, rho: float = 2.9)[source]

Bases: object

Data class to store constants related to geothermal properties.

Parameters:
  • tc (float) – Crustal thickness, km

  • T0 (float) – Temperature at the surface, C

  • T1 (float) – Temperature at the base of the crust, C

  • q0 (float) – Heat flux at the surface, W/m2

  • qm (float) – Heat flux at the base, W/m2

  • k (float) – Thermal conductivity, W/(m K)

  • H0 (float) – Internal heat production at the surface W/(kg m3)

  • hr (float) – Decay lengthscale of heat production, km

  • rho (float) – Density, g/mc3

H0: float = 7e-10
T0: float = 10.0
T1: float = 600.0
hr: float = 10.0
k: float = 2.5
q0: float = 0.059
qm: float = 0.03
rho: float = 2.9
tc: float = None
temperature_dependence.V_T_correction(T, dvdT=-0.0004)[source]

Calculate the velocity correction based on the temperature.

Parameters:
  • T (float) – Temperature at which to calculate the velocity correction.

  • dvdT (float, optional) – Rate of change of velocity with temperature. Default is -4e-4.

Returns:

The velocity correction at the given temperature.

Return type:

float

temperature_dependence.compressibility(rho_o, P, K=90000000000.0)[source]

Calculate the effect of confining pressure on density.

Parameters:
  • rho_o (float) – Surface (reference) density.

  • P (float) – Pressure in MPa.

  • K (float, optional) – Bulk modulus in Pa. Default is 90e9.

Returns:

  • abs_rho (float) – Density at pressure, P.

  • frac_change (float) – Fractional change in density (e.g., 1.1 indicates a 10% velocity increase).

  • rel_rho (float) – Relative density change (e.g., 0.1 indicates a 10 Mg/m3 density increase).

temperature_dependence.rho_thermal(rho_o, T, alpha=3e-05)[source]

Calculate simple thermal expansion.

Parameters:
  • rho_o (float) – Surface (reference) density.

  • T (float) – Temperature in degrees Celsius.

  • alpha (float, optional) – Thermal expansion coefficient. Default is 3e-5.

Returns:

  • abs_rho (float) – Density at temperature, T.

  • frac_change (float) – Fractional change in density (e.g., 1.1 indicates a 10% velocity increase).

  • rel_rho (float) – Relative density change (e.g., 0.1 indicates a 10 kg/m3 density increase).

temperature_dependence.rho_thermal2(rho_o, T, alpha0=1e-05, alpha1=2.9e-08, T0=10)[source]

Calculate the effect of temperature on density.

Parameters:
  • rho_o (float) – Surface (reference) density.

  • T (float) – Temperature in degrees Celsius.

  • alpha0 (float, optional) – Thermal expansion at 0K (K^{-1}). Default is 1.0e-5.

  • alpha1 (float, optional) – Thermal expansion temperature derivative (K^{-2}). Default is 2.9e-8.

  • T0 (int, optional) – Surface temperature in the same units as T. Default is 10.

Returns:

  • abs_rho (float) – Density at temperature, T.

  • frac_change (float) – Fractional change in density (e.g., 1.1 indicates a 10% velocity increase).

  • rel_rho (float) – Relative density change (e.g., 0.1 indicates a 10 kg/m3 density increase).