How scuervo91/pvtpy works
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.