Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5b7d068
twobody interactions as input
haykh May 12, 2026
1b19e2c
Merge branch '1.4.0rc' into dev/qed
haykh May 12, 2026
554e172
qed input params + caller in srpic.hpp
haykh May 12, 2026
d9930b8
compton tests
haykh May 14, 2026
388d9af
extra injector for single species
haykh May 14, 2026
a09db82
qed incorporated
haykh May 14, 2026
d70b393
twobody interactions as input
haykh May 12, 2026
f687ac6
qed input params + caller in srpic.hpp
haykh May 12, 2026
5b41982
compton tests
haykh May 14, 2026
2ef59cb
extra injector for single species
haykh May 14, 2026
5cfc138
qed incorporated
haykh May 14, 2026
7ae4cde
Merge branch 'dev/qed' of github.com:entity-toolkit/entity into dev/qed
haykh May 15, 2026
4c11843
rebased
haykh May 15, 2026
4f6d914
tests for compton fixed (proper cross section)
haykh May 15, 2026
e6f4c48
fmt script updated
haykh May 15, 2026
7f57abb
clang-tidy recommendations
haykh May 15, 2026
ca6470f
Merge branch '1.5.0rc' into dev/qed
haykh May 18, 2026
5cd3de6
Merge branch 'dev/momsmooth' into dev/qed
haykh May 18, 2026
5ca3bd2
confine zerofill only to necessary components
haykh May 21, 2026
5722ca4
support for average V scalar
haykh May 21, 2026
8db0b2b
single species nonuniform injector
haykh May 21, 2026
99f1b1f
Merge branch 'dev/momsmooth' into dev/qed
haykh May 21, 2026
a1ff3c0
Merge branch 'master' into dev/qed
haykh May 21, 2026
0933873
Merge branch '1.5.0rc' into dev/qed
haykh May 21, 2026
2ed90d3
upd
haykh Jun 9, 2026
3beef39
nix modules upd
haykh Jun 20, 2026
8084fa6
rms
haykh Jun 29, 2026
6ed5c5a
rms pgen
haykh Jun 29, 2026
6a62202
minor fixes for nvcc
haykh Jul 20, 2026
417beb4
nvcc 12.8 weirdness fix
haykh Jul 20, 2026
4bcd2d0
rms setup change
haykh Sep 7, 2026
2f93c2f
Merge branch 'master' into dev/qed
haykh Sep 14, 2026
8ff60c7
merged to 1.5.0rc
haykh Sep 14, 2026
6926b87
version fixed
haykh Sep 14, 2026
95a3590
post merge bugs fixed
haykh Sep 14, 2026
277eb74
devenv setup
haykh Sep 14, 2026
4574ccc
Merge branch 'dev/qed' of github.com:entity-toolkit/entity into dev/qed
haykh Sep 14, 2026
95efd53
merge 1.5.0rc
haykh Sep 28, 2026
a9a7086
tiling bugfix
haykh Sep 28, 2026
59ce8f1
tutorial cartesian sr input
haykh Oct 5, 2026
3f98548
Merge branch '1.5.0rc' into dev/qed
haykh Oct 5, 2026
0b4652d
Merge remote-tracking branch 'origin/1.5.0rc' into dev/qed
haykh Oct 5, 2026
da39e2b
cartesian sr tutorial upd
haykh Oct 6, 2026
67cc529
minor schema upd + kompaneets test upd
haykh Oct 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ ignore-*
tombi/
tidy/
.claude
.understand-anything

# devenv
.devenv*
Expand Down
2 changes: 1 addition & 1 deletion CODEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ entity
│ ├── styling.cmake # styling functions
│ └── tests.cmake # root cmake for tests
├── dev # developer-specific tools
│ ├── nix # nix-shells
│ ├── nix # nix-shell & devenv environments
│ ├── runners # dockerfiles for github runners on different architectures
│ ├── scripts # developer-specific scripts
│ ├── Dockerfile.common # parent docker environment for development
Expand Down
1 change: 1 addition & 0 deletions dev/nix/adios2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ stdenv.mkDerivation {
];

