When the apocalypse comes, what's for dinner? Multiple studies indicate that if global warming continues at the current rate, we're likely to see vast swaths of our food supply vanish. Scientists at UC Davis found that fruit and nut trees rely on a stretch of cold temperatures in order to grow. No more chilly nights would mean no more almonds, apricots, or cherries, among other crops. Other researchers have found that we will also be saying goodbye to cold-water fish, maple syrup, beer, peanut butter, and possibly grains and livestock.

But while this may sound like the kind of question you'd arrive at in a late night dorm room munchies session, it's also the question that motivates a handful of scientists to show up for work every morning. Call them the food engineers of the apocalypse, these are people who have moved beyond the question of how to stop global warming. They've assumed that we've all failed, the earth is really hot, now what do we eat? The answer, for better or for worse, is beans.

Earlier this year, scientists at the International Center for Tropical Agriculture (CIAT) announced that they had discovered 30 different types of beans that would be able to withstand global warming. The beans will be able to grow in a world where water is scarce, and where temperatures have risen worldwide by up to seven degrees Fahrenheit.

The research center responsible for the discovery is a bean-centric place. With facilities in Colombia and across three sites in Africa, the bean program has been running for 45 years; currently, 18 scientists are working on making the food both more nutritional and resilient. For much of the world, beans offer cheap access to protein, so ensuring their survival is less about ensuring chili stays on restaurant menus and more about preventing malnutrition and starvation.

Based on the products of these greenhouses, a handful of beans may be the power food of the future.

The work that led to CIAT's development of the heat-beater beans originally started as an effort to develop a crop that could tolerate poor soils and drought — efforts that have been underway in one form or another for much of the bean program's existence. But the team rapidly added research in heat tolerance because, well, it was hot out. "When we worked with our climate experts, it became evident that within a couple generations the bean crop could be severely limited in the area where it could be planted," said Steve Beebe, head of CIAT's bean breeding program. "So it raised a red flag about the necessity to start attending to this."

Beebe's lab is housed in a research campus just outside of the sprawling city of Cali in Valle de Cauca, Colombia. With multiple dining rooms, a library, a gym, and a guest house, it sounds a little like Google for plants. Beebe travels frequently between the campus, where beans are grown in greenhouses that allow his team to control temperature, and bean plots on Colombia's Caribbean coast. And based on the products of these greenhouses and plots, a handful of beans may be the power food of the future.

To make a new bean, scientists reach into gene banks — vast cold stores of germ plasma that have been analyzed for a range of traits like size, color, the ability to grow with minimal water, or resistance to pests — and cross-breed different types of beans to achieve a single bean that has all of the desired characteristics. At its most basic level, engineering a bean is something like following a recipe, except that instead of adding flavors, you're adding bean characteristics.

The beans we may all be eating soon are a cross between common beans like pinto, white, black, and kidney beans, and the tepary, which is a tough bean that's been cultivated since pre-Columbian times in northern Mexico and the American southwest. They're small and red, but as of yet, no one seems to have tasted them. Given that Beebe has been working with beans for the bulk of his career, one might assume he's tasted the so-called heat-beater beans. But no, he has not. He hears they taste sweet.

Dr. Idupulapati Rao, a plant nutritionist and physiologist also working on the bean breeding program, admitted that he hasn't tasted them, either. This is in part because bean breeders begin by selecting for traits that they've identified to be the most vital to a successful food — in this case, the ability to grow in high temperatures, and being of a size and color that would be appealing to locals in the areas the bean will grow. (In Central America, people prefer to eat small red or black beans, whereas in the Andean region, larger beans are preferred.) Taste comes later, as part of an official cooking test phase, during which scientists work on the tasting and preparation of the beans. They then go back into the gene banks to create beans that people are able to easily prepare and which taste good.

Bean-breeders are more concerned with selecting desirable traits. Taste comes later, as part of an official cooking test phase.

It seems hard to believe that one could work with a food product for decades and not want to taste the end product, but it's possible that the breeders are suffering from bean-burnout.

"We get served beans every day in the cafeteria," said Dr. Rao. "So we eat whatever is commercially available in the market." Or the scientists may just be waiting for December to come around — every year at CIAT's holiday party, the staff cooks and eats what Dr. Rao referred to as "our best beans." He suspected that the heat-beaters would be on the menu this year.

If the worst does come to pass and all of our favorite foods slowly migrate to colder climate areas, get really expensive, and then go away for good, that would leave primarily rice and beans for meals. But the good news is that after a few millennia we might no longer care. Recent research has found that animal species who have altered their diets eventually lose the ability to taste certain foods. Cats, for example, can no longer taste sweet, and dolphins are probably unable to taste bitter. That means that while it might be hard for a population used to eating bacon ice cream and kale Caesar salads to adjust to an all-bean diet at first, eons from now, our ancestors may no longer be able to detect those flavors anyway. And our nutrition may not suffer from a monotonous bean diet, either.

"If you look at a mouse or a rat in a lab, what we've fed them for generations is a single unvaried food," said Dr. Gary Beauchamp, emeritus director of the Monell Chemical Senses Center and a co-author of the cat taste bud study. "They've reproduced for at least hundreds of generations with no apparent problems."

While those of us who like a little flavor on our plates may worry about a future filled with beans, the scientists at CIAT don't seem too concerned. I wondered what it is like to get up every day assuming that sooner or later we're all going to be living on beans, but neither Beebe nor Rao see it that way. To Beebe, climate change is just another challenge for both humans and science.

"I have a lot of faith in biology and the capacity of humans to adapt."

"I have a lot of faith in biology and the capacity of humans to adapt," he said. "Organisms have seen worse in the past, and biology is capable of meeting the challenge. Do we have the persistence and the patience to slug it out and let biology do its work? To the extent we can prevent it, we should do everything we possibly can, but it's a challenge that we can meet." In other words, the possible eradication of most of our food sources makes for an exciting day at the office.

And Rao doesn't view the work being done at CIAT as an admission that climate change is inevitable, but rather a realistic assessment of the conditions we have today. "The heat-tolerant beans that we have, if they can cope with an increase of three or four degrees, then we're prepared for the worst-case scenario," he said.

Beebe agrees. "We've been seeing some pretty hot years," he said. "The future is now."