Refractory cement

Last time we discussed how the furnace body material needs to have a low thermal conductivity, to ensure that temperature builds up inside the furnace; this has the nice additional property that the outside of the furnace remains relatively cool, at least in the non-steady state.

The material also needs to have small thermal expansion. Because the thermal conductivity is, by assumption, low, there will be a large thermal gradiant; that is, when it is fired up, there will be areas of the furnace body that are very hot, and areas that are relatively very cold; if the body expands significantly more in the hot sections more than the cold sections then we have a thermal shock scenario, which can fracture the furnace.

A substance which has these properties is said to be refractory; I’m going to make my furnace out of refractory cement.

What is so special about refractory cement? Why not use ordinary Portland cement, or even concrete?

Cement works by undergoing a chemical reaction in the presence of water that essentially causes it to crystalize. Doing so can trap considerable amounts of water in the body of the cement. Concrete is essentially a mixture of cement and hunks of rock. When these substances are used in a high-temperature application, the trapped water will attempt to vaporize and form a high-pressure steam; if the pressure gets high enough, cracks can form explosively. And concrete may also contain rocks that fracture under heat, which can make the situation worse. Do not use ordinary cement or concrete.

Refractory cement is typically ordinary Portland cement plus additional chemical additives which encourage far less water retention in the cement. But since the chemical reactions that make the cement crystalize in the first place are hydrating reactions, there’s got to be enough water in the cement throughout the curing process to ensure that it hardens throughout.

So, some important tips for casting refractory cement:

  • Cement is caustic when wet, presents an inhalation hazard when dry, and undergoes an exothermic (heat-producing) reaction when curing. Keep this in mind and use the appropriate safety gear.
  • Use the entire bag. As the bag was shaken on the truck from the factory, it might no longer be a consistent mixture of the necessary chemicals.
  • Mix in exactly the amount of water recommended by the manufacturer. When it is adequately mixed you should be able to make a snowball out of it and throw it without it either liquefying or crumbling as you do so.
  • If using a wooden mould, spray the mould surfaces that will get cement on them with cooking oil spray. This will discourage the cement from losing water too quickly into the wood as it cures.
  • Cement is extremely strong in compression but has poor tensile strength. Bend some steel coat hangers or rebar and use it as reinforcement inside the concrete, particularly in the lid.
  • Avoid the creation of air pockets; they will contain air which can also expand when heated and encourage cracks. Get a hammer drill and a piece of scrap wood. Use the vibration of the hammer drill against the wood to vibrate the surface of the cement; this will drive out the bubbles.
  • Do not wet the surface and trowel it smooth. Smooth it out with your (gloved) hands.

Once it is cast then the curing process begins. It is very important that the cement have the right water level as it cures; the cement should be very dry when the process is done, but it cannot dry too quickly otherwise the hydrating reactions that make it strong will not have time to take effect. Also, you don’t want to be in a situation where the surfaces have hardened so much that they are trapping lots of water inside.

  • For the first 24 hours, keep the exposed surfaces covered with plastic sheeting or damp rags; the edges will dry first but they need to stay damp so that they harden.
  • After the first 24 hours, put a 75 watt light bulb (lit!) inside the furnace. This will provide enough heat to slowly drive much of the excess water out of the cement. Leave it there for a week or so.
  • The last, and most crucial stage, is the calcining stage, when the last of the water is driven out and the final chemical reactions take place. Build a small fire in the furnace and bring it up to the metal-melting temperature over a period of many hours, the longer, the better.

How hot will the exterior get?

Before getting into the material science of cement, let’s take a step back here. What’s the fundamental nature of the furnace? That is, what are the simplest, most fundamental parts and functions of a metal-melting furnace? You need:

  • A source of heat. In this case, fire.
  • An enclosure around the heat with low thermal conductivity. That is, some way of preventing the heat from escaping. If heat is being produced faster than it can escape then by definition the temperature is going up.

