djsilva99 / heatrapy

Python library for simulating heat transfer processes
https://djsilva99.github.io/heatrapy
MIT License
72 stars 14 forks source link

[ Question ] [ Upgrades ] 1D model + Robin boundary condition #1

Closed MCilento93 closed 1 month ago

MCilento93 commented 4 years ago

Dear Mr. D.J. Silva,

I am using your package ‘heatrapy’ to do simple 1D Thermal model, and I have few questions about. First and foremost, I would like to thank you for implementing it, because boost a fresh implementation of FD approach on python (I come from a different PL), and because it is very handy.

  1. I have created a material lib file (.txt) and set properly in the root directory of the package. What happen in case you update the project and I do the conda update? My lib will be removed?
  2. From the discretization schemes you used in the implicit_general.py module, I see that the overall number of material segments is equal to the num_points instance attribute value. But, according to your sample, 0.5 m of gadolinium is done with borders=(1,11) that results in 12 num_points (temperature point values) 0.05 m length. That should be 12*0.05 m=0.6 m overall length. Is my understanding wrong?
  3. Material activation results into use of properties of the material considered from materialName0.txt to materialNamea.txt. But which is the truly physical effect if the properties are the same?
  4. I need to model the Robin boundary condition, but the code does not consider this as a possible boundary cond. Nonetheless, I think it can be included as Q term by list. For example, assuming I have ‘Cu’ sample and fresh air at left side, I would write: Q=[10.,0,1], with 10 as W/m2/k heat transfer coefficient (in my mind I assume the 1D length is for a section area of 1 m2). The issue I have, is that the code assume parameter Q for amb_temperature (from your paper Q=Q0+q*(T-Tamb)), that is the initial temperature of the single_object, whereas if changed simply with an other value it will result in Robin boundary Conds! Additionally, I don’t understand the physical usefulness of the instance variables h_left and h_right (sorry me, I am an energy engineer, and they are used for calculating the power leaving/entering the object). Overall I mean, if you have a single object, you set Tamb=300, boundaries=(0,0), and provide power by Q it will result in no changes for this setup. But in case I could consider a different temperature for self.Q.Tamb values, I think it will work as a robin condition (that has to be properly coupled with the adiabatic condition boundaries=(0,0)). Nonetheless I tried to do some experiments with this in mind, but it does not seem to work: I set the initial temperature of the single object (from a copy.deepcopy() list of previous results) and, with both sides insulated I tried to decrease the temperature by mean of Q terms, but the results is not a cooling.

Thank you for the comprehension,

Best regards,

djsilva99 commented 4 years ago

Hello

  1. I think so. If you update and if you have changed the material library in the package folder, you may lose it. In a coming update I will allow to insert a custom path for the material properties folder in addition to the package database, which will solve this issue.

  2. You are right. I will insert this info in the documentation for now, and then correct it in the code.

  3. If the properties are the same nothing happens. Be aware that tadi and tadd properties must be zero in the whole range of temperatures. I created this activation/deactivation properties to handle magnetocaloric effects for my research, but it can be used for other purposes.

  4. When I wrote the package it was not intended for Robin boundary conditions. Looking at your description, I think you are in the right direction. You first tried to use the package using the Q variable and then tried to modify the code. At this moment I do not have time to help you with it, but from my experience you might be missing a detail since you reasoning seems sound. Once you arrive at a correct answer please let me know.

Best regards

MCilento93 commented 4 years ago

Hello

  1. I think so. If you update and if you have changed the material library in the package folder, you may lose it. In a coming update I will allow to insert a custom path for the material properties folder in addition to the package database, which will solve this issue.
  2. You are right. I will insert this info in the documentation for now, and then correct it in the code.
  3. If the properties are the same nothing happens. Be aware that tadi and tadd properties must be zero in the whole range of temperatures. I created this activation/deactivation properties to handle magnetocaloric effects for my research, but it can be used for other purposes.
  4. When I wrote the package it was not intended for Robin boundary conditions. Looking at your description, I think you are in the right direction. You first tried to use the package using the Q variable and then tried to modify the code. At this moment I do not have time to help you with it, but from my experience you might be missing a detail since you reasoning seems sound. Once you arrive at a correct answer please let me know.

Best regards

Thank you for clarifications. But in my view, what is missing the most in python world is a code capable to manage heat transfer equations. I assure you that by only mean of 1D linear and radial models, you would figure out a lot of practical engineering cases of real life. The sectors of applications are wide, but the modularity in terms of boundary conditions and body to model would be really nice to have.

By mean of 1D thermal body, as in your package, you can model the transient heat losses of a building walls or window, but meanwhile you could use it for model nuclear power generation in control road and design the cooling circuit helped by other package. In energy sector, one can use it to model thermal losses from a pipe at 600°C with more strata of insulants, or in manufacturing processing you can use if for design cable eletrical loads or stuff like this.

A simple and handy package, that maybe can be empowered at level of differential equations by mean of Sympy , able to report all cases to 1 or 2 models, with proper methods to set widespread boundary conditions, would be infintely powerful! And I think about the amount of packages avaiable for fluids that may interacts and help more.

In case you need support for this, it would be my pleasure to give a contribution. Regards and thank for you work,