Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SolverStorage.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
19
22#include "shambackends/vec.hpp"
40#include <memory>
41
42namespace shammodels::sph {
43
44 template<class T>
45 using Component = shambase::StorageComponent<T>;
46
47 template<class Tvec, class Tmorton>
49 public:
50 using Tscal = shambase::VecComponent<Tvec>;
51 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
52
53 using GhostHandle = BasicSPHGhostHandler<Tvec>;
54 using GhostHandleCache = typename GhostHandle::CacheMap;
55
57
58 std::shared_ptr<shamrock::solvergraph::ExchangeGhostLayer> exchange_gz_node;
59 std::shared_ptr<shamrock::solvergraph::ExchangeGhostField<Tscal>> exchange_gz_alpha;
60 std::shared_ptr<shamrock::solvergraph::ExchangeGhostLayer> exchange_gz_positions;
61
63 std::shared_ptr<shamrock::solvergraph::OperationSequence> solver_sequence;
64
65 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> part_counts;
66 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> part_counts_with_ghost;
67
68 std::shared_ptr<shamrock::solvergraph::FieldRefs<Tvec>> positions_with_ghosts;
69 std::shared_ptr<shamrock::solvergraph::FieldRefs<Tscal>> hpart_with_ghosts;
70
71 std::shared_ptr<shammodels::sph::solvergraph::NeighCache> neigh_cache;
72
73 std::shared_ptr<shamrock::solvergraph::RankGetter> patch_rank_owner;
74
75 Component<SerialPatchTree<Tvec>> serial_patch_tree;
76
77 Component<GhostHandle> ghost_handler;
78
79 Component<GhostHandleCache> ghost_patch_cache;
80
81 Component<shambase::DistributedData<shamrock::patch::PatchDataLayer>> merged_xyzh;
82
83 Component<shambase::DistributedData<RTree>> merged_pos_trees;
84
85 Component<shambase::DistributedData<shamtree::KarrasRadixTreeField<Tscal>>>
86 rtree_rint_field;
87
88 std::shared_ptr<shamrock::solvergraph::Field<Tscal>> omega;
89
90 // Bisection bracket [lo, hi] on h used by IterateSmoothingLengthDensityBisectingNR.
91 // Lazily created (unlike omega/pressure/soundspeed) since they're only needed when that
92 // smoothing length mode is selected.
93 std::shared_ptr<shamrock::solvergraph::Field<Tscal>> h_bisect_lo;
94 std::shared_ptr<shamrock::solvergraph::Field<Tscal>> h_bisect_hi;
95
96 std::shared_ptr<shamrock::patch::PatchDataLayerLayout> ghost_layout;
97 std::shared_ptr<shamrock::patch::PatchDataLayerLayout> xyzh_ghost_layout;
98
99 Component<shambase::DistributedData<shamrock::patch::PatchDataLayer>>
100 merged_patchdata_ghost;
101
102 std::shared_ptr<shamrock::solvergraph::Field<Tscal>> alpha_av_updated;
103 Component<shambase::DistributedData<PatchDataField<Tscal>>> alpha_av_ghost;
104
105 std::shared_ptr<shamrock::solvergraph::Field<Tscal>> pressure;
106 std::shared_ptr<shamrock::solvergraph::Field<Tscal>> soundspeed;
107
108 Component<shamrock::ComputeField<Tvec>> old_axyz;
109 Component<shamrock::ComputeField<Tscal>> old_duint;
110
111 Component<shamrock::ComputeField<Tvec>> old_dB_on_rho;
112 Component<shamrock::ComputeField<Tscal>> old_dpsi_on_ch;
113
114 Component<shambase::DistributedData<PatchDataField<Tvec>>> MagCurrentJ_ghost;
115 std::shared_ptr<shamrock::solvergraph::Field<Tvec>> MagCurrentJ;
116 std::shared_ptr<shamrock::solvergraph::ExchangeGhostField<Tvec>> exchange_gz_J;
117
118 Component<shamrock::ComputeField<Tscal>> old_dtepsilon;
119 Component<shamrock::ComputeField<Tvec>> old_dtdeltav;
120 Component<shamrock::ComputeField<Tscal>> old_ds_j_dt;
121
122 struct Timings {
123 f64 interface = 0;
124 f64 neighbors = 0;
125 f64 io = 0;
126
128 void reset() { *this = {}; }
129 } timings_details;
130 };
131
132} // namespace shammodels::sph
Declare a class to register and retrieve nodes and edges from a unique container.
double f64
Alias for double.
std::uint32_t u32
32 bit unsigned integer
A graph container for managing solver nodes and edges with type-safe access.
A Compressed Leaf Bounding Volume Hierarchy (CLBVH) for neighborhood queries.
namespace for the sph model
This file contains the definition for the stacktrace related functionality.
void reset()
Reset the timings logged in the storage.