# lucianopatruno/phasexpert architecture

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

- Interactive diagram: https://gitdiagram.com/lucianopatruno/phasexpert
- Repository: https://github.com/lucianopatruno/phasexpert

## Overview

PhaseXpert is an iPhone application for traceable thermophysical and phase-property calculations on CO₂-rich mixtures. The principal workflow is entering operating conditions and composition, validating the request, dispatching it through a registered thermodynamic provider, and presenting immutable results with provenance. Users can also save and compare cases, explore phase diagrams and property sweeps, screen streams, estimate impurity reactions, and export reports. The graph follows documented architecture and indexed or excerpted references; unsampled feature internals are represented by their exact source directories.

Main entry points: [`PhaseXpert/Features/Calculator/CalculatorViewModel.swift`](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/Calculator/CalculatorViewModel.swift) (Calculator UI), [`PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift`](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift) (Provider registry), [`PhaseXpert/App/RootView.swift`](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/App/RootView.swift) (App navigation), [`PhaseXpert/Features/StreamScreening/StreamScreeningViewModel.swift`](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/StreamScreening/StreamScreeningViewModel.swift) (Stream screening)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and calculation"]
  node_shell["App navigation<br/>[RootView.swift]"]
  node_calculator["Calculator UI"]
  node_format["Property formatting"]
end

subgraph group_core["Core domain and validation"]
  node_domain["Calculation models"]
  node_composition["Canonical composition"]
  node_validator["Request validation"]
  node_evidence["Validation evidence"]
  node_capability["CCS capabilities"]
end

subgraph group_providers["Thermodynamic providers"]
  node_registry["Provider registry"]
  node_contract["Provider contract"]
  node_coolprop["CoolProp provider"]
  node_coolengine["Native CoolProp engine"]
  node_coolbridge["CoolProp bridge"]
  node_teqp["teqp provider<br/>[TeqpProvider.swift]"]
  node_teqpengine["Native teqp engine"]
  node_teqpbridge["teqp bridge"]
end

subgraph group_analysis["Engineering analysis"]
  node_phase["Phase diagrams"]
  node_phasecore["Phase-map orchestration<br/>[PhaseMap.swift]"]
  node_sweep["Property sweeps"]
  node_screening["Stream screening"]
  node_mixing["Stream mixing<br/>[StreamMixing.swift]"]
  node_reactions["Impurity reactions"]
end

subgraph group_records["Cases and exports"]
  node_cases[("Saved cases")]
  node_export["Calculation exports"]
  node_compare["Case comparison"]
end

node_user(("Engineer"))

node_user -->|"uses"| node_shell
node_shell -->|"opens"| node_calculator
node_shell -->|"opens"| node_phase
node_shell -->|"opens"| node_cases
node_calculator -.->|"creates request"| node_domain
node_calculator -.->|"validates"| node_validator
node_validator -->|"canonicalizes"| node_composition
node_calculator -.->|"dispatches through"| node_registry
node_registry -->|"registers"| node_contract
node_coolprop -->|"conforms to"| node_contract
node_registry -->|"selects"| node_coolprop
node_coolprop -.->|"delegates to"| node_coolengine
node_coolengine -->|"calls"| node_coolbridge
node_teqp -->|"delegates to"| node_teqpengine
node_teqpengine -->|"calls"| node_teqpbridge
node_evidence -->|"evaluates"| node_capability
node_phase -.->|"requests map"| node_phasecore
node_phase -->|"uses providers"| node_registry
node_sweep -->|"uses providers"| node_registry
node_screening -->|"presents screening"| node_screening
node_screening -.->|"uses mixing"| node_mixing
node_cases -->|"compares records"| node_compare
node_cases -->|"exports records"| node_export
node_calculator -.->|"formats values"| node_format
node_reactions -.->|"supports screening"| node_screening

