Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e1774af
empty commit
haykh Jan 27, 2026
5564508
srpic engine modularized
haykh Jan 29, 2026
4e61680
minor renaming
haykh Jan 30, 2026
f420ca3
nix upd + O3 flag added + gui option rm
haykh Jan 30, 2026
3281a55
tests now can be compiled with pgen
haykh Jan 30, 2026
4418b55
Merge branch '1.4.0rc' of github.com:entity-toolkit/entity into dev/e…
haykh Jan 30, 2026
3cf77b6
prtldim trait for metrics
haykh Jan 31, 2026
c295fb8
support for 2D arrays in setup input
haykh Jan 31, 2026
f13a68d
GR with no init_flds in pgen support
haykh Jan 31, 2026
73e4640
rm unnecessary add_subdirectory in benchmark cmake
haykh Jan 31, 2026
c351db2
fixed fields now accepts time
haykh Feb 5, 2026
4687028
CPUTEST
haykh Feb 5, 2026
08d51f6
rm unnecessary printf
haykh Feb 5, 2026
835a7b5
compton emission kernel
haykh Feb 5, 2026
3028d2b
random pool is now std::optional
haykh Feb 9, 2026
fe3fea1
CPUTEST
haykh Feb 9, 2026
09b177b
bump cmake + order of variables in domain constructor
haykh Feb 9, 2026
5bf97fd
Merge pull request #177 from entity-toolkit/1.3.3rc
haykh Feb 9, 2026
014f888
Merge remote-tracking branch 'origin' into 1.4.0rc
haykh Feb 9, 2026
e068569
empty commit
haykh Jan 27, 2026
a2ea14a
srpic engine modularized
haykh Jan 29, 2026
56cf9a6
minor renaming
haykh Jan 30, 2026
4c2dcab
nix upd + O3 flag added + gui option rm
haykh Jan 30, 2026
eb5ec66
tests now can be compiled with pgen
haykh Jan 30, 2026
6a123e2
prtldim trait for metrics
haykh Jan 31, 2026
e207373
support for 2D arrays in setup input
haykh Jan 31, 2026
2775a88
GR with no init_flds in pgen support
haykh Jan 31, 2026
754873f
rm unnecessary add_subdirectory in benchmark cmake
haykh Jan 31, 2026
4e1fa89
compton emission kernel
haykh Feb 5, 2026
0d43dd8
Merge branch 'dev/emission' of github.com:entity-toolkit/entity into …
haykh Feb 9, 2026
9fb060e
fixed fields now accepts time
haykh Feb 5, 2026
93f4002
CPUTEST
haykh Feb 5, 2026
9430ce5
rm unnecessary printf
haykh Feb 5, 2026
1d34ab9
Merge branch 'dev/fixfields' of github.com:entity-toolkit/entity into…
haykh Feb 9, 2026
8b0cc5c
compton emission routine
haykh Feb 11, 2026
acd6504
Merge branch 'dev/emission' into dev/fixfields
haykh Feb 11, 2026
bda9732
compton emission tested
haykh Feb 12, 2026
06fd6c4
synchrotron drag + fix mass dependence
haykh Feb 13, 2026
53fe419
Merge branch 'dev/fixfields' of github.com:entity-toolkit/entity into…
haykh Feb 13, 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
33 changes: 19 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ set(pgen
${default_pgen}
CACHE STRING "Problem generator")

set(gui
${default_gui}
CACHE BOOL "Use GUI [nttiny]")
set(output
${default_output}
CACHE BOOL "Enable output")
Expand All @@ -70,7 +67,7 @@ if(${DEBUG} STREQUAL "OFF")
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "CMake build type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG -O3")
else()
set(CMAKE_BUILD_TYPE
Debug
Expand Down Expand Up @@ -170,21 +167,29 @@ endif()

link_libraries(${DEPENDENCIES})

set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
add_subdirectory(${SRC_DIR}/global ${CMAKE_CURRENT_BINARY_DIR}/global)
add_subdirectory(${SRC_DIR}/metrics ${CMAKE_CURRENT_BINARY_DIR}/metrics)
add_subdirectory(${SRC_DIR}/kernels ${CMAKE_CURRENT_BINARY_DIR}/kernels)
add_subdirectory(${SRC_DIR}/archetypes ${CMAKE_CURRENT_BINARY_DIR}/archetypes)
add_subdirectory(${SRC_DIR}/framework ${CMAKE_CURRENT_BINARY_DIR}/framework)
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)

