Category Archives: Main Blog

SimBuilding on iPad

SimBuilding (alpha version) is a 3D simulation game that we are developing to provide a more accessible and fun way to teach building science. A good reason that we are working on this game is because we want to teach building science concepts and practices to home energy professionals without having to invade someone's house or risk ruining it (well, we have to create or maintain some awful cases for teaching purposes, but what sane property owner would allow us to do so?). We also believe that computer graphics can be used to create some cool effects that demonstrate the ideas more clearly, providing complementary experiences to hands-on learning. The project is funded by the National Science Foundation to support technical education and workforce development.

SimBuilding is based on three.js, a powerful JavaScript-based graphics library that renders 3D scenes within the browser using WebGL. This allows it to run on a variety of devices, including the iPad (but not on a smartphone that has less horsepower, however). The photos in this blog post show how it looks on an iPad Mini, with multi-touch support for navigation and interaction.

In its current version, SimBuilding only supports virtual infrared thermography. The player walks around in a virtual house, challenged to correctly identify home energy problems in a house using a virtual IR camera. The virtual IR camera will show false-color IR images of a large number of sites when the player inspects them, from which the player must diagnose the causes of problems if he believes the house has been compromised by problems such as missing insulation, thermal bridge, air leakage, or water damage. In addition to the IR camera, a set of diagnostics tools is also provided, such as a blower-door system that is used to depressurize a house for identifying infiltration. We will also provide links to our Energy2D simulations should the player become interested in deepening their understanding about heat transfer concepts such as conduction, convection, and radiation.

SimBuilding is a collaborative project with New Mexico EnergySmart Academy at Santa Fe. A number of industry partners such as FLIR Systems and Building Science Corporation are also involved in this project. Our special thanks go to Jay Bowen of FLIR, who generously provided most of the IR images used to create the IR game scenes free of charge.

A stock-and-flow model for building thermal analysis

Figure 1. A stock-and-flow model of building energy.
Our Energy3D CAD software has two built-in simulation engines for performing solar energy analysis and building thermal analysis. I have extensively blogged about solar energy analysis using Energy3D. This article introduces building thermal analysis with Energy3D.

Figure 2. A colonial house.
The current version of the building energy simulation engine is based on a simple stock-and-flow model of building energy. Viewed from the perspective of system dynamics—a subject that studies the behavior of complex systems, the total thermal energy of a building is a stock and the energy gains or losses through its various components are flows. These gains or losses usually happen via the energy exchange between the building and the environment through the components. For instance, the solar radiation that shines into a building through its windows are inputs; the heat transfer through its walls may be inputs or outputs depending on the temperature difference between the inside and the outside.

Figure 3. The annual energy graph.
Figure1 illustrates how energy flows into and out of a building in the winter and summer, respectively. In order to maintain the temperature inside a building, the thermal energy it contains must remain constant—any shortage of thermal energy must be compensated and any excessive thermal energy must be removed. These are done through heating and air conditioning systems, which, together with ventilation systems, are commonly known as HVAC systems. Based on the stock-and-flow model, we can predict the energy cost of heating and air conditioning by summing up the energy flows in various processes of heat transfer, solar radiation, and energy generation over all the components of the building such as walls, windows, or roofs and over a certain period of time such as a day, a month, or a year.

Figure 2 shows the solar radiation heat map of a house and the distribution of the heat flux density over its building envelope. Figure 3 shows the results of the annual energy analysis for the house shown in Figure 2.

More information can be found in Chapter 3 of Energy3D's User Guide.

Beautiful Chemisty won the Vizzies Award

The National Science Foundation and the Popular Science Magazine have announced that “Beautiful Chemistry” won the Expert's Choice Award for Video at the 2015 Visualization Challenge, known as Vizzies. According to the Popular Science Magazine,
For many, the phrase “chemical reactions” conjures memories of tedious laboratory work and equations scribbled on exams. But Yan Liang, a professor at the University of Science and Technology of China in Hefei, sees art in the basic science. Last September, Liang and colleagues launched beautiful​ to highlight aesthetically pleasing chemistry. Their video showcases crystallization, fluorescence, and other reactions or structures shot in glorious detail. Liang says finding experiments that meet their visual standards has been a challenge. “Many reactions are very interesting, but not beautiful,” he says. “But sometimes, when shot at close distance without the distraction of beakers or test tubes, ordinary reactions such as precipitation can be very beautiful.”
Beautiful Chemistry is the first of the Beautiful Science Series that Prof. Liang has been planning. The series will include two new titles, Beautiful Simulations and Beautiful Infrared, which we will co-produce with Prof. Liang this summer while he visits Boston.

