# mohammadadib-cu/omnisoot-cv architecture

> Architecture diagram of the GitHub repository mohammadadib-cu/omnisoot-cv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohammadadib-cu/omnisoot-cv
- Repository: https://github.com/mohammadadib-cu/omnisoot-cv

## Overview

##### Project Type and Purpose
- omnisoot is a computational simulation tool designed for gas-phase synthesis of nanoparticles (soot, graphene, etc.) in flames and reactors, used for both scientific research and process optimization.
- It leverages well-known libraries (Cantera for reaction mechanisms and SciPy for ODE integrations) and supports multiple reactor configurations (Constant Volume, Perfectly Stirred, PlugFlow, etc.).

##### Analyzing the File Structure
- The top-level file tree includes key directories:
- The main package files (README.md, __init__.py) set up the project.
- The “apps” directory contains modular simulation components (e.g., flame, reactors, soot models, etc.). Each file or module represents a distinct simulation capability or model (like PAH growth, soot thermodynamics, and surface reactions).
- The “examples” directory organizes practical applications by reactor type. There are subdirectories for “ConstantVolume”, “PerfectlyStirred”, and “PlugFlow” reactors, each with data files (YAML configurations) and executable scripts.
- The “legacy” directory captures previous or deprecated implementations that might offer perspective on evolution or alternative simulation methods.
- A “lib” directory hints at additional libraries or helper functions.
- This structure reveals a modular design where core simulation logic is contained in “apps” while “examples” provides user demonstrations and test cases.

##### Reading the README for Additional Context
- The README confirms that omnisoot is object-oriented, processes reaction mechanisms using Cantera, and employs SciPy for reactor ODE integration.
- It lists supported reactor types along with models for particle dynamics, inception, growth, and oxidation.
- The README clarifies that the tool is accessible via Python and a web interface for visualization, which implies additional components not explicitly shown but potentially external to the current file tree.

a. Main Components:
- Simulation Core (from “apps”):
- Modules such as flame, reactors, sootmodels, sootthermo, etc.
- Each module is responsible for a specific aspect of simulation (e.g., reaction kinetics, energy/particle balances, and physical properties).
- Reactor Simulation Examples:
- Each reactor type (Constant Volume, Perfectly Stirred, PlugFlow) is encapsulated in its own directory within “examples,” demonstrating various simulation setups.
- Legacy Code:
- The “legacy” folder contains previous implementations (e.g., cpfr, psr) which might still influence or be referenced by the current system.
- External Dependencies:
- Integration with external libraries like Cantera and SciPy.
- Web Interface Component (if applicable):
- Although not explicitly present in the file tree, note that a web interface exists for post-processing and visualization.

b. Relationships and Interactions:
- Core modules in “apps” interact to perform simulation tasks:
- For example, “sootthermo” calculates thermodynamic properties which feed into “reactors” for dynamic simulation.
- “solutionarray” and “solutionmodifier” indicate data handling and modification logic.
- Reaction mechanisms processed by Cantera are handed off to SciPy’s ODE solvers in reactor simulations.
- The “examples” directory demonstrates how these modules are orchestrated in practice for different reactor types, with data flows from configuration files (e.g., YAML) to simulation execution scripts.
- Legacy modules may interact or provide backward-compatible routines.

c. Architectural Patterns:
- Modular design: each simulation module (or “app”) is encapsulated enabling flexibility in combining different models.
- Separation of concerns: simulation logic (in “apps”) is decoupled from demonstration/usage examples (in “examples”).
- Integration with external services: clear dependency on Cantera and SciPy for core computations.

d. Relevant Technologies:
- Programming Language: Python.
- Key Libraries: Cantera (reaction mechanism processing), SciPy (ODE integration).
- Data representation: YAML configuration files (for reactor setup).

##### Elements
- Each component should be clearly labeled (e.g., “Flame Simulation Module”, “Reactor Models”, “Soot Thermodynamics”, “Data Input/Config (YAML)”, “Cantera Engine”, “SciPy ODE Solver”).
- Core modules (rectangles),
- Annotations can be added to indicate the type of computing operation (e.g., “thermodynamic calculations”, “ODE integration”) at each module.

##### Final Advice
- Be detailed: capture all essential architectural components from the “apps”, “examples”, “legacy”, and “lib” directories.
- Out dependencies from high-level modules down to the lower-level functionalities (e.g., data input, simulation calculations, post-processing).

