# scuervo91/pvtpy architecture

> Architecture diagram of the GitHub repository scuervo91/pvtpy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scuervo91/pvtpy
- Repository: https://github.com/scuervo91/pvtpy

## Overview

##### Main Components
- Library Core (pvtpy package) – This is the root module that brings together all the submodules.
- Submodules:
- "black_oil": Implements correlations specifically for oil, gas, and water PVT properties.
- "compositional": Deals with compositional modeling including chromatography and handling component interactions.
- "eos": Contains different Equation of State implementations (Peng-Robinson, Redlich-Kwong, Soave-Redlich-Kwong, van der Waals, etc.).
- "fluids": Defines the fluid types (oil, gas, water) and the base fluid properties.
- "pvt": Focused on generating PVT data (likely orchestrating calls to other submodules to produce output tables).
- "units": Provides unit conversion functionalities.
- Documentation and Examples: The "docs" directory holds example notebooks that showcase how to use the library and demonstrate its various parts.
- Testing: The "test" directory indicates a suite of tests validating the functionality.
- CI/CD and Build: The GitHub workflows (.github/workflows) and configuration files (pyproject.toml, mkdocs.yml) represent deployment integration and documentation build processes.

##### Relationships and Interactions
- The central component (pvtpy package) acts as an entry point.
- The “pvt” module likely calls functions and uses classes from “black_oil”, “fluids”, “compositional”, and possibly “eos” to compute PVT tables.
- The “black_oil” and “compositional” modules provide specialized correlation functions that feed into the overall fluid property computations.
- The “eos” module supplies different methods to estimate densities and other thermodynamic properties, potentially offering an override or selection between methods.
- Functions in “units” are used across the library to ensure consistent unit handling.
- External consumers (users via notebooks or scripts, as shown in the “docs/examples” folder) interact with the library API exposed by pvtpy.
- Testing and CI workflows ensure that changes in any submodule are verified before deployment or publication to PyPI.

##### Architectural Patterns and Design Principles
- Modularity: Each functional area (e.g., EOS calculations, fluid definitions) is encapsulated in its own submodule.
- Separation of Concerns: Clearly defined modules for domain-specific logic (correlations, compositional analysis, unit conversion) help keep the code organized.
- Reusability: The structure allows users to leverage only the components they need (e.g., using EOS methods separately from PVT table generation).
- Extensibility: New correlations, EOS, or fluid types could be added without major refactoring.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Library Core Container
    subgraph "Library Core: pvtpy"
        PVT["pvt Module"]:::module
        BO["black_oil Module"]:::comp
        COMP["compositional Module"]:::comp
        EOS["eos Module"]:::comp
        FLUIDS["fluids Module"]:::comp
        UNITS["units Module"]:::util
    end

    Core["pvtpy Package"]:::package

    %% Relationships within Library Core
    Core -->|"entry"| PVT
    PVT -->|"calls_correlation_functions"| BO
    PVT -->|"processes_composition"| COMP
    PVT -->|"applies_EOS"| EOS
    PVT -->|"retrieves_fluid_properties"| FLUIDS
    PVT -->|"converts_units"| UNITS

    %% External Components
    USER["End Users (Notebooks/Scripts)"]:::external
    DOCS["Documentation & Examples"]:::docs
    TEST["Testing Suite"]:::external
    CI["CI/CD Workflows"]:::ci

    %% External Interactions
    USER -->|"uses_API"| Core
    DOCS -->|"guides_usage"| Core
    TEST -->|"validates"| Core
    CI -->|"integrates_tests"| TEST

    %% Click Events
    click Core "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/"
    click PVT "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/pvt/"
    click BO "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/black_oil/"
    click COMP "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/compositional/"
    click EOS "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/eos/"
    click FLUIDS "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/fluids/"
    click UNITS "https://github.com/scuervo91/pvtpy/tree/main/pvtpy/units/"
    click DOCS "https://github.com/scuervo91/pvtpy/tree/main/docs/"
    click TEST "https://github.com/scuervo91/pvtpy/tree/main/test/"
    click CI "https://github.com/scuervo91/pvtpy/tree/main/.github/workflows/"

    %% Styles
    classDef package fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef module fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef comp fill:#ffcccb,stroke:#000,stroke-width:2px;
    classDef util fill:#ffffcc,stroke:#000,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef docs fill:#dda0dd,stroke:#000,stroke-width:2px;
    classDef ci fill:#ffd700,stroke:#000,stroke-width:2px;
```
