Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3d22fd0
initial commit on internal renderer
LudwigBoess Jun 30, 2026
ca24afe
add background to rendered image
LudwigBoess Jun 30, 2026
614aff4
added colorbar
LudwigBoess Jun 30, 2026
df10820
significant speedup
LudwigBoess Jun 30, 2026
ec55fcf
reduce send/recv via uint8
LudwigBoess Jun 30, 2026
6dd8117
added option to define colorbar ticks as parameter
LudwigBoess Jun 30, 2026
a84c821
generalize field rendering
LudwigBoess Jun 30, 2026
36ce55c
generalized field rendering
LudwigBoess Jun 30, 2026
866bf50
added Vmag rendering
LudwigBoess Jun 30, 2026
afb45f5
support for 2D rendering
LudwigBoess Jun 30, 2026
02cf11c
rendering of axis spines, ticks and labels
LudwigBoess Jun 30, 2026
5a0bffc
3D field lines
LudwigBoess Jun 30, 2026
7f8e819
2D field lines
LudwigBoess Jul 1, 2026
4c66325
option to plot time label
LudwigBoess Jul 1, 2026
95f08f2
added option to provide axis limits to rendering
LudwigBoess Jul 1, 2026
856d66c
added moving camera to track e.g. shock fronts
LudwigBoess Jul 1, 2026
cc78232
style updates
LudwigBoess Jul 1, 2026
0bf6e74
added more colormaps
LudwigBoess Jul 1, 2026
9d74601
always render axis ticks in the foreground
LudwigBoess Jul 5, 2026
28f9dab
python script to preview render orientation
LudwigBoess Jul 5, 2026
2511855
Merge branch '1.5.0rc' into dev/raytrace_renderer
LudwigBoess Jul 14, 2026
e825a25
planetarium dome rendering in 2D
LudwigBoess Jul 25, 2026
c1e851a
3D dome rendering
LudwigBoess Jul 28, 2026
410dca1
Merge branch '1.5.0rc' into dev/raytrace_renderer
LudwigBoess Jul 28, 2026
b50fad6
only render half-sphere within `dome_radius` to avoid corner projecti…
LudwigBoess Jul 29, 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
416 changes: 416 additions & 0 deletions input.example.toml

Large diffs are not rendered by default.