Congratulations to Prof. Liang for this amazing work!

The deception of unconditionally stable solvers

Unconditionally stable solvers for time-dependent ordinary or partial differential equations are desirable in game development because they are highly resilient to player actions -- they never "blow up." In the entertainment industry, unconditionally stable solvers for creating visual fluid effects (e.g., flow, smoke, or fire) in games and movies were popularized by Jos Stam's 1999 paper "Stable Fluids."

Figure 1: Heat conduction between two objects.
The reason that a solver explodes is because the error generated in a numerical procedure gets amplified in iteration and grows exponentially. This occurs especially when the differential equation is stiff. A stiff equation often contains one or more terms that change very rapidly in space or time. For example, a sudden change of temperature between two touching objects (Figure 1) creates what is known as a singularity in mathematics (a jump discontinuity, to be more specific). Even if the system described by the equation has many other terms that do not behave like this, one such term is enough to crash the whole solver if it is linked to other terms directly or indirectly. To avoid this breakdown, a very small time step must be used, which often makes the simulation look too slow to be useful for games.

The above problem typically occurs in what is known as the explicit method in the family of the finite-difference methods (FDMs) commonly used to solve time-dependent differential equations. There is a magic bullet for solving this problem. This method is known as the implicit method. The secret is that it introduces numerical diffusion, an unphysical mechanism that causes the errors to dissipate before they grow uncontrollably. Many unconditionally stable solvers use the implicit method, allowing the user to use a much larger time step to speed up the simulation.

There ain't no such thing as a free lunch, however. It turns out that we cannot have the advantages of both speed and accuracy at the same time (efficiency and quality are often at odd in reality, as we have all learned from life experiences). Worse, we may even be deceived by the stability of an unconditionally stable solver without questioning the validity of the predicted results. If the error does not drive the solver nuts and the visual looks fine, the result must be good, right?

Figure 2: Predicted final temperature vs. time step.
Not really.

The default FDM solver in Energy2D for simulating thermal conduction uses the implicit method as well. As a result, it never blows up no matter how large the time step is. While this provides good user experiences, you must be cautious if you are using it in serious engineering work that requires not only numerical stability but also numerical reliability (in games we normally do not care about accuracy as long as the visual looks entertaining, but engineering is a precision science). In the following, I will explain the problems using very simple simulations:

1. Inaccurate prediction of steady states

Figure 3. Much longer equilibration with a large time step.
Figure 1 shows a simulation in which two objects at different temperatures come into contact and thermal energy flows from the high-temperature object into the low-temperature one. The two objects have different heat capacities (another jump discontinuity other than the difference in initial temperatures). As expected, the simulation shows that the two objects approach the same temperature, as illustrated by the convergence of the two temperature curves in the graph. If you increase the time step, this overall equilibration behavior does not change. Everything seems good at this point. But if you look at the final temperature after the system reaches the steady state, you will find that there are some deviations from the exact result, as illustrated in Figure 2, when the time step is larger than 0.1 second. The deviation stabilizes at about 24°C -- 4°C higher than the exact result.
Figure 4. Accurate behavior at a small time step.

2. Inaccurate equilibration time

The inaccuracy at large time steps is not limited to steady states. Figure 3 shows that the time it takes the system to reach the steady state is more than 10 times (about 1.5 hours as opposed to roughly 0.1 hours -- if you read the labels of the horizontal time axis of the graph) if we use a time step of 5 seconds as opposed to 0.05 second. The deceiving part of this is that the simulation appears to run equally quickly in both cases, which may fool your eyes until you look at the numerical outputs in the graphs.

3. Incorrect transient behaviors

