Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d91090f
cooling -> radiative drag + param overhaul
haykh Jan 6, 2026
6d9eb8b
parameters reader refactor (CPUTEST)
haykh Jan 8, 2026
e18b72f
refactored params even further (CPUTEST)
haykh Jan 8, 2026
1802bae
fixed cmake for params (CPUTEST)
haykh Jan 9, 2026
0567440
added header comments
haykh Jan 9, 2026
9b519bb
further simplified params reading for grid (CPUTEST)
haykh Jan 9, 2026
46dc068
algorithms parameter reader (CPUTEST)
haykh Jan 9, 2026
c1a6a27
minor bug in algorithm param (CPUTEST)
haykh Jan 9, 2026
29f1595
prtl pusher is now an bit-int (CPUTEST)
haykh Jan 9, 2026
68a6a11
minor str issue for clang
haykh Jan 12, 2026
bf7ff96
pusher kernel sr constructor simplified (CPUTEST)
haykh Jan 12, 2026
727c023
radiation drag & emission policy separated
haykh Jan 19, 2026
cf7f9ed
CPUTEST
haykh Jan 19, 2026
784dd5b
dependencies script (no cluster presets yet)
haykh Jan 20, 2026
f4740be
concepts revised
haykh Jan 22, 2026
a1ab3cb
compatibility partially fixed (WIP)
haykh Jan 25, 2026
2e140cc
Gate engine instantiations by PGen compatibility
haykh Jan 25, 2026
362a44a
Limit engine instantiations to pgen specializations
haykh Jan 25, 2026
135b8bf
Inline engine template definitions
haykh Jan 25, 2026
58aa480
fixed pgen compatibility issue
haykh Jan 25, 2026
4da54f2
Merge pull request #4 from haykh/codex/restrict-engine-metric-combina…
haykh Jan 25, 2026
4f98353
fixed namespacing in pgens (CPUTEST)
haykh Jan 25, 2026
a72903a
Merge pull request #171 from haykh/dev/emission
haykh Jan 25, 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,178 changes: 1,178 additions & 0 deletions dependencies.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dev/nix/kokkos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ let
rocprim
rocminfo
rocm-smi
pkgs.llvmPackages_19.clang-tools
];
"CUDA" = with pkgs.cudaPackages; [
llvmPackages_18.clang-tools
llvmPackages_19.clang-tools
cudatoolkit
cuda_cudart
pkgs.gcc13
];
"NONE" = [
pkgs.llvmPackages_18.clang-tools
pkgs.llvmPackages_19.clang-tools
pkgs.gcc13
];
};
Expand Down
87 changes: 74 additions & 13 deletions input.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,59 @@
# @from: `scales.larmor0`
# @value: `1 / larmor0`

[radiation]
[radiation.drag]
[radiation.drag.synchrotron]
# Radiation reaction limit gamma-factor for synchrotron
# @type: float [> 0.0]
# @default: 1.0
# @note: [required] if one of the species has `radiative_drag = "synchrotron"`
gamma_rad = ""

[radiation.drag.compton]
# Radiation reaction limit gamma-factor for Compton drag
# @type: float [> 0.0]
# @default: 1.0
# @note: [required] if one of the species has `radiative_drag = "compton"`
gamma_rad = ""

[radiation.emission]
[radiation.emission.synchrotron]
# Gamma-factor of a particle emitting synchrotron photons at energy `m0 c^2` in fiducial magnetic field `B0`
# @type: float [> 1.0]
# @default: 10.0
gamma_qed = ""
# Minimum photon energy for synchrotron emission (units of `m0 c^2`)
# @type: float [> 0.0]
# @default: 1e-4
photon_energy_min = ""
# Weights for the emitted synchrotron photons
# @type: float [> 0.0]
# @default: 1.0
photon_weight = ""
# Index of species for the emitted photon
# @type: ushort [> 0]
# @required
photon_species = ""