812 changes: 812 additions & 0 deletions render_preview.py

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/engines/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ namespace ntt {
#if defined(OUTPUT_ENABLED)
m_metadomain.InitWriter(&m_adios, m_params);
m_metadomain.InitCheckpointWriter(&m_adios, m_params);
m_metadomain.InitRenderer(m_params);
#endif
logger::Checkpoint("Initializing Engine", HERE);
if (not is_resuming) {
Expand Down Expand Up @@ -255,7 +256,7 @@ namespace ntt {
"Injector", "Custom",
"LoadBalance",
"ParticleSort", "Output",
"Checkpoint" },
"Render", "Checkpoint" },
[]() {
Kokkos::fence();
},
Expand Down Expand Up @@ -323,6 +324,7 @@ namespace ntt {
++step;

auto print_output = false;
auto print_render = false;
auto print_checkpoint = false;
#if defined(OUTPUT_ENABLED)
timers.start("Output");
Expand Down Expand Up @@ -368,6 +370,10 @@ namespace ntt {
}
timers.stop("Output");

timers.start("Render");
print_render = m_metadomain.Render(m_params, step, step - 1, time, time - dt);
timers.stop("Render");

timers.start("Checkpoint");
print_checkpoint = m_metadomain.WriteCheckpoint(m_params,
step,
Expand All @@ -394,6 +400,7 @@ namespace ntt {
m_metadomain.l_maxnpart_perspec(),
print_prtl_clear,
print_output,
print_render,
print_checkpoint,
m_params.get<bool>("diagnostics.colored_stdout"));
}
Expand Down
1 change: 1 addition & 0 deletions src/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ set(SOURCES
${SRC_DIR}/containers/fields.cpp)
if(${output})
list(APPEND SOURCES ${SRC_DIR}/domain/metadomain_io.cpp)
list(APPEND SOURCES ${SRC_DIR}/domain/metadomain_render.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)
Expand Down
22 changes: 22 additions & 0 deletions src/framework/domain/metadomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#if defined(OUTPUT_ENABLED)
#include "output/checkpoint.h"
#include "output/render/renderer.h"
#include "output/writer.h"

#include <adios2.h>
Expand Down Expand Up @@ -96,6 +97,9 @@ namespace ntt {
void SynchronizeFields(Domain<S, M>&,
CommTags,
const cell_range_t& = { 0, 0 }) const;
// Halo-fill of the bckp buffer (neighbor active cells -> local ghosts),
// used by the in-situ renderer for seamless trilinear sampling.
void CommunicateBckp(Domain<S, M>&, const cell_range_t&) const;
#if defined(MPI_ENABLED) && defined(OUTPUT_ENABLED)
void CommunicateVectorPotential(unsigned short);
#endif
Expand Down Expand Up @@ -173,6 +177,23 @@ namespace ntt {
void ContinueFromCheckpoint(adios2::ADIOS*, const SimulationParams&);
void redecomposeFromCheckpoint(const std::vector<std::vector<ncells_t>>&,
const std::vector<boundaries_t<real_t>>&);

/* in-situ renderer (3D volume ray-march & 2D slice; metadomain_render.cpp) */
void InitRenderer(const SimulationParams&);
auto Render(const SimulationParams&,
timestep_t,
timestep_t,
simtime_t,
simtime_t) -> bool;
// Prepare the scalar named by a scene's `field` into bckp(:, 0) (active
// cells synced; ghosts not yet halo-filled). Shared by the 2D and 3D render
// paths so the field grammar (moments, T/V components, |E,B,J|, species
// suffix) has a single source of truth. Returns false (and warns) for an
// unknown field or invalid species so the caller can skip the scene.
auto prepareRenderScalar(const SimulationParams&,
Domain<S, M>&,
const std::string& field_name,
ndfield_t<M::Dim, 6>&) const -> bool;
#endif

void InitStatsWriter(const SimulationParams&, bool);
Expand Down Expand Up @@ -305,6 +326,7 @@ namespace ntt {
#if defined(OUTPUT_ENABLED)
out::Writer g_writer;
checkpoint::Writer g_checkpoint_writer;
out::Renderer g_renderer;
#endif

#if defined(MPI_ENABLED)
Expand Down
34 changes: 34 additions & 0 deletions src/framework/domain/metadomain_comm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,47 @@ namespace ntt {
#endif
}

template <SimEngine::type S, MetricClass M>
void Metadomain<S, M>::CommunicateBckp(Domain<S, M>& domain,
const cell_range_t& components) const {
// Halo FILL of the bckp buffer: copy each neighbor's active boundary cells
// into this domain's ghost zones (additive=false). This is distinct from
// SynchronizeFields, which sums ghost-deposited values back into active
// cells. The renderer needs the ghost halo populated so trilinear sampling
// near a domain face reads valid neighbor values (C0 across the face).
for (auto& direction : dir::Directions<M::Dim>::all) {
const auto [send_params,
recv_params] = GetSendRecvParams(this, domain, direction, false);
const auto [send_indrank, send_slice] = send_params;
const auto [recv_indrank, recv_slice] = recv_params;
const auto [send_ind, send_rank] = send_indrank;
const auto [recv_ind, recv_rank] = recv_indrank;
if (send_rank < 0 and recv_rank < 0) {
continue;
}
comm::CommunicateField<M::Dim, 6>(domain.index(),
domain.fields.bckp,
domain.fields.bckp,
send_ind,
recv_ind,
send_rank,
recv_rank,
send_slice,
recv_slice,
components,
false);
}
}

// NOLINTBEGIN(bugprone-macro-parentheses)
#define METADOMAIN_COMM(S, M, D) \
template void Metadomain<S, M<D>>::CommunicateFields(Domain<S, M<D>>&, \
CommTags) const; \
template void Metadomain<S, M<D>>::SynchronizeFields(Domain<S, M<D>>&, \
CommTags, \
const cell_range_t&) const; \
template void Metadomain<S, M<D>>::CommunicateBckp(Domain<S, M<D>>&, \
const cell_range_t&) const; \
template void Metadomain<S, M<D>>::CommunicateParticles(Domain<S, M<D>>&) const;

NTT_FOREACH_SPECIALIZATION(METADOMAIN_COMM)
Expand Down
Loading
Loading