oil_sg_from_jacoby
Calculate oil specific gravity using molecular weight and aromaticity factor for petroleum fraction characterization in reservoir engineering applications.
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 |
Input Schema (JSON Schema)
Implementation Reference
- The @mcp.tool()-decorated handler function that implements the core logic of 'oil_sg_from_jacoby', calling pyrestoolbox.oil.oil_ja_sg to compute specific gravity from molecular weight and Jacoby aromaticity factor.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 BaseModel defining the input schema (request parameters: mw and ja with validation).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)The server.py file imports register_oil_tools from oil_tools.py and calls it on the FastMCP instance, which defines and registers the 'oil_sg_from_jacoby' tool via @mcp.tool() decorator.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)