extract_eclipse_problem_cells
Extract convergence problem cells from ECLIPSE/Intersect PRT files to identify simulation failures, material balance errors, and problematic grid regions for debugging reservoir models.
Instructions
Extract convergence problem cells from ECLIPSE/Intersect PRT file.
SIMULATION DIAGNOSTICS TOOL - Parse ECLIPSE/Intersect PRT output files to extract cells with convergence failures, material balance errors, or other simulation problems.
What It Does:
Scans ECLIPSE .PRT files for error/warning messages
Identifies problem cells by (I, J, K) grid coordinates
Extracts timestep and iteration information
Reports error types and severity
Applications:
Convergence Debugging: Find cells causing timestep cuts
Model QC: Identify grid initialization issues
Performance Tuning: Locate problematic regions
Numerical Stability: Track material balance errors
Common Problems Detected:
Material balance errors
Negative saturations
Pressure/temperature out of range
Flash calculation failures
Linear solver issues
Severe saturation changes
Workflow:
Run ECLIPSE/Intersect simulation
Locate the .PRT output file
Use this tool to extract problem cell locations
Investigate problematic cells in pre-processor
Refine initialization or grid properties
Output Format: List of problem cells with timestep, iteration, cell coordinates (I,J,K), error type, and severity.
Args: request: Path to PRT file and output options
Returns: Dictionary with list of problem cells and summary statistics
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |
Input Schema (JSON Schema)
Implementation Reference
- The main handler function for the 'extract_eclipse_problem_cells' tool. It parses ECLIPSE/Intersect PRT files using pyrestoolbox.simtools.ix_extract_problem_cells to identify and report convergence problem cells with details like timestep, iteration, grid position (I,J,K), error type, and message.@mcp.tool() def extract_eclipse_problem_cells(request: ExtractProblemCellsRequest) -> dict: """Extract convergence problem cells from ECLIPSE/Intersect PRT file. **SIMULATION DIAGNOSTICS TOOL** - Parse ECLIPSE/Intersect PRT output files to extract cells with convergence failures, material balance errors, or other simulation problems. **What It Does:** - Scans ECLIPSE .PRT files for error/warning messages - Identifies problem cells by (I, J, K) grid coordinates - Extracts timestep and iteration information - Reports error types and severity **Applications:** - **Convergence Debugging:** Find cells causing timestep cuts - **Model QC:** Identify grid initialization issues - **Performance Tuning:** Locate problematic regions - **Numerical Stability:** Track material balance errors **Common Problems Detected:** - Material balance errors - Negative saturations - Pressure/temperature out of range - Flash calculation failures - Linear solver issues - Severe saturation changes **Workflow:** 1. Run ECLIPSE/Intersect simulation 2. Locate the .PRT output file 3. Use this tool to extract problem cell locations 4. Investigate problematic cells in pre-processor 5. Refine initialization or grid properties **Output Format:** List of problem cells with timestep, iteration, cell coordinates (I,J,K), error type, and severity. Args: request: Path to PRT file and output options Returns: Dictionary with list of problem cells and summary statistics """ try: # Extract problem cells from PRT file results = simtools.ix_extract_problem_cells( filename=request.filename, silent=request.silent ) if not results: return { "problem_cells": [], "total_problems": 0, "message": "No convergence problems detected in PRT file", "file": request.filename, "inputs": request.model_dump(), } # Process results into structured format problem_list = [] for problem in results: problem_list.append({ "timestep": problem.get("timestep", "Unknown"), "iteration": problem.get("iteration", "Unknown"), "i": problem.get("i", -1), "j": problem.get("j", -1), "k": problem.get("k", -1), "error_type": problem.get("error_type", "Unknown"), "message": problem.get("message", ""), }) return { "problem_cells": problem_list, "total_problems": len(problem_list), "file": request.filename, "method": "ECLIPSE/Intersect PRT file parsing", "inputs": request.model_dump(), "note": "Investigate problem cells in grid pre-processor to resolve convergence issues", } except FileNotFoundError: return { "error": f"PRT file not found: {request.filename}", "suggestion": "Verify file path and ensure ECLIPSE/Intersect simulation completed", "inputs": request.model_dump(), } except Exception as e: return { "error": str(e), "file": request.filename, "inputs": request.model_dump(), }
- Pydantic BaseModel defining the input schema for the tool, requiring a 'filename' path to the PRT file and an optional 'silent' flag to suppress console output.class ExtractProblemCellsRequest(BaseModel): """Request model for ECLIPSE problem cell extraction.""" filename: str = Field(..., description="Path to ECLIPSE/Intersect PRT file") silent: bool = Field(True, description="Suppress console output")
- src/pyrestoolbox_mcp/server.py:27-27 (registration)The call to register_simtools_tools(mcp) in the main server initialization, which registers the extract_eclipse_problem_cells tool along with other simulation tools.register_simtools_tools(mcp)
- src/pyrestoolbox_mcp/tools/simtools_tools.py:17-17 (registration)The registration function definition that contains the @mcp.tool() decorator for extract_eclipse_problem_cells and defines/registers all simtools tools when called.def register_simtools_tools(mcp: FastMCP) -> None: