A simple visualizer and numerical solver for determining the temperature distribution inside a can of drink during a cooling process.
The application was written in C++ for browsers and desktop (Windows/Linux). It uses a simple physical model, only the conduction inside the drink (Fourier's law) and the heat transfer (Newton's law of coooling) at the boundary is modelled, the can is neglected, and the environment temperature is constant.
The physics of the calculations are explained here but I modified much of it for my own likings.
The app can be used in browser here!
You can create as many processes as you want, this is useful if you want to compare different configurations.
There are two type of processes:
- with the first type you can calculate how much time is needed to cool down the drink to a target temperature
- with the second type you can determine the average temperature of the drink after a given amount of time has elapsed
There are four type of parameters which have to be specified:
- can's geometric properties - height and radius and their division factors, the radiuses are not divided equally but they are diveded in a way that the generated volumes are equal.
- drink's material properties - self-explanatory (the default values are the water's parameters)
- temperature properties - self explanatory
- time properties: the time-step is the time-discretization value, while the snapshot value is the time difference between two stored states (Note: not all states are stored as they would need much memory and at low time-step values technically no differences can be seen between to neighbouring states)
You can manipulate the camera at any time. The camare can move in a cylindrical coordinate system and it always looks at the can/origo.
After setting up the process, press start and the calculation begins. The length of the calculation depends on the geometry/time discretization and on the temperature conditions, obviously. The default process should only take a moment to finish.
When post-processing, you can set the elapsed time of the selected process and the heat distribution at the specified time is visualized then. Also, multiple type of heat maps can be generated which help you to read the required temperature values.
The temperature-time distribution of the process is also shown to the user as a plot.
Try the browser port or you can download the application from the release section. On Windows you have to install Visual Studio redistributables first.
Clone the project with its submodules:
git clone --recurse-submodules -j8 https://github.com/Ma-Pe-Ma/Drink-Cooling-Visualizer.git
A CMake project is added to the repository which should configure and then build without problems.
The app requires the following dependecies (which do not need further configuring):
- GLFW - utility used to create OpenGL contexts, and windows
- glm - a maths library for graphics
- Dear ImGui - an immediate mode GUI library
- ImPlot - an immediate mode plotting library for Dear ImGui
- Tiny Color Map - a simple header-only library used to create color maps
- GLAD - an OpenGL Loading Library
The app should also compile without problems to WebAssemby build with Emscripten.
This is a simple hobby project which should not be taken seriously. I do not plan to improve the functionality of this application.
The weakest part of it is the essence of the app: the numerical solver. I think some parameters are not okay and there may be problems with the solver too. If I will be in the mood then I will try to improve it in the future...