Figure 5. Incorrect behavior at a very large time step.
With a more complex system, the transient behaviors can be affected more significantly when a large time step is used. Figure 4 shows a case in which the thermal conduction through two materials of different thermal conductivities (wood vs. metal) are compared, with a small time step (1 second). Figure 5 shows that when a time step of 1,000 seconds is used, the wood turns out to be initially more conductive than metal, which, of course, is not correct. If the previous example with two touching objects suggests that the simulation result can be quantitatively inaccurate at large time steps, this example means that the results can also be qualitatively incorrect in some cases (which is worse).

The general advice is to always choose a few smaller time steps to check if your results would change significantly. You can use a large time step to set up and test your model rapidly. But you should run your model at smaller time steps to validate your results.

The purpose of this article is to inform you that there are certain issues with Energy2D simulations that you must be aware if you are using it for engineering purposes. If these issues are taken care of, Energy2D can be highly accurate for conduction simulations, as illustrated by this example that demonstrates the conservation of energy of an isolated conductive system.

Energy2D and Quantum Workbench featured in Springer books

Two recently published Springer books have featured our visual simulation software, indicating perhaps that their broader impacts beyond their originally intended audiences (earlier I have blogged about the publication of the first scientific paper that used Energy2D to simulate geological problems).

A German book "Faszinierende Physik" (Fantastic Physics) includes a series of screenshots from a 2D quantum tunneling simulation from our Quantum Workbench software that shows how wave functions split when they smash into a barrier. The lead author of the book said in the email to us that he found the images generated by the Quantum Workbench "particularly beautiful."

Another book "Simulation and Learning: A Model-Centered Approach" chose our Energy2D software as a showcase that demonstrates how powerful scientific simulations can convey complex science and engineering ideas.

Quantum Workbench and Energy2D are based on solving extremely complex partial differential equations that govern the quantum world and the macroscopic world, respectively. Despite the complexity in the math and computation, both software present intuitive visualizations and support real-time interactions so that anyone can mess around with them and discover rich scientific phenomena on the computer.

Common architectural styles supported by Energy3D

Energy3D supports the design of some basic architectural styles commonly seen in New England, such as Colonial and Cape Cod. Its simple 3D user interface allows users to quickly sketch up a house with an aesthetically pleasing look -- with only mouse clicks and drags (and, of course, some patience). This makes it easy for middle and high school students to create meaningful, realistic designs and learn science and engineering from these authentic experiences -- who wants to keep doing those cardboard houses that look nothing like a real house for another 100 years?

The true enabler of science learning in Energy3D is its analytic capability that can tell students the energy consequences of their designs while they are working on them. Without this analytical capability, learning would have been cut short at architectural design (which undeniably is the fun part of Energy3D that entices students to explore many different design options that entertain the eyes). With the analytical capability, the relationship between form and function becomes a major driving force for student design. It is at this point that an Energy3D project becomes an engineering design project.

Architectural design, which focuses on designing the form, and engineering design, which focuses on designing the function, are equally important in both educational and professional practices. Students need to learn both. After all, the purpose of design is to meet various people's needs, including their aesthetic needs. This principle of coupling architectural design and engineering design is of generic importance as it can be extended to the broader case of integrating industrial design and engineering design. It is this coupling that marries art, science, and usability.

We are working on providing a list of common architectural styles that can be designed using Energy3D. These styles, four of them are shown in this article, show only the basic form of each style. Each should only take less than an hour to sketch up for beginners. If you want, you can derive more complex and detailed designs for each style.

Two “Global Experiments” about Climate Change

In an earlier post on this blog I wrote about the need to increase our knowledge of how people think about climate change and then apply that knowledge to expedite policy changes. Subsequently I discovered that there is an active community of psychologists, experts in communications and other researchers who conduct valuable inquiries in this field.

Some of their findings are sobering, such as data from April 2014 showing that only one in three Americans discusses global warming with family and friends even occasionally. One of the many reasons this is true is that for more than five years, with little variation from year to year, only about one in three Americans have believed people in the U.S. are being harmed “right now” by global warming—despite Superstorm Sandy, Hurricane Katrina, extreme drought in the West and other once-rare climate events. One does not wish for more droughts, extreme heat waves, superstorms or wildfires; however, those are the kinds of events that may, slowly, change opinions about climate change.