That’s it; a furnace is an enclosure with a fire in it. It could be a hole in the ground, and of course, for many centuries, a hole in the ground with a fire in it was perfectly adequate. The area surrounding my summer cottage in Ontario is dotted with the ruins of 19th century lime kilns, which were basically holes in the ground in which limestone was turned into quicklime by the application of intense heat.

So what we need is a substance that first, has a low thermal conductivity; that is, heat energy moves slowly through it, and therefore builds up the temperature on the hot side.

The thermal conductance is the quantity of heat energy that is emitted by a unit area in a unit time (and energy per time is of course power) when there is a unit temperature difference between the two sides separated by a unit thickness of material. A typical refractory cement will transmit on the order of 2 joules of heat energy per second (so, two watts of power) through a square meter of cement if the cement is 1 cm thick and the temperature difference between the sides is one degree Fahrenheit.  

In our case, the furnace will have a total surface area of about 0.4 square metres, be about 5 cm thick, and have a temperature delta of about 1350°F. Multiply that all out and that’s about 5400 watts, which seems like rather a lot! That’s the surface of the furnace emitting the same heat as that of eleven 500W shop lights, which is more than I’d like to touch, even wearing gloves.

But we’ve forgotten something important in this back-of-the-envelope calculation: the thermal conductance that we’ve just worked out is the steady state. That is, if we left the furnace running indefinitely, burning charcoal such that the interior was exactly 1400°F, then of course eventually the exterior would get quite hot as it attempted to radiate that heat out into the air. But we’re not going to stoke the furnace with fresh charcoal indefinitely; it’ll typically run for less than half an hour. Also we have completely neglected the fact that a huge amount of heat is going to leave via the top when it is opened. And that when the crucible full of molten metal is removed, all of that heat disappears from the furnace.

Actually solving analytically how hot the surface of the furnace will get is more calculus than I’d care to do; it has been a long time since my 3A term Partial Differential Equations One, and we only solved the Heat Equation in one dimension. I suppose I could write a program to simulate it; all you’d need to know is the specific heat of all the parts (that is, how much energy a unit volume of a substance possesses at a given temperature), and then use a combination of conservation of energy and Fourier’s rule for heat transfer to work it out.

I seem to have strayed somewhat from my original topic, which was what properties the body of the furnace needs to have. More on that next time.

Avoid Galvanized Metals

As I said earlier, one of my primary concerns in this adventure will be ensuring that the foundry is safe by design. While researching possible ways to form furnaces out of refractory cement, I’ve seen a great many designs on the internet that use galvanized sheet metal and pipes as furnace parts. For example, this furnace looks absolutely gorgeous and I’m sure it produces great results, but the amount of galvanized metal on that thing concerns me.

Galvanization is a rustproofing technique whereby a steel object is dipped in molten zinc, forming a thin layer of zinc-steel alloy on the surface. Though this certainly does resist corrosion, the zinc alloy will vaporize into gaseous zinc oxide at about 400°F. Effects of zinc oxide inhalation include, as Wikipedia helpfully points out, fever, chills, nausea, headache, fatigue, muscle aches, joint pains, shortness of breath, chest pain, burning sensations, shock, collapse, convulsions, yellow eyes, rash, vomiting, diarrhea and low blood pressure.

None of that sounds like a fabulous adventure.

Now, you might reasonably point out that the galvanized portions of the sorts of “steel bucket furnace” build are all on the external surface (the “cold face”) of the furnace, which typically will not get even close to 400°F. To which I would respond that the key word there is “typically”. If the furnace runs too hot for too long, or if something near the furnace catches on fire, or if molten metal is spilled onto the zincky (*) surface, or if you accidentally put a piece of magnesium into the furnace thinking it is aluminum and it starts burning uncontrollably, then odds are pretty good that some zinc will vaporize at exactly the moment when you have some larger disaster to manage. (And in that last case, you have the problem of inhaling magnesium oxide, which is just as bad; more on magnesium in a later episode.)

