Posts Tagged ‘Energy2D’

Using fans to create fluid flows in Energy2D

August 10th, 2014 by Charles Xie
Fig. 1: Swirling flows form between two opposite fans.
A new type of object, "fan", has been added to Energy2D to create and control fluid flows. This fan replaces the original implementation of fan that assigns a velocity to a solid part (which doesn't allow the fluid to flow through). For the CFD folks who are reading this post, this is equivalent to an internal velocity boundary.

To add a fan to the scene, use the Insert Menu to drop a fan to the last clicked location. You can then drag it anywhere and resize it any way. By default, the velocity of a fan is zero. You will need to set its velocity in the popup window that can be opened using the right-click popup menu. Currently, however, rotation has not been implemented, so a fan can only blow in four directions: left, right, up, or down -- the direction depends on the aspect ratio of the fan's shape and the value of the velocity.

Fig. 2: Eddy formation in a hole.
With this new feature, we can create a directional flow in Energy2D to simulate things such as a river or wind field. Then we can easily simulate various kinds of eddy flow and visualize them using the streamline feature of Energy2D.

For example, Figure 1 shows the continuous formation of swirling flows between two fans that blow wind in the opposite direction. If you move the fans further apart, you will find that the swirling pattern will not form. Could the mechanism shown in this simulation be related to the formation of certain types of twisters?


Fig. 3: Eddy formation behind a fin.
Figures 2 and 3 show the formation of an eddy in a hole and behind an obstacle, respectively. These eddies are common in fast-flowing rivers. Experienced fishermen know there is a higher chance to find fish in these eddies.

Scanning radiation flux with moving sensors in Energy2D

July 13th, 2014 by Charles Xie
Figure 1: Moving sensors facing a rectangular radiator.
The heat flux sensor in Energy2D can be used to measure radiative heat flux, as well as conductive and convective heat fluxes. Radiative heat flux depends on not only the temperature of the object the sensor measures but also the angle at which it faces the object. The latter is known as the view factor.

In radiative heat transfer, a view factor between two surfaces A and B is the proportion of the radiation which leaves surface A that strikes surface B. If the two surfaces face each other directly, the view factor is greater than the case in which they do not. If the two surfaces are closer, the view factor is greater.

Figure 2: Rotating sensors inside and outside a ring radiator.
To conveniently visualize the effect of a view factor, Energy2D allows you to attach a heat flux sensor to a moving or rotating particle, with a settable linear or angular velocity. In this way, we can set up sensors to automatically "scan" the field of radiation heat flux like a radar.

Figure 1 shows a moving sensor and a rotating sensor, as well as the data they record. A third sensor is also placed to the right of an object that is being heated by the radiator. This object has an emissivity of one so it also radiates. Its radiation flux is recorded by the third sensor whose data shows a slowly increasing heat flux as the object slowly warms up.

As an interesting test case, Figure 2 shows two rotating sensors, one placed precisely at the center of a ring radiator and the other outside. The almost steady line recorded by the first sensor suggests that the view factor at the center does not change, which makes sense. The small sawtooth shape is due to the limitation of discretization in our numerical simulation.

Multiphysics simulations of inelastic collisions with Energy2D

July 4th, 2014 by Charles Xie
Figure 1. Mechano-thermal simulation of inelastic collision.
Many existing simulations of inelastic collisions show the changes of speeds and energy of the colliding objects without showing what happens to the lost energy, which is often converted into thermal energy that spreads out through heat transfer. With the new multiphysics modeling capabilities, the Energy2D software can show the complete picture of energy transfer from the mechanical form to the thermal form in a single simulation.

Figure 2. Thermal marks left by collisions.
Figure 1 shows the collisions of three identical balls (mass = 10 kg, speed = 1 m/s) with three fixed objects that have different elasticities (0, 0.5, and 1). The results show that, in the case of the completely inelastic collision, all the kinetic energy of the ball (5 J) is converted into thermal energy of the rectangular hit object (at this point, the particles in Energy2D do not hold thermal energy, but this will be changed in a future version), whereas in the case of completely elastic collision, the ball B1 does not lose any kinetic energy to the hit object. In the cases of inelastic collisions, you can see the thermal marks created by the collisions. The thermometers placed in the objects also register a rise of temperatures. This view resembles infrared images of floors taken immediately after being hit by tennis balls.

Figure 3. Collisions in Energy2D.
Energy2D supports particle collisions with all the 2D shapes that it provides: rectangles, ellipses, polygons, and blobs. Figure 2 shows the thermal marks on two blobs created by a few bouncing particles. And Figure 3 shows another simulation of collision dynamics with a lot of particles bouncing off complex shapes (boy, it took me quite a while in this July 4 weekend to hunt down most of the bugs in the collision code).

The multiphysics functionality of Energy2D is an exciting new feature as it allows more realistic modeling of natural phenomena. Even in science classrooms, realism of simulations is not just something that is nice to have. If computer simulations are to rival real experiments, it must produce not only the expected effects but also the unexpected side effects. Capable of achieving just that, a multiphysics simulation can create a deep and wide learning space just like real experiments. For engineering design, this depth and breadth are not options -- there is no open-endedness without this depth and breadth and there is no engineering without open-endedness.

Simulating thermal radiation with Energy2D

June 27th, 2014 by Charles Xie
Figure 1: Stefan's Law in action.
The original ray-tracing radiation solver in our Energy2D software suffers from performance problems as well as inaccuracies (no, light particles do not travel that slowly as shown in it). After some sleepless nights, I finally implemented a real radiation solver, coupled it with the heat and fluid solvers, and supported both the convex and concave shapes (see this short paper for the mathematics and the algorithms). At last, Energy2D is capable of simulating all three heat transfer mechanisms in a decent way.

Figure 2: Radiation in a box.
Able to simulate heat, fluid, radiation, particles, and any combination of them, Energy2D is now one step closer towards a full multiphysics capacity. Despite the fact that all these complex calculations are done in real time on a single computer, the software still runs at a pretty amazing speed on an average Windows tablet (such as the Surface Pro). I guess this is why our industry friends love it (although Energy2D is mostly designed for K-12 students, to my surprise, quite a number of engineers are using it to do conceptual product design). Who doesn't like a CFD tool for dummies that can save time from the long preprocessor-solver-postprocessor cycle?

Figure 1 shows a simulation that illustrates radiation heat transfer. As you can see, energy can "jump" from a high-temperature object (a radiator) to a low-temperature one without heating the medium between them (unlike the cases of conduction and convection). Users
Figure 3. Radiation in a circle.
can adjust the temperature of the radiator on the left and investigate how the radiation heat transfer increases with respect to the temperature, as per Stefan-Boltzmann's Law. The image also shows the view factor field used in the computation. The simulation provides many subtleties. For example, if you observe carefully, you can find that the radiation barrier used to separate the left compartment from the right one increases the heating on the right side of the upper left object and the left side of the upper right object -- because it reflects the radiation from the two radiators at the lower part of the box to the two sides!

Figures 2 and 3 show radiation among different shapes in an enclosed space. They show how accurate the radiation solver may be. The radiation heating on the side walls seems to make sense. In Figure 2, the upper one gets the most radiation energy because it is the closest to the radiator. The right one gets the least because part of it is blocked from the radiator by the other object in a box. A further test case using a symmetric setup shows its accuracy.

Simulating PTC and NTC heating elements with Energy2D

June 23rd, 2014 by Charles Xie
Figure 1: A demo simulation.
A heating element converts electricity into heat through Joule heating: Electric current passing through the element encounters resistance, causing the temperature of the element to rise. A thermistor is a type of resistor whose resistance changes significantly with temperature. In a heating element that uses a thermistor with a positive temperature coefficient (PTC), called a PTC heating element, the temperature increases rapidly. In a heating element that uses a thermistor with a negative temperature coefficient (NTC), called a NTC heating element, the heating will gradually weaken when the temperature increases.

Figure 2: Setting the temperature coefficient.
Several Energy2D users have requested adding PTC/NTC controls to the software. So this was added last night. You can now set the temperature coefficient while defining a power source, as shown in Figure 2.

Figure 1 shows the comparison of the temperature increasing in a PTC heater, a constant-power heater, and a NTC heater, with the temperature coefficients being 0.1, 0, and -0.1, respectively. Note that in the case of constant power, the temperature increases linearly in time (as per the definition of constant power), whereas PTC and NTC exhibit nonlinear behaviors.

You can click the link under the image to run the simulation yourself.

Towards a multiphysics Energy2D

June 14th, 2014 by Charles Xie
Figure 1: Particle motions driven by convective flow.
Up to yesterday, our Energy2D software has been a program for simulating, mostly, fluid and heat flows. But there are also objects in the world that are not fluids. To simulate that part of the world, we have to incorporate some other physics. A simple addition is to couple particles with fluids. This technique is commonly known as discrete phase modeling in the CFD community. It is used to model things such as suspension particles in fluids.

Figure 2: Heat traces of fireballs.
The latest version of Energy2D has a particle solver and a particle editor. Particles in Energy2D observe collision dynamics among themselves and interact with fluid and heat flows: particles can not only be moved by the fluid but also exert reaction force and transfer heat to the fluid. Figure 1 shows the motion of two types of particles driven by a convective flow. Depending on its density (relative to the fluid density), a particle may be buoyant enough to flow with the fluid or so heavy that it must sink to the bottom. This is shown in Figure 1: The black particles are the heavy ones and the white ones are the light ones; the convective force is not strong enough to move the black ones.

Particles can also transfer physical properties such as energy and momentum to the fluid while they are moving. Figure 2 shows the heat traces left by fireballs of different sizes.

Figure 3: Thermophoresis (Soret's effect)
With this new capacity, we can simulate phenomena such as thermophoresis, in which the different particle types in a mixture respond to a temperature gradient differently and thereby can be separated by just heating them up.

If you are enticed enough to want to see these simulations at work, click the links below the figures.

These new features represent an overdue step towards making Energy2D a versatile multiphysics simulation system. For engineering simulations, multiphysics is essential as real-world problems are often complicated by more than one mechanisms, each driven by its own physics.

The particle dynamics shown here is very simple (just a weekend's work). In the long run, I expect that a generic contact dynamics engine such as that of Box2D will be implemented in Energy2D. Coupling the Eulerian and Lagrangian reference frames, this integration will make Energy2D more interesting and useful. That would be a critical step towards our goal for Energy2D to simulate as many energy-related natural phenomena as possible.

Temperature change may not represent heat transfer; heat flux does.

May 4th, 2014 by Charles Xie
Figure 1 (go to simulation)
There has been some confusion lately about the heat transfer representations in Energy2D simulations. By default, Energy2D shows the temperature distribution and uses the change of the distribution to visualize heat flow. This is all good if we have only one type of medium or material. But in reality, different materials have different thermal conductivities and different volumetric heat capacities (i.e., the ability of a given volume of a substance to store thermal energy when the temperature increases by one degree; the volumetric heat capacity is in fact the specific heat multiplied by the density).

A
Figure 2 (go to simulation)
According to the Heat Equation, the change of temperature is affected by the thermal diffusivity, which is the thermal conductivity divided by the volumetric heat capacity (now that I have written the terminology down, I can see why these terms are so confusing). In general, a higher thermal conductivity and a lower volumetric heat capacity will both result in faster temperature change.

To illustrate my points, Figure 1 shows a comparison of temperature changes in two materials. The pieces that have the same texture are made of the same material. The upper ones have a lower thermal conductivity but a higher thermal diffusivity. The lower ones have a higher thermal conductivity but a lower thermal diffusivity. In both upper and lower setups, the piece on the left side maintains a higher temperature to provide the heat source. Everything else starts with a low temperature initially. The entire container is completely insulated -- no heat in, no heat out. Two thermometers are placed just at the right ends of the middle rods. Their results show that the temperature rises more quickly in the upper setup (Figure 1) -- because it has a higher diffusivity.

The fact that something diffuses faster doesn't mean it diffuses more. In order to see that, we can place two heat flux sensors somewhere in the rods to capture the heat flows. Figure 2 shows the results from the heat flux sensors. Obviously, there is a lot more heat flow in the lower setup in the same time period.

Figure 3 (go to simulation)
The conclusion is that it is the heat flux, not the temperature change, that ultimately measures heat transfer. If you want to know how fast heat transfer occurs, the thermal conductivity is a good measure. However, if you want to know how fast temperature changes, the thermal diffusivity is a good measure. This may be also important to remember for those who use infrared cameras: Infrared cameras only measure temperature distribution, so what we really see from infrared images is actually thermal diffusion and thermal diffusion alone could be deceiving.

Figure 4 (go to simulation)
To make this even more fun (or confusing), let's replace the pieces on the right of the container with two pieces that are made of the same material that has a volumetric heat capacity between those of the other upper and lower ones. You wouldn't think this change would affect the results, at least not qualitatively. But the truth is that, the temperature in the lower setup in this case rises more quickly than the temperature in the upper setup -- exactly opposite to the case shown in Figure 1! The surprising result indicates how unreliable temperature change may be as an indicator of heat transfer. In this case, the temperature field of the middle rod is affected by what it is connected with. If we look at the results from the heat flux sensors (Figure 4), the heat flux that goes through the rod is much higher in the lower setup. This once again shows that heat flux is a more reliable measure of heat transfer.

In Energy2D, we have implemented an Energy Field view to supplement the Temperature Field view to remedy this problem.

Getting sensor data out of Energy2D

February 9th, 2014 by Charles Xie
Figure 1: Copy data from Energy2D.
Since a few users asked if the simulation data in Energy2D can be exported to other applications such as Excel, I have added a feature to the app for extracting virtual sensor data as multi-column time series data. For the user's convenience, there are three different ways of getting these data:
  1. When right-clicking on a sensor, the "View Data..." from the popup menu returns the data that has been recorded by the selected sensor.
  2. When right-clicking on a spot not occupied by a sensor, the "View Data..." from the popup menu returns a tabbed pane that contains all the sensor data -- different types of sensor are organized in different tabs.
  3. When the translucent graph is open, clicking the View Data button on the graph window's control panel returns the data recorded by all the sensors of the selected type, in consistent with the current display of the data in the graph window.
Figure 2: Paste data into Excel.
Regardless of which way you use, use the "Copy Data" button at the bottom of the data window to copy the data (Figure 1) and paste it into Excel. Once you get the data into Excel, you can process and plot them in any way you want (Figure 2). This feature is very handy if you need to combine data from multiple simulations into a single graph.

Note: This feature only works for the app. For security reason, the embedded applet is not allowed to access the System Clipboard (this is understandable, because people often copy and paste important information!)

Fireplaces at odd with energy efficiency? An Energy2D simulation

January 18th, 2014 by Charles Xie
In the winter, a fireplace is the coziest place in the house when we need some thermal comfort. It is probably something hard to remove from our living standards and our culture (it is supposed to be the only way Santa comes into your house). But is the concept of fireplace -- an ancient way of warming up a house -- really a good idea today when the entire house is heated by a modern distributed heating system? In terms of energy efficiency, the advice from science is that it probably isn't.

Figure 1. A fire is lit in the fireplace.
When the wood burns, a fireplace creates an updraft force that draws the warm air from the house to the outside through the chimney. This creates a "negative pressure" that draws the cold air from the outside into the house through small cracks in the building envelope. This is called the stack effect. So while you are getting radiation heat from the fireplace, you are also losing heat in the house at a faster rate through convection. As a result, your furnace has to work harder to keep other parts of your house warm.

Figure 2. No fire.
Our Energy2D tool can be used to investigate this because it can simulate both the stack effect and thermostats. Let's just create a house heated by a heating board on the floor as shown in the figures in this article. The heating board is controlled by a thermostat whose temperature sensor is positioned in the middle of the house. A few cracks were purposely created in the wall on the right side to let the cold air from the outside in. Their sizes were exaggerated in this simulation.

Figure 1 shows the duty cycles of the heating board within two hours when the house was heated from 0 °C to 20 °C with a fire lit in the fireplace. A heating run is a segment of the temperature curve in which the temperature increases, indicating the house is being heated. In our simulation, the duration of a heating run is approximately the same under different conditions. The difference is in the durations of the cooling runs. A more drafty house tends to have shorter cooling runs as it loses energy more quickly. Let's just count those heating runs. Figure 1 shows that 15 heating runs were recorded in this case.

Figure 2 shows the case when there was no fire in the fireplace and the fireplace door was closed. 13 heating runs were recorded in this case.

What does this result mean? This means that, in order to keep the house at 20 °C, you actually need to spend a bit more on your energy bill when the fireplace is burning. This is kind of counter-intuitive, but it may be true, especially when you have a large drafty house.

Figure 3. In a house without cracks...
How do we know that the increased energy loss is due to the cracks? Easy. We can just nudge the window and the wall on the right to close the gaps. Now we have a tight house. Re-run the simulation shows that  only 11 heating runs were recorded (Figure 3). In this case, you can see in Figure 3 that the cooling runs lasted longer, indicating that the rate of heat loss decreased.

Note that this Energy2D simulation is only an approximation. It does not consider the radiation heat gain from the fireplace. And it assumes that the fire would burn irrespective of air supply. But still, it illustrates the point.

This example demonstrates how useful Energy2D may be for all precollege students. In creating this simulation, all I did is to drag and drop, change some parameters, run the simulation, and then count the heating runs. As simple as that, this tool could be a game changer in science and engineering education in high schools or even middle schools. It really creates an abundance of learning opportunities for students to experiment with concepts and designs that would otherwise be inaccessible. Similar experiences are currently only possible at college level with expensive professional software that typically cost hundreds or even thousands of dollars for just a single license. Yet, according to some of our users, our Energy2D rivals those expensive tools to some extent (I would never claim that myself, though).

Dart projects of Energy2D and Quantum Workbench announced

January 8th, 2014 by Charles Xie
Last month, Google announced Dart 1.0, a new programming language for the Web that aims to greatly accelerate Web development. Dart uses HTML5 as the UI. It can either run on the Dart Virtual Machine being built in Chrome or be compiled into JavaScript to run in other browsers. Dart can also be used to create standalone apps (I guess it is meant to be the main programming language for Google's own Chrome OS) or server-side software. An ECMA Technical Committee (TC 52) has been formed to make Dart into an international standard.

This is the moment I have been waiting for. As a developer with C/Java background, I am not convinced that JavaScript is made for large, complex projects (as Web programming seems to be moving towards) -- even after reading many articles and books about JavaScript. The facts that after ten years Google Docs still has only a tiny fraction of functionality of Word and basic functions such as positioning an image have not improved much suggest that its JavaScript front end has probably reached its limit.

Don't get me wrong. JavaScript is an excellent choice for creating interactive Web experiences. I use JavaScript extensively to create Web interfaces for interacting with the Energy2D applet. But I think it is in general healthy for the developer community if we are given more options. Recognizing the weaknesses of JavaScript, the community has already created CoffeeScript and TypeScript (supersets of JavaScript that strips off unproductive features of JavaScript) that also require compilation into native JavaScript. Dart is Google's solution to these problems that should be welcomed. To a Java developer like me, Dart provides a much better option because it returns the power of class-based object-oriented programming to developers who must create Web-based front ends. What is even sweeter is that its SDK provides a familiar Eclipse-based programming platform that makes many developers feel at home.

Excited about the potential of this new language (plus it is from Google and will be highly performant on Chrome), I am announcing the development of the Dart versions of our Energy2D and Quantum Workbench software. These software are based on complex mathematical solutions of extremely complex partial differential equations and will hopefully provide some showcases to anyone interested in Dart. This is not to say the development of the Java versions will cease. We are committed to develop and maintain both Dart and Java versions.

Hopefully 2014 will be an exciting year for us!