# ------------------------------- Main source ------------------------------ #
if(NOT ${pgen} STREQUAL ${default_pgen})
set_problem_generator(${pgen})
add_subdirectory(${SRC_DIR}/engines ${CMAKE_CURRENT_BINARY_DIR}/engines)
add_subdirectory(${SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src)
endif()

if(TESTS)
# ---------------------------------- Tests --------------------------------- #
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/tests.cmake)
elseif(BENCHMARK)
endif()

if(BENCHMARK)
# ------------------------------ Benchmark --------------------------------- #
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/benchmark.cmake)
else()
# ----------------------------------- GUI ---------------------------------- #
if(${gui})
find_or_fetch_dependency(nttiny FALSE QUIET)
endif()

# ------------------------------- Main source ------------------------------ #
set_problem_generator(${pgen})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src src)
endif()

include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/report.cmake)
11 changes: 0 additions & 11 deletions cmake/benchmark.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@

set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

add_subdirectory(${SRC_DIR}/global ${CMAKE_CURRENT_BINARY_DIR}/global)
add_subdirectory(${SRC_DIR}/metrics ${CMAKE_CURRENT_BINARY_DIR}/metrics)
add_subdirectory(${SRC_DIR}/kernels ${CMAKE_CURRENT_BINARY_DIR}/kernels)
add_subdirectory(${SRC_DIR}/archetypes ${CMAKE_CURRENT_BINARY_DIR}/archetypes)
add_subdirectory(${SRC_DIR}/framework ${CMAKE_CURRENT_BINARY_DIR}/framework)

if(${output})
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)
add_subdirectory(${SRC_DIR}/checkpoint ${CMAKE_CURRENT_BINARY_DIR}/checkpoint)
endif()

set(exec benchmark.xc)
set(src ${CMAKE_CURRENT_SOURCE_DIR}/benchmark/benchmark.cpp)

Expand Down
35 changes: 30 additions & 5 deletions cmake/report.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ if(${PGEN_FOUND})
"${Blue}"
PGEN_REPORT
0)
elseif(${TESTS})
endif()

