Skip to main content
Glama
gabrielserrao

pyResToolbox MCP Server

lorenz_from_flow_fractions

Calculate the Lorenz coefficient to quantify vertical conformance by analyzing flow and permeability-thickness fractions from production data.

Instructions

Calculate Lorenz coefficient from flow and permeability fractions.

LORENZ FROM PRODUCTION DATA - Computes Lorenz coefficient from layer-by-layer flow and permeability data. Essential for analyzing actual production data and quantifying vertical conformance from measured production allocation.

Parameters:

  • flow_frac (list, required): Flow fractions from each layer (0-1). Must sum to 1.0. Length must match perm_frac. Example: [0.1, 0.2, 0.3, 0.4].

  • perm_frac (list, required): Permeability-thickness fractions (kh fractions) for each layer (0-1). Must sum to 1.0. Length must match flow_frac. Example: [0.05, 0.15, 0.25, 0.55].

Input Data Sources:

  • PLT (Production Logging Tool): Flow rate per layer from production logs

  • Tracer Tests: Flow allocation from tracer response

  • Production Allocation: Flow rates from well test analysis

  • Core Data: Permeability and thickness from core analysis

  • Log Data: Permeability from well logs, thickness from formation tops

Lorenz Coefficient Calculation: Constructs Lorenz curve from data:

  1. Sort layers by kh fraction (ascending)

  2. Calculate cumulative kh fraction (x-axis)

  3. Calculate cumulative flow fraction (y-axis)

  4. Calculate area between curve and diagonal (45° line)

  5. L = 2 × area (normalized to 0-1)

Interpretation:

  • L < 0.3: High conformance (flow matches capacity)

  • L = 0.3-0.6: Moderate conformance (some flow imbalance)

  • L ≥ 0.6: Poor conformance (severe flow imbalance)

Applications:

  • Production Allocation Analysis: Quantify vertical conformance from PLT data

  • PLT Interpretation: Convert PLT flow rates to heterogeneity measure

  • Tracer Test Analysis: Evaluate sweep efficiency from tracer response

  • Vertical Conformance Evaluation: Assess waterflood performance

  • History Matching: Match simulation to measured production allocation

  • Performance Diagnosis: Identify layers with poor conformance

Returns: Dictionary with:

  • lorenz_coefficient (float): Lorenz coefficient (0-1)

  • number_of_layers (int): Number of layers analyzed

  • method (str): "Lorenz from flow and permeability fractions"

  • interpretation (str): Conformance level guidance

  • inputs (dict): Echo of input parameters

Common Mistakes:

  • Flow fractions don't sum to 1.0 (must normalize)

  • Perm fractions don't sum to 1.0 (must normalize)

  • Length mismatch between flow_frac and perm_frac

  • Using weight fractions instead of flow fractions

  • Not sorting layers correctly (must sort by kh)

  • Using wrong kh calculation (must be k × h, not just k)

Example Usage:

{
    "flow_frac": [0.1, 0.2, 0.3, 0.4],
    "perm_frac": [0.05, 0.15, 0.25, 0.55]
}

Result: L ≈ 0.4-0.5 (moderate conformance - high-k layers produce more than their capacity fraction, low-k layers produce less).

Note: This is the most direct way to calculate Lorenz from actual production data. Always ensure fractions sum to 1.0 and layers are correctly matched. High L indicates poor vertical conformance (flow imbalance).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and excels. It details the calculation algorithm step-by-step, provides interpretation guidelines (L < 0.3: high conformance, etc.), lists common mistakes with specific validation requirements (sum to 1.0, length match), and explains what the tool returns. This gives the agent comprehensive behavioral understanding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Parameters, Input Data Sources, Calculation, Interpretation, Applications, Returns, Common Mistakes, Example Usage, Note). While comprehensive, some sections like 'Applications' and 'Common Mistakes' are quite detailed, making it longer than minimal. However, every sentence adds value, and key information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 0% schema description coverage, but with an output schema, the description provides exceptional completeness. It covers purpose, usage, algorithm, interpretation, applications, parameters, returns (though output schema exists, it adds interpretation guidance), common mistakes, and examples. This fully compensates for the lack of structured metadata.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema description coverage, the description provides extensive parameter semantics. It defines flow_frac and perm_frac with clear units (0-1 fractions), requirements (must sum to 1.0, length match), examples, and explains their physical meaning (flow fractions from production allocation, permeability-thickness fractions). It also clarifies common pitfalls like using weight fractions instead of flow fractions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool calculates Lorenz coefficient from flow and permeability fractions, specifying it's for analyzing production data and quantifying vertical conformance. It distinguishes from sibling 'flow_fractions_from_lorenz' by being the inverse operation, and from 'beta_to_lorenz' and 'lorenz_to_beta' by using different input types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool ('most direct way to calculate Lorenz from actual production data') and provides extensive context through 'Input Data Sources' (PLT, tracer tests, etc.) and 'Applications' sections. It also implicitly contrasts with siblings by focusing on measured production allocation rather than theoretical distributions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gabrielserrao/pyrestoolbox-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server