propagatedBuildInputs = [
pkgs.libgcc
pkgs.gcc15
]
++ (
Expand Down
2 changes: 1 addition & 1 deletion dev/nix/devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
},
"root": "root",
"version": 7
}
}
1 change: 1 addition & 0 deletions dev/nix/kokkos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let
];
"NONE" = [
pkgs.clang-tools
pkgs.libgcc
pkgs.gcc15
];
};
Expand Down
62 changes: 31 additions & 31 deletions dev/scripts/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@
verify=false

for arg in "$@"; do
case $arg in
--verify) verify=true ;;
esac
case $arg in
--verify) verify=true ;;
esac
done

if $verify; then
diff_output=""
diff_output=""

if command -v cmake-format &>/dev/null; then
while IFS= read -r -d '' f; do
if ! diff -q <(cmake-format "$f") "$f" &>/dev/null; then
diff_output+=" $f\n"
fi
done < <(find cmake/ src/ minimal/ tests/ -type f \( -name "*.cmake" -o -name "*.txt" \) -print0)
fi
if command -v cmake-format &>/dev/null; then
while IFS= read -r -d '' f; do
if ! diff -q <(cmake-format "$f") "$f" &>/dev/null; then
diff_output+=" $f\n"
fi
done < <(find cmake/ src/ minimal/ tests/ -type f \( -name "*.cmake" -o -name "*.txt" \) -print0)
fi

if command -v clang-format &>/dev/null; then
while IFS= read -r -d '' f; do
if ! clang-format --style=file --dry-run --Werror "$f" &>/dev/null; then
diff_output+=" $f\n"
fi
done < <(find pgens/ src/ minimal/ tests/ -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) -print0)
fi
if command -v clang-format &>/dev/null; then
while IFS= read -r -d '' f; do
if ! clang-format --style=file --dry-run --Werror "$f" &>/dev/null; then
diff_output+=" $f\n"
fi
done < <(find pgens/ examples/ tutorials/ src/ minimal/ tests/ -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) -print0)
fi

if [ -n "$diff_output" ]; then
echo "Formatting check failed. The following files need formatting:"
printf "$diff_output"
exit 1
else
echo "All files are properly formatted."
fi
if [ -n "$diff_output" ]; then
echo "Formatting check failed. The following files need formatting:"
printf '%s' "$diff_output"
exit 1
else
echo "All files are properly formatted."
fi
else
if command -v cmake-format &>/dev/null; then
find cmake/ src/ minimal/ tests/ -type f -name "*.cmake" -o -name "*.txt" | xargs cmake-format -i
fi
if command -v cmake-format &>/dev/null; then
find cmake/ src/ minimal/ tests/ \( -type f -name "*.cmake" -o -name "*.txt" \) -exec cmake-format -i {} \;
fi

