The county is betting on a combination of modern engineering and decades-old desalination technology. A pipe trench under construction leads to a nearby lagoon inlet; 18 house-size concrete tanks await loads of sand and charcoal to treat the salt water before it is ready for desalination; pressurizers lead to a stainless-steel pipe one meter in diameter. This final piece of gleaming hardware will convey water under high pressure into 2,000 fiberglass tubes, where it will be squeezed through semipermeable polymer membranes. What gets through will be fresh water, leaving brine behind.

The process is called reverse osmosis (RO), and it’s the mainstay of large-scale desalination facilities around the world. As water is forced through the membrane, the polymer allows the water molecules to pass while blocking the salts and other inorganic impurities. Global desalination output has tripled since 2000: 16,000 plants are up and running around the world, and the pace of construction is expected to increase while the technology continues to improve. Carlsbad, for example, has been outfitted with state-of-the art commercial membranes and advanced pressure-recovery systems. But the plants remain costly to build and operate.

Seawater desalination, in fact, is one of the most expensive sources of fresh water. The water sells—depending on site conditions—for between $1,000 and $2,500 per acre-foot (the amount used by two five-person U.S. households per year). Carlsbad’s product will sell for around $2,000, which is 80 percent more than the county pays for treated water from outside the area. One reason is the huge amount of energy required to push water through the membranes. And Carlsbad, like most desalination plants, is being built with extra pumps, treatment capacity, and membrane tubes, the better to guarantee uptime. “Because it is a critical asset for the region, there is a tremendous amount of redundancy to give high reliability,” says Jonathan Loveland, vice president at Poseidon Water, the owner of the plant. “If any piece fails, something else will pick up the slack.”

Already, some 700 million people worldwide suffer from water scarcity, but that number is expected to swell to 1.8 billion in just 10 years. Some countries, like Israel, already rely heavily on desalination; more will follow suit. In many places, “we are already at the limit of renewable water resources, and yet we continue to grow,” says John Lienhard, a mechanical engineer and director of the Center for Clean Water and Clean Energy at MIT. “On top of that we have global warming, with hotter and drier conditions in many areas, which will potentially further reduce the amount of renewable water available.” While conservation and recycling will help, you can’t recycle what you don’t have. “As coastal cities grow,” he says, “the value of seawater desalination is going to increase rapidly, and it’s likely we will see widespread adoption.”

Against this grim backdrop, there is some good news. In short, desalination is ripe for technological improvement. A combination of sensor-driven optimization and automation, plus new types of membranes, could eventually allow for desalination plants that are half the size and use commensurately less energy. Among other benefits, small, mobile desalination units could be used in agricultural regions hundreds of miles away from the ocean, where demand for water is great and growing.

Smart Water

Every two weeks, Yoram Cohen, a chemical engineer who heads the Water Technology Research Center at the University of California, Los Angeles, hits the road for the drought-blasted San Joaquin Valley. Part of the state’s vast agricultural midsection that grows much of the country’s produce, the region has suffered badly. Last year, 2014, was the third straight drought year—at a time when demand for water has reached an all-time high. I joined Cohen for a recent outing: a car ride from his labs at UCLA to the small valley town of Firebaugh, in one of the hardest-hit agricultural regions in the state. Along I-5, the highway that connects the cities of California’s southern coast with its central valley, we saw vast water-engineering edifices built in the 1950s, including four vast pipes traversing the Tehachapi ­Mountains and the cement-lined California Aqueduct, which cuts a serpentine path through the valley floor. The state’s water system—devoted roughly 80 percent to agriculture and 20 percent to cities—is still conveying water pumped all the way from the Sacramento River delta through the 444-mile California Aqueduct. The water infrastructure made Southern California what it is today.

But it’s a system under great stress. California’s persistent lack of precipitation means 80 percent of the state is now in “extreme” or “exceptional” drought, forcing water restrictions in urban areas and cutoffs to some farmers. The results are plain to see: tracts of parched farmland lie newly abandoned; road signs flash warnings of “extreme drought”; signs plead “Water = Jobs.” According to a recent study by the University of California, Davis, the drought inflicted $1.5 billion in agricultural losses in 2014 alone.

Still under construction, the desalination plant in Carlsbad, California, will be the largest such facility in the United States. Awaiting installation at the facility are stainless-steel turbine pumps, wrapped in protective Mylar, that will be used to pump the clean water.

The Israeli-born Cohen explains that despite these pressures, desalination hasn’t fundamentally changed since the 1980s. The time it takes to plan for big projects (Carlsbad took 14 years) makes it hard for investors to expect much payoff from new technologies, and U.S. federal research funding has gone to other priorities. Besides, it’s been possible to recycle or conserve water so that expensive desalination has been less necessary. The flip side of this, Cohen says, is that desalination is now in a position to be transformed by the same kinds of sensing, automation, and algorithm-controlled processes that are remaking other industries. I would soon see what he was talking about.

