CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-flopy

FloPy is a Python package to create, run, and post-process MODFLOW-based models

Agent Success

Agent success rate when using this tile

66%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.14x

Baseline

Agent success rate without this tile

58%

Overview
Eval results
Files

task.mdevals/scenario-1/

Groundwater Recharge Time Series Manager

A tool for managing time-varying recharge data in MODFLOW 6 groundwater models.

Problem Description

Create a Python script that applies time-varying recharge rates to a MODFLOW 6 groundwater flow model. The recharge rates vary over time and should be specified using an external time series file that is linked to the recharge package.

Requirements

Setup

You will work with a basic MODFLOW 6 simulation that has:

  • Simulation name: "recharge_ts_sim"
  • Model name: "gwf"
  • 2 stress periods (each 10 days long)
  • Simple 10x10x1 grid (1 layer, 100m cell size)
  • Output directory: "./output"

Time Series Data

Create a time series data file with three time points:

  • Time 0.0 days → recharge rate 0.001 m/day
  • Time 10.0 days → recharge rate 0.003 m/day
  • Time 20.0 days → recharge rate 0.002 m/day

The time series should be named "rch_ts" and saved as "recharge_ts.txt" in the simulation workspace.

Implementation

Your implementation should:

  1. Create the time series data file in the correct format for MODFLOW 6
  2. Set up a simulation with a groundwater flow model
  3. Add temporal and spatial discretization packages
  4. Configure the recharge package to reference the time series by name
  5. Write all simulation files to the output directory

Test Cases

  • The simulation creates required input files in the output directory @test
  • The recharge package file contains a reference to the time series @test
  • The time series file is created in the correct location @test

Implementation

@generates

API

def create_time_series_file(filepath: str, times: list, values: list) -> None:
    """
    Create a time series data file for MODFLOW 6.

    Args:
        filepath: Path where the time series file will be created
        times: List of time values (in days)
        values: List of corresponding recharge rates (in m/day)
    """
    pass

def setup_recharge_with_timeseries(
    sim_name: str,
    sim_ws: str,
    ts_filename: str,
    nper: int = 2,
    perlen: float = 10.0,
    nrow: int = 10,
    ncol: int = 10
) -> None:
    """
    Set up a MODFLOW 6 simulation with time-varying recharge.

    Args:
        sim_name: Name of the simulation
        sim_ws: Workspace directory for the simulation
        ts_filename: Name of the time series file to use
        nper: Number of stress periods
        perlen: Length of each stress period in days
        nrow: Number of rows in the grid
        ncol: Number of columns in the grid
    """
    pass

Dependencies { .dependencies }

flopy { .dependency }

Python package for creating, running, and post-processing MODFLOW-based groundwater models. Provides support for MODFLOW 6 time series functionality.

tessl i tessl/pypi-flopy@3.9.0

tile.json