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")
112 inline void init_required_fields() { solver_config.set_layout(context.get_pdl_write()); }
115 void gen_serial_patch_tree();
116 inline void reset_serial_patch_tree() { storage.serial_patch_tree.reset(); }
119 using GhostHandle = GSPHGhostHandler<Tvec>;
120 using GhostHandleCache =
typename GhostHandle::CacheMap;
122 inline void reset_ghost_handler() {
129 void clear_ghost_cache();
131 void merge_position_ghost();
134 using RTree =
typename Config::RTree;
135 void build_merged_pos_trees();
136 void clear_merged_pos_trees();
138 void compute_presteps_rint();
139 void reset_presteps_rint();
141 void start_neighbors_cache();
142 void reset_neighbors_cache();
144 void gsph_prestep(Tscal time_val, Tscal dt);
146 void apply_position_boundary(Tscal time_val);
148 void do_predictor_leapfrog(Tscal dt);
150 void init_ghost_layout();
152 void communicate_merge_ghosts_fields();
153 void reset_merge_ghosts_fields();
155 void compute_eos_fields();
156 void reset_eos_fields();
191 void prepare_corrector();
213 bool apply_corrector(Tscal dt,
u64 Npart_all);
215 void update_sync_load_values();
217 Solver(ShamrockCtx &context) : context(context) {}
219 void init_solver_graph();
221 void vtk_do_dump(std::string filename,
bool add_patch_world_id);
223 inline void print_timestep_logs() {
226 "GSPH",
"iteration since start :", solve_logs.get_iteration_count());
228 "GSPH",
"time since start :", shambase::details::get_wtime(),
"(s)");
234 Tscal evolve_once_time_expl(Tscal t_current, Tscal dt_input) {
236 set_next_dt(dt_input);
241 inline bool evolve_until(Tscal target_time,
i32 niter_max = -1) {
244 Tscal t = get_time();
246 if (t > target_time) {
248 "the target time is higher than the current time");
251 if (t + dt > target_time) {
252 set_next_dt(target_time - t);
259 while (get_time() < target_time) {
263 if ((iter_count >= niter_max) && (niter_max != -1)) {
264 logger::info_ln(
"GSPH",
"stopping evolve until because of niter =", iter_count);
269 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...