With this repo I'd like to show you some of my (very simple) results about my study of thermodynamics. In particular, I analitically studied the way temperature of objects change over time, and I built some basic GUI interfaces with python to plot the results I found. The problems I analyzed go for a crescent way of difficulty, and the repo ends with a general solution I came up with that comprehend all the possible situations. Hope it could be interesting :)
- First problem: single object and the environment
- Second problem: two objects without environment
- Third problem: two objects and the environment
- A more general way
Let's consider an object of mass
To find it, let us consider a system with the properties we provided. It doesn't matter if the object is cooler or hotter than the environment, physics works both ways :)
Given that, let us quantify the total heat transfered by the object or to the object in a very small period of time
Now, we can think of the total heat exchanged as the total heat power released in the
Then, from the electro-thermal analogy we can express the heat power using the temperature of the environment
The - sign is fundamental to maintain the equivalence (for example, suppose the object is cooling: in that case
Finally, we can divide both terms by
We eventually obtained this beautiful linear differential equation for the temperature function! In the end it should look like this:
Remembering that
This function goes to
Starting from this analytical solution I wrote the object_environment.py
python script, that simply reads the properties of the system from some input-boxes and then plot the curve of the function.
Let's consider two objects of mass
First of all, it can be usefull to find the equivalence temperature
From here we have
As we can see, the equivalence temperature seems to be the weighted average of the initial objects temperatures, with the weights expressed by the product
Now let's understand what happens to our system after a really short period of time
with the - sign balancing the equation (in fact, when one temperature increases and its difference is positive, the other decreases and its difference is negative). From here we divide both terms by
Then we integrate both sides of the equation and we obtain:
This final result shows that
The equation can eventually be written as:
and, of course
Finally, let's rewrite the previous equation using the electro-thermal analogy: the amount of heat transfered in a
Now, let's focus on the second and the fourth term
As we seen, the functions
This is the linear differential equation that governs the
Note that the the term
These results have been applied in the object_object.py
script. A simple GUI wraps the graph and add some input-boxes to let you play around with different scenarios.
For the third problem, let's consider two objects of mass
From here, it's very difficult to find an analytical solution for the temperature curves of the objects, since the system is too complicated. Anyway, we can opt for an iterative solution! Like before, let us describe the total heat exchanged by the first object in a small period of time
Again, we can think of the total heat transfered as the total heat power released in the
Now, the heat power that is being exchanged during the
The - sign is fundamental to maintain the equivalence (for example, suppose
From this equation we notice that we can derive the temperature of the object at time
For example, after the first
We can see that by iterating this formula over and over again and by storing each time the values computed we are able to build the temperature curve of the object. Obviously, all the temperatures of the system must be updated over time, so to be able to build the object_object_environment.py
script, and seems to work pretty well.
As seen in the previous paragraph about the object_object_environment.py
script, it is not always necessary to compute a differential equation to plot the graph of different objects in the system. By using the iterative approach, the only difficulty is writing the first equation correctly and then plugging it into a script that builds a function step by step.
For example, suppose we have
So, the temperature of object 1 at time
Not every object should exchange heat with all others. For instance, object 1 may directly exchange heat with objects 2 and 4 but not with objects 3 and 5. We can represent these objects and their thermal interactions through a weighted graph, where each node symbolizes an object and each edge represents a connection between two objects, with the weight indicating thermal resistances.
This concept presents a more scalable and efficient approach to the problem of finding the temperature variations over time, and represent the generalization of the previous exercises.