You might also reasonably point out that the furnace will already be vaporizing all kinds of nasty stuff; many impurities in the scrap will go up in smoke. We are going to need to ensure that the furnace is operated in a well-ventilated space. I would respond to that by saying let’s not make a bad situation worse if we can avoid it.

Therefore I’m planning on avoiding galvanized metals entirely. In fact, it is not clear to me why the exterior of the furnace needs to be faced in any metal at all. Why should the cold side not be plain refractory cement, as the hot side is? 

(*) Good Scrabble word there.  

Furnace Design Considerations

A foundry is an operation that does two things. It first melts metal in a furnace and second casts the molten metal in a mold, forming some useful shape as it solidifies. There are a number of design factors when making a backyard foundry:

What kinds of metal are to be cast? 

The kinds of metals you can cast is primarily a function of the heat of the furnace. Melting points of some familiar metals are:

  • Pewter (an alloy of tin and other stuff): about 400°F
  • Tin: 450°F
  • Lead: 621°F
  • Zinc: 787°F
  • Aluminum: 1220°F
  • Brass (an alloy of copper and zinc): about 1700°F
  • Bronze (an alloy of copper and tin): 1742°F
  • Silver: 1763°F
  • Gold: 1984°F
  • Copper: 1984°F
  • Iron: 2800°F

So as you can see, pewter, tin and lead are pretty easy to melt — heck, you could melt them in your kitchen stove — but also tend to make things that are pretty soft. Zinc is mostly used in alloys, and as we will see in the next episode, is insanely dangerous. Gold and silver are precious; I’m not interested in jewelry making here. Copper needs to get very hot, and iron is a whole other ballpark. That’s out of my league.

But melting aluminum, brass and bronze seems to be within reach, and these metals are hard enough to build tools yet soft enough to machine with easily-available steel bits. We can melt aluminum with ordinary charcoal or propane.

How heavy is the furnace?

I intend this furnace to be portable; I’ll store it in my detached garage when not in use, and run it in the back yard. This means that I’ll need to be able to move it, either by lifting it, or with a hand truck.

Let’s suppose that a furnace is a cylinder that is partially empty and partially full of cement. And let’s suppose, to make estimation easier, that the cylinder is as tall as it is wide. About two thirds of the volume of the cylinder will be full of cement, and about one third will be empty. Cement is approximately three times as dense as water. So the weight of a cylindrical furnace is twice the weight of the same cylinder full of water. Water weighs one tonnes per cubic metre, and the volume of a cylinder is pi times the height times the radius squared; the height, we’ve already said, is equal to the diameter.

So roughly we can expect that a furnace weighs:

  • 12kg if it is 20 cm in diameter – a paint can
  • 24kg if it is 25 cm in diameter – a normal bucket
  • 41kg if it is 30 cm in diameter – large bucket
  • 66kg if it is 35 cm in diameter – a small trash can
  • 100kg if it is 40 cm in diameter – wait, 100 kg is way too heavy

(American readers who do not yet know the metric system: a kg is about 2 lbs. 30 cm is about a foot.)

These numbers are rough, but they seem plausible.

How much metal can we melt at a time?

Molten metal resolidifies surprisingly quickly, so you want to make more than you need for a given casting. You don’t ever want to make a partial casting, then go back and melt more metal. So how much we make at a time is important.

We said that the interior of the furnace is about a third of its total volume. Let’s suppose that the size of the crucible – the removable container that holds the molten metal – is about half the remaining volume, and that we’re going to fill it two-thirds full of molten metal. So that’s one-ninth the total volume of the furnace devoted to the actual metal, which will be slightly less dense than the concrete.  

Heck, let’s just make the math easy. The maximum mass of metal we can melt will be on the order of a tenth the mass of the furnace. So maybe one kilogram for the smallest furnace and maybe four kilograms for the “large bucket” furnace.

What’s the fuel?

