39 template<
class Tvec,
class Tgr
idVec>
42 using Tscal = shambase::VecComponent<Tvec>;
43 using Tgridscal = shambase::VecComponent<TgridVec>;
44 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
49 using AMRBlock =
typename Config::AMRBlock;
63 .template get_edge_ref<shamrock::solvergraph::IDataEdgeSerializable<Tscal>>(
"time")
71 .template get_edge_ref<shamrock::solvergraph::IDataEdgeSerializable<Tscal>>(
"dt")
82 auto &sync = scheduler().synchronized_data;
83 auto names = sync.get_edge_names();
84 auto has_edge = [&](
const std::string &name) {
85 return std::find(names.begin(), names.end(), name) != names.end();
88 if (!has_edge(
"time")) {
89 auto edge = sync.register_edge(
93 if (!has_edge(
"dt")) {
94 auto edge = sync.register_edge(
101 std::optional<std::function<void(
void)>> step_begin_callback;
102 std::optional<std::function<void(
void)>> step_end_callback;
104 std::vector<SolverStepCallback> timestep_callbacks{};
106 inline void init_required_fields() { solver_config.set_layout(context.get_pdl_write()); }
110 void do_debug_vtk_dump(std::string filename);
112 inline void print_timestep_logs() {
123 inline Tscal evolve_once_time_expl(Tscal t_current, Tscal dt_input) {
125 set_next_dt(dt_input);
130 inline bool evolve_until(Tscal target_time,
i32 niter_max) {
133 Tscal t = get_time();
135 if (t > target_time) {
137 "the target time is lower than the current time");
140 if (t + dt > target_time) {
141 set_next_dt(target_time - t);
148 while (get_time() < target_time) {
152 if ((iter_count >= niter_max) && (niter_max != -1)) {
153 logger::info_ln(
"SPH",
"stopping evolve until because of niter =", iter_count);
158 print_timestep_logs();
utility to manipulate AMR blocks
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
std::int32_t i32
32 bit integer
Tscal & time_edge_value()
Access synchronized simulation time (scheduler edge "time").
void ensure_time_state_edges()
Register time/dt synchronized edges if missing (idempotent).
Tscal & dt_edge_value()
Access synchronized next dt (scheduler edge "dt").
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...
ExcptTypes make_except_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Create an exception with a message and a location.
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
namespace for the basegodunov model
void info_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
f64 get_wtime()
Returns the current wall clock time in seconds.
Class holding the logs of the solver /todo add a variable to keep only a definite number of steps in ...