73 using Tscal = shambase::VecComponent<Tvec>;
74 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
75 using Kernel = SPHKernel<Tscal>;
81 static constexpr Tscal Rkern = Kernel::Rkern;
95 .template get_edge_ref<shamrock::solvergraph::IDataEdgeSerializable<Tscal>>(
"time")
103 .template get_edge_ref<shamrock::solvergraph::IDataEdgeSerializable<Tscal>>(
"dt")
114 auto &sync = scheduler().synchronized_data;
115 auto names = sync.get_edge_names();
116 auto has_edge = [&](
const std::string &name) {
117 return std::find(names.begin(), names.end(), name) != names.end();
120 if (!has_edge(
"time")) {
121 auto edge = sync.register_edge(
125 if (!has_edge(
"dt")) {
126 auto edge = sync.register_edge(
132 inline void init_required_fields() { solver_config.set_layout(context.get_pdl_write()); }
135 void gen_serial_patch_tree();
139 using GhostHandle = GSPHGhostHandler<Tvec>;
140 using GhostHandleCache =
typename GhostHandle::CacheMap;
142 void gen_ghost_handler(Tscal time_val);
143 inline void reset_ghost_handler() {
147 void build_ghost_cache();
148 void clear_ghost_cache();
150 void merge_position_ghost();
153 using RTree =
typename Config::RTree;
154 void build_merged_pos_trees();
155 void clear_merged_pos_trees();
157 void compute_presteps_rint();
158 void reset_presteps_rint();
160 void start_neighbors_cache();
161 void reset_neighbors_cache();
163 void gsph_prestep(Tscal time_val, Tscal dt);
165 void apply_position_boundary(Tscal time_val);
167 void do_predictor_leapfrog(Tscal dt);
169 void init_ghost_layout();
171 void communicate_merge_ghosts_fields();
172 void reset_merge_ghosts_fields();
174 void compute_eos_fields();
175 void reset_eos_fields();
210 void prepare_corrector();
232 bool apply_corrector(Tscal dt,
u64 Npart_all);
234 void update_sync_load_values();
236 Solver(ShamrockCtx &context) : context(context) {}
238 void init_solver_graph();
240 void vtk_do_dump(std::string filename,
bool add_patch_world_id);
242 inline void print_timestep_logs() {
245 "GSPH",
"iteration since start :", solve_logs.get_iteration_count());
247 "GSPH",
"time since start :", shambase::details::get_wtime(),
"(s)");
253 Tscal evolve_once_time_expl(Tscal t_current, Tscal dt_input) {
255 set_next_dt(dt_input);
260 inline bool evolve_until(Tscal target_time,
i32 niter_max = -1) {
263 Tscal t = get_time();
265 if (t > target_time) {
267 "the target time is higher than the current time");
270 if (t + dt > target_time) {
271 set_next_dt(target_time - t);
278 while (get_time() < target_time) {
282 if ((iter_count >= niter_max) && (niter_max != -1)) {
283 logger::info_ln(
"GSPH",
"stopping evolve until because of niter =", iter_count);
288 print_timestep_logs();
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...