This detailed layered approach ensures that the architecture of omnisoot is represented accurately, highlighting both its modular design and integration with external scientific libraries, while also demonstrating how various reactor models and simulation examples are tied together.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Project Setup and Documentation
    subgraph "Project Setup and Documentation"
        PS_README["Project README & Documentation"]:::ps
        PS_INIT["Project __init__ File"]:::ps
    end

    %% Helper Libraries
    subgraph "Helper Libraries"
        HL["Helper Libraries"]:::hl
    end

    %% Simulation Core (Apps)
    subgraph "Simulation Core (Apps)"
        SC_Flame["Flame Simulation Module"]:::core
        SC_Reactors["Reactors Simulation Module"]:::core
        SC_PAH["PAH Growth Module"]:::core
        SC_SootModels["Soot Models Module"]:::core
        SC_SootThermo["Soot Thermodynamics Module"]:::core
        SC_SootGas["Soot Gas Phase Module"]:::core
        SC_SootWrappers["Soot Wrappers Module"]:::core
        SC_SurfaceRxns["Surface Reactions Module"]:::core
        SC_SolArray["Solution Array Module"]:::core
        SC_SolModifier["Solution Modifier Module"]:::core
    end

    %% Reactor Simulation Examples
    subgraph "Reactor Simulation Examples"
        RE_CV["Constant Volume Reactor"]:::example
        RE_PSR["Perfectly Stirred Reactor"]:::example
        RE_PF["Plug Flow Reactor"]:::example
    end

    %% Legacy Simulation Implementations
    subgraph "Legacy Simulation Implementations"
        Legacy_CPFR["CPFR Module"]:::legacy
        Legacy_PSR["PSR Module"]:::legacy
        Legacy_EPTL["EPTL Soot Module"]:::legacy
    end

    %% External Dependencies
    subgraph "External Dependencies"
        Cantera["Cantera Engine"]:::ext
        SciPy["SciPy ODE Solver"]:::ext
    end

    %% User Interface Layer
    subgraph "User Interface Layer"
        WebInterface["Web Visualization Interface"]:::ui
    end

    %% Relationships between layers
    PS_README -->|"initializes"| SC_Flame
    PS_README -->|"initializes"| SC_Reactors
    PS_INIT -->|"initializes"| SC_PAH
    HL -->|"supports"| SC_Flame
    HL -->|"supports"| SC_Reactors
    HL -->|"supports"| SC_PAH
    HL -->|"supports"| SC_SootModels
    HL -->|"supports"| SC_SootThermo
    HL -->|"supports"| SC_SootGas
    HL -->|"supports"| SC_SootWrappers
    HL -->|"supports"| SC_SurfaceRxns
    HL -->|"supports"| SC_SolArray
    HL -->|"supports"| SC_SolModifier

    RE_CV -->|"configures"| SC_Flame
    RE_PSR -->|"configures"| SC_Reactors
    RE_PF -->|"configures"| SC_SootModels

    Legacy_CPFR -->|"alternative"| SC_Reactors
    Legacy_PSR -->|"alternative"| SC_SootThermo
    Legacy_EPTL -->|"alternative"| SC_SootGas

    SC_Flame -->|"uses"| Cantera
    SC_Flame -->|"uses"| SciPy
    SC_Reactors -->|"uses"| Cantera
    SC_Reactors -->|"uses"| SciPy
    SC_PAH -->|"uses"| Cantera
    SC_SootModels -->|"uses"| SciPy
    SC_SootThermo -->|"uses"| SciPy
    SC_SootGas -->|"uses"| SciPy
    SC_SootWrappers -->|"uses"| SciPy
    SC_SurfaceRxns -->|"uses"| Cantera
    SC_SolArray -->|"uses"| SciPy
    SC_SolModifier -->|"uses"| SciPy

    SC_Flame -->|"outputs"| WebInterface
    SC_Reactors -->|"outputs"| WebInterface
    SC_PAH -->|"outputs"| WebInterface
    SC_SootModels -->|"outputs"| WebInterface
    SC_SootThermo -->|"outputs"| WebInterface
    SC_SootGas -->|"outputs"| WebInterface
    SC_SootWrappers -->|"outputs"| WebInterface
    SC_SurfaceRxns -->|"outputs"| WebInterface
    SC_SolArray -->|"outputs"| WebInterface
    SC_SolModifier -->|"outputs"| WebInterface

    %% Click Events for Simulation Core Components (Apps)
    click SC_Flame "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/flame.py"
    click SC_Reactors "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/reactors.py"
    click SC_PAH "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/pahgrowth.py"
    click SC_SootModels "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/sootmodels.py"
    click SC_SootThermo "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/sootthermo.py"
    click SC_SootGas "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/sootgas.py"
    click SC_SootWrappers "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/sootwrappers.py"
    click SC_SurfaceRxns "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/surfacereactions.py"
    click SC_SolArray "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/solutionarray.py"
    click SC_SolModifier "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/apps/solutionmodifier.py"

    %% Click Events for Reactor Simulation Examples
    click RE_CV "https://github.com/mohammadadib-cu/omnisoot-cv/tree/main/examples/Reactors/ConstantVolume"
    click RE_PSR "https://github.com/mohammadadib-cu/omnisoot-cv/tree/main/examples/Reactors/PerfectlyStirred"
    click RE_PF "https://github.com/mohammadadib-cu/omnisoot-cv/tree/main/examples/Reactors/PlugFlow"

    %% Click Events for Legacy Implementations
    click Legacy_CPFR "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/legacy/cpfr.py"
    click Legacy_PSR "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/legacy/psr.py"
    click Legacy_EPTL "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/legacy/eptlsoot.py"

    %% Click Events for Project Setup and Documentation
    click PS_README "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/README.md"
    click PS_INIT "https://github.com/mohammadadib-cu/omnisoot-cv/blob/main/__init__.py"

    %% Click Event for Helper Libraries
    click HL "https://github.com/mohammadadib-cu/omnisoot-cv/tree/main/lib"

    %% Styles
    classDef ps fill:#FFD3B6,stroke:#333,stroke-width:2px;
    classDef hl fill:#E3DFFD,stroke:#333,stroke-width:2px;
    classDef core fill:#D3E4CD,stroke:#333,stroke-width:2px;
    classDef example fill:#FCF6BD,stroke:#333,stroke-width:2px;
    classDef legacy fill:#FAD4D8,stroke:#333,stroke-width:2px;
    classDef ext fill:#BEE3DB,stroke:#333,stroke-width:2px;
    classDef ui fill:#C3B1E1,stroke:#333,stroke-width:2px;
```