People who realize how threatening climate change is believe that we are conducting a risky “experiment” with the sensitivity of Earth systems to increasing levels of carbon dioxide and other heat-trapping gases. For example, we still don’t understand climate “tipping points” well; however, our global experiment is already teaching us about tipping points, like it or not.

Professor Richard Somerville of the Scripps Institution of Oceanography at UC San Diego—who was Coordinating Lead Author of the Intergovernmental Panel on Climate Change’s fourth assessment report (2007)—wrote, in his 2006 paper called “Medical metaphors for climate change,”

“What is still not obvious to many is that all of us are now engaged in a second global experiment [emphasis added], this time an educational and geopolitical one. We are going to find out whether humanity is going to take climate science seriously enough to act meaningfully, rather than just procrastinating until nature ultimately proves that our climate predictions were right.”

This educational experiment—where education is broadly defined and includes more than what is taught in schools—could hardly be more important. It will take a concerted effort, over many years, by formal and informal institutions, political leaders and organizations, TV stations, museums, churches and others, to increase knowledge and a sense of urgency among policymakers and the public. The Concord Consortium’s High Adventure Science (HAS) project is one element in this long-term effort.

The Next Generation Science Standards include climate change as an important topic for instruction, which is significant because more people need some understanding of the science behind climate change. But the “educational experiment” the world is conducting requires policymakers and the public to learn far more than science. Better understanding the economics, political, regulatory, governance, diplomatic and technology issues needed to address climate change will be vital, as will an emphasis on ethics and values. It would be interesting to know how, and how often, climate change is a topic of study in other subjects taught in schools, colleges and universities (including social science classes, like Psychology), or whether it is addressed almost exclusively in “hard science” courses.

Visualizing the "thermal breathing" of a house in 24-hour cycle with Energy3D

The behavior of a house losing or gaining thermal energy from the outside in a 24-hour cycle, when visualized using Energy3D's heat flux view, resembles breathing, especially in the transition between seasons in which the midday can be hot and the midnight can be cold. We call this phenomenon the "thermal breathing" of a house. This embedded YouTube video in this blog post illustrates this effect. For the house shown in the video, the date was set to be May 1st and the location is set to Santa Fe, New Mexico.

This video only shows the daily thermal breathing of a house. Considering the seasonal change of temperature, we may also definite a concept "annual thermal breathing," which describes this behavior on an annual basis.

This breathing metaphor may help students build a more vivid mental picture of the dynamic heat exchange between a house and the environment. Interestingly, it was only after I realized this thermal visualization feature in Energy3D that this metaphor came to my mind. This experience reflects the importance of doing in science and engineering: Ideas often do not emerge until we get something concrete done. This process of externalization of thinking is critically important to the eventual internalization of ideas or concepts.

Using particle feeders in Energy2D for advection simulations

Fig. 1: Particle advection behind two obstacles.
Advection is a transport mechanism in which a substance is carried by the flow of a fluid. An example is the transport of sand in a river or pollen in the air. Advection is different from diffusion, whereas the more commonly known term, convection, is the combination of advection and diffusion.

Our Energy2D can simulate advection as it integrates particle dynamics in the Lagrangian frame and fluid dynamics in the Eulerian frame. Particles in Energy2D do not spontaneously diffuse -- they are driven by gravity or fluid, though we can introduce Brownian particles in the future by incorporating the Langevin Equation into Energy2D.

Fig. 2: Blowing away particles.
Over this weekend, I added a new object, the particle feeder, for creating continuous particle flow in the presence of open mass boundary. A particle feeder can emit a specified type of particle at a specified frequency. All these settings can be adjusted in its property window, which can be opened by right-clicking on it and selecting the relevant menu.

Figure 1 shows a comparison of particle advection behind a turbulent flow and a streamlined flow. Have you ever seen these kinds of patterns in rivers?

Figure 2 shows how particles of different densities separate when you blow them with a fan. There are six particle feeders at the top that continually drop particles. A fan is placed not far below the feeders.

With these new additions to Energy2D, we hope to be able to simulate more complex atmospheric phenomena (such as pollutant transport through jet streams) in the future.