[radiation.emission.compton]
# Gamma-factor of a particle emitting inverse Compton photons at energy `m0 c^2` in fiducial magnetic field `B0`
# @type: float [> 1.0]
# @default: 10.0
gamma_qed = ""
# Minimum photon energy for inverse Compton emission (units of `m0 c^2`)
# @type: float [> 0.0]
# @default: 1e-4
photon_energy_min = ""
# Weights for the emitted inverse Compton photons
# @type: float [> 0.0]
# @default: 1.0
photon_weight = ""
# Index of species for the emitted photon
# @type: ushort [> 0]
# @required
photon_species = ""

[algorithms]
# Number of current smoothing passes
# @type: ushort [>= 0]
Expand Down Expand Up @@ -224,10 +277,12 @@
# @type: bool
# @default: true
enable = ""
# Order of the particle shape function
# @type: int
# @default: 1
order = ""

# @inferred:
# - order
# @brief: order of the particle shape function
# @from: compile-time definition `shape_order`
# @type: ushort [0 -> 10]

[algorithms.gr]
# Stepsize for numerical differentiation in GR pusher
Expand All @@ -250,16 +305,13 @@
# @note: When `larmor_max` == 0, the limit is disabled
larmor_max = ""

[algorithms.synchrotron]
# Radiation reaction limit gamma-factor for synchrotron
# @type: float [> 0.0]
# @default: 1.0
# @note: [required] if one of the species has `cooling = "synchrotron"`
gamma_rad = ""

# Stencil coefficients for the field solver [notation as in Blinne+ (2018)]
# @note: Standard Yee solver: `delta_i = beta_ij = 0.0`
[algorithms.fieldsolver]
# Enable the fieldsolver
# @type: bool
# @default: true
enable = ""
# delta_x coefficient (for `F_{i +/- 3/2, j, k}`)
# @type: float
# @default: 0.0
Expand Down Expand Up @@ -366,8 +418,17 @@
# Radiation reaction to use for the species
# @type: string
# @default: "None"
# @enum: "None", "Synchrotron"
cooling = ""
# @enum: "None", "Synchrotron", "Compton"
# @note: Can also be coma-separated combination, e.g., "Synchrotron,Compton"
# @note: Relevant radiation.drag parameters should also be provided
radiative_drag = ""
# Particle emission policy for the species
# @type: string
# @default: "None"
# @enum: "None", "Synchrotron", "Compton", "StrongFieldPP"
# @note: Only one emission mechanism allowed
# @note: Appropriate radiation drag flag will be applied automatically (unless explicitly set to "None")
emission = ""

# Parameters for specific problem generators and setups
[setup]
Expand Down
20 changes: 14 additions & 6 deletions pgens/accretion/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#include "global.h"

#include "arch/kokkos_aliases.h"
#include "arch/traits.h"
#include "utils/numeric.h"

#include "archetypes/energy_dist.h"
#include "archetypes/particle_injector.h"
#include "archetypes/problem_generator.h"
#include "archetypes/spatial_dist.h"
#include "archetypes/traits.h"
#include "framework/domain/metadomain.h"

#include "kernels/particle_moments.hpp"
Expand Down Expand Up @@ -43,7 +43,8 @@ namespace user {
TWO * metric.spin() * g_00);
}