As the late-October sun set, long shadows cast the crusty ground in high relief. We exited I-5, drove nine miles, and turned right on a hard-packed dirt lane between pistachio trees. It was dusk, and the beams from headlights disappeared into the flat desert nothingness. Yet when I opened the window, I caught a whiff of something that smelled vaguely like the salty air at the coast. The headlights exposed the culprit: a pipe vomiting a brew of much-reused agricultural runoff. It had started in the ­Sacramento delta as fresh water. But it got progressively more concentrated by evaporation in the aqueduct system, and still more so as it was applied to crops, picked up minerals in the ground, and was applied to crops again. It was now almost as saline as seawater, and contaminated with a range of minerals and fertilizers as well.

It takes a lot of energy to push water through the membranes.

Cohen led me to a nearby trailer inhabited by two graduate students and a vast collection of tanks, pipes, valves, tubes, and computers. It was a totally automated system, able to use any of the brackish or polluted stuff Firebaugh’s farmers produce and generate 30,000 drinkable gallons per day. A computer screen displayed a real-time black-and-white image that looked like a lunar landscape. It was a shot from a piece of the polyamide membrane at the center of the process. The image revealed a few white chunks: the beginning of mineral scaling, a bane of membranes. Image analysis software can detect this happening, and an algorithm can direct a valve to open and dispense an antiscaling solution into the system—keeping ahead of the problem. Other sensors and control systems can drive tweaks to avert other fouling problems, changing the pressure or the dosage of chemical additives used for pretreatment.

Cohen reached for a plastic tube and twisted a small tap. Clear water drooled out; he held his hand out to capture some, lifted it to his mouth, drank a bit, and rubbed the rest on his face. “If we can figure out a car that does not require a driver, why can’t we figure out how to run an RO plant without operators?” he said.

The savings could be significant: automated systems such as these could probably save between one-third and one-half the costs of conventional desalination plants, Cohen says. But more than that, a trailer-sized unit—able to adapt to different sites and conditions by the hour—could simply roll around and help farmers get fresh water no matter what they start with.

Magic Membranes

Even if systems get smarter, reverse osmosis is still an energy hog. Carlsbad will consume more than 35 megawatts of electricity (which could power around 30,000 homes), for an annual bill of $30 million. About two-thirds of that will go to the water pressure needed to make the technology work. (The other third will go mostly to pumping the water 10 miles uphill to a reservoir, as well as to pretreatment and intake pumping.) Carlsbad’s owners estimate that the plant will consume 2.8 kilowatt-hours per cubic meter for desalination alone. Some small reverse-osmosis systems, using differently configured processes (running water in batches rather than pumping continuously), are hitting 1.5 to 1.7 kilowatt-hours, says Lienhard. But the technology hasn’t been proved at larger scales.

What’s the problem? It takes a lot of work to push water through the membranes—pressure that translates into high energy usage. Those relatively thick polyamide membranes, though far from ideal, are the best we’ve got right now. But a few groups are trying to come up with more efficient materials. At MIT, mechanical engineer Rohit Karnik’s team is building membranes a single atom thick, to help water molecules just pop through. The researchers blast graphene with ion beams and bathe it in chemicals to etch pores less than a nanometer across.

In theory, an essentially two-dimensional membrane like this one provides the least possible resistance. Computer models by Jeffrey Grossman’s materials science and engineering group at MIT showed that graphene membranes could cut the energy used in reverse osmosis by 15 to 46 percent. Even better, the high permeability could mean that far less surface area is needed to get the job done, so the entire plant could be half the size.

So far Karnik has fabricated a one-square-centimeter graphene membrane, punched holes in it, and shown that it can selectively hold back certain ions. But he’s not yet shown it can actually desalinate seawater, even on a lab bench. And once he or another group achieves that, the next challenge is to reliably make miles of membrane materials with consistent features. Karnik is optimistic that he’ll get there, but he says it will be years before graphene membranes are ready.

Existing membrane materials might get better thanks to other nanoengineering approaches. In a small section of the Firebaugh trailer, Cohen is running an experiment with a membrane of his group’s own devising. A base layer is made of polyamide. But then he adds a layer of tentacle-like brushes made of polymers that are hydrophilic, which means they attract water. Early research suggests these hybrid membranes may be far better at resisting fouling, because the brushes—which he likens to kelp swaying on an undersea rock—discourage things from sticking. This could mean less downtime, fewer replacements, and faster throughput. But Cohen, taking a swig of his ditch water, urges realism. “People have this fixation that somehow there will be a magic membrane that will reduce the cost of desalination to next to none, and I think that is a little bit misleading,” he says.

For now in California’s coastal municipalities, seawater is still the option of last resort, after conservation, recycling, and even treating and reusing sewage. While many are weighing desalination, the city most likely to follow in San Diego’s footsteps is Santa Barbara. That’s because it already built an RO plant in the early 1990s after a five-year drought, only to quickly shut it down when a couple of years of good winter rains refilled reservoirs. The city recently moved to start funding an expensive rehabilitation of the site so that it can be reactivated if needed. Other municipalities have decided it’s too expensive or environmentally problematic (the facilities inevitably kill fish eggs and other marine life, unless intake pipes are buried beneath sand at great cost).

But that assessment might get turned on its head. Water captured in reservoirs or pumped from faraway deltas is getting more expensive—and such alternatives come with their own environmental costs. As sources dry up and competition for water mounts from businesses, farmers, and cities, we will inevitably turn to seawater and other salty sources. It might not be a great solution, but the bottom line is that we are left with fewer and fewer choices in a water-starved world.