# bykvad/pythermonet architecture

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

- Interactive diagram: https://gitdiagram.com/bykvad/pythermonet
- Repository: https://github.com/bykvad/pythermonet

## Overview

pythermonet is a Python toolkit for thermal-network engineering, particularly dimensioning and thermal analysis of ground-source heat-exchanger systems. Its main design flow represents project inputs and heat-pump loads, dimensions the hydraulic network, sizes borehole or horizontal ground fields, and estimates distribution-pipe thermal effects. The graph preserves BHE/HHE sizing, g-function support, input readers, and the shared physical models. Several connections are based on SOURCE INDEX references rather than inspected call sites; those edges indicate dependencies, not a verified execution sequence.

Main entry points: [`src/pythermonet/dimensioning/BHE/bhe_workflow.py`](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/BHE/bhe_workflow.py) (BHE workflow), [`src/pythermonet/dimensioning/HHE/hhe_workflow.py`](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/HHE/hhe_workflow.py) (HHE workflow), [`src/pythermonet/dimensioning/BHE/borehole_length.py`](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/BHE/borehole_length.py) (Borehole sizing), [`src/pythermonet/dimensioning/ground_field.py`](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/ground_field.py) (Ground-field sizing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Project inputs"]
  node_project_readers["Project readers"]
  node_topology_reader["Topology readers<br/>[read_topology.py]"]
  node_dimensioned_reader["Dimensioned topology"]
  node_load_reader["Load reader"]
  node_heat_pump_reader["Heat-pump reader<br/>[read_heat_pumps.py]"]
end

subgraph group_domain["Network domain"]
  node_ground_loads["Ground loads<br/>[ground_loads.py]"]
  node_heat_pump["Heat pumps<br/>[heat_pump.py]"]
  node_distribution_network["Distribution network"]
  node_pipe_infrastructure["Pipe infrastructure"]
  node_vhe_field["Borehole field<br/>[vhe_field.py]"]
  node_materials["Materials and fluids<br/>[material.py]"]
  node_pipe_segment["Pipe segments<br/>[pipe_segment.py]"]
  node_soil["Soil properties<br/>[soil.py]"]
end

subgraph group_design["Dimensioning"]
  node_bhe_workflow["BHE workflow<br/>[bhe_workflow.py]"]
  node_hhe_workflow["HHE workflow<br/>[hhe_workflow.py]"]
  node_borehole_sizing["Borehole sizing<br/>[borehole_length.py]"]
  node_field_sizing["Ground-field sizing<br/>[ground_field.py]"]
  node_hydraulic_sizing["Hydraulic sizing"]
  node_hydraulic_result["Hydraulic results"]
end

subgraph group_analysis["Physics and simulation"]
  node_gfunction_service["G-function service<br/>[service.py]"]
  node_gfunction_models["G-function models<br/>[models.py]"]
  node_pygfunction_adapter["pygfunction adapter"]
  node_bhe_resistance["Borehole resistance<br/>[bhe_resistance.py]"]
  node_hydraulics["Hydraulic physics<br/>[hydraulics.py]"]
  node_system_gfunctions["System g-functions<br/>[gfunctions.py]"]
  node_hhe_gfunction["HHE g-function<br/>[gfunction.py]"]
  node_hhe_aggregation["HHE aggregation<br/>[aggregation.py]"]
  node_hhe_heat_transfer["HHE heat transfer<br/>[heat_transfer.py]"]
  node_pipe_thermal_model["Pipe thermal model"]
  node_pipe_thermal_runner["Pipe thermal runner"]
  node_thermal_resistances["Thermal resistances"]
  node_sources["Thermal sources<br/>[sources.py]"]
end

node_heat_pump_reader -->|"reads"| node_heat_pump
node_dimensioned_reader -->|"builds"| node_distribution_network
node_dimensioned_reader -->|"uses"| node_pipe_infrastructure
node_dimensioned_reader -->|"uses"| node_hydraulic_result
node_ground_loads -->|"aggregates"| node_heat_pump
node_ground_loads -->|"uses"| node_materials
node_bhe_workflow -->|"uses"| node_ground_loads
node_bhe_workflow -->|"uses"| node_vhe_field
node_bhe_workflow -->|"uses"| node_borehole_sizing
node_bhe_workflow -->|"uses"| node_hydraulic_result
node_bhe_workflow -->|"uses"| node_hydraulics
node_bhe_workflow -->|"uses"| node_pipe_thermal_runner
node_hhe_workflow -->|"uses"| node_ground_loads
node_hhe_workflow -->|"uses"| node_pipe_infrastructure
node_hhe_workflow -->|"uses"| node_field_sizing
node_hhe_workflow -->|"uses"| node_hydraulic_result
node_hhe_workflow -->|"uses"| node_hydraulics
node_hhe_workflow -->|"uses"| node_pipe_thermal_runner
node_borehole_sizing -->|"uses"| node_vhe_field
node_borehole_sizing -->|"uses"| node_bhe_resistance
node_borehole_sizing -->|"uses"| node_sources
node_borehole_sizing -->|"uses"| node_field_sizing
node_field_sizing -->|"adapts"| node_vhe_field
node_field_sizing -->|"uses"| node_pipe_infrastructure
node_field_sizing -->|"uses"| node_hydraulics
node_hydraulic_sizing -->|"uses"| node_hydraulics
node_hydraulic_sizing -->|"produces"| node_hydraulic_result
node_gfunction_service -->|"uses"| node_gfunction_models
node_gfunction_service -->|"delegates"| node_pygfunction_adapter
node_pygfunction_adapter -->|"uses"| node_gfunction_models
node_system_gfunctions -->|"uses"| node_pygfunction_adapter
node_system_gfunctions -->|"uses"| node_hhe_gfunction
node_system_gfunctions -->|"uses"| node_pipe_infrastructure
node_hhe_gfunction -->|"uses"| node_hhe_aggregation
node_hhe_gfunction -->|"uses"| node_hhe_heat_transfer
node_hhe_aggregation -->|"uses"| node_hhe_heat_transfer
node_pipe_thermal_runner -->|"calls"| node_pipe_thermal_model
node_pipe_thermal_model -->|"uses"| node_thermal_resistances
node_pipe_thermal_model -->|"uses"| node_sources
node_bhe_resistance -->|"uses"| node_thermal_resistances
node_pipe_infrastructure -->|"uses"| node_pipe_segment
node_vhe_field -->|"uses"| node_pipe_segment
node_vhe_field -->|"uses"| node_materials
node_materials -->|"extends"| node_soil

click node_project_readers "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_project_inputs.py"
click node_topology_reader "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_topology.py"
click node_dimensioned_reader "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_dimensioned_topology.py"
click node_load_reader "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_aggregated_load.py"
click node_heat_pump_reader "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_heat_pumps.py"
click node_ground_loads "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/ground_loads.py"
click node_heat_pump "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/heat_pump.py"
click node_distribution_network "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/distribution_network.py"
click node_pipe_infrastructure "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/pipe_infrastructure.py"
click node_vhe_field "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/vhe_field.py"
click node_materials "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/core/material.py"
click node_pipe_segment "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/core/pipe_segment.py"
click node_soil "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/core/soil.py"
click node_bhe_workflow "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/BHE/bhe_workflow.py"
click node_hhe_workflow "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/HHE/hhe_workflow.py"
click node_borehole_sizing "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/BHE/borehole_length.py"
click node_field_sizing "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/ground_field.py"
click node_hydraulic_sizing "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/hydraulic_dimensioning.py"
click node_hydraulic_result "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/hydraulic_result.py"
click node_gfunction_service "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/gfunctions/service.py"
click node_gfunction_models "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/gfunctions/models.py"
click node_pygfunction_adapter "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/gfunctions/pygfunction_impl.py"
click node_bhe_resistance "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/bhe_resistance.py"
click node_hydraulics "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/hydraulics.py"
click node_system_gfunctions "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/system/gfunctions.py"
click node_hhe_gfunction "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/HHE/gfunction.py"
click node_hhe_aggregation "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/HHE/aggregation.py"
click node_hhe_heat_transfer "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/HHE/heat_transfer.py"
click node_pipe_thermal_model "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/distribution_pipe_thermal_model.py"
click node_pipe_thermal_runner "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/run_distribution_pipe_thermal_model.py"
click node_thermal_resistances "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/thermal_resistances.py"
click node_sources "https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/sources.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_project_readers,node_topology_reader,node_dimensioned_reader,node_load_reader,node_heat_pump_reader toneBlue
class node_ground_loads,node_heat_pump,node_distribution_network,node_pipe_infrastructure,node_vhe_field,node_materials,node_pipe_segment,node_soil toneAmber
class node_bhe_workflow,node_hhe_workflow,node_borehole_sizing,node_field_sizing,node_hydraulic_sizing,node_hydraulic_result toneMint
class node_gfunction_service,node_gfunction_models,node_pygfunction_adapter,node_bhe_resistance,node_hydraulics,node_system_gfunctions,node_hhe_gfunction,node_hhe_aggregation,node_hhe_heat_transfer,node_pipe_thermal_model,node_pipe_thermal_runner,node_thermal_resistances,node_sources toneRose
```

## Components

### Project inputs

- [Project readers](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_project_inputs.py): `src/pythermonet/input/read_project_inputs.py`
- [Topology readers](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_topology.py): `src/pythermonet/input/read_topology.py`
- [Dimensioned topology](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_dimensioned_topology.py): `src/pythermonet/input/read_dimensioned_topology.py`
- [Load reader](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_aggregated_load.py): `src/pythermonet/input/read_aggregated_load.py`
- [Heat-pump reader](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/input/read_heat_pumps.py): `src/pythermonet/input/read_heat_pumps.py`

### Network domain

- [Ground loads](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/ground_loads.py): `src/pythermonet/components/ground_loads.py`
- [Heat pumps](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/heat_pump.py): `src/pythermonet/components/heat_pump.py`
- [Distribution network](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/distribution_network.py): `src/pythermonet/components/distribution_network.py`
- [Pipe infrastructure](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/pipe_infrastructure.py): `src/pythermonet/components/pipe_infrastructure.py`
- [Borehole field](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/components/vhe_field.py): `src/pythermonet/components/vhe_field.py`
- [Materials and fluids](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/core/material.py): `src/pythermonet/core/material.py`
- [Pipe segments](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/core/pipe_segment.py): `src/pythermonet/core/pipe_segment.py`
- [Soil properties](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/core/soil.py): `src/pythermonet/core/soil.py`

### Dimensioning

- [BHE workflow](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/BHE/bhe_workflow.py): `src/pythermonet/dimensioning/BHE/bhe_workflow.py`
- [HHE workflow](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/HHE/hhe_workflow.py): `src/pythermonet/dimensioning/HHE/hhe_workflow.py`
- [Borehole sizing](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/BHE/borehole_length.py): `src/pythermonet/dimensioning/BHE/borehole_length.py`
- [Ground-field sizing](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/ground_field.py): `src/pythermonet/dimensioning/ground_field.py`
- [Hydraulic sizing](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/hydraulic_dimensioning.py): `src/pythermonet/dimensioning/hydraulic_dimensioning.py`
- [Hydraulic results](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/dimensioning/hydraulic_result.py): `src/pythermonet/dimensioning/hydraulic_result.py`

### Physics and simulation

- [G-function service](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/gfunctions/service.py): `src/pythermonet/gfunctions/service.py`
- [G-function models](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/gfunctions/models.py): `src/pythermonet/gfunctions/models.py`
- [pygfunction adapter](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/gfunctions/pygfunction_impl.py): `src/pythermonet/gfunctions/pygfunction_impl.py`
- [Borehole resistance](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/bhe_resistance.py): `src/pythermonet/physics/bhe_resistance.py`
- [Hydraulic physics](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/hydraulics.py): `src/pythermonet/physics/hydraulics.py`
- [System g-functions](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/system/gfunctions.py): `src/pythermonet/system/gfunctions.py`
- [HHE g-function](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/HHE/gfunction.py): `src/pythermonet/simulation/HHE/gfunction.py`
- [HHE aggregation](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/HHE/aggregation.py): `src/pythermonet/simulation/HHE/aggregation.py`
- [HHE heat transfer](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/HHE/heat_transfer.py): `src/pythermonet/simulation/HHE/heat_transfer.py`
- [Pipe thermal model](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/distribution_pipe_thermal_model.py): `src/pythermonet/simulation/distribution_pipe_thermal_model.py`
- [Pipe thermal runner](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/simulation/run_distribution_pipe_thermal_model.py): `src/pythermonet/simulation/run_distribution_pipe_thermal_model.py`
- [Thermal resistances](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/thermal_resistances.py): `src/pythermonet/physics/thermal_resistances.py`
- [Thermal sources](https://github.com/bykvad/pythermonet/blob/main/src/pythermonet/physics/sources.py): `src/pythermonet/physics/sources.py`

## Connections

- Heat-pump reader → Heat pumps: reads (evidence: `src/pythermonet/input/read_heat_pumps.py`)
- Dimensioned topology → Distribution network: builds (evidence: `src/pythermonet/input/read_dimensioned_topology.py`)
- Dimensioned topology → Pipe infrastructure: uses (evidence: `src/pythermonet/input/read_dimensioned_topology.py`)
- Dimensioned topology → Hydraulic results: uses (evidence: `src/pythermonet/input/read_dimensioned_topology.py`)
- Ground loads → Heat pumps: aggregates (evidence: `src/pythermonet/components/ground_loads.py`)
- Ground loads → Materials and fluids: uses (evidence: `src/pythermonet/components/ground_loads.py`)
- BHE workflow → Ground loads: uses (evidence: `src/pythermonet/dimensioning/BHE/bhe_workflow.py`)
- BHE workflow → Borehole field: uses (evidence: `src/pythermonet/dimensioning/BHE/bhe_workflow.py`)
- BHE workflow → Borehole sizing: uses (evidence: `src/pythermonet/dimensioning/BHE/bhe_workflow.py`)
- BHE workflow → Hydraulic results: uses (evidence: `src/pythermonet/dimensioning/BHE/bhe_workflow.py`)
- BHE workflow → Hydraulic physics: uses (evidence: `src/pythermonet/dimensioning/BHE/bhe_workflow.py`)
- BHE workflow → Pipe thermal runner: uses (evidence: `src/pythermonet/dimensioning/BHE/bhe_workflow.py`)
- HHE workflow → Ground loads: uses (evidence: `src/pythermonet/dimensioning/HHE/hhe_workflow.py`)
- HHE workflow → Pipe infrastructure: uses (evidence: `src/pythermonet/dimensioning/HHE/hhe_workflow.py`)
- HHE workflow → Ground-field sizing: uses (evidence: `src/pythermonet/dimensioning/HHE/hhe_workflow.py`)
- HHE workflow → Hydraulic results: uses (evidence: `src/pythermonet/dimensioning/HHE/hhe_workflow.py`)
- HHE workflow → Hydraulic physics: uses (evidence: `src/pythermonet/dimensioning/HHE/hhe_workflow.py`)
- HHE workflow → Pipe thermal runner: uses (evidence: `src/pythermonet/dimensioning/HHE/hhe_workflow.py`)
- Borehole sizing → Borehole field: uses (evidence: `src/pythermonet/dimensioning/BHE/borehole_length.py`)
- Borehole sizing → Borehole resistance: uses (evidence: `src/pythermonet/dimensioning/BHE/borehole_length.py`)
- Borehole sizing → Thermal sources: uses (evidence: `src/pythermonet/dimensioning/BHE/borehole_length.py`)
- Borehole sizing → Ground-field sizing: uses (evidence: `src/pythermonet/dimensioning/BHE/borehole_length.py`)
- Ground-field sizing → Borehole field: adapts (evidence: `src/pythermonet/dimensioning/ground_field.py`)
- Ground-field sizing → Pipe infrastructure: uses (evidence: `src/pythermonet/dimensioning/ground_field.py`)
- Ground-field sizing → Hydraulic physics: uses (evidence: `src/pythermonet/dimensioning/ground_field.py`)
- Hydraulic sizing → Hydraulic physics: uses (evidence: `src/pythermonet/dimensioning/hydraulic_dimensioning.py`)
- Hydraulic sizing → Hydraulic results: produces (evidence: `src/pythermonet/dimensioning/hydraulic_dimensioning.py`)
- G-function service → G-function models: uses (evidence: `src/pythermonet/gfunctions/service.py`)
- G-function service → pygfunction adapter: delegates (evidence: `src/pythermonet/gfunctions/service.py`)
- pygfunction adapter → G-function models: uses (evidence: `src/pythermonet/gfunctions/pygfunction_impl.py`)
- System g-functions → pygfunction adapter: uses (evidence: `src/pythermonet/system/gfunctions.py`)
- System g-functions → HHE g-function: uses (evidence: `src/pythermonet/system/gfunctions.py`)
- System g-functions → Pipe infrastructure: uses (evidence: `src/pythermonet/system/gfunctions.py`)
- HHE g-function → HHE aggregation: uses (evidence: `src/pythermonet/simulation/HHE/gfunction.py`)
- HHE g-function → HHE heat transfer: uses (evidence: `src/pythermonet/simulation/HHE/gfunction.py`)
- HHE aggregation → HHE heat transfer: uses (evidence: `src/pythermonet/simulation/HHE/aggregation.py`)
- Pipe thermal runner → Pipe thermal model: calls (evidence: `src/pythermonet/simulation/run_distribution_pipe_thermal_model.py`)
- Pipe thermal model → Thermal resistances: uses (evidence: `src/pythermonet/simulation/distribution_pipe_thermal_model.py`)
- Pipe thermal model → Thermal sources: uses (evidence: `src/pythermonet/simulation/distribution_pipe_thermal_model.py`)
- Borehole resistance → Thermal resistances: uses (evidence: `src/pythermonet/physics/bhe_resistance.py`)
- Pipe infrastructure → Pipe segments: uses (evidence: `src/pythermonet/components/pipe_infrastructure.py`)
- Borehole field → Pipe segments: uses (evidence: `src/pythermonet/components/vhe_field.py`)
- Borehole field → Materials and fluids: uses (evidence: `src/pythermonet/components/vhe_field.py`)
- Materials and fluids → Soil properties: extends (evidence: `src/pythermonet/core/soil.py`)