if command -v clang-format &>/dev/null; then
find pgens/ src/ minimal/ tests/ -type f -name "*.cpp" -o -name "*.hpp" -o -name "*.h" | xargs clang-format --style=file -i
fi
if command -v clang-format &>/dev/null; then
find pgens/ src/ minimal/ tests/ examples/ pgens/ tutorials/ \( -type f -name "*.cpp" -o -name "*.hpp" -o -name "*.h" \) -exec clang-format --style=file -i {} \;
fi
fi
98 changes: 96 additions & 2 deletions entity.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"$id": "https://entity-toolkit.github.io/schema/entity.schema.json",
"title": "entity",
"description": "Entity simulation input file",
"$comment": "GENERATOR CONVENTION -- this schema is the single source of truth for `input.template.toml`. Standard keywords carry the machine-checkable part (type/enum/minimum/maximum/items/prefixItems/minItems/maxItems/pattern/default/required/deprecated). The `x-entity` object carries the parts JSON Schema cannot express, all verbatim from the template comments: `type` = the literal `@type:` annotation (use it for the comment line whenever present, else derive from the standard keywords); `default` = the literal `@default:` annotation (use it whenever present, else format the standard `default`); `notes` = ordered `@note:` lines; `examples` = ordered `@example:` lines; `enum` = an illustrative, NON-exhaustive value list that must not be validated as a real `enum`; `deprecated` = the `@deprecated:` text. `x-entity.inferred` on an object lists quantities the code derives rather than reads; they are NOT valid input keys (so they are absent from `properties` and rejected by `additionalProperties: false`) and should be emitted as an `@inferred:` comment block after that table's own keys and before its sub-tables. Property order in `properties` is the emission order. Objects with `additionalProperties: true` are free-form. `$ref` is used once, for `$defs/colormap`.",
"$comment": "GENERATOR CONVENTION -- this schema is the single source of truth for `input.default.toml`. Standard keywords carry the machine-checkable part (type/enum/minimum/maximum/items/prefixItems/minItems/maxItems/pattern/default/required/deprecated). The `x-entity` object carries the parts JSON Schema cannot express, all verbatim from the template comments: `type` = the literal `@type:` annotation (use it for the comment line whenever present, else derive from the standard keywords); `default` = the literal `@default:` annotation (use it whenever present, else format the standard `default`); `notes` = ordered `@note:` lines; `examples` = ordered `@example:` lines; `enum` = an illustrative, NON-exhaustive value list that must not be validated as a real `enum`; `deprecated` = the `@deprecated:` text. `x-entity.inferred` on an object lists quantities the code derives rather than reads; they are NOT valid input keys (so they are absent from `properties` and rejected by `additionalProperties: false`) and should be emitted as an `@inferred:` comment block after that table's own keys and before its sub-tables. Property order in `properties` is the emission order. Objects with `additionalProperties: true` are free-form. `$ref` is used once, for `$defs/colormap`.",
"type": "object",
"additionalProperties": false,
"required": [
Expand Down Expand Up @@ -844,6 +844,100 @@
}
}
},
"two_body": {
"description": "Parameters for two-body interactions",
"type": "object",
"additionalProperties": false,
"properties": {
"thomson_optical_depth": {
"description": "Nominal Thomson optical depth: `tau = n0 * sigma_T * 1` over a distance of 1 in physical units (n0 = nominal density)",
"type": "number",
"exclusiveMinimum": 0.0,
"default": 1.0
},
"interaction": {
"description": "Specific interaction parameters",
"type": "array",
"minItems": 1,
"x-entity": {
"array_of_tables": true
},
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"type",
"group1"
],
"properties": {
"type": {
"description": "Type of the two-body interaction",
"anyOf": [
{
"enum": [
"Compton"
]
},
{
"type": "string",
"pattern": "(?i)^(Compton)$"
}
],
"x-entity": {
"type": "string"
}
},
"group1": {
"description": "First group of species indices participating in the interaction",
"type": "array",
"minItems": 1,
"items": {
"type": "integer",
"minimum": 1
}
},
"group2": {
"description": "Second group of species indices participating in the interaction",
"type": "array",
"minItems": 0,
"default": [],
"x-entity": {
"notes": [
"For interactions between particles of the same group, leave `group2` empty"
]
},
"items": {
"type": "integer",
"minimum": 1
}
},
"interval": {
"description": "Interval in timesteps between checking for the interaction",
"type": "integer",
"minimum": 1,
"default": 1
},
"tile_size": {
"description": "Size of interaction tile in cells",
"type": "integer",
"minimum": 1,
"default": 4
},
"recoil1": {
"description": "Whether to apply recoil to the first group of particles",
"type": "boolean",
"default": true
},
"recoil2": {
"description": "Whether to apply recoil to the second group of particles",
"type": "boolean",
"default": true
}
}
}
}
}
},
"algorithms": {
"description": "Algorithm and solver tuning",
"type": "object",
Expand Down Expand Up @@ -1650,7 +1744,7 @@
"e_min": {
"description": "Minimum energy for the spectra output",
"type": "number",
"exclusiveMinimum": 0.0,
"minimum": 0.0,
"default": 0.001,
"x-entity": {
"type": "float",
Expand Down
63 changes: 63 additions & 0 deletions examples/compton_jones/compton_jones.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import nt2
import matplotlib.pyplot as plt
import numpy as np

data = nt2.Data("compton_jones")

photons = data.particles.sel(sp=3).isel(t=-1).load()
photons = photons[np.sqrt(photons.ux**2 + photons.uy**2 + photons.uz**2) > 0.01]

plt.rcParams["figure.dpi"] = 300
plt.rcParams["font.family"] = "serif"
plt.rcParams["mathtext.fontset"] = "stix"

fig = plt.figure(figsize=(9, 4))
gs = fig.add_gridspec(1, 2, wspace=0.35)
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1])

gamma = np.sqrt(1 + data.attrs["setup.electron_4vel"] ** 2)
e0 = data.attrs["setup.photon_energy"]
Gamma = 4 * e0 * gamma
emax = gamma * Gamma / (1 + Gamma)

es = data.spectra.E[1:-1] / emax

dnde = data.spectra.N_3.isel(t=-1)[1:-1]
dnde /= np.trapezoid(dnde, es)
ax1.plot(es, dnde)

es = np.linspace(es.values.min(), es.values.max(), 250)
qs = es / (1 + Gamma * (1 - es))
dnde_th = (
2 * qs * np.log(qs)
+ (1 + 2 * qs) * (1 - qs)
+ 0.5 * Gamma**2 * qs**2 / (1 + Gamma * qs) * (1 - qs)
)

dnde_th /= np.trapezoid(dnde_th, es)

ax1.plot(es, dnde_th, c="k", ls=":")
ax1.set(
xlim=(0, 1),
ylim=(0, 4),
xlabel=r"$\varepsilon_{\rm ph} / \varepsilon_{\rm max}$",
ylabel=r"$dn_{\rm ph}/d\varepsilon_{\rm ph}$",
)

plt.scatter(
photons.ux / emax,
photons.uy / emax,
s=1,
linewidth=0,
)
xs = np.linspace(0, 1, 100)
ys = 2 / gamma * xs
ax2.plot(xs, ys, c="k", ls="--", lw=0.5)
ax2.plot(xs, -ys, c="k", ls="--", lw=0.5)
ax2.set(
xlabel=r"$p_{\rm ph}^x / \varepsilon_{\rm max}$",
ylabel=r"$p_{\rm ph}^y / \varepsilon_{\rm max}$",
)

plt.savefig("compton_jones.png", bbox_inches="tight")
89 changes: 89 additions & 0 deletions examples/compton_jones/compton_jones.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[simulation]
name = "compton_jones"
engine = "srpic"
runtime = 10.0

[grid]
resolution = [32, 32]
extent = [[0.0, 1.0], [0.0, 1.0]]

[grid.metric]
metric = "minkowski"

[grid.boundaries]
fields = [["PERIODIC"], ["PERIODIC"]]
particles = [["PERIODIC"], ["PERIODIC"]]

[scales]
larmor0 = 1.0
skindepth0 = 1.0

[two_body]
thomson_optical_depth = 100.0

[[two_body.interaction]]
type = "compton"
group1 = [1]
group2 = [2]
interval = 1
tile_size = 5
recoil1 = false
recoil2 = true

[algorithms]
current_filters = 0

[algorithms.deposit]
enable = false

[algorithms.fieldsolver]
enable = false

[particles]
ppc0 = 5.0
clear_interval = 1

[[particles.species]]
label = "e-"
mass = 1.0
charge = -1.0
maxnpart = 1e6

[[particles.species]]
label = "ph"
mass = 0.0
charge = 0.0
maxnpart = 1e6

[[particles.species]]
label = "ph_out"
mass = 0.0
charge = 0.0
maxnpart = 1e7
pusher = "none"

[setup]
electron_4vel = 999.9995
photon_energy = 1e-2

[output]
interval_time = 9.0

[output.fields]
quantities = ["N_1", "N_2", "N_3"]

[output.particles]
species = [1, 2, 3]
stride = 1

[output.spectra]
log_bins = false
e_min = 0
e_max = 1100
n_bins = 100

[output.stats]
quantities = ["T00_1", "T00_2", "T00_3"]

[checkpoint]
keep = 0
Loading
Loading