# amirhossein-naeejnezhad/refrigeration-cycle-model architecture

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

- Interactive diagram: https://gitdiagram.com/amirhossein-naeejnezhad/refrigeration-cycle-model
- Repository: https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model

## Overview

This repository models an R32 vapor-compression refrigeration cycle for data-center cooling. The principal workflow starts with a condenser-water inlet-temperature sweep, designs fixed heat-exchanger conductances, iteratively solves each operating point, reconstructs thermodynamic states and performance, then presents plots and exports tabular results. The map-based compressor model and CoolProp cycle reconstruction form the core physics; LMTD matching couples that physics to the air- and water-side heat exchangers. Source excerpts show the main control flow and core calculations; unsampled notebook behavior is not inferred.

Main entry points: [`src/main.py`](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/main.py) (Study runner), [`src/thermodynamics.py`](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/thermodynamics.py) (Cycle reconstruction), [`src/utils.py`](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/utils.py) (Numeric helpers), [`src/heat_exchanger.py`](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/heat_exchanger.py) (HX design)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Model setup"]
  node_config["Model parameters<br/>[config.py]"]
  node_utilities["Numeric helpers<br/>[utils.py]"]
end

subgraph group_physics["Cycle physics"]
  node_hx_design["HX design<br/>[heat_exchanger.py]"]
  node_hx_matching["LMTD matching<br/>[heat_exchanger.py]"]
  node_cycle_model["Cycle reconstruction<br/>[thermodynamics.py]"]
  node_compressor_map["Compressor map<br/>[compressor.py]"]
end

subgraph group_study["Operating study"]
  node_runner["Study runner<br/>[main.py]"]
  node_operating_solver["Operating solver<br/>[solver.py]"]
end

subgraph group_results["Analysis and results"]
  node_study_output["Tables and CSV<br/>[main.py]"]
  node_performance_plots["Performance plots<br/>[plots_others.py]"]
  node_pressure_study["Pressure-ratio study<br/>[plots_others.py]"]
  node_cycle_diagrams["Cycle diagrams<br/>[plots_ph_ts.py]"]
end

node_user(("Engineer"))
node_coolprop["CoolProp"]

node_user -.->|"runs"| node_runner
node_runner -->|"reads settings"| node_config
node_runner -->|"designs conductance"| node_hx_design
node_hx_design -->|"evaluates nominal cycle"| node_cycle_model
node_runner -->|"solves sweep"| node_operating_solver
node_operating_solver -->|"evaluates cycle"| node_cycle_model
node_operating_solver -->|"updates temperatures"| node_hx_matching
node_cycle_model -->|"evaluates map"| node_compressor_map
node_cycle_model -->|"queries properties"| node_coolprop
node_runner -->|"converts units"| node_utilities
node_hx_design -->|"calculates LMTD"| node_utilities
node_hx_matching -->|"calculates LMTD"| node_utilities
node_runner -->|"builds and exports"| node_study_output
node_runner -->|"plots results"| node_performance_plots
node_runner -->|"plots states"| node_cycle_diagrams
node_runner -->|"runs extrapolation"| node_pressure_study
node_performance_plots -->|"uses plot helper"| node_utilities
node_cycle_diagrams -->|"queries properties"| node_coolprop

click node_runner "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/main.py"
click node_config "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/config.py"
click node_hx_design "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/heat_exchanger.py"
click node_operating_solver "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/solver.py"
click node_hx_matching "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/heat_exchanger.py"
click node_cycle_model "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/thermodynamics.py"
click node_compressor_map "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/compressor.py"
click node_utilities "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/utils.py"
click node_study_output "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/main.py"
click node_performance_plots "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/plots_others.py"
click node_pressure_study "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/plots_others.py"
click node_cycle_diagrams "https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/plots_ph_ts.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_config,node_utilities toneBlue
class node_hx_design,node_hx_matching,node_cycle_model,node_compressor_map toneAmber
class node_runner,node_operating_solver toneMint
class node_study_output,node_performance_plots,node_pressure_study,node_cycle_diagrams toneRose
class node_user,node_coolprop toneIndigo
```

## Components

### Model setup

- [Model parameters](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/config.py): `src/config.py`
- [Numeric helpers](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/utils.py): `src/utils.py`

### Cycle physics

- [HX design](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/heat_exchanger.py): `src/heat_exchanger.py`
- [LMTD matching](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/heat_exchanger.py): `src/heat_exchanger.py`
- [Cycle reconstruction](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/thermodynamics.py): `src/thermodynamics.py`
- [Compressor map](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/compressor.py): `src/compressor.py`

### Operating study

- [Study runner](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/main.py): `src/main.py`
- [Operating solver](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/solver.py): `src/solver.py`

### Analysis and results

- [Tables and CSV](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/main.py): `src/main.py`
- [Performance plots](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/plots_others.py): `src/plots_others.py`
- [Pressure-ratio study](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/plots_others.py): `src/plots_others.py`
- [Cycle diagrams](https://github.com/amirhossein-naeejnezhad/refrigeration-cycle-model/blob/main/src/plots_ph_ts.py): `src/plots_ph_ts.py`

### Other components

- **Engineer**
- **CoolProp**

## Connections

- Engineer → Study runner: runs
- Study runner → Model parameters: reads settings (evidence: `src/main.py`)
- Study runner → HX design: designs conductance (evidence: `src/main.py`)
- HX design → Cycle reconstruction: evaluates nominal cycle (evidence: `src/heat_exchanger.py`)
- Study runner → Operating solver: solves sweep (evidence: `src/main.py`)
- Operating solver → Cycle reconstruction: evaluates cycle (evidence: `src/solver.py`)
- Operating solver → LMTD matching: updates temperatures (evidence: `src/solver.py`)
- Cycle reconstruction → Compressor map: evaluates map (evidence: `src/thermodynamics.py`)
- Cycle reconstruction → CoolProp: queries properties (evidence: `src/thermodynamics.py`)
- Study runner → Numeric helpers: converts units (evidence: `src/main.py`)
- HX design → Numeric helpers: calculates LMTD (evidence: `src/heat_exchanger.py`)
- LMTD matching → Numeric helpers: calculates LMTD (evidence: `src/heat_exchanger.py`)
- Study runner → Tables and CSV: builds and exports (evidence: `src/main.py`)
- Study runner → Performance plots: plots results (evidence: `src/main.py`)
- Study runner → Cycle diagrams: plots states (evidence: `src/main.py`)
- Study runner → Pressure-ratio study: runs extrapolation (evidence: `src/main.py`)
- Performance plots → Numeric helpers: uses plot helper (evidence: `src/plots_others.py`)
- Cycle diagrams → CoolProp: queries properties (evidence: `src/plots_ph_ts.py`)
