# mohibpak/phase-forge architecture

> Architecture diagram of the GitHub repository mohibpak/phase-forge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohibpak/phase-forge
- Repository: https://github.com/mohibpak/phase-forge

## Overview

PhaseForge is an interactive binary-alloy phase-diagram and transformation analysis toolkit. Users choose a built-in alloy or define a custom system, inspect phase fields and tie-line/lever-rule results, explore solidification and cooling simulations, then generate downloadable reports. The computational model, simulation routines, preset data, and report renderer form the internal layers behind the Streamlit application. The README and excerpts establish the main connections; unsampled UI details are not expanded into separate components.

Main entry points: [`app.py`](https://github.com/mohibpak/phase-forge/blob/main/app.py) (Streamlit interface), [`phaseforge/report.py`](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/report.py) (HTML report builder), [`phaseforge/simulation.py`](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/simulation.py) (Solidification tracing), [`phaseforge/core.py`](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py) (Eutectic model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interactive application"]
  node_app["Streamlit interface<br/>[app.py]"]
  node_system_config["Alloy selection<br/>[app.py]"]
  node_phase_view["Phase diagram view<br/>[app.py]"]
  node_tie_analysis["Tie-line analysis<br/>[app.py]"]
  node_path_view["Solidification view<br/>[app.py]"]
  node_cooling_view["Cooling curve view<br/>[app.py]"]
  node_report_view["Report controls<br/>[app.py]"]
end

subgraph group_analysis["Phase analysis"]
  node_diagram_model["Eutectic model<br/>[core.py]"]
  node_phase_regions["Phase classification<br/>[core.py]"]
  node_tie_lever["Tie-line and lever rule<br/>[core.py]"]
end

subgraph group_transformations["Transformation simulation"]
  node_solidification["Solidification tracing<br/>[simulation.py]"]
  node_cooling_model["Cooling simulation<br/>[simulation.py]"]
end

subgraph group_outputs["Reports and presets"]
  node_preset_data["Alloy presets<br/>[presets.py]"]
  node_static_plots["Static plot renderer<br/>[report.py]"]
  node_html_report["HTML report builder<br/>[report.py]"]
end

node_user(("Alloy analyst"))

node_user -->|"uses"| node_app
node_app -->|"presents"| node_system_config
node_system_config -->|"loads preset data"| node_preset_data
node_app -->|"constructs model"| node_diagram_model
node_phase_view -->|"plots curves"| node_diagram_model
node_phase_view -->|"shades fields"| node_phase_regions
node_tie_analysis -->|"classifies point"| node_phase_regions
node_tie_analysis -->|"calculates fractions"| node_tie_lever
node_app -->|"traces path"| node_solidification
node_path_view -->|"plots trajectory"| node_solidification
node_app -->|"simulates cooling"| node_cooling_model
node_cooling_view -->|"plots curve"| node_cooling_model
node_app -->|"builds report"| node_html_report
node_report_view -->|"exports PNG"| node_static_plots
node_html_report -->|"embeds plots"| node_static_plots
node_html_report -->|"includes path results"| node_solidification
node_html_report -->|"includes cooling results"| node_cooling_model

click node_app "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_system_config "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_phase_view "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_tie_analysis "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_path_view "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_cooling_view "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_report_view "https://github.com/mohibpak/phase-forge/blob/main/app.py"
click node_preset_data "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/presets.py"
click node_diagram_model "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py"
click node_phase_regions "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py"
click node_tie_lever "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py"
click node_solidification "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/simulation.py"
click node_cooling_model "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/simulation.py"
click node_static_plots "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/report.py"
click node_html_report "https://github.com/mohibpak/phase-forge/blob/main/phaseforge/report.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_system_config,node_phase_view,node_tie_analysis,node_path_view,node_cooling_view,node_report_view toneBlue
class node_diagram_model,node_phase_regions,node_tie_lever toneAmber
class node_solidification,node_cooling_model toneMint
class node_preset_data,node_static_plots,node_html_report toneRose
class node_user toneIndigo
```

## Components

### Interactive application

- [Streamlit interface](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`
- [Alloy selection](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`
- [Phase diagram view](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`
- [Tie-line analysis](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`
- [Solidification view](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`
- [Cooling curve view](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`
- [Report controls](https://github.com/mohibpak/phase-forge/blob/main/app.py): `app.py`

### Phase analysis

- [Eutectic model](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py): `phaseforge/core.py`
- [Phase classification](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py): `phaseforge/core.py`
- [Tie-line and lever rule](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/core.py): `phaseforge/core.py`

### Transformation simulation

- [Solidification tracing](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/simulation.py): `phaseforge/simulation.py`
- [Cooling simulation](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/simulation.py): `phaseforge/simulation.py`

### Reports and presets

- [Alloy presets](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/presets.py): `phaseforge/presets.py`
- [Static plot renderer](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/report.py): `phaseforge/report.py`
- [HTML report builder](https://github.com/mohibpak/phase-forge/blob/main/phaseforge/report.py): `phaseforge/report.py`

### Other components

- **Alloy analyst**

## Connections

- Alloy analyst → Streamlit interface: uses (evidence: `README.md`)
- Streamlit interface → Alloy selection: presents (evidence: `app.py`)
- Alloy selection → Alloy presets: loads preset data (evidence: `app.py`)
- Streamlit interface → Eutectic model: constructs model (evidence: `app.py`)
- Phase diagram view → Eutectic model: plots curves (evidence: `app.py`)
- Phase diagram view → Phase classification: shades fields (evidence: `app.py`)
- Tie-line analysis → Phase classification: classifies point (evidence: `app.py`)
- Tie-line analysis → Tie-line and lever rule: calculates fractions (evidence: `README.md`)
- Streamlit interface → Solidification tracing: traces path (evidence: `app.py`)
- Solidification view → Solidification tracing: plots trajectory (evidence: `app.py`)
- Streamlit interface → Cooling simulation: simulates cooling (evidence: `app.py`)
- Cooling curve view → Cooling simulation: plots curve (evidence: `app.py`)
- Streamlit interface → HTML report builder: builds report (evidence: `app.py`)
- Report controls → Static plot renderer: exports PNG (evidence: `app.py`)
- HTML report builder → Static plot renderer: embeds plots (evidence: `phaseforge/report.py`)
- HTML report builder → Solidification tracing: includes path results (evidence: `phaseforge/report.py`)
- HTML report builder → Cooling simulation: includes cooling results (evidence: `phaseforge/report.py`)
