Heat
Heat transfer systems.
The package covers diffusion of heat on lattices and meshes, and cooling towards the surroundings.
CoffeeCupElement(label, *, T=90.0)
Bases: Element
Cup of coffee at the temperature T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the cup. |
required |
T
|
float
|
The initial temperature of the coffee. |
90.0
|
Examples:
>>> from skcomplex.systems.physics.heat import CoffeeCupElement
>>> CoffeeCupElement('coffee', T=60.0).T
60.0
Source code in src/skcomplex/systems/physics/heat/_cooling.py
42 43 44 | |
CoolingCoffeeSystem(T=90.0, *, room=20.0, k=0.1, label='system', solver='auto', backend='auto')
Bases: BaseSystem
A cup of coffee whose temperature relaxes to that of the room.
The temperature follows T' = -k (T - T_room).
The heat flow is proportional to the discrepancy between the coffee and the room, a balancing feedback loop, so hot
coffee cools and iced coffee warms, both exponentially with the time constant 1 / k. The system has the
temperature coffee.T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
The initial temperature of the coffee. |
90.0
|
room
|
float
|
The temperature of the room. |
20.0
|
k
|
float
|
The rate of heat exchange. |
0.1
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.heat import CoolingCoffeeSystem
>>> trajectory = CoolingCoffeeSystem(T=5.0).prepare().simulate(until=10.0)
>>> round(float(trajectory.get_values('coffee.T')[0]), 1)
5.0
Source code in src/skcomplex/systems/physics/heat/_cooling.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
HeatDiffusionSystem(shape=(64, 64), *, D=1.0, spacing=1.0, boundary='zero-flux', label='system', solver='auto', backend='auto')
Bases: BaseSystem
Heat diffusing on a plate from a hot square in its middle.
The temperature follows du/dt = D laplacian(u).
The system has the temperature plate.u.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shape
|
Sequence[int]
|
The number of sites along every dimension. |
(64, 64)
|
D
|
float
|
The diffusion coefficient. |
1.0
|
spacing
|
float
|
The distance between sites. |
1.0
|
boundary
|
str
|
|
'zero-flux'
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.heat import HeatDiffusionSystem
>>> HeatDiffusionSystem((10, 10), boundary='fixed').prepare().system_.elements[0].space.boundary
{'u': ('fixed', 0.0)}
Source code in src/skcomplex/systems/physics/heat/_heat.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
HeatElement(label, *, u=0.0, D=1.0, space=None)
Bases: Element
Sites of a plate with the temperature u and the heat diffusion coefficient D.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the plate. |
required |
u
|
object
|
The initial temperature, one value per site or one for all. |
0.0
|
D
|
Annotated[float, closed_open(0, oo)]
|
The diffusion coefficient. |
1.0
|
space
|
BaseSpace | None
|
The lattice or the mesh of the sites, or |
None
|
Examples:
>>> from skcomplex.systems.physics.heat import HeatElement
>>> HeatElement('site', D=0.5).D
0.5
Source code in src/skcomplex/systems/physics/heat/_heat.py
49 50 51 52 53 54 55 56 57 58 59 | |
HeatLShapeSystem(refine=3, *, D=1.0, temperature=harmonic, label='system', solver='auto', backend='auto')
Bases: BaseSystem
Heat on the L-shaped domain with fixed boundary temperatures.
The domain is discretised by linear finite elements.
The plate starts cold inside, and its temperature relaxes to the solution of Laplace's equation with the boundary
temperatures. The default boundary temperature is harmonic, so the steady state is known. The system has the
temperature plate.u at the nodes of the mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refine
|
int
|
The number of uniform refinements of the mesh. |
3
|
D
|
float
|
The diffusion coefficient. |
1.0
|
temperature
|
Callable[[Array, Array], Array] | float
|
The boundary temperature, a number or a function of the coordinates. |
harmonic
|
label
|
str
|
The label of the system, which names it when it is nested in another one. |
'system'
|
solver
|
BaseSolver | str
|
The solver of the problem, or |
'auto'
|
backend
|
BaseBackend | str
|
The backend that evaluates the compiled functions, or |
'auto'
|
Examples:
>>> from skcomplex.systems.physics.heat import HeatLShapeSystem
>>> HeatLShapeSystem(1).prepare().system_.elements[0].space.prepare().size_
21
Source code in src/skcomplex/systems/physics/heat/_heat.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
NewtonCoolingInteraction(label, *, target, room=20.0, k=0.1)
Bases: Interaction
Newton cooling of a body towards the temperature of the room.
The temperature T of the target follows T' = -k (T - room).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the body that cools. |
required |
room
|
float
|
The temperature of the room. |
20.0
|
k
|
Annotated[float, closed_open(0, oo)]
|
The rate of heat exchange. |
0.1
|
Examples:
>>> from skcomplex.systems.physics.heat import NewtonCoolingInteraction
>>> NewtonCoolingInteraction('cooling', target='coffee', k=0.2).k
0.2
Source code in src/skcomplex/systems/physics/heat/_cooling.py
73 74 75 76 77 78 79 80 81 82 83 84 | |
harmonic(x, y)
Return the harmonic function exp(x) sin(y).
It is a steady temperature known in closed form.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Array
|
The first coordinates. |
required |
y
|
Array
|
The second coordinates. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
values |
Array
|
The temperatures. |
Examples:
>>> from skcomplex.systems.physics.heat import harmonic
>>> float(harmonic(0.0, 0.0))
0.0
Source code in src/skcomplex/systems/physics/heat/_heat.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |