Skip to main content
Glama
IBM

Physics MCP Server

by IBM

calculate_venturi_effect

Compute throat velocity, pressure drop, and volumetric flow rate for fluid flowing through a constriction, applying the continuity equation and Bernoulli's principle.

Instructions

Calculate Venturi effect (flow through constriction).

Uses continuity equation and Bernoulli's principle.

Args:
    inlet_diameter: Inlet diameter in meters
    throat_diameter: Throat (constriction) diameter in meters
    inlet_velocity: Inlet velocity in m/s
    fluid_density: Fluid density in kg/m³

Returns:
    Dict containing:
        - throat_velocity: Velocity at throat in m/s
        - pressure_drop: Pressure drop from inlet to throat in Pascals
        - flow_rate: Volumetric flow rate in m³/s

Example - Venturi meter:
    result = await calculate_venturi_effect(
        inlet_diameter=0.1,  # 10 cm
        throat_diameter=0.05,  # 5 cm
        inlet_velocity=2.0,  # m/s
        fluid_density=1000  # water
    )
    # throat_velocity = 8 m/s (4x area reduction)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inlet_diameterYes
throat_diameterYes
inlet_velocityYes
fluid_densityYes

Implementation Reference

  • Async tool handler for calculate_venturi_effect that wraps the core logic. Decorated with @tool for MCP registration. Accepts inlet_diameter, throat_diameter, inlet_velocity, fluid_density and returns throat_velocity, pressure_drop, flow_rate.
    async def calculate_venturi_effect(
        inlet_diameter: float,
        throat_diameter: float,
        inlet_velocity: float,
        fluid_density: float,
    ) -> dict:
        """Calculate Venturi effect (flow through constriction).
    
        Uses continuity equation and Bernoulli's principle.
    
        Args:
            inlet_diameter: Inlet diameter in meters
            throat_diameter: Throat (constriction) diameter in meters
            inlet_velocity: Inlet velocity in m/s
            fluid_density: Fluid density in kg/m³
    
        Returns:
            Dict containing:
                - throat_velocity: Velocity at throat in m/s
                - pressure_drop: Pressure drop from inlet to throat in Pascals
                - flow_rate: Volumetric flow rate in m³/s
    
        Example - Venturi meter:
            result = await calculate_venturi_effect(
                inlet_diameter=0.1,  # 10 cm
                throat_diameter=0.05,  # 5 cm
                inlet_velocity=2.0,  # m/s
                fluid_density=1000  # water
            )
            # throat_velocity = 8 m/s (4x area reduction)
        """
        from ..fluid_advanced import VenturiEffectRequest, calculate_venturi_effect as calc_venturi
    
        request = VenturiEffectRequest(
            inlet_diameter=inlet_diameter,
            throat_diameter=throat_diameter,
            inlet_velocity=inlet_velocity,
            fluid_density=fluid_density,
        )
        response = calc_venturi(request)
        return response.model_dump()
  • Core implementation of Venturi effect calculation using continuity equation (A1*v1 = A2*v2) and Bernoulli's principle (ΔP = 0.5*ρ*(v2² - v1²)). Computes throat velocity, pressure drop, and flow rate.
    def calculate_venturi_effect(request: VenturiEffectRequest) -> VenturiEffectResponse:
        """Calculate Venturi effect (flow through constriction).
    
        Uses continuity equation and Bernoulli's principle:
        - A₁v₁ = A₂v₂ (continuity)
        - P₁ + (1/2)ρv₁² = P₂ + (1/2)ρv₂² (Bernoulli)
    
        Args:
            request: Venturi effect request
    
        Returns:
            Throat velocity and pressure drop
        """
        d1 = request.inlet_diameter
        d2 = request.throat_diameter
        v1 = request.inlet_velocity
        rho = request.fluid_density
    
        # Areas
        A1 = math.pi * (d1 / 2.0) ** 2
        A2 = math.pi * (d2 / 2.0) ** 2
    
        # Continuity: A₁v₁ = A₂v₂
        v2 = v1 * (A1 / A2)
    
        # Bernoulli: ΔP = (1/2)ρ(v₂² - v₁²)
        pressure_drop = 0.5 * rho * (v2 * v2 - v1 * v1)
    
        # Flow rate
        flow_rate = A1 * v1
    
        return VenturiEffectResponse(
            throat_velocity=v2,
            pressure_drop=pressure_drop,
            flow_rate=flow_rate,
        )
  • VenturiEffectRequest Pydantic schema: defines input fields (inlet_diameter, throat_diameter, inlet_velocity, fluid_density) with validation constraints.
    class VenturiEffectRequest(BaseModel):
        """Request for Venturi effect calculation (flow through constriction)."""
    
        inlet_diameter: float = Field(..., description="Inlet diameter in meters", gt=0.0)
        throat_diameter: float = Field(..., description="Throat diameter in meters", gt=0.0)
        inlet_velocity: float = Field(..., description="Inlet velocity in m/s", ge=0.0)
        fluid_density: float = Field(default=1000.0, description="Fluid density in kg/m³", gt=0.0)
  • VenturiEffectResponse Pydantic schema: defines output fields (throat_velocity, pressure_drop, flow_rate).
    class VenturiEffectResponse(BaseModel):
        """Response for Venturi effect."""
    
        throat_velocity: float = Field(..., description="Velocity at throat in m/s")
        pressure_drop: float = Field(..., description="Pressure drop from inlet to throat in Pascals")
        flow_rate: float = Field(..., description="Volumetric flow rate in m³/s")
  • The @tool decorator on line 497 registers calculate_venturi_effect as an MCP tool in the tools/fluid.py module.
    @tool  # type: ignore[arg-type]
    async def calculate_venturi_effect(
        inlet_diameter: float,
        throat_diameter: float,
        inlet_velocity: float,
        fluid_density: float,
    ) -> dict:
        """Calculate Venturi effect (flow through constriction).
    
        Uses continuity equation and Bernoulli's principle.
    
        Args:
            inlet_diameter: Inlet diameter in meters
            throat_diameter: Throat (constriction) diameter in meters
            inlet_velocity: Inlet velocity in m/s
            fluid_density: Fluid density in kg/m³
    
        Returns:
            Dict containing:
                - throat_velocity: Velocity at throat in m/s
                - pressure_drop: Pressure drop from inlet to throat in Pascals
                - flow_rate: Volumetric flow rate in m³/s
    
        Example - Venturi meter:
            result = await calculate_venturi_effect(
                inlet_diameter=0.1,  # 10 cm
                throat_diameter=0.05,  # 5 cm
                inlet_velocity=2.0,  # m/s
                fluid_density=1000  # water
            )
            # throat_velocity = 8 m/s (4x area reduction)
        """
        from ..fluid_advanced import VenturiEffectRequest, calculate_venturi_effect as calc_venturi
    
        request = VenturiEffectRequest(
            inlet_diameter=inlet_diameter,
            throat_diameter=throat_diameter,
            inlet_velocity=inlet_velocity,
            fluid_density=fluid_density,
        )
        response = calc_venturi(request)
        return response.model_dump()
Behavior4/5

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

No annotations are provided, but the description adequately describes the mathematical computation and expected inputs/outputs. For a pure calculation tool, this covers behavioral traits sufficiently. It does not disclose any side effects because none exist.

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

Conciseness5/5

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

The description is well-structured with sections for purpose, parameter list, return values, and an example. Every sentence adds value; no fluff.

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 output schema, the description fully specifies the return dictionary with keys, units, and an example. All necessary information for a physics calculation tool is present.

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?

Schema description coverage is 0%, but the description includes detailed docstrings for each parameter with units (e.g., 'inlet diameter in meters'). This adds significant meaning beyond the bare schema, enabling correct usage.

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 it calculates the Venturi effect using continuity equation and Bernoulli's principle. The specific verb 'calculate' and resource 'Venturi effect' are precise, and the tool is distinct from sibling physics calculation tools.

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

Usage Guidelines3/5

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

The description mentions 'flow through constriction' and provides an example, but does not explicitly guide when to use this tool over closely related siblings like 'calculate_bernoulli'. No 'when not to use' or alternatives are given.

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/IBM/chuk-mcp-physics'

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