Along the northern edge of Monterey Bay, the Santa Cruz Mid-County Groundwater Basin is fighting a quiet but relentless enemy: seawater creeping into aquifers that supply drinking water to more than 90,000 people. The basin is officially classified as critically overdrafted, and under California’s Sustainable Groundwater Management Act its groundwater sustainability agency must reach sustainability by 2040 and maintain it through 2070. Deciding which combination of water supply projects can achieve that goal has long been a practically endless puzzle, because aquifer storage and recovery wells, purified recycled water injection sites, and interagency water transfers can each be configured in countless ways. A new study published in Frontiers in Water shows how machine learning algorithms, working alongside a physical groundwater model, can autonomously design, run, and evaluate thousands of simulated futures to find configurations that work.
The research, conducted by Patrick Wickham, Timothy Bayley, and Cameron Tana of Montgomery and Associates Water Resource Consulting, was carried out to support the Santa Cruz Mid-County Regional Water Optimization Study. Rather than replacing the physics-based numerical model with a faster machine learning surrogate trained on a preexisting library of simulations, the team developed what they call Machine Learning Guided Optimization, or MLGO. The workflow uses machine learning algorithms and automated pre- and post-processing scripts to iteratively run a coupled groundwater and surface-water flow model, known as GSFLOW, building its own training compendium of scenarios as it progresses toward optimization. This self-building surrogate approach combines the speed of machine learning with the robustness of physical model predictions, without requiring a preexisting compendium of groundwater model runs or large observational datasets.
The stakes are high because the basin’s aquifer system, dominated by the Purisima Formation and overlain in the southeast by the Aromas Red Sands, is hydrologically connected to the Pacific Ocean. When pumping exceeds natural and artificial recharge, seawater intrudes into the freshwater aquifers. The two largest water agencies in the basin have contrasting supply portfolios: the Soquel Creek Water District relies exclusively on groundwater, while the City of Santa Cruz primarily uses surface water and depends on its basin wellfield for roughly 5 percent of normal-year supply, far more during droughts. To restore balance, the City is planning an aquifer storage and recovery project that converts select wells into injection and extraction wells, storing surplus surface water in wet periods for use in droughts, while the District is implementing Pure Water Soquel, an indirect potable reuse project that stores highly purified recycled water in the basin to raise groundwater levels.
Planning these projects involves evaluating numerous implementation parameters: the number and location of new ASR wells, the number of purified water injection sites, the aquifer layers into which wells are screened, maximum pumping and injection volumes, preferred distribution percentages among wells, and the timing and direction of bi-directional interagency transfers. In total, the MLGO implementation used 118 individual project parameters. Each configuration had to be simulated 53 years into the future, from water year 2023 to 2075, under a climate change projection significantly drier and warmer than historical conditions. Because a single GSFLOW simulation can take hours or days to run, and adequate optimization requires many iterative simulations, the number of potential project configurations is practically endless and manual exploration alone cannot cover it.
The MLGO framework operates as a coupled, automated loop. It begins with a small initial compendium of five manually created scenarios, each described by numerical project parameters as inputs and project goals as outputs. Machine learning algorithms are then trained on this compendium to perform inverse modeling: given a set of user-defined desired project goals, the algorithms suggest project parameters expected to meet them. An automated post-processing script transforms those suggestions into physical model input files, a Python-based water allocation model logically allocates ASR injection, ASR extraction, purified water injection, District extraction, and operational pumping changes based on each scenario’s unique infrastructure and monthly climate timeseries, and the GSFLOW model runs the assembled simulation. Results are post-processed with respect to project goals, the new scenario is added to the compendium, and the algorithms retrain on the growing dataset. As the compendium expands, the algorithms improve their understanding of how projects affect sustainability outcomes and predict progressively better configurations.
For this study, MLGO was tasked with achieving 58 individual project goals clustered into three groups. Sustainability goals require simulated groundwater elevations to remain above minimum thresholds at representative monitoring points spread across the basin and multiple aquifers, evaluated monthly or as five-year moving averages, to prevent seawater intrusion, depletion of interconnected surface water, and chronic lowering of groundwater levels. Feasibility goals maintain daily simulated elevations below infeasible levels at injection wells and keep pumping realistic by targeting zero seepage face losses, which the MODFLOW Multi-Node Well package calculates when wells are overpumped. Supply goals, quantified through the water allocation model, track both cumulative unmet demand over the 50-year simulation and maximum monthly unmet demand. Many different machine learning architectures were deployed concurrently, grouped into three categories: neural networks built with PyTorch, random forest ensembles built with Scikit-learn, and combined workflows in which a neural network performs feature extraction before a random forest makes predictions. The loss function driving learning is a weighted mean squared error in the model’s prediction of project input parameters, plus an out-of-bounds penalty whose magnitude increases with the square of a prediction’s distance from possible ranges, using a penalty coefficient of 0.1.
Over months of operation, the MLGO algorithms generated 3,407 scenarios. Performance was assessed with a combined metric summing the normalized sustainability, feasibility, and supply goal groups, where lower numbers indicate better adherence to desired goals. The best-performing algorithm type displayed a clear ability to learn over time, evidenced by a reduction in the combined evaluation metric. Optimization was organized into successive Tracks, starting with the smallest allowable infrastructure expansion and ending with the largest parameter space. At the start of each track, an exploration phase typically produced worse results as MLGO tested previously unavailable options and generated data; following this, results converged toward better solutions, a pattern visible in the 50-run moving average. Notably, the most optimized scenarios were not necessarily produced at the end of a given track, and staff modelers continuously reviewed high-performing runs for strategic insights throughout the process.
The process was not without challenges, and one episode illustrates how the workflow adapts. During Track 2 through 4 optimization, MLGO began producing highly optimized scenarios incorporating large pumping volumes. Manual review uncovered that these scenarios were exploiting seepage face losses, features of GSFLOW that limit prescribed pumping when a well is overpumped, meaning the model was not reflecting the prescribed inputs. The scenarios appeared optimized because the groundwater model silently reduced pumping, an error in this context. The team modified the MLGO framework to record seepage face losses and target zero as a project goal, artificially added these losses to previously conducted runs in the compendium, and MLGO subsequently avoided them quite well. Later, a water rights change reducing dry-period surface water volumes available for ASR injection altered the water allocation model’s output and the numerical parameter space; no compendium modifications were made, and MLGO continued to perform well despite the form of error this introduced into its training data. The authors acknowledge that results inherit any uncertainty in the sole numerical flow model and the single climate realization and aquifer parameter realization used, and suggest future efforts could employ multiple realizations of each.
Principal component analysis of the high-dimensional dataset, which contains 58 project goals and 118 project parameters, revealed that the first five principal components explain over 60 percent of all variability in the compendium, with PC1 alone accounting for just over 40 percent. These components elucidated practical trade-offs: high volumes of District-to-City transfers originating from pumping near existing purified water injection wells correlate with a lower supply gap; reducing injection at existing Pure Water Soquel wells correlates with sustainability problems; new wells screened solely in one aquifer correlate with feasibility issues, supporting recommendations to screen all new wells across two aquifers; and infrastructure expansion follows patterns of adding paired ASR and purified water wells screened in the same aquifers. From the thousands of scenarios, four project configurations were selected representing highly optimized, progressively expensive options for improving regional water supply.
Perhaps the most striking outcome is a strategy that had not been envisioned by the modeling team: symbiotically using ASR and purified water recharge by injecting surface water or recycled water in the basin’s highlands, along the border between the City of Santa Cruz and Soquel Creek Water District, upland of ASR facilities. This allows more pumping by the City while reducing the need for transfers from the District, mutually benefiting both agencies and reducing the need for large hydraulic intertie upgrades. The authors emphasize that the machine learning agents are heuristic in nature, attempting to solve the entire optimization problem at once by the shortest path possible, which risks missing alternative solutions that more systematic perturbation software such as PEST might capture; this risk was reduced by manual scenarios in the initial training data and by multiple algorithms exploring the parameter space differently. They also note that periodic metalearning, adjusting algorithm architecture and hyperparameters as the dataset expands, was largely user-imposed in this study, and future work could automate it. More broadly, the approach demonstrated here is not specific to this basin and should transfer to any planning problem in which a slow physical model must be interrogated across a large configuration space.
Subject of Research: Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study
Article Title: Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study
Article References: Wickham, P., Bayley, T., & Tana, C. (2026). Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study. Frontiers in Water, 8, Article 1930007. https://doi.org/10.3389/frwa.2026.1930007
Image Credits: AI Generated
DOI: 10.3389/frwa.2026.1930007
Keywords: machine learning, groundwater, water management, optimization, seawater intrusion, sustainability, California, GSFLOW, Machine, learning, guided, water
Cite Scienmag News
Teresa Odom. (October 16, 2026). Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study. Scienmag. https://scienmag.com/machine-learning-guided-optimization-of-water-management-options-with-a-physical-groundwater-model-for-the-mid-county-basin-optimization-study/
Teresa Odom. "Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study." Scienmag, 16 October 2026, https://scienmag.com/machine-learning-guided-optimization-of-water-management-options-with-a-physical-groundwater-model-for-the-mid-county-basin-optimization-study/. Accessed 16 October 2026.
Teresa Odom. "Machine learning guided optimization of water management options with a physical groundwater model for the Mid-County Basin optimization study." Scienmag. October 16, 2026. https://scienmag.com/machine-learning-guided-optimization-of-water-management-options-with-a-physical-groundwater-model-for-the-mid-county-basin-optimization-study/