click node_shell "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/App/RootView.swift"
click node_calculator "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/Calculator/CalculatorViewModel.swift"
click node_format "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/Calculator/EngineeringPropertyFormatter.swift"
click node_domain "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Domain/CalculationModels.swift"
click node_composition "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Domain/CanonicalComposition.swift"
click node_validator "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Validation/CalculationValidator.swift"
click node_evidence "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Validation/ValidationEvidenceEvaluator.swift"
click node_capability "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/AdvancedCCSCapabilityMatrix.swift"
click node_registry "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift"
click node_contract "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/ThermodynamicModelProvider.swift"
click node_coolprop "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/CoolPropProvider.swift"
click node_coolengine "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeCoolPropEngine.swift"
click node_coolbridge "https://github.com/lucianopatruno/phasexpert/blob/main/Native/CoolPropBridge/src/PhaseXpertCoolPropBridge.cpp"
click node_teqp "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/TeqpProvider.swift"
click node_teqpengine "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeTeqpEngine.swift"
click node_teqpbridge "https://github.com/lucianopatruno/phasexpert/blob/main/Native/TeqpBridge/src/PhaseXpertTeqpBridge.cpp"
click node_phase "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/PhaseDiagram/PhaseDiagramView.swift"
click node_phasecore "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/PhaseMap.swift"
click node_sweep "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/PropertySweep/MultiCasePropertySweep.swift"
click node_screening "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/StreamScreening/StreamScreeningViewModel.swift"
click node_mixing "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/StreamMixing.swift"
click node_reactions "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/ImpurityReactions.swift"
click node_cases "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/SavedCases/SavedCasesView.swift"
click node_export "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Export/CalculationExport.swift"
click node_compare "https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/SavedCases/CaseBatchComparison.swift"

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_shell,node_calculator,node_format toneBlue
class node_domain,node_composition,node_validator,node_evidence,node_capability toneAmber
class node_registry,node_contract,node_coolprop,node_coolengine,node_coolbridge,node_teqp,node_teqpengine,node_teqpbridge toneMint
class node_phase,node_phasecore,node_sweep,node_screening,node_mixing,node_reactions toneRose
class node_cases,node_export,node_compare,node_user toneIndigo
```

## Components

### App and calculation

- [App navigation](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/App/RootView.swift): `PhaseXpert/App/RootView.swift`
- [Calculator UI](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/Calculator/CalculatorViewModel.swift): `PhaseXpert/Features/Calculator/CalculatorViewModel.swift`
- [Property formatting](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/Calculator/EngineeringPropertyFormatter.swift): `PhaseXpert/Features/Calculator/EngineeringPropertyFormatter.swift`

### Core domain and validation

- [Calculation models](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Domain/CalculationModels.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Domain/CalculationModels.swift`
- [Canonical composition](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Domain/CanonicalComposition.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Domain/CanonicalComposition.swift`
- [Request validation](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Validation/CalculationValidator.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Validation/CalculationValidator.swift`
- [Validation evidence](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Validation/ValidationEvidenceEvaluator.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Validation/ValidationEvidenceEvaluator.swift`
- [CCS capabilities](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/AdvancedCCSCapabilityMatrix.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/AdvancedCCSCapabilityMatrix.swift`

### Thermodynamic providers

- [Provider registry](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift`
- [Provider contract](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/ThermodynamicModelProvider.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/ThermodynamicModelProvider.swift`
- [CoolProp provider](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/CoolPropProvider.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/CoolPropProvider.swift`
- [Native CoolProp engine](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeCoolPropEngine.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeCoolPropEngine.swift`
- [CoolProp bridge](https://github.com/lucianopatruno/phasexpert/blob/main/Native/CoolPropBridge/src/PhaseXpertCoolPropBridge.cpp): `Native/CoolPropBridge/src/PhaseXpertCoolPropBridge.cpp`
- [teqp provider](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/TeqpProvider.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/TeqpProvider.swift`
- [Native teqp engine](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeTeqpEngine.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeTeqpEngine.swift`
- [teqp bridge](https://github.com/lucianopatruno/phasexpert/blob/main/Native/TeqpBridge/src/PhaseXpertTeqpBridge.cpp): `Native/TeqpBridge/src/PhaseXpertTeqpBridge.cpp`

### Engineering analysis

- [Phase diagrams](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/PhaseDiagram/PhaseDiagramView.swift): `PhaseXpert/Features/PhaseDiagram/PhaseDiagramView.swift`
- [Phase-map orchestration](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/PhaseMap.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/PhaseMap.swift`
- [Property sweeps](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/PropertySweep/MultiCasePropertySweep.swift): `PhaseXpert/Features/PropertySweep/MultiCasePropertySweep.swift`
- [Stream screening](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/StreamScreening/StreamScreeningViewModel.swift): `PhaseXpert/Features/StreamScreening/StreamScreeningViewModel.swift`
- [Stream mixing](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/StreamMixing.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/StreamMixing.swift`
- [Impurity reactions](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/ImpurityReactions.swift): `PhaseXpertCore/Sources/PhaseXpertCore/Orchestration/ImpurityReactions.swift`

### Cases and exports

- [Saved cases](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/SavedCases/SavedCasesView.swift): `PhaseXpert/Features/SavedCases/SavedCasesView.swift`
- [Calculation exports](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Export/CalculationExport.swift): `PhaseXpert/Export/CalculationExport.swift`
- [Case comparison](https://github.com/lucianopatruno/phasexpert/blob/main/PhaseXpert/Features/SavedCases/CaseBatchComparison.swift): `PhaseXpert/Features/SavedCases/CaseBatchComparison.swift`

### Other components

- **Engineer**

## Connections

- Engineer → App navigation: uses
- App navigation → Calculator UI: opens (evidence: `PhaseXpert/App/RootView.swift`)
- App navigation → Phase diagrams: opens (evidence: `PhaseXpert/App/RootView.swift`)
- App navigation → Saved cases: opens (evidence: `PhaseXpert/App/RootView.swift`)
- Calculator UI → Calculation models: creates request
- Calculator UI → Request validation: validates
- Request validation → Canonical composition: canonicalizes (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Domain/CanonicalComposition.swift`)
- Calculator UI → Provider registry: dispatches through
- Provider registry → Provider contract: registers (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift`)
- CoolProp provider → Provider contract: conforms to (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift`)
- Provider registry → CoolProp provider: selects (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Providers/ProviderRegistry.swift`)
- CoolProp provider → Native CoolProp engine: delegates to
- Native CoolProp engine → CoolProp bridge: calls (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeCoolPropEngine.swift`)
- teqp provider → Native teqp engine: delegates to (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeTeqpEngine.swift`)
- Native teqp engine → teqp bridge: calls (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Providers/NativeTeqpEngine.swift`)
- Validation evidence → CCS capabilities: evaluates (evidence: `PhaseXpertCore/Sources/PhaseXpertCore/Validation/ValidationEvidenceEvaluator.swift`)
- Phase diagrams → Phase-map orchestration: requests map
- Phase diagrams → Provider registry: uses providers (evidence: `PhaseXpert/Features/PhaseDiagram/PhaseDiagramView.swift`)
- Property sweeps → Provider registry: uses providers (evidence: `PhaseXpert/Features/PropertySweep/MultiCasePropertySweep.swift`)
- Stream screening → Stream screening: presents screening (evidence: `PhaseXpert/Features/StreamScreening/StreamScreeningView.swift`)
- Stream screening → Stream mixing: uses mixing
- Saved cases → Case comparison: compares records
- Saved cases → Calculation exports: exports records (evidence: `PhaseXpert/Features/SavedCases/SavedCasesView.swift`)
- Calculator UI → Property formatting: formats values
- Impurity reactions → Stream screening: supports screening
