Skip to content

ConvectiveCoolingBase

ConvectiveCoolingBase

ConvectiveCoolingBase(
    altitude: floatArrayLike,
    cable_azimuth: floatArrayLike,
    ambient_temperature: floatArrayLike,
    wind_speed: floatArrayLike,
    outer_diameter: floatArrayLike,
    air_density: Callable[
        [floatArrayLike, floatArrayLike], floatArrayLike
    ],
    dynamic_viscosity: Callable[
        [floatArrayLike], floatArrayLike
    ],
    thermal_conductivity: Callable[
        [floatArrayLike], floatArrayLike
    ],
    wind_azimuth: floatArrayLike = None,
    wind_attack_angle: floatArrayLike = None,
    **kwargs: Any,
)

Bases: PowerTerm

Convective cooling term.

Source code in src/thermohl/power/convective_cooling.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
def __init__(
    self,
    altitude: floatArrayLike,
    cable_azimuth: floatArrayLike,
    ambient_temperature: floatArrayLike,
    wind_speed: floatArrayLike,
    outer_diameter: floatArrayLike,
    air_density: Callable[[floatArrayLike, floatArrayLike], floatArrayLike],
    dynamic_viscosity: Callable[[floatArrayLike], floatArrayLike],
    thermal_conductivity: Callable[[floatArrayLike], floatArrayLike],
    wind_azimuth: floatArrayLike = None,
    wind_attack_angle: floatArrayLike = None,
    **kwargs: Any,
):
    self.altitude = altitude
    self.ambient_temp = ambient_temperature
    self.wind_speed = wind_speed

    if wind_attack_angle is None and wind_azimuth is None:
        raise ValueError("Must provide either wind_attack_angle or wind_azimuth.")
    if wind_attack_angle is not None and wind_azimuth is not None:
        logger.warning(
            "both wind_attack_angle and wind_azimuth are provided. wind_azimuth will be ignored."
        )
    if wind_attack_angle is not None:
        self.wind_attack_angle = wind_attack_angle
    else:
        self.wind_attack_angle = compute_wind_attack_angle(
            cable_azimuth, wind_azimuth
        )

    self.outer_diameter = outer_diameter

    self.air_density = air_density
    self.dynamic_viscosity = dynamic_viscosity
    self.thermal_conductivity = thermal_conductivity

derivative

derivative(
    conductor_temperature: floatArrayLike,
    temperature_increment: float = _TEMP_INCREMENT,
) -> floatArrayLike

Compute power term derivative regarding temperature in function of temperature.

Usually this function should be overriden in children classes; if it is not the case it will evaluate the derivative from the value method with a second-order approximation.

Parameters:

Name Type Description Default

conductor_temperature

float | ndarray

Conductor temperature (°C).

required

temperature_increment

float

Temperature increment. The default is 1.0E-03.

_TEMP_INCREMENT

Returns:

Type Description
floatArrayLike

float | numpy.ndarray: Power term derivative (W·m⁻¹·K⁻¹).

Source code in src/thermohl/power/power_term.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def derivative(
    self,
    conductor_temperature: floatArrayLike,
    temperature_increment: float = _TEMP_INCREMENT,
) -> floatArrayLike:
    r"""Compute power term derivative regarding temperature in function of temperature.

    Usually this function should be overriden in children classes; if it is
    not the case it will evaluate the derivative from the value method with
    a second-order approximation.

    Args:
        conductor_temperature (float | numpy.ndarray): Conductor temperature (°C).
        temperature_increment (float, optional): Temperature increment. The default is 1.0E-03.

    Returns:
        float | numpy.ndarray: Power term derivative (W·m⁻¹·K⁻¹).

    """
    return (
        self.value(conductor_temperature + temperature_increment)
        - self.value(conductor_temperature - temperature_increment)
    ) / (2.0 * temperature_increment)

value

value(
    conductor_temperature: floatArrayLike,
) -> floatArrayLike

Compute convective cooling.

Parameters:

Name Type Description Default

conductor_temperature

float | ndarray

Conductor temperature (°C).

required

Returns:

Type Description
floatArrayLike

float | numpy.ndarray: Power term value (W·m⁻¹).

Source code in src/thermohl/power/convective_cooling.py
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
def value(self, conductor_temperature: floatArrayLike) -> floatArrayLike:
    r"""Compute convective cooling.

    Args:
        conductor_temperature (float | numpy.ndarray): Conductor temperature (°C).

    Returns:
        float | numpy.ndarray: Power term value (W·m⁻¹).

    """
    film_temperature = 0.5 * (conductor_temperature + self.ambient_temp)
    temperature_delta = conductor_temperature - self.ambient_temp
    air_density = self.air_density(film_temperature, self.altitude)
    return np.maximum(
        self._value_forced(film_temperature, temperature_delta, air_density),
        self._value_natural(temperature_delta, air_density),
    )