Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 5 additions & 10 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)

set(TEST_DIRECTORIES "")

if(NOT ${mpi})
list(APPEND TEST_DIRECTORIES global)
list(APPEND TEST_DIRECTORIES metrics)
list(APPEND TEST_DIRECTORIES kernels)
list(APPEND TEST_DIRECTORIES archetypes)
list(APPEND TEST_DIRECTORIES framework)
elseif(${mpi} AND ${output})
list(APPEND TEST_DIRECTORIES framework)
endif()

list(APPEND TEST_DIRECTORIES global)
list(APPEND TEST_DIRECTORIES metrics)
list(APPEND TEST_DIRECTORIES kernels)
list(APPEND TEST_DIRECTORIES archetypes)
list(APPEND TEST_DIRECTORIES framework)
list(APPEND TEST_DIRECTORIES output)

foreach(test_dir IN LISTS TEST_DIRECTORIES)
Expand Down
13 changes: 12 additions & 1 deletion input.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,16 @@
# @type: bool
# @default: false
use_weights = ""
# Timesteps between particle re-sorting (removing dead particles)
# Timesteps between particle re-sorting by tags (removing dead particles)
# @type: uint
# @default: 100
# @note: Set to 0 to disable re-sorting
clear_interval = ""
# Timesteps between spatial sorting of particles (for better cache performance)
# @type: uint
# @default: 0
# @note: Set to 0 to disable spatial sorting
spatial_sorting_interval = ""

# @inferred:
# - nspec
Expand Down Expand Up @@ -453,6 +458,12 @@
# @note: Only one emission mechanism allowed
# @note: Appropriate radiation drag flag will be applied automatically (unless explicitly set to "None")
emission = ""
# Timesteps between spatial sorting of particles for given species
# @type: uint
# @default: 0
# @note: Set to 0 to disable spatial sorting
# @note: Overrides `particles.spatial_sorting_interval` for the given species
spatial_sorting_interval = ""

# Parameters for specific problem generators and setups
[setup]
Expand Down
5 changes: 3 additions & 2 deletions src/engines/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "utils/diag.h"
#include "utils/reporter.h"
#include "utils/timer.h"
#include <toml11/toml.hpp>

#include "archetypes/field_setter.h"
#include "archetypes/traits.h"
Expand All @@ -35,6 +34,8 @@

#include "pgen.hpp"

#include <toml11/toml.hpp>

#if defined(OUTPUT_ENABLED)
#include <adios2.h>
#endif
Expand Down Expand Up @@ -248,7 +249,7 @@ namespace ntt {
"ParticlePusher", "FieldBoundaries",
"ParticleBoundaries", "Communications",
"Injector", "Custom",
"PrtlClear", "Output",
"ParticleSort", "Output",
"Checkpoint" },
[]() {
Kokkos::fence();
Expand Down
10 changes: 4 additions & 6 deletions src/engines/grpic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "utils/log.h"
#include "utils/numeric.h"
#include "utils/timer.h"
#include <toml11/toml.hpp>

#include "framework/domain/domain.h"
#include "framework/parameters/parameters.h"
Expand All @@ -36,6 +35,7 @@

#include <Kokkos_Core.hpp>
#include <Kokkos_ScatterView.hpp>
#include <toml11/toml.hpp>

#include <string>
#include <utility>
Expand Down Expand Up @@ -532,11 +532,9 @@ namespace ntt {
timers.stop("FieldBoundaries");
}

if (clear_interval > 0 and step % clear_interval == 0 and step > 0) {
timers.start("PrtlClear");
m_metadomain.RemoveDeadParticles(dom);
timers.stop("PrtlClear");
}
timers.start("ParticleSort");
m_metadomain.SortParticles(time, step, m_params, dom);
timers.stop("ParticleSort");

/**
* Finally: em0::B at n-1/2
Expand Down
10 changes: 4 additions & 6 deletions src/engines/srpic/srpic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "utils/numeric.h"
#include "utils/timer.h"
#include <toml11/toml.hpp>

#include "engines/srpic/currents.h"
#include "engines/srpic/fields_bcs.h"
Expand All @@ -34,6 +33,7 @@

#include <Kokkos_Core.hpp>
#include <Kokkos_ScatterView.hpp>
#include <toml11/toml.hpp>

namespace ntt {

Expand Down Expand Up @@ -186,11 +186,9 @@ namespace ntt {
timers.stop("Injector");
}

if (clear_interval > 0 and step % clear_interval == 0 and step > 0) {
timers.start("PrtlClear");
m_metadomain.RemoveDeadParticles(dom);
timers.stop("PrtlClear");
}
timers.start("ParticleSort");
m_metadomain.SortParticles(time, step, m_params, dom);
timers.stop("ParticleSort");
}
};

Expand Down
22 changes: 14 additions & 8 deletions src/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
# * simulation.cpp
# * domain/grid.cpp
# * domain/metadomain.cpp
# * domain/communications.cpp
# * domain/checkpoint.cpp
# * domain/metadomain_sort.cpp
# * domain/metadomain_comm.cpp
# * domain/metadomain_chckpt.cpp
# * domain/metadomain_stats.cpp
# * domain/metadomain_io.cpp
# * containers/particles.cpp
# * containers/particles_comm.cpp
# * containers/particles_io.cpp
# * containers/particles_sort.cpp
# * containers/fields.cpp
# * domain/stats.cpp
# * domain/output.cpp
#
# @includes:
#
Expand Down Expand Up @@ -50,13 +54,15 @@ set(SOURCES
${SRC_DIR}/parameters/extra.cpp
${SRC_DIR}/domain/grid.cpp
${SRC_DIR}/domain/metadomain.cpp
${SRC_DIR}/domain/communications.cpp
${SRC_DIR}/domain/stats.cpp
${SRC_DIR}/domain/metadomain_comm.cpp
${SRC_DIR}/domain/metadomain_sort.cpp
${SRC_DIR}/domain/metadomain_stats.cpp
${SRC_DIR}/containers/particles.cpp
${SRC_DIR}/containers/particles_sort.cpp
${SRC_DIR}/containers/fields.cpp)
if(${output})
list(APPEND SOURCES ${SRC_DIR}/domain/output.cpp)
list(APPEND SOURCES ${SRC_DIR}/domain/checkpoint.cpp)
list(APPEND SOURCES ${SRC_DIR}/domain/metadomain_io.cpp)
list(APPEND SOURCES ${SRC_DIR}/domain/metadomain_chckpt.cpp)
list(APPEND SOURCES ${SRC_DIR}/containers/fields_io.cpp)
list(APPEND SOURCES ${SRC_DIR}/containers/particles_io.cpp)
endif()
Expand Down
Loading