70 using Tscal = shambase::VecComponent<Tvec>;
72 using Kernel = SPHKernel<Tscal>;
78 static constexpr Tscal Rkern = Kernel::Rkern;
88 inline void init_required_fields() { solver_config.set_layout(context.get_pdl_write()); }
91 void gen_serial_patch_tree();
98 void gen_ghost_handler(Tscal time_val);
99 inline void reset_ghost_handler() {
103 void build_ghost_cache();
104 void clear_ghost_cache();
106 void merge_position_ghost();
110 void build_merged_pos_trees();
111 void clear_merged_pos_trees();
113 void compute_presteps_rint();
114 void reset_presteps_rint();
116 void start_neighbors_cache();
117 void reset_neighbors_cache();
119 void gsph_prestep(Tscal time_val, Tscal dt);
121 void apply_position_boundary(Tscal time_val);
123 void do_predictor_leapfrog(Tscal dt);
125 void init_ghost_layout();
127 void communicate_merge_ghosts_fields();
128 void reset_merge_ghosts_fields();
130 void compute_omega();
131 void compute_eos_fields();
132 void reset_eos_fields();
154 void prepare_corrector();
176 bool apply_corrector(Tscal dt,
u64 Npart_all);
178 void update_sync_load_values();
182 void init_solver_graph();
184 void vtk_do_dump(std::string filename,
bool add_patch_world_id);
186 inline void print_timestep_logs() {
189 "GSPH",
"iteration since start :", solve_logs.get_iteration_count());
191 "GSPH",
"time since start :", shambase::details::get_wtime(),
"(s)");
197 Tscal evolve_once_time_expl(Tscal t_current, Tscal dt_input) {
198 solver_config.set_time(t_current);
199 solver_config.set_next_dt(dt_input);
201 return solver_config.get_dt();
204 inline bool evolve_until(Tscal target_time,
i32 niter_max = -1) {
206 Tscal dt = solver_config.get_dt();
207 Tscal t = solver_config.get_time();
209 if (t > target_time) {
211 "the target time is higher than the current time");
214 if (t + dt > target_time) {
215 solver_config.set_next_dt(target_time - t);
222 while (solver_config.get_time() < target_time) {
226 if ((iter_count >= niter_max) && (niter_max != -1)) {
227 logger::info_ln(
"GSPH",
"stopping evolve until because of niter =", iter_count);
232 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...