35 template<
class Tvec,
class Tgr
idVec>
38 using Tscal = shambase::VecComponent<Tvec>;
39 using Tgridscal = shambase::VecComponent<TgridVec>;
40 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
45 using AMRBlock =
typename Config::AMRBlock;
58 .template get_edge_ref<shamrock::solvergraph::IDataEdgeSerializable<Tscal>>(
"time")
66 .template get_edge_ref<shamrock::solvergraph::IDataEdgeSerializable<Tscal>>(
"dt")
77 auto &sync = scheduler().synchronized_data;
78 auto names = sync.get_edge_names();
79 auto has_edge = [&](
const std::string &name) {
80 return std::find(names.begin(), names.end(), name) != names.end();
83 if (!has_edge(
"time")) {
84 auto edge = sync.register_edge(
88 if (!has_edge(
"dt")) {
89 auto edge = sync.register_edge(
95 inline void init_required_fields() { solver_config.set_layout(context.get_pdl_write()); }
99 void do_debug_vtk_dump(std::string filename);
101 inline void print_timestep_logs() {
112 inline Tscal evolve_once_time_expl(Tscal t_current, Tscal dt_input) {
114 set_next_dt(dt_input);
119 inline bool evolve_until(Tscal target_time,
i32 niter_max) {
122 Tscal t = get_time();
124 if (t > target_time) {
126 "the target time is lower than the current time");
129 if (t + dt > target_time) {
130 set_next_dt(target_time - t);
137 while (get_time() < target_time) {
141 if ((iter_count >= niter_max) && (niter_max != -1)) {
142 logger::info_ln(
"SPH",
"stopping evolve until because of niter =", iter_count);
147 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.