if(${TESTS})
set(TEST_NAMES "")
foreach(test_dir IN LISTS TEST_DIRECTORIES)
get_property(
Expand All @@ -18,14 +20,38 @@ elseif(${TESTS})
list(APPEND TEST_NAMES ${LOCAL_TEST_NAMES})
endforeach()
printchoices(
"Test cases"
"Tests"
"TESTS"
"${ON_OFF_VALUES}"
"ON"
"OFF"
"${Green}"
TESTS_REPORT_1
46)
printchoices(
""
""
"${TEST_NAMES}"
""
"${ColorReset}"
""
TESTS_REPORT
TESTS_REPORT_2
0)
# remove only first line of TESTS_REPORT_2
string(REPLACE "\n" ";" TESTS_REPORT_2_LIST "${TESTS_REPORT_2}")
list(REMOVE_AT TESTS_REPORT_2_LIST 0)
string(REPLACE ";" "\n" TESTS_REPORT_2 "${TESTS_REPORT_2_LIST}")
set(TESTS_REPORT "${TESTS_REPORT_1}\n${TESTS_REPORT_2}")
else()
printchoices(
"Tests"
"TESTS"
"${ON_OFF_VALUES}"
"OFF"
"OFF"
"${Green}"
TESTS_REPORT
46)
endif()

printchoices(
Expand Down Expand Up @@ -120,9 +146,8 @@ string(APPEND REPORT_TEXT ${DASHED_LINE_SYMBOL} "\n" "Configurations" "\n")

if(${PGEN_FOUND})
string(APPEND REPORT_TEXT " " ${PGEN_REPORT} "\n")
elseif(${TESTS})
string(APPEND REPORT_TEXT " " ${TESTS_REPORT} "\n")
endif()
string(APPEND REPORT_TEXT " " ${TESTS_REPORT} "\n")

string(
APPEND
Expand Down
7 changes: 0 additions & 7 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ enable_testing()

set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

add_subdirectory(${SRC_DIR}/global ${CMAKE_CURRENT_BINARY_DIR}/global)
add_subdirectory(${SRC_DIR}/metrics ${CMAKE_CURRENT_BINARY_DIR}/metrics)
add_subdirectory(${SRC_DIR}/kernels ${CMAKE_CURRENT_BINARY_DIR}/kernels)
add_subdirectory(${SRC_DIR}/archetypes ${CMAKE_CURRENT_BINARY_DIR}/archetypes)
add_subdirectory(${SRC_DIR}/framework ${CMAKE_CURRENT_BINARY_DIR}/framework)
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)

set(TEST_DIRECTORIES "")

if(NOT ${mpi})
Expand Down
14 changes: 7 additions & 7 deletions dev/nix/kokkos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@

let
name = "kokkos";
pversion = "5.0.0";
pversion = "5.0.1";
compilerPkgs = {
"HIP" = with pkgs.rocmPackages; [
llvm.llvm
clang
rocm-core
clr
rocthrust
rocprim
rocminfo
rocm-smi
pkgs.llvmPackages_19.clang-tools
pkgs.clang-tools
];
"CUDA" = with pkgs.cudaPackages; [
llvmPackages_19.clang-tools
pkgs.clang-tools
cudatoolkit
cuda_cudart
pkgs.gcc13
];
"NONE" = [
pkgs.llvmPackages_19.clang-tools
pkgs.clang-tools
pkgs.gcc13
];
};
Expand All @@ -41,7 +41,7 @@ let
"-D Kokkos_ENABLE_HIP=ON"
"-D Kokkos_ARCH_${getArch { }}=ON"
"-D GPU_TARGETS=${builtins.replaceStrings [ "amd_" ] [ "" ] (pkgs.lib.toLower (getArch { }))}"
"-D CMAKE_CXX_COMPILER=hipcc"
"-D CMAKE_CXX_COMPILER=clang++"
];
"CUDA" = [
"-D Kokkos_ENABLE_CUDA=ON"
Expand All @@ -57,7 +57,7 @@ pkgs.stdenv.mkDerivation rec {
src = pkgs.fetchgit {
url = "https://github.com/kokkos/kokkos/";
rev = "${pversion}";
sha256 = "sha256-C4DarqnEcdF3+19TPqcM0A9bcQSkKTJkB8b7OkzC7T8=";
sha256 = "sha256-ChpwGBwE7sNovjdAM/iCeOqqwGufKxAh5vQ3qK6aFBU=";
};

nativeBuildInputs = with pkgs; [
Expand Down
4 changes: 2 additions & 2 deletions dev/nix/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ let
CC = "gcc";
};
HIP = {
CXX = "hipcc";
CC = "hipcc";
CXX = "clang++";
CC = "clang";
};
CUDA = { };
};
Expand Down
24 changes: 24 additions & 0 deletions input.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@
# @required
photon_species = ""

# @inferred:
# - nominal_probability
# @brief: Nominal probability of the emission for a particle with `gamma * beta = 1`, charge-to-mass = `q0 / m0`
# @type: float
# @from: `.gamma_qed`, `.photon_weight`, `...drag.synchrotron.gamma_rad`, `scales.omegaB0`, `algorithms.timestep.dt`
# @value: `0.1 * omegaB0 * dt * (gamma_qed / gamma_rad)^2 / photon_weight`
# - nominal_photon_energy
# @brief: Nominal energy of the emitted photon for a particle with `gamma * beta = 1`, mass = `m0`
# @type: float
# @from: `.gamma_qed`
# @value: `(1 / gamma_qed)^2`

[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]
Expand All @@ -248,6 +260,18 @@
# @required
photon_species = ""

# @inferred:
# - nominal_probability
# @brief: Nominal probability of the emission for a particle with `gamma * beta = 1`, charge-to-mass = `q0 / m0`
# @type: float
# @from: `.gamma_qed`, `.photon_weight`, `...drag.compton.gamma_rad`, `scales.omegaB0`, `algorithms.timestep.dt`
# @value: `0.1 * omegaB0 * dt * (gamma_qed / gamma_rad)^2 / photon_weight`
# - nominal_photon_energy
# @brief: Nominal energy of the emitted photon for a particle with `gamma * beta = 1`, mass = `m0`
# @type: float
# @from: `.gamma_qed`
# @value: `(1 / gamma_qed)^2`

[algorithms]
# Number of current smoothing passes
# @type: ushort [>= 0]
Expand Down
4 changes: 2 additions & 2 deletions pgens/accretion/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ namespace user {

inline void InitPrtls(Domain<S, M>& local_domain) {
const auto energy_dist = arch::Maxwellian<S, M>(local_domain.mesh.metric,
local_domain.random_pool,
local_domain.random_pool(),
temperature);
const auto spatial_dist = PointDistribution<S, M>(xi_min,
xi_max,
Expand All @@ -260,7 +260,7 @@ namespace user {

void CustomPostStep(std::size_t, long double time, Domain<S, M>& local_domain) {
const auto energy_dist = arch::Maxwellian<S, M>(local_domain.mesh.metric,
local_domain.random_pool,
local_domain.random_pool(),
temperature);
const auto spatial_dist = PointDistribution<S, M>(xi_min,
xi_max,
Expand Down
4 changes: 2 additions & 2 deletions pgens/reconnection/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ namespace user {

// current layer
auto edist_cs = arch::Maxwellian<S, M>(local_domain.mesh.metric,
local_domain.random_pool,
local_domain.random_pool(),
cs_temperature,
{ ZERO, ZERO, cs_drift_u });
const auto sdist_cs = CurrentLayer<S, M>(local_domain.mesh.metric,
Expand All @@ -243,7 +243,7 @@ namespace user {
}

const auto energy_dist = arch::Maxwellian<S, M>(domain.mesh.metric,
domain.random_pool,
domain.random_pool(),
bg_temperature);

const auto dx = domain.mesh.metric.template sqrt_h_<1, 1>({});
Expand Down
2 changes: 1 addition & 1 deletion pgens/turbulence/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ namespace user {

// particle escape (resample velocities)
const auto energy_dist = arch::Maxwellian<S, M>(domain.mesh.metric,
domain.random_pool,
domain.random_pool(),
temperature);
for (const auto& sp : { 0, 1 }) {
if (domain.species[sp].npld_r() > 1) {
Expand Down
9 changes: 0 additions & 9 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@

set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})

# dependencies
add_subdirectory(${SRC_DIR}/global ${CMAKE_CURRENT_BINARY_DIR}/global)
add_subdirectory(${SRC_DIR}/metrics ${CMAKE_CURRENT_BINARY_DIR}/metrics)
add_subdirectory(${SRC_DIR}/kernels ${CMAKE_CURRENT_BINARY_DIR}/kernels)
add_subdirectory(${SRC_DIR}/archetypes ${CMAKE_CURRENT_BINARY_DIR}/archetypes)
add_subdirectory(${SRC_DIR}/framework ${CMAKE_CURRENT_BINARY_DIR}/framework)
add_subdirectory(${SRC_DIR}/engines ${CMAKE_CURRENT_BINARY_DIR}/engines)
add_subdirectory(${SRC_DIR}/output ${CMAKE_CURRENT_BINARY_DIR}/output)

set(ENTITY ${PROJECT_NAME}.xc)
set(SOURCES ${SRC_DIR}/entity.cpp)

Expand Down
4 changes: 2 additions & 2 deletions src/archetypes/particle_injector.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ namespace arch {
energy_dists.first,
energy_dists.second,
ONE / params.template get<real_t>("scales.V0"),
domain.random_pool));
domain.random_pool()));
domain.species[species.first - 1].set_npart(
domain.species[species.first - 1].npart() + nparticles);
domain.species[species.second - 1].set_npart(
Expand Down Expand Up @@ -372,7 +372,7 @@ namespace arch {
energy_dists.second,
spatial_dist,
ONE / params.template get<real_t>("scales.V0"),
domain.random_pool);
domain.random_pool());
Kokkos::parallel_for("InjectNonUniformNumberDensity",
cell_range,
injector_kernel);
Expand Down
2 changes: 1 addition & 1 deletion src/archetypes/tests/pgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct CustomPgen : public arch::ProblemGenerator<S, M> {
return init_flds;
}

auto FixFieldsConst(const bc_in&, const ntt::em&) const
auto FixFieldsConst(simtime_t, const bc_in&, ntt::em) const
-> std::pair<real_t, bool> {
return { ZERO, false };
}
Expand Down
9 changes: 5 additions & 4 deletions src/archetypes/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ namespace arch {
};

template <class PG>
concept HasFixFieldsConst = requires(const PG& pgen,
const bc_in& bc,
const ntt::em& comp) {
concept HasFixFieldsConst = requires(const PG& pgen,
simtime_t time,
const bc_in& bc,
ntt::em comp) {
{
pgen.FixFieldsConst(bc, comp)
pgen.FixFieldsConst(time, bc, comp)
} -> std::convertible_to<std::pair<real_t, bool>>;
};

Expand Down
4 changes: 2 additions & 2 deletions src/archetypes/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ namespace arch {
const auto temperature_2 = temperatures.second / mass_2;

const auto maxwellian_1 = arch::Maxwellian<S, M>(domain.mesh.metric,
domain.random_pool,
domain.random_pool(),
temperature_1,
drift_four_vels.first);
const auto maxwellian_2 = arch::Maxwellian<S, M>(domain.mesh.metric,
domain.random_pool,
domain.random_pool(),
temperature_2,
drift_four_vels.second);

Expand Down
7 changes: 7 additions & 0 deletions src/engines/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ namespace ntt {
virtual void step_forward(timer::Timers&, Domain<S, M>&) = 0;

void run();

auto engineParams() const -> prm::Parameters {
auto parameters = prm::Parameters {};
parameters.set("dt", static_cast<real_t>(dt));
parameters.set("time", static_cast<simtime_t>(time));
return parameters;
}
};

template <SimEngine::type S, class M>
Expand Down
Loading