The two basic fuels for backyard metalcasting are charcoal and propane. Charcoal has, of course, been used as metal casting fuel for six thousand years; propane, somewhat less. Both are inexpensive and widely available. Propane furnaces apparently require a custom-built burner apparatus and pressure regulator. (The valve on a barbecue tank regulates rate of flow, not pressure.)

There are of course safety issues to consider: propane is a highly flammable gas delivered at liquification pressure which will explode in a huge fireball of vaporized accelerant if heated excessively. Bags of charcoal, by contrast, seldom explode.

Charcoal does present two inconveniences: it produces ash, which could get impurities into the molten metal (where they will float) and is generaly irritating to clean up, and second, the combustion chamber must be rather larger to accomodate the bulkiness of the fuel.

However, choice of fuel actually is one of the criteria that impacts the design the least, because both fuels require basically the same furnace design. That is, there must be a pipe at the bottom of the furnace that admits either blown air, in the case of a charcoal burner, or the propane. It should therefore be relatively easy to change fuels if necessary.

Summing up

A 30 cm diameter cylindrical furnace will weigh about 40 kg, be easily moved with a hand truck, take up as much space as a large bucket, and enable melting of several kg of aluminum at a time. The interior chamber will be plenty large enough for charcoal and a good sized crucible.

Next time: some thoughts on furnace materials.

Should C# warn on null dereference?

As you probably know, the C# compiler does flow analysis on constants for the purposes of finding unreachable code. In this method the statement with the calls is known to be unreachable, and the compiler warns about it.

const object x = null; 
void Foo() 
  if (x != null)

Now suppose we removed the if statement and just had the call:

const object x = null; 
void Foo() 

The compiler does not warn you that you’re dereferencing null! The question is, as usual, why not?
Continue reading

Safety Third

“Safety third”, is what they say at Burning Man — when I naively asked what was first and second, the answer was of course obvious: having fun, and looking good doing it.

Worse, there was once a sign up in the kitchen of a cafeteria I used to frequent; it listed the top ten rules for cafeteria employees. Things like “Treat the customers and your coworkers with respect always”, and “Actively look for small problems and fix them before they become serious problems”, and so on. ”Put safety first” was, of course, number seven.

As I work on the design and implementation of a backyard aluminum foundry I’m going to think a lot about how to make its operation safe by design. Melting aluminum in your backyard is hardly a new idea; the internet has dozens or hundreds of web sites about people who have done so. It is astounding to me how unsafe many of those backyard operations are, in both design and operation. In the last couple of days as I’ve been researching this topic I’ve seen videos of people pouring molten aluminum wearing shorts, a t-shirt and sandals. I’m not suggesting that you need to obtain a silver suit to melt aluminum, but I personally would not want a 1400°F puddle of molten aluminum splashing onto the floor beside my sandaled feet.

Fabulous Adventures In Casting

Good morning internet, I’m Eric Lippert. You may know me from my Microsoft Developer Network blog, Fabulous Adventures In Coding, where I discuss the design and implementation of C# and various other programming languages.

There is something profoundly satisfying about building a tool, which is why I enjoy my job so much: I make software tools. In fact, I make software meta-tools: my customers are themselves software engineers, who are in turn making software tools for their customers.

But that is a very abstract approach to toolmaking. When I’m not working on programming languages, I enjoy puttering around my hundred-year-old house, and I’ve amassed a considerable number of tools in doing so. I have a working, though entirely self-taught, knowledge of basic carpentry and electrics. But an area I have absolutely no experience in at all is metalworking; it is our ability to work metals that has driven our amazing technological advancement for the majority of the last six thousand years.

So, I’m thinking that this autumn when it gets cold and rainy and not much fun to sail, instead of working on yet another book editing project, perhaps I’ll build myself a foundry in the garage, start melting aluminum, and see if I can build some tools. If I do, this blog will document my fabulous adventures in metal casting. Like I said, this is an area I know practically nothing about, so I’m going to be learning as I go here.

