# emirhanic/reactorfoam architecture

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

- Interactive diagram: https://gitdiagram.com/emirhanic/reactorfoam
- Repository: https://github.com/emirhanic/reactorfoam

## Overview

##### Project type and purpose
- reactorFoam is a specialized CFD solver built on OpenFOAM-v10. It extends interFoam to handle two incompressible, isothermal immiscible fluids with VOF interface capturing, optional mesh motion/topology changes (adaptive remeshing), plus an optional radioactive‐decay term in the phase‐fraction transport.

##### File structure
- Top level:
- Makefiles (`Allwmake`, `Make/`, `wmake` support) for building against OpenFOAM libraries
- `reactorFoam.C`: the main solver entry point
- Equation headers (`UEqn.H`, `alphaEqn.H`, `pEqn.H`, etc.) that encapsulate individual equation setup/solve
- Subdirectories for two custom libraries:
– `VoFTurbulenceDamping/`: adds turbulence damping logic to the VOF model
– `incompressibleInterPhaseTransportModel/`: encapsulates the immiscible‐phase transport model
- Each library has its own `Make/`, source (*.C), headers (*.H), and `lnInclude/` for OpenFOAM include linking.

##### README for additional insights
- Confirms physics extensions: radioactive decay added to the alpha transport equation
- Build instructions use `wmake` under `$FOAM_APP/solvers`

##### Detail
- Build dependencies: which Makefiles compile which modules
- Optional branches (mesh motion vs. static mesh)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build System Layer
    subgraph "Build System" 
        direction TB
        Allwmake["Allwmake"]:::build
        MakeFolder["Make/"]:::build
    end

    %% Application Layer
    subgraph "reactorFoam Application Code"
        direction TB
        Reactor["reactorFoam.C (main)"]:::app
        subgraph "Equation Modules"
            direction TB
            UEqn["UEqn.H"]:::app
            Alpha["alphaEqn.H"]:::app
            AlphaSubCycle["alphaEqnSubCycle.H"]:::app
            AlphaSuSp["alphaSuSp.H"]:::app
            CorrectPhiInit["initCorrectPhi.H"]:::app
            CorrectPhi["correctPhi.H"]:::app
            CreateRefs["createFieldRefs.H"]:::app
            CreateFields["createFields.H"]:::app
            pEqn["pEqn.H"]:::app
            RhoFs["rhofs.H"]:::app
        end
    end

    %% Custom Libraries Layer
    subgraph "Custom Libraries"
        direction TB
        subgraph "VoFTurbulenceDamping" 
            direction TB
            VTD_C["VoFTurbulenceDamping.C"]:::lib
            VTD_H["VoFTurbulenceDamping.H"]:::lib
            VTD_Make["Make/"]:::lib
            VTD_ln["lnInclude/"]:::lib
        end
        subgraph "InterPhase Transport Model"
            direction TB
            IPT_C["incompressibleInterPhaseTransportModel.C"]:::lib
            IPT_H["incompressibleInterPhaseTransportModel.H"]:::lib
            IPT_Make["Make/"]:::lib
            IPT_ln["lnInclude/"]:::lib
        end
    end

    %% Core Libraries Layer
    subgraph "OpenFOAM Core Libraries"
        direction TB
        FVMatrices["fvMatrices"]:::core
        FinVol["finiteVolume"]:::core
        MeshTools["dynamicMesh modules"]:::core
        IO["IO"]:::core
    end

    %% Data Layer
    subgraph "Data"
        direction TB
        InputData["Mesh & Initial Fields"]:::data
        OutputData["Time-folder Results & Logs"]:::data
    end

    %% Connections
    Allwmake -->|builds| Reactor
    MakeFolder -->|builds| Reactor

    Reactor -->|reads| InputData
    InputData --> CreateFields
    Reactor --> CreateRefs
    Reactor --> CreateFields

    Reactor -->|calls| UEqn
    Reactor -->|calls| Alpha
    Alpha -->|uses| AlphaSubCycle
    Alpha -->|uses| AlphaSuSp
    Alpha -->|plugins| VTD_C
    Alpha -->|plugins| IPT_C

    Reactor -->|calls| pEqn
    Reactor -->|calls| RhoFs
    Reactor -->|initializes| CorrectPhiInit
    Reactor -->|uses| CorrectPhi

    Reactor -->|optionally calls| MeshTools
    Reactor -->|writes| OutputData

    %% External Core Dependencies
    Reactor --> FVMatrices
    Reactor --> FinVol
    Reactor --> IO

    %% Click Events
    click Reactor "https://github.com/emirhanic/reactorfoam/blob/main/reactorFoam.C"
    click UEqn "https://github.com/emirhanic/reactorfoam/blob/main/UEqn.H"
    click Alpha "https://github.com/emirhanic/reactorfoam/blob/main/alphaEqn.H"
    click AlphaSubCycle "https://github.com/emirhanic/reactorfoam/blob/main/alphaEqnSubCycle.H"
    click AlphaSuSp "https://github.com/emirhanic/reactorfoam/blob/main/alphaSuSp.H"
    click CorrectPhi "https://github.com/emirhanic/reactorfoam/blob/main/correctPhi.H"
    click CreateRefs "https://github.com/emirhanic/reactorfoam/blob/main/createFieldRefs.H"
    click CreateFields "https://github.com/emirhanic/reactorfoam/blob/main/createFields.H"
    click pEqn "https://github.com/emirhanic/reactorfoam/blob/main/pEqn.H"
    click RhoFs "https://github.com/emirhanic/reactorfoam/blob/main/rhofs.H"
    click CorrectPhiInit "https://github.com/emirhanic/reactorfoam/blob/main/initCorrectPhi.H"
    click VTD_C "https://github.com/emirhanic/reactorfoam/blob/main/VoFTurbulenceDamping/VoFTurbulenceDamping.C"
    click VTD_H "https://github.com/emirhanic/reactorfoam/blob/main/VoFTurbulenceDamping/VoFTurbulenceDamping.H"
    click VTD_Make "https://github.com/emirhanic/reactorfoam/tree/main/VoFTurbulenceDamping/Make/"
    click VTD_ln "https://github.com/emirhanic/reactorfoam/tree/main/VoFTurbulenceDamping/lnInclude/"
    click IPT_C "https://github.com/emirhanic/reactorfoam/blob/main/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.C"
    click IPT_H "https://github.com/emirhanic/reactorfoam/blob/main/incompressibleInterPhaseTransportModel/incompressibleInterPhaseTransportModel.H"
    click IPT_Make "https://github.com/emirhanic/reactorfoam/tree/main/incompressibleInterPhaseTransportModel/Make/"
    click IPT_ln "https://github.com/emirhanic/reactorfoam/tree/main/incompressibleInterPhaseTransportModel/lnInclude/"
    click Allwmake "https://github.com/emirhanic/reactorfoam/tree/main/Allwmake"
    click MakeFolder "https://github.com/emirhanic/reactorfoam/tree/main/Make/"

    %% Styles
    classDef build fill:#c2f0c2,stroke:#2e7d32,color:#000;
    classDef app fill:#cfe2f3,stroke:#0b5394,color:#000;
    classDef lib fill:#fff2cc,stroke:#b45f06,color:#000;
    classDef core fill:#d9d9d9,stroke:#7f7f7f,color:#000;
    classDef data fill:#f4cccc,stroke:#cc0000,color:#000;
```
