oil_sg_from_jacoby
Calculate oil specific gravity using molecular weight and aromaticity factor for petroleum fraction characterization in reservoir engineering.
Instructions
Calculate oil specific gravity from molecular weight and Jacoby aromaticity.
HYDROCARBON CHARACTERIZATION TOOL - Estimates specific gravity for undefined petroleum fractions using molecular weight and aromaticity.
Jacoby Aromaticity Factor (JA):
0.0 = Pure paraffinic (alkanes)
0.5 = Mixed (typical crude oils)
1.0 = Pure aromatic
Applications:
Plus fraction (C7+) characterization
Undefined heavy end lumping
EOS fluid modeling
Pseudo-component generation
Returns specific gravity (dimensionless, water=1).
Args: request: Molecular weight and Jacoby aromaticity factor
Returns: Dictionary with specific gravity, method, and inputs
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes |
Implementation Reference
- The tool handler function decorated with @mcp.tool(). It takes JacobyAromaticitySGRequest, calls pyrestoolbox.oil.oil_ja_sg(mw, ja), handles array/scalar output, and returns formatted dict with value, method, units, inputs.@mcp.tool() def oil_sg_from_jacoby(request: JacobyAromaticitySGRequest) -> dict: """Calculate oil specific gravity from molecular weight and Jacoby aromaticity. **HYDROCARBON CHARACTERIZATION TOOL** - Estimates specific gravity for undefined petroleum fractions using molecular weight and aromaticity. **Jacoby Aromaticity Factor (JA):** - 0.0 = Pure paraffinic (alkanes) - 0.5 = Mixed (typical crude oils) - 1.0 = Pure aromatic **Applications:** - Plus fraction (C7+) characterization - Undefined heavy end lumping - EOS fluid modeling - Pseudo-component generation Returns specific gravity (dimensionless, water=1). Args: request: Molecular weight and Jacoby aromaticity factor Returns: Dictionary with specific gravity, method, and inputs """ sg = oil.oil_ja_sg(mw=request.mw, ja=request.ja) if isinstance(sg, np.ndarray): value = sg.tolist() else: value = float(sg) return { "value": value, "method": "Jacoby aromaticity correlation", "units": "dimensionless (water=1)", "inputs": request.model_dump(), }
- Pydantic model defining the input schema for the tool, with fields for molecular weight (mw > 0) and Jacoby aromaticity factor (ja in [0,1]), supporting scalar or list inputs.class JacobyAromaticitySGRequest(BaseModel): """Request model for Jacoby aromaticity to SG calculation.""" mw: Union[float, List[float]] = Field( ..., gt=0, description="Molecular weight (lb/lbmol) - scalar or array" ) ja: Union[float, List[float]] = Field( ..., ge=0, le=1, description="Jacoby aromaticity factor (0=paraffinic, 1=aromatic)" )
- src/pyrestoolbox_mcp/server.py:16-24 (registration)Import of register_oil_tools from oil_tools.py and call to register_oil_tools(mcp), which defines and registers all oil tools including oil_sg_from_jacoby with the FastMCP server instance.from .tools.oil_tools import register_oil_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)