# linzchey/plasma-simulation-code architecture

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

- Interactive diagram: https://gitdiagram.com/linzchey/plasma-simulation-code
- Repository: https://github.com/linzchey/plasma-simulation-code

## Overview

This is a bounded, one-dimensional kinetic particle-in-cell plasma simulator with Monte Carlo collisions and plasma-surface interactions. A user configures a run, the executable constructs and advances the PIC simulation, and diagnostics and particle dumps provide results or support restarting. The graph preserves the documented collision, boundary, field, population-control, multi-species, and diagnostic capabilities. Detailed orchestration evidence is available in main.cpp and pic.h; unsampled implementations are represented only where the README documents the capability.

Main entry points: [`Plasma_Simulation_Code/pic.cpp`](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/pic.cpp) (PIC orchestrator), [`Plasma_Simulation_Code/particle.cpp`](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particle.cpp) (Species particles), [`Plasma_Simulation_Code/input_files/parameters.h`](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/input_files/parameters.h) (Run parameters), [`Plasma_Simulation_Code/main.cpp`](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/main.cpp) (Simulation entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_run["Run setup"]
  node_config["Run parameters<br/>[parameters.h]"]
  node_entry["Simulation entry<br/>[main.cpp]"]
  node_pic["PIC orchestrator<br/>[pic.cpp]"]
end

subgraph group_physics["Plasma physics"]
  node_particles["Species particles<br/>[particle.cpp]"]
  node_particle_data["Particle state<br/>[particleVec.h]"]
  node_fields["Grid fields<br/>[fields.cpp]"]
  node_boundary["Wall interactions<br/>[boundary.cpp]"]
  node_collisions["Collision base<br/>[collisions.cpp]"]
  node_electron_collisions["Electron collisions<br/>[e_collisions.cpp]"]
  node_ion_collisions["Ion collisions<br/>[ion_collisions.cpp]"]
end

subgraph group_diagnostics["Diagnostics and state"]
  node_graphs["Diagnostics<br/>[graphs.cpp]"]
  node_dump["Particle dumps<br/>[particle.cpp]"]
  node_results["Text-file results"]
end

node_user(("Simulation user"))
node_visualizer(("Data visualization"))

node_user -->|"sets parameters"| node_config
node_config -->|"configures"| node_entry
node_entry -->|"starts run"| node_pic
node_pic -->|"advances species"| node_particles
node_pic -->|"uses fields"| node_fields
node_pic -->|"applies boundaries"| node_boundary
node_pic -->|"uses collisions"| node_electron_collisions
node_pic -->|"uses collisions"| node_ion_collisions
node_pic -->|"collects diagnostics"| node_graphs
node_electron_collisions -->|"inherits from"| node_collisions
node_ion_collisions -->|"inherits from"| node_collisions
node_particles -->|"stores particles"| node_particle_data
node_particles -->|"dumps state"| node_dump
node_graphs -->|"writes diagnostics"| node_results
node_dump -->|"writes restart data"| node_results
node_results -->|"feeds data"| node_visualizer

click node_config "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/input_files/parameters.h"
click node_entry "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/main.cpp"
click node_pic "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/pic.cpp"
click node_particles "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particle.cpp"
click node_particle_data "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particleVec.h"
click node_fields "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/fields.cpp"
click node_boundary "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/boundary.cpp"
click node_collisions "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/collisions.cpp"
click node_electron_collisions "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/e_collisions.cpp"
click node_ion_collisions "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/ion_collisions.cpp"
click node_graphs "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/graphs.cpp"
click node_dump "https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particle.cpp"

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_entry,node_pic,node_user toneBlue
class node_particles,node_particle_data,node_fields,node_boundary,node_collisions,node_electron_collisions,node_ion_collisions toneAmber
class node_graphs,node_dump,node_results toneMint
class node_visualizer toneIndigo
```

## Components

### Run setup

- [Run parameters](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/input_files/parameters.h): `Plasma_Simulation_Code/input_files/parameters.h`
- [Simulation entry](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/main.cpp): `Plasma_Simulation_Code/main.cpp`
- [PIC orchestrator](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/pic.cpp): `Plasma_Simulation_Code/pic.cpp`

### Plasma physics

- [Species particles](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particle.cpp): `Plasma_Simulation_Code/particle.cpp`
- [Particle state](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particleVec.h): `Plasma_Simulation_Code/particleVec.h`
- [Grid fields](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/fields.cpp): `Plasma_Simulation_Code/fields.cpp`
- [Wall interactions](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/boundary.cpp): `Plasma_Simulation_Code/boundary.cpp`
- [Collision base](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/collisions.cpp): `Plasma_Simulation_Code/collisions.cpp`
- [Electron collisions](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/e_collisions.cpp): `Plasma_Simulation_Code/e_collisions.cpp`
- [Ion collisions](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/ion_collisions.cpp): `Plasma_Simulation_Code/ion_collisions.cpp`

### Diagnostics and state

- [Diagnostics](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/graphs.cpp): `Plasma_Simulation_Code/graphs.cpp`
- [Particle dumps](https://github.com/linzchey/plasma-simulation-code/blob/master/Plasma_Simulation_Code/particle.cpp): `Plasma_Simulation_Code/particle.cpp`
- **Text-file results**

### Other components

- **Simulation user**
- **Data visualization**

## Connections

- Simulation user → Run parameters: sets parameters (evidence: `README.md`)
- Run parameters → Simulation entry: configures (evidence: `Plasma_Simulation_Code/main.cpp`)
- Simulation entry → PIC orchestrator: starts run (evidence: `Plasma_Simulation_Code/main.cpp`)
- PIC orchestrator → Species particles: advances species
- PIC orchestrator → Grid fields: uses fields
- PIC orchestrator → Wall interactions: applies boundaries
- PIC orchestrator → Electron collisions: uses collisions
- PIC orchestrator → Ion collisions: uses collisions
- PIC orchestrator → Diagnostics: collects diagnostics
- Electron collisions → Collision base: inherits from
- Ion collisions → Collision base: inherits from
- Species particles → Particle state: stores particles
- Species particles → Particle dumps: dumps state (evidence: `Plasma_Simulation_Code/particle.cpp`)
- Diagnostics → Text-file results: writes diagnostics (evidence: `README.md`)
- Particle dumps → Text-file results: writes restart data (evidence: `README.md`)
- Text-file results → Data visualization: feeds data (evidence: `README.md`)
