# combustion-and-propulsion-iitgn/prf-minimal architecture

> Architecture diagram of the GitHub repository combustion-and-propulsion-iitgn/prf-minimal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/combustion-and-propulsion-iitgn/prf-minimal
- Repository: https://github.com/combustion-and-propulsion-iitgn/prf-minimal

## Overview

##### Project Type and Purpose
- This is a scientific simulation framework built on OpenFOAM. It provides:
- A core application (`rocketMotor`) for modeling rocket motor propellant regression and two-phase flows.
- A suite of domain-specific C++ libraries (multiphase models, boundary conditions, interface tracking, heat‐transfer, etc.).
- Post‐processing utilities and function objects for thrust calculation, stream functions, and data mapping.
- Use case: researchers run CFD simulations (single/multiphase) in tutorial or custom cases, compile code with OpenFOAM toolchain, then post-process results.

##### File‐Structure Analysis
Top level:
- `applications/rocketMotor` – custom CFD solver executable.
- `src/` – modular libraries organized by functionality:
– `PhaseSystems` (gas‐particle reaction systems)
– `interfaceTrackingModels`, `interfacialModels` (momentum/heat exchange)
– `fvPatchFields` (custom boundary conditions)
– `multiphaseCompressibleTurbulenceModels` (turbulence closures)
– `phaseModel`, `sharpInterfaceHeatTransferModels`
– `functionObjects` (runtime post‐processors)
- `utilities/` – standalone post‐processing executables.
- `platforms/`, `Make/`, `bashrc`, `Allwmake` – build/config scripts for wmake/OpenFOAM.
Architectural choices:
– Layered C++ libraries (domain modules)
– One core application linking to these libs
– Utilities linking to a subset of libraries
– Build system orchestrates compilation of all components

##### README Insights
- Core application: `rocketMotor` for propellant regression, CD nozzle flows.
- Highlights: custom boundary conditions, multiphase models, function objects, utilities.
- Build: requires sourcing `bashrc`, then `./Allwmake`.