When is a cast not a cast?

I’m asked a lot of questions about conversion logic in C#, which is not that surprising. Conversions are common, and the rules are pretty complicated. Here’s some code I was asked about recently; I’ve stripped it down to its essence for clarity:

class C<T> {} 
class D 
  public static C<U> M<U>(C<bool> c)   
  { return =something=; } 
public static class X 
  public static V Cast<V>(object obj) 
  { return (V)obj; } 

where there are three possible texts for “=something=“:

  1. (C<U>)c
  2. X.Cast<C<U>>(c);
  3. (C<U>)(object)c

Version 1 fails at compile time. Versions 2 and 3 succeed at compile time, and then fail at runtime if U is not bool.

Question: Why does the first version fail at compile time?

Because the compiler knows that the only way this conversion could possibly succeed is if U is bool, but U can be anything! The compiler assumes that most of the time U is not going to be constructed with bool, and therefore this code is almost certainly an error, and the compiler is bringing that fact to your attention.

Question: Then why does the second version succeed at compile time?

Because the compiler has no idea that a method named X.Cast<V> is going to perform a cast to V! All the compiler sees is a call to a method that takes an object, and you’ve given it an object, so the compiler’s work is done. The method is a “black box” from the caller’s perspective; the compiler does not look inside that box to see whether the mechanisms in that box are likely to fail given the input. This “cast” is not really a cast from the compiler’s perspective, it’s a method call.

Question: So what about the third version? Why does it not fail like the first version?

This one is actually the same thing as the second version; all we’ve done is inlined the body of the call to X.Cast<V>, including the intermediate conversion to object! That conversion is relevant.

Question: In both the second and third cases, the conversion succeeds at compile time because there is a conversion to object in the middle?

That’s right. The rule is: if there is a conversion from a type S to object, then there is an explicit conversion from object to S.[1. Of course it is not the case that there is a conversion from every type to object. There is no conversion from any pointer type to object, from the void return type to object, and there are also some special “typed reference” helper types that cannot be converted to object. Maybe I’ll discuss those in another episode of FAIC.]

By making a conversion to object before doing the “offensive” conversion, you are basically telling the compiler “please throw away the compile-time information you have about the type of the thing I am converting”. In the third version we do so explicitly; in the second version we do so sneakily, by making an implicit conversion to object when the argument is converted to the parameter type.

Question: So this explains why compile-time type checking doesn’t seem to work quite right on LINQ expressions?

Yes! You would think that the compiler would disallow nonsense like:

from bool b in new int[] { 123, 345 } select b.ToString()

because obviously there is no conversion from int to bool, so how can range variable b take on the values in the array? Nevertheless, this succeeds because the compiler translates this to

(new int[] { 123, 345 }).Cast<bool>().Select(b=>b.ToString())

and the compiler has no idea that passing a sequence of integers to the extension method Cast<bool> is going to fail at runtime. That method is a black box. You and I know that it is going to perform a cast, and that the cast is going to fail, but the compiler does not know that.

And maybe we do not actually know it either; perhaps we are using some library other than the default LINQ-to-objects query provider that does know how to make conversions between types that the C# language would not normally allow. This is actually an extensibility feature masquerading as a compiler deficiency: it’s not a bug, it’s a feature! [2. My glib statement here conveniently ignores that this method had quite a nasty bug in its initial release, a bug that was mostly my fault. Late in the game before the release one of the developers changed the implementation of the extension method so that it allowed more conversions than were specified, as a convenience to users. I reviewed the change while under the incorrect impression that the implemented behaviour was the specified behaviour. It was not, and the implementation was quite slow in a common code path. We took a breaking change in a service pack as a result. The cost of breaking a few people who might have been relying on the unintended behaviour was considered to be low compared to the cost to everyone of the slow implementation. This was a tough, controversial call but I think we did the right thing in the end. I regret the error.]

Next time on FAIC: Should C# warn on null dereferences known to the compiler?