Heat Loss and Energy Remaining Between Two Identical Materials

1. Jan 8, 2014

spl3001

I'm trying to write a very, very simple heat flow simulation program.

The idea is an environment space is a grid, with each grid space identical in respect to all other grid spaces (I'm calling a grid space an "element") except temperature. So, they are physically the same except temperature differences.

I have found a formula for power output from a hot object in a cool environment:

q = εδ (Th4 - Tc4)A

Where:
ε : Emissivity (doesn't matter, set to 1 in this case)
σ : Stefan-Boltzmann constant
Th: Temperature of hot object in Kelvin
Tc: Temperature of cold object in Kelvin
A: Area of hot object exposed to cold object (can be assumed to be 1, or not particularly important in the application)

That's great, so now I know the instantaneous power output. But I need to integrate this so I can have a formula that basically has time as an input and outputs the temperature of the hot object at some time after the initial conditions. It's been some time since my calculus classes sadly.

2. Jan 8, 2014

Staff: Mentor

Are you sure you are dealing with radiative heat transport and not conductive heat transport?

3. Jan 8, 2014

spl3001

Yes, just radiative. I feel including conduction will be...complicated. Though one or the other only would be great.

4. Jan 8, 2014

akib

It might be great!

5. Jan 8, 2014

Chet

6. Jan 8, 2014

spl3001

Well lets go with conduction then. I'd be interested in seeing the steps to deriving the formula as well.

7. Jan 8, 2014

Staff: Mentor

I assume you are solving this problem for a rectangular sheet of material, correct? I also assume you are interested in the transient (time varying) response, correct? What are the initial conditions and boundary conditions?

Chet

8. Jan 8, 2014

spl3001

The setup is as follows:

The environment is divided into a rectangular grid of squares of any size (m x n). Each square can exchange heat with any of the 8 neighboring squares. The 4 left, right, up and down of a given square element have a heat exchange weight of 1.0. The diagonal squares exchange heat at a reduced rate of $\frac{1}{\sqrt{2}}$, taking into effect the increase distance between their centers.

All the squares are physically identical (at least for the initial version of this program), except for temperature. They would have in this case identical conductance, mass, particle count, etc. The only variable is heat (or total energy) and time. The actual rate of exchange for this hypothetical material can be arbitrarily chosen. An example would be a block 1 meter in length, and maybe 1 watt per edge per Δkelvin.

The rectangular environment is bounded by a perfectly insulating wall. No heat can be exchanged between it and the individual elements (which means the perimeter has a special case to deal with absent heat exchanging elements).

The simulation can have a varying time step, and this will eventually be taken into account into the simulation.

That's the basic idea at the moment: a really crummy experiment at a finite element analysis program.

9. Jan 9, 2014

Staff: Mentor

This sounds like a standard transient heat conduction problem. The sheet of material starts out at a uniform temperature, and some sort of heating takes place either within the sheet or at its edges. The edges that are insulated have no heat entering or leaving. There may be some heat entering through a portion of the boundary as imposed by a heat flux. You are using an 8 point finite difference (/element) approximation to describe the rate of change of temperature at each nodal point. This involves the 8 nearest neighbors. Correct so far?

Chet

10. Jan 9, 2014

spl3001

Yes, 8 nearest neighbors, with the 4 diagonal ones weighted as less conductive as the other 4. The initial conditions are basically the temperature (or energy content: heat) of the elements specified. One example I've been using a square grid with the center square at a high temperature. The heat spreads in a roughly Gaussian distribution, I assume, out from the center.

I currently have a crude hack to move the "heat" around the grid, but I have to put in a constraint because other wise there will be an oscillation between elements because of the way the heat transfer is currently done (some basic subtraction for the flow of heat out, and some addition for the flow of heat in, regardless of other potentially important effects or surroundings).

11. Jan 10, 2014

Staff: Mentor

Before we continue, can you please give me some more underlying background. Is this a project or problem for a course in
Heat Transfer
Numerical Analysis
Finite Element?

Is it a project for your work?

How have you set the problem up so far (equations)?
Why are you using 8 points instead of 4? Is using 8 a requirement of the assignment?

In other words, what is motivating this work?

Chet

12. Jan 10, 2014

spl3001

Honestly, it's just for fun, haha. I like physics, programming, and using those first two interests to make little simulations. Heat flow and fluid flow have interested me, but I can't afford some of the CFD and FEA software packages, nor do I desire the accuracy and power that they provide.

The problem currently doesn't use any physical equations (in other words, anything close to modeling real world heat flow). I'm at work right now, but I think the pseudo code was something along these lines:

Code (Text):
Loop through the 8 neighbors

If neighbor is diagonal
weight = 0.70716
else
weight = 1

if(Abs(Grid Heat - Neighbors Heat) > 0.001) //hack part
totalHeatFlux += (Grid Heat - Neighbors Heat) / 100 * weight //more hack parts

End loop

Grids Heat -= totalHeatFlux
And that whole process is repeated for every element in the grid. The test to see if the difference is really small is to prevent all the neighbors squares from removing heat from a colder object because the code doesn't look at the total heat flow out. And the division by 100 is to reduce the flow out.

13. Jan 10, 2014

Staff: Mentor

What gave you the idea that you need to include 8 nearest neighbors? Only 4 are desirable (and necessary). That makes applying the boundary conditions on your rectangular grid easier too.
You seem to have no experience with numerical analysis related to transient heat conduction problems. You need to learn how to formulate a finite difference approximation to the heat conduction equation (which is a partial differential equation), and you need to learn how to march in the time direction.

There are going to be problems with the time integration (like the ones you are already experiencing) if you take too large time steps in an explicit finite difference scheme (like the one you're using). The solution is actually unstable, and you can't fix things in the ad hoc way you are attempting. The time-dependent integration is numerically "stiff" if you are using an explicit scheme. The solution to this difficulty is to solve the equations with an implicit scheme. This is the only way you are going to be able to use increasing time steps. If you try to use too large a time step in an explicit scheme, the solution is going to go unstable. You can live with an explicit method if you are willing to take small stable time steps throughout the solution.

A good book to start learning about numerical methods is Applied Numerical Methods by Luther, Carnahan, and Wilkes. Start looking at the chapters where they show how to do transient heat conduction problems. You also need to learn something about solving stiff differential equations if you would prefer to use an implicit method and take larger time steps. My recommendation for now is to stick with the explicit scheme with smaller time steps.

Chet

14. Jan 10, 2014

Khashishi

It's probably OK to use explicit integration in this simple example. The pseudocode looks reasonable. Make sure you know the difference between heat and temperature. You said each grid point is identical, but in general, you could have a point with lower heat but higher temperature if the heat capacity of that cell is lower.

I would suggest storing the constants (like 0.001) into variable names so it's easier to adjust the precision if needed. The time step is implied inside the 100.

Right now, if you increase the grid resolution, it will take more time steps for a heat pulse to get from one end to the other. It might be a good exercise to explicitly write out the dimensions, and put the heat conduction coefficient into a variable name in such a way that it is independent of the grid resolution.