a. Main Components
- OpenFOAM Core (external)
- Build System
– bashrc / environment
– wmake / Allwmake scripts
- Domain Libraries (src/)
– Phase Systems
– Interfacial Models
– fvPatchFields
– Turbulence Models
– Interface Tracking
– Phase Models
– Heat Transfer Models
– Function Objects
- Applications
– rocketMotor
- Utilities
– ReynoldsNumber, mapVolFields, postProcessRocket, rocketConservation, setMultipleAlphaField, setRocketInitField, streamFunction
- Input/Output
– Case directories (tutorials/, user cases)
– Simulation results (fields, logs)
– Post‐processed data
b. Relationships & Data Flow
1. User defines a case directory (mesh, dictionaries).
2. Build system compiles domain libraries and links them into `rocketMotor` and utilities.
3. User runs `rocketMotor` → reads mesh + dictionaries + custom boundary conditions → uses PhaseSystems & InterfacialModels libraries → writes field results.
4. User optionally runs utilities or function objects embedded during simulation → read results → compute thrust, stream function, mapping, etc.
5. Outputs for analysis or validation.
c. Architectural Patterns
- Layered architecture: core physical models separated into libraries.
- Plugin‐style `functionObjects` loaded at runtime.
- Factory patterns in OpenFOAM for boundary conditions (`fvPatchFields`) and interfacial/drift models.
d. Key Technologies & Frameworks
- C++17, OpenFOAM v2112 API
- wmake / Allwmake build system
- GNU Make
- Bash environment setup

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External
    OpenFOAM["OpenFOAM"]:::external

    %% Build System
    subgraph "Build System"
        bashrc["bashrc"]:::build
        Allwmake["Allwmake"]:::build
        MakeDir["Make/"]:::build
    end

    %% Domain Libraries
    subgraph "Domain Libraries (src/)"
        PhaseSystems["PhaseSystems"]:::library
        InterfacialModels["Interfacial Models"]:::library
        InterfaceTrackingModels["Interface Tracking Models"]:::library
        fvPatchFields["fvPatchFields"]:::library
        TurbulenceModels["Multiphase Compressible Turbulence Models"]:::library
        MultiphaseSystem["Multiphase System"]:::library
        PhaseModel["Phase Models"]:::library
        SharpInterfaceHeatTransferModels["Sharp Interface Heat Transfer Models"]:::library
        FunctionObjects["Function Objects"]:::library
    end

    %% Applications and Utilities
    rocketMotor["rocketMotor"]:::executable
    subgraph "Utilities"
        ReynoldsNumber["ReynoldsNumber"]:::executable
        mapVolFields["mapVolFields"]:::executable
        postProcessRocket["postProcessRocket"]:::executable
        rocketConservation["rocketConservation"]:::executable
        setMultipleAlphaField["setMultipleAlphaField"]:::executable
        setRocketInitField["setRocketInitField"]:::executable
        streamFunction["streamFunction"]:::executable
    end

    %% Data
    CaseIO["Case I/O"]:::data
    Results["Simulation Results"]:::data

    %% Connections - Build dependencies
    OpenFOAM --> BuildSystem
    BuildSystem --> PhaseSystems
    BuildSystem --> InterfacialModels
    BuildSystem --> InterfaceTrackingModels
    BuildSystem --> fvPatchFields
    BuildSystem --> TurbulenceModels
    BuildSystem --> MultiphaseSystem
    BuildSystem --> PhaseModel
    BuildSystem --> SharpInterfaceHeatTransferModels
    BuildSystem --> FunctionObjects

    %% Libraries to applications/utilities
    PhaseSystems --> rocketMotor
    InterfacialModels --> rocketMotor
    InterfaceTrackingModels --> rocketMotor
    fvPatchFields --> rocketMotor
    TurbulenceModels --> rocketMotor
    MultiphaseSystem --> rocketMotor
    PhaseModel --> rocketMotor
    SharpInterfaceHeatTransferModels --> rocketMotor
    FunctionObjects --> rocketMotor

    PhaseSystems --> ReynoldsNumber
    PhaseSystems --> mapVolFields
    PhaseSystems --> postProcessRocket
    PhaseSystems --> rocketConservation
    PhaseSystems --> setMultipleAlphaField
    PhaseSystems --> setRocketInitField
    PhaseSystems --> streamFunction

    %% Data flow
    CaseIO --> rocketMotor
    rocketMotor --> Results
    Results --> ReynoldsNumber
    Results --> mapVolFields
    Results --> postProcessRocket
    Results --> rocketConservation
    Results --> setMultipleAlphaField
    Results --> setRocketInitField
    Results --> streamFunction

    %% Click Events
    click bashrc "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/bashrc"
    click Allwmake "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/Allwmake"
    click MakeDir "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/Make/"
    click rocketMotor "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/blob/master/applications/rocketMotor/rocketMotor.C"
    click PhaseSystems "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/PhaseSystems"
    click InterfacialModels "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/interfacialModels"
    click InterfaceTrackingModels "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/interfaceTrackingModels"
    click fvPatchFields "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/fvPatchFields"
    click TurbulenceModels "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/multiphaseCompressibleTurbulenceModels"
    click MultiphaseSystem "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/multiphaseSystem"
    click PhaseModel "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/phaseModel"
    click SharpInterfaceHeatTransferModels "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/sharpInterfaceHeatTransferModels"
    click FunctionObjects "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/src/functionObjects"
    click ReynoldsNumber "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/ReynoldsNumber"
    click mapVolFields "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/mapVolFields"
    click postProcessRocket "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/postProcessRocket"
    click rocketConservation "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/rocketConservation"
    click setMultipleAlphaField "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/setMultipleAlphaField"
    click setRocketInitField "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/setRocketInitField"
    click streamFunction "https://github.com/combustion-and-propulsion-iitgn/prf-minimal/tree/master/utilities/streamFunction"

    %% Styles
    classDef external fill:#AEC6CF,stroke:#000,stroke-width:1px
    classDef build fill:#77DD77,stroke:#000,stroke-width:1px
    classDef library fill:#FDFD96,stroke:#000,stroke-width:1px
    classDef executable fill:#FFB347,stroke:#000,stroke-width:1px
    classDef data fill:#D3D3D3,stroke:#000,stroke-width:1px

    class BuildSystem,bashrc,Allwmake,MakeDir build
    class PhaseSystems,InterfacialModels,InterfaceTrackingModels,fvPatchFields,TurbulenceModels,MultiphaseSystem,PhaseModel,SharpInterfaceHeatTransferModels,FunctionObjects library
    class rocketMotor,ReynoldsNumber,mapVolFields,postProcessRocket,rocketConservation,setMultipleAlphaField,setRocketInitField,streamFunction executable
    class OpenFOAM external
    class CaseIO,Results data
```
