gas_water_content
Calculate water content in natural gas to prevent hydrate formation and design dehydration systems based on pressure, temperature, and gas gravity inputs.
Instructions
Calculate water content of natural gas.
CRITICAL GAS PROCESSING TOOL - Computes the amount of water vapor that natural gas can hold at given pressure and temperature conditions. Essential for hydrate prevention, dehydration unit design, and pipeline operation. Water content decreases with increasing pressure and decreasing temperature.
Parameters:
sg (float, required): Gas specific gravity (air=1.0). Valid: 0.55-3.0. Typical: 0.6-1.2. Example: 0.7.
degf (float, required): Temperature in °F. Valid: -460 to 1000. Typical: 40-200°F. Example: 100.0.
p (float or list, required): Pressure(s) in psia. Must be > 0. Can be scalar or array. Example: 1000.0 or [500, 1000, 2000].
Water Content Behavior:
Decreases with increasing pressure (less water can dissolve)
Decreases with decreasing temperature (less water vapor)
Typical range: 5-200 lb/MMSCF at pipeline conditions
At high pressure/low temperature: <10 lb/MMSCF
Hydrate Formation: Gas-water systems form solid hydrates (ice-like structures) at certain P-T conditions. Hydrates can block pipelines and equipment. Gas must be dehydrated below:
Hydrate formation temperature at operating pressure
Typical target: <7 lb/MMSCF for pipeline operation
Typical target: <0.1 lb/MMSCF for LNG/cryogenic processes
Correlation: Uses McCain correlation (1990) based on experimental data for sweet natural gas. Valid for typical pipeline and processing conditions.
Applications:
Hydrate Prevention: Determine minimum dehydration requirement
Dehydration Unit Design: Size glycol contactors and regenerators
Pipeline Corrosion: Assess water-related corrosion risk
Gas Processing: Design dehydration systems for sales gas
Sales Gas Specs: Ensure compliance with water content limits
Returns: Dictionary with:
value (float or list): Water content in lb/MMSCF (matches input p shape)
method (str): "McCain (1990) correlation"
units (str): "lb/MMSCF"
inputs (dict): Echo of input parameters
note (str): Hydrate prevention guidance
Common Mistakes:
Using separator temperature instead of pipeline/processing temperature
Pressure in barg/psig instead of psia (must be absolute)
Not understanding hydrate formation conditions
Confusing water content (lb/MMSCF) with water dew point (°F)
Temperature in Celsius instead of Fahrenheit
Example Usage:
Result: Water content decreases from ~50 lb/MMSCF at 500 psia to ~20 lb/MMSCF at 2000 psia.
Note: Water content is critical for pipeline operation. Always check against hydrate formation curve. For hydrate prevention, compare to hydrate formation temperature at operating pressure. Typical pipeline requirement: <7 lb/MMSCF.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |
Implementation Reference
- The main handler function for the 'gas_water_content' tool, decorated with @mcp.tool(). It takes GasWaterContentRequest, calls pyrestoolbox.gas.gas_water_content, formats the result, and returns a standardized dictionary response.@mcp.tool() def gas_water_content(request: GasWaterContentRequest) -> dict: """Calculate water content of natural gas. **CRITICAL GAS PROCESSING TOOL** - Computes the amount of water vapor that natural gas can hold at given pressure and temperature conditions. Essential for hydrate prevention, dehydration unit design, and pipeline operation. Water content decreases with increasing pressure and decreasing temperature. **Parameters:** - **sg** (float, required): Gas specific gravity (air=1.0). Valid: 0.55-3.0. Typical: 0.6-1.2. Example: 0.7. - **degf** (float, required): Temperature in °F. Valid: -460 to 1000. Typical: 40-200°F. Example: 100.0. - **p** (float or list, required): Pressure(s) in psia. Must be > 0. Can be scalar or array. Example: 1000.0 or [500, 1000, 2000]. **Water Content Behavior:** - Decreases with increasing pressure (less water can dissolve) - Decreases with decreasing temperature (less water vapor) - Typical range: 5-200 lb/MMSCF at pipeline conditions - At high pressure/low temperature: <10 lb/MMSCF **Hydrate Formation:** Gas-water systems form solid hydrates (ice-like structures) at certain P-T conditions. Hydrates can block pipelines and equipment. Gas must be dehydrated below: - Hydrate formation temperature at operating pressure - Typical target: <7 lb/MMSCF for pipeline operation - Typical target: <0.1 lb/MMSCF for LNG/cryogenic processes **Correlation:** Uses McCain correlation (1990) based on experimental data for sweet natural gas. Valid for typical pipeline and processing conditions. **Applications:** - **Hydrate Prevention:** Determine minimum dehydration requirement - **Dehydration Unit Design:** Size glycol contactors and regenerators - **Pipeline Corrosion:** Assess water-related corrosion risk - **Gas Processing:** Design dehydration systems for sales gas - **Sales Gas Specs:** Ensure compliance with water content limits **Returns:** Dictionary with: - **value** (float or list): Water content in lb/MMSCF (matches input p shape) - **method** (str): "McCain (1990) correlation" - **units** (str): "lb/MMSCF" - **inputs** (dict): Echo of input parameters - **note** (str): Hydrate prevention guidance **Common Mistakes:** - Using separator temperature instead of pipeline/processing temperature - Pressure in barg/psig instead of psia (must be absolute) - Not understanding hydrate formation conditions - Confusing water content (lb/MMSCF) with water dew point (°F) - Temperature in Celsius instead of Fahrenheit **Example Usage:** ```python { "sg": 0.7, "degf": 100.0, "p": [500, 1000, 2000] } ``` Result: Water content decreases from ~50 lb/MMSCF at 500 psia to ~20 lb/MMSCF at 2000 psia. **Note:** Water content is critical for pipeline operation. Always check against hydrate formation curve. For hydrate prevention, compare to hydrate formation temperature at operating pressure. Typical pipeline requirement: <7 lb/MMSCF. """ wc = gas.gas_water_content( p=request.p, degf=request.degf, ) # Convert numpy array to list for JSON serialization if isinstance(wc, np.ndarray): value = wc.tolist() else: value = float(wc) return { "value": value, "method": "McCain (1990) correlation", "units": "lb/MMSCF", "inputs": request.model_dump(), "note": "For hydrate prevention, compare to hydrate formation curve", }
- Pydantic BaseModel defining the input schema for the gas_water_content tool, including fields for pressure (p) and temperature (degf) with validation.class GasWaterContentRequest(BaseModel): """Request model for gas water content calculation.""" model_config = ConfigDict( json_schema_extra={ "example": { "p": 1000.0, "degf": 100.0, } } ) p: Union[float, List[float]] = Field( ..., description="Pressure (psia) - scalar or array" ) degf: Union[float, List[float]] = Field( ..., description="Temperature (degrees Fahrenheit) - scalar or array" ) @field_validator("p", "degf") @classmethod def validate_positive(cls, v): if isinstance(v, list): if not all(val > 0 for val in v): raise ValueError("All values must be positive") else: if v <= 0: raise ValueError("Value must be positive") return v
- src/pyrestoolbox_mcp/server.py:17-25 (registration)Import of register_gas_tools and its invocation on the MCP server instance, which defines and registers the gas_water_content tool among other gas tools.from .tools.gas_tools import register_gas_tools from .tools.inflow_tools import register_inflow_tools from .tools.simtools_tools import register_simtools_tools from .tools.brine_tools import register_brine_tools from .tools.layer_tools import register_layer_tools from .tools.library_tools import register_library_tools register_oil_tools(mcp) register_gas_tools(mcp)
- src/pyrestoolbox_mcp/tools/gas_tools.py:893-980 (registration)The @mcp.tool() decorator directly on the handler function registers it as an MCP tool when register_gas_tools is called.@mcp.tool() def gas_water_content(request: GasWaterContentRequest) -> dict: """Calculate water content of natural gas. **CRITICAL GAS PROCESSING TOOL** - Computes the amount of water vapor that natural gas can hold at given pressure and temperature conditions. Essential for hydrate prevention, dehydration unit design, and pipeline operation. Water content decreases with increasing pressure and decreasing temperature. **Parameters:** - **sg** (float, required): Gas specific gravity (air=1.0). Valid: 0.55-3.0. Typical: 0.6-1.2. Example: 0.7. - **degf** (float, required): Temperature in °F. Valid: -460 to 1000. Typical: 40-200°F. Example: 100.0. - **p** (float or list, required): Pressure(s) in psia. Must be > 0. Can be scalar or array. Example: 1000.0 or [500, 1000, 2000]. **Water Content Behavior:** - Decreases with increasing pressure (less water can dissolve) - Decreases with decreasing temperature (less water vapor) - Typical range: 5-200 lb/MMSCF at pipeline conditions - At high pressure/low temperature: <10 lb/MMSCF **Hydrate Formation:** Gas-water systems form solid hydrates (ice-like structures) at certain P-T conditions. Hydrates can block pipelines and equipment. Gas must be dehydrated below: - Hydrate formation temperature at operating pressure - Typical target: <7 lb/MMSCF for pipeline operation - Typical target: <0.1 lb/MMSCF for LNG/cryogenic processes **Correlation:** Uses McCain correlation (1990) based on experimental data for sweet natural gas. Valid for typical pipeline and processing conditions. **Applications:** - **Hydrate Prevention:** Determine minimum dehydration requirement - **Dehydration Unit Design:** Size glycol contactors and regenerators - **Pipeline Corrosion:** Assess water-related corrosion risk - **Gas Processing:** Design dehydration systems for sales gas - **Sales Gas Specs:** Ensure compliance with water content limits **Returns:** Dictionary with: - **value** (float or list): Water content in lb/MMSCF (matches input p shape) - **method** (str): "McCain (1990) correlation" - **units** (str): "lb/MMSCF" - **inputs** (dict): Echo of input parameters - **note** (str): Hydrate prevention guidance **Common Mistakes:** - Using separator temperature instead of pipeline/processing temperature - Pressure in barg/psig instead of psia (must be absolute) - Not understanding hydrate formation conditions - Confusing water content (lb/MMSCF) with water dew point (°F) - Temperature in Celsius instead of Fahrenheit **Example Usage:** ```python { "sg": 0.7, "degf": 100.0, "p": [500, 1000, 2000] } ``` Result: Water content decreases from ~50 lb/MMSCF at 500 psia to ~20 lb/MMSCF at 2000 psia. **Note:** Water content is critical for pipeline operation. Always check against hydrate formation curve. For hydrate prevention, compare to hydrate formation temperature at operating pressure. Typical pipeline requirement: <7 lb/MMSCF. """ wc = gas.gas_water_content( p=request.p, degf=request.degf, ) # Convert numpy array to list for JSON serialization if isinstance(wc, np.ndarray): value = wc.tolist() else: value = float(wc) return { "value": value, "method": "McCain (1990) correlation", "units": "lb/MMSCF", "inputs": request.model_dump(), "note": "For hydrate prevention, compare to hydrate formation curve", }
- test_tools.py:126-128 (helper)Test invocation of the gas_water_content tool in the test suite.("gas_water_content", {"request": { "p": 3500.0, "degf": 180.0 }}),