Skip to content
Open
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
337 changes: 337 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