Inline auto bx1(const coord_t<D>& x_Ph) const -> real_t { // at ( i , j + HALF )
Inline auto bx1(const coord_t<D>& x_Ph) const
-> real_t { // at ( i , j + HALF )
coord_t<D> xi { ZERO }, x0m { ZERO }, x0p { ZERO };
metric.template convert<Crd::Ph, Crd::Cd>(x_Ph, xi);

Expand All @@ -61,7 +62,8 @@ namespace user {
}
}

Inline auto bx2(const coord_t<D>& x_Ph) const -> real_t { // at ( i + HALF , j )
Inline auto bx2(const coord_t<D>& x_Ph) const
-> real_t { // at ( i + HALF , j )
coord_t<D> xi { ZERO }, x0m { ZERO }, x0p { ZERO };
metric.template convert<Crd::Ph, Crd::Cd>(x_Ph, xi);

Expand Down Expand Up @@ -197,11 +199,17 @@ namespace user {
template <SimEngine::type S, class M>
struct PGen : public arch::ProblemGenerator<S, M> {
// compatibility traits for the problem generator
static constexpr auto engines { traits::compatible_with<SimEngine::GRPIC>::value };
static constexpr auto engines {
arch::traits::pgen::compatible_with<SimEngine::GRPIC>::value
};
static constexpr auto metrics {
traits::compatible_with<Metric::Kerr_Schild, Metric::QKerr_Schild, Metric::Kerr_Schild_0>::value
arch::traits::pgen::compatible_with<Metric::Kerr_Schild,
Metric::QKerr_Schild,
Metric::Kerr_Schild_0>::value
};
static constexpr auto dimensions {
arch::traits::pgen::compatible_with<Dim::_2D>::value
};
static constexpr auto dimensions { traits::compatible_with<Dim::_2D>::value };

// for easy access to variables in the child class
using arch::ProblemGenerator<S, M>::D;
Expand Down
12 changes: 8 additions & 4 deletions pgens/magnetosphere/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#include "global.h"

#include "arch/kokkos_aliases.h"
#include "arch/traits.h"
#include "utils/numeric.h"

#include "archetypes/problem_generator.h"
#include "archetypes/traits.h"
#include "framework/domain/metadomain.h"

#include <string>
Expand Down Expand Up @@ -87,11 +87,15 @@ namespace user {
template <SimEngine::type S, class M>
struct PGen : public arch::ProblemGenerator<S, M> {
// compatibility traits for the problem generator
static constexpr auto engines { traits::compatible_with<SimEngine::SRPIC>::value };
static constexpr auto engines {
arch::traits::pgen::compatible_with<SimEngine::SRPIC>::value
};
static constexpr auto metrics {
traits::compatible_with<Metric::Spherical, Metric::QSpherical>::value
arch::traits::pgen::compatible_with<Metric::Spherical, Metric::QSpherical>::value
};
static constexpr auto dimensions {
arch::traits::pgen::compatible_with<Dim::_2D>::value
};
static constexpr auto dimensions { traits::compatible_with<Dim::_2D>::value };

// for easy access to variables in the child class
using arch::ProblemGenerator<S, M>::D;
Expand Down
18 changes: 9 additions & 9 deletions pgens/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include "enums.h"
#include "global.h"

#include "arch/traits.h"
#include "utils/formatting.h"

#include "archetypes/problem_generator.h"
#include "archetypes/traits.h"
#include "framework/domain/metadomain.h"

#include <plog/Log.h>
Expand All @@ -19,18 +19,18 @@ namespace user {
struct PGen : public arch::ProblemGenerator<S, M> {
// compatibility traits for the problem generator
static constexpr auto engines {
traits::compatible_with<SimEngine::SRPIC, SimEngine::GRPIC>::value
arch::traits::pgen::compatible_with<SimEngine::SRPIC, SimEngine::GRPIC>::value
};
static constexpr auto metrics {
traits::compatible_with<Metric::Minkowski,
Metric::Spherical,
Metric::QSpherical,
Metric::Kerr_Schild,
Metric::QKerr_Schild,
Metric::Kerr_Schild_0>::value
arch::traits::pgen::compatible_with<Metric::Minkowski,
Metric::Spherical,
Metric::QSpherical,
Metric::Kerr_Schild,
Metric::QKerr_Schild,
Metric::Kerr_Schild_0>::value
};
static constexpr auto dimensions {
traits::compatible_with<Dim::_1D, Dim::_2D, Dim::_3D>::value
arch::traits::pgen::compatible_with<Dim::_1D, Dim::_2D, Dim::_3D>::value
};

// for easy access to variables in the child class
Expand Down
12 changes: 8 additions & 4 deletions pgens/reconnection/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#include "global.h"

#include "arch/kokkos_aliases.h"
#include "arch/traits.h"
#include "utils/numeric.h"

#include "archetypes/energy_dist.h"
#include "archetypes/particle_injector.h"
#include "archetypes/problem_generator.h"
#include "archetypes/spatial_dist.h"
#include "archetypes/traits.h"
#include "archetypes/utils.h"
#include "framework/domain/metadomain.h"

Expand Down Expand Up @@ -141,10 +141,14 @@ namespace user {
template <SimEngine::type S, class M>
struct PGen : public arch::ProblemGenerator<S, M> {
// compatibility traits for the problem generator
static constexpr auto engines { traits::compatible_with<SimEngine::SRPIC>::value };
static constexpr auto metrics { traits::compatible_with<Metric::Minkowski>::value };
static constexpr auto engines {
arch::traits::pgen::compatible_with<SimEngine::SRPIC>::value
};
static constexpr auto metrics {
arch::traits::pgen::compatible_with<Metric::Minkowski>::value
};
static constexpr auto dimensions {
traits::compatible_with<Dim::_2D, Dim::_3D>::value
arch::traits::pgen::compatible_with<Dim::_2D, Dim::_3D>::value
};

// for easy access to variables in the child class
Expand Down
16 changes: 10 additions & 6 deletions pgens/shock/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include "enums.h"
#include "global.h"

#include "arch/traits.h"
#include "utils/error.h"
#include "utils/numeric.h"

#include "archetypes/field_setter.h"
#include "archetypes/problem_generator.h"
#include "archetypes/traits.h"
#include "archetypes/utils.h"
#include "framework/domain/metadomain.h"

Expand Down Expand Up @@ -69,10 +69,14 @@ namespace user {
template <SimEngine::type S, class M>
struct PGen : public arch::ProblemGenerator<S, M> {
// compatibility traits for the problem generator
static constexpr auto engines { traits::compatible_with<SimEngine::SRPIC>::value };
static constexpr auto metrics { traits::compatible_with<Metric::Minkowski>::value };
static constexpr auto engines {
arch::traits::pgen::compatible_with<SimEngine::SRPIC>::value
};
static constexpr auto metrics {
arch::traits::pgen::compatible_with<Metric::Minkowski>::value
};
static constexpr auto dimensions {
traits::compatible_with<Dim::_1D, Dim::_2D, Dim::_3D>::value
arch::traits::pgen::compatible_with<Dim::_1D, Dim::_2D, Dim::_3D>::value
};

// for easy access to variables in the child class
Expand Down Expand Up @@ -117,8 +121,8 @@ namespace user {
return init_flds;
}

auto FixFieldsConst(const bc_in&,
const em& comp) const -> std::pair<real_t, bool> {
auto FixFieldsConst(const bc_in&, const em& comp) const
-> std::pair<real_t, bool> {
if (comp == em::ex1) {
return { init_flds.ex1({ ZERO }), true };
} else if (comp == em::ex2) {
Expand Down
14 changes: 8 additions & 6 deletions pgens/streaming/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#include "global.h"

#include "arch/kokkos_aliases.h"
#include "arch/traits.h"
#include "utils/error.h"
#include "utils/numeric.h"

#include "archetypes/problem_generator.h"
#include "archetypes/traits.h"
#include "archetypes/utils.h"
#include "framework/domain/domain.h"
#include "framework/domain/metadomain.h"
Expand Down Expand Up @@ -54,18 +54,20 @@ namespace user {
struct PGen : public arch::ProblemGenerator<S, M> {

// compatibility traits for the problem generator
static constexpr auto engines = traits::compatible_with<SimEngine::SRPIC>::value;
static constexpr auto metrics = traits::compatible_with<Metric::Minkowski>::value;
static constexpr auto engines =
arch::traits::pgen::compatible_with<SimEngine::SRPIC>::value;
static constexpr auto metrics =
arch::traits::pgen::compatible_with<Metric::Minkowski>::value;
static constexpr auto dimensions =
traits::compatible_with<Dim::_1D, Dim::_2D, Dim::_3D>::value;
arch::traits::pgen::compatible_with<Dim::_1D, Dim::_2D, Dim::_3D>::value;

// for easy access to variables in the child class
using arch::ProblemGenerator<S, M>::D;
using arch::ProblemGenerator<S, M>::C;
using arch::ProblemGenerator<S, M>::params;

prmvec_t drifts_in_x, drifts_in_y, drifts_in_z;
prmvec_t densities, temperatures;
prmvec_t drifts_in_x, drifts_in_y, drifts_in_z;
prmvec_t densities, temperatures;
// initial magnetic field
real_t Btheta, Bphi, Bmag;
InitFields<D> init_flds;
Expand Down
Loading