Solver3T
Solver3T
Solver3T(
dic: Optional[dict[str, Any]] = None,
joule: Type[PowerTerm] = PowerTerm,
solar: Type[PowerTerm] = PowerTerm,
convective: Type[PowerTerm] = PowerTerm,
radiative: Type[PowerTerm] = PowerTerm,
precipitation: Type[PowerTerm] = PowerTerm,
)
Bases: Solver
Source code in src/thermohl/solver/slv3t.py
106 107 108 109 110 111 112 113 114 115 116 | |
average
average(
surface_temperature: floatArray,
core_temperature: floatArray,
) -> floatArrayLike
Compute average temperature given surface and core temperature.
This formula is based on analytical solution in steady-state mode. For single material, the formula reduces itself to an usual mean; for bi-material conductors, we have geometrical terms to take into account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
Returns:
| Type | Description |
|---|---|
floatArrayLike
|
float | numpy.ndarray: Array of average temperatures. |
Source code in src/thermohl/solver/slv3t.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
balance_3t
balance_3t(
surface_temperature: floatArray,
core_temperature: floatArray,
joule_value: Optional[floatArrayLike] = None,
) -> floatArrayLike
Calculate the thermal balance.
This method computes the thermal balance by summing the joule heating, specific heat, and subtracting the contributions from the cooling components (convection, radiation, and conduction).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
|
float | ndarray
|
Precomputed joule heating value. If None, it will be computed from the given temperatures. |
None
|
Returns:
| Type | Description |
|---|---|
floatArrayLike
|
float | numpy.ndarray: The resulting thermal balance. |
Source code in src/thermohl/solver/slv3t.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
balance_and_morgan
balance_and_morgan(
surface_temperature: floatArray,
core_temperature: floatArray,
) -> tuple[floatArrayLike, floatArray]
Compute both balance and morgan efficiently by sharing computations.
This is the optimized version used by steady-state solvers to avoid redundant joule heating calculations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
Returns:
| Type | Description |
|---|---|
tuple[floatArrayLike, floatArray]
|
tuple[float | numpy.ndarray, numpy.ndarray]: The thermal balance and the Morgan function result. |
Source code in src/thermohl/solver/slv3t.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
joule
joule(
surface_temperature: floatArray,
core_temperature: floatArray,
) -> floatArrayLike
Calculate the Joule heating effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
Returns:
| Type | Description |
|---|---|
floatArrayLike
|
float | numpy.ndarray: The calculated Joule heating values. |
Notes:
- The function computes the average temperature temperature.
- Returns the Joule heating values based on the adjusted temperatures.
Source code in src/thermohl/solver/slv3t.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
morgan_3t
morgan_3t(
surface_temperature: floatArray,
core_temperature: floatArray,
joule_value: Optional[floatArrayLike] = None,
) -> floatArray
Computes the Morgan function for given temperature arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
|
float | ndarray
|
Precomputed joule heating value. If None, it will be computed from the given temperatures. |
None
|
Returns:
| Type | Description |
|---|---|
floatArray
|
numpy.ndarray: Resulting array after applying the Morgan function. |
Source code in src/thermohl/solver/slv3t.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
steady_intensity
steady_intensity(
max_conductor_temperature: floatArrayLike = np.array(
[]
),
target: CableLocationListLike = None,
cable_type: CableTypeListLike = None,
tol: float = default.tol,
maxiter: int = default.maxiter,
return_err: bool = False,
return_temp: bool = True,
return_power: bool = True,
) -> dict[str, np.ndarray]
Compute the steady-state intensity for a given temperature profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | ndarray
|
Initial temperature profile. Default is an empty numpy array. |
array([])
|
|
TargetType | list[CableLocation]
|
Target specification for the solver. Default is None. |
None
|
|
CableType | list[CableType]
|
Cable type specification for the solver. Default is None. If provided, it overrides the target specification. |
None
|
|
float
|
Tolerance for the solver. Default is DP.tol. |
tol
|
|
int
|
Maximum number of iterations for the solver. Default is DP.maxiter. |
maxiter
|
|
bool
|
If True, return the error in the output DataFrame. Default is False. |
False
|
|
bool
|
If True, return the temperature profiles in the output DataFrame. Default is True. |
True
|
|
bool
|
If True, return the power profiles in the output DataFrame. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
dict[str, np.ndarray]: Dictionary containing the steady-state intensity and optionally the error, temperature profiles, and power profiles, |
dict[str, ndarray]
|
along with input data. |
Source code in src/thermohl/solver/slv3t.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | |
steady_temperature
steady_temperature(
surface_temperature_guess: Optional[
floatArrayLike
] = None,
core_temperature_guess: Optional[floatArrayLike] = None,
tol: float = default.tol,
maxiter: int = default.maxiter,
return_err: bool = False,
return_power: bool = True,
) -> dict[str, np.ndarray]
Compute the steady-state temperature distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | ndarray | None
|
Initial guess for the surface temperature. If None, ambient temperature is used. |
None
|
|
float | ndarray | None
|
Initial guess for the core temperature. If None, 1.5 times the absolute value of ambient temperature is used. |
None
|
|
float
|
Tolerance for the quasi-Newton solver. |
tol
|
|
int
|
Maximum number of iterations for the quasi-Newton solver. |
maxiter
|
|
bool
|
If True, the error of the solution is included in the returned dict. |
False
|
|
bool
|
If True, power-related values are included in the returned dict. |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
dict[str, np.ndarray]: Dictionary containing the steady-state temperatures and optionally the error and power-related values, |
dict[str, ndarray]
|
along with input data. |
Source code in src/thermohl/solver/slv3t.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
transient_temperature
transient_temperature(
offset: floatArray = np.array([]),
surface_temperature_0: Optional[floatArrayLike] = None,
core_temperature_0: Optional[floatArrayLike] = None,
return_power: bool = False,
) -> Dict[str, Any]
Compute transient-state temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
A 1D array with times (in seconds) when the temperature needs to be computed. The array must contain increasing values (undefined behaviour otherwise). |
array([])
|
|
float | ndarray | None
|
Initial surface temperature. If None, the ambient temperature from the internal dict will be used. The default is None. |
None
|
|
float | ndarray | None
|
Initial core temperature. If None, the ambient temperature from the internal dict will be used. The default is None. |
None
|
|
bool
|
Return power term values. The default is False. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: A dictionary with temperature and other results (depending on inputs) in the keys, |
Dict[str, Any]
|
along with input data. |
Source code in src/thermohl/solver/slv3t.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
update
update() -> None
Updates the solver's internal state by reinitializing several components
and recalculating the Morgan coefficients.
This method performs the following steps:
1. Extends the arguments to their maximum length.
2. Reinitializes the joule_heating, solar_heating, convective_cooling, radiative_cooling, and precipitation_cooling components using the updated arguments.
3. Recalculates the Morgan coefficients using the updated dimensions.
4. Compresses the arguments.
Returns:
None
Source code in src/thermohl/solver/slv3t.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |