Skip to content

Commit fc768fa

Browse files
authored
Merge pull request #2 from budjensen/revert-my-edits
Revert my edits
2 parents d167494 + 0837e05 commit fc768fa

File tree

2 files changed

+2
-35
lines changed

2 files changed

+2
-35
lines changed

README.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,2 @@
11
# test-particle-sim-1D
22
Test particle simulator for APC 524
3-
4-
Many graduate-level PIC codes are not designed for computational efficiency. One main focus of this code will be writing a simple but high-performance Python-based test particle code that emphasizes clean software design and efficient data handling.
5-
6-
The code will be structured around a Particle class that can initialize arrays of particles, calculate electric and magnetic fields, and integrate particle motion given time step, background density, and other simulation parameters. The main goals are to:
7-
Implement a minimal framework that can later include collisions and magnetic fields.
8-
Ensure the code is modular, efficient, and easy to expand.
9-
10-
Primary distinction between the two data storage strategies:
11-
12-
In an Array of Structures (AoS), each particle object contains its own properties—position, velocity, charge, and mass. These are stored together in memory for each particle. This layout is straightforward but inefficient for large-scale operations, since it requires looping through many small objects in memory.
13-
14-
In a Structure of Arrays (SoA), particle properties are stored as separate arrays (one array for all positions, one for all velocities, etc.). This allows operations to be vectorized and performed efficiently using NumPy without loops.
15-
16-
The Structure of Arrays approach will be implemented for better performance and cache locality, especially important as particle counts scale to tens or hundreds of thousands. This choice also simplifies vectorized updates in Python, where loop-based approaches are inherently slower.
17-
18-
The initial goal is to implement a collisionless test-particle simulation. The code will:
19-
20-
Initialize charged particles with specified masses, charges, and velocities.
21-
Integrate their motion through predefined electric or magnetic fields.
22-
Record diagnostics such as particle positions, velocities, and energies.
23-
24-
The first validation case will simulate a magnetic mirror, where a static magnetic field varies along one spatial dimension:
25-
The field will be strongest at both ends of the domain and weakest at the center.
26-
Particles initialized at the midplane should reflect at the appropriate turning points due to conservation of the adiabatic invariant (μB = constant).
27-
28-
This test case verifies correct motion integration and conservation laws without the need for a self-consistent field solve or collisions. The simulation will use an input file structure specifying:
29-
30-
Simulation domain and time step.
31-
Field definitions (E, B, or both).
32-
Particle information (mass, charge, count, and initial velocities/positions).
33-
Collisions (to be added later).
34-
35-
The input system should easily switch between cases, such as electrons in a magnetic mirror or ions in a sheath.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "test-particle-sim-1d"
33
version = "0.1.0"
4-
description = "1D Test Particle Simulator for APC 524 Term Project"
4+
description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.12"
7-
dependencies = ["numpy>=1.26"]
7+
dependencies = []

0 commit comments

Comments
 (0)