52#ifndef OPENSWMM_ENGINE_2D_GPU_EXPLICIT_KOKKOS_SURFACE_SOLVER_HPP
53#define OPENSWMM_ENGINE_2D_GPU_EXPLICIT_KOKKOS_SURFACE_SOLVER_HPP
120 double advance(
double t_current,
double t_target)
override;
185 RunStats
run_stats() const noexcept override;
201 void refreshConveyance();
206 DView d_tri_area_, d_tri_cz_, d_tri_cx_, d_tri_cy_, d_vz_, d_vx_, d_vy_;
209 IView d_vs_ptr_, d_vs_idx_;
210 DView d_edge_length_, d_mannings_n_;
212 IView d_cL_, d_cR_, d_slotL_, d_slotR_, d_cell_ptr_, d_cell_edge_;
213 DView d_xi_, d_inv_dx_, d_zface_, d_ze_lo_, d_ze_hi_, d_nx_, d_ny_, d_mx_, d_my_;
214 DView d_n2_, d_sign_, d_lchar_;
217 DView d_volume_, d_head_, d_depth_;
218 DView d_q_, d_faccL_, d_faccR_, d_qcx_, d_qcy_;
219 DView d_rain_, d_coup_, d_evap_, d_infil_;
226 DView d_infil_applied_;
227 DView d_evap_applied_;
228 std::vector<double> evap_applied_host_;
234 DView d_coupling_applied_;
238 DView d_node_fullvol_;
239 std::vector<double> infil_applied_host_;
240 std::vector<double> coupling_applied_host_;
242 IView d_active_, d_pin_t0_, d_tier_, d_face_tier_;
243 IView d_cells_compact_, d_edges_compact_;
248 IView d_bc_cell_, d_bc_slot_, d_bc_type_;
249 DView d_bc_accum_, d_bc_slope_, d_bc_head_, d_bc_flow_;
250 DView d_bc_in_, d_bc_out_;
251 std::vector<double> bc_in_host_, bc_out_host_;
252 DView d_bc_requested_, d_bc_last_flow_, d_bc_last_dt_;
253 std::vector<double> bc_requested_host_, bc_last_flow_host_, bc_last_dt_host_;
256 std::vector<int> bc_cell_host_, bc_slot_host_;
259 IView d_cp_cell_, d_cp_vertex_, d_cp_node_;
260 DView d_cp_cd_, d_cp_area_;
263 IView d_cp_law_, d_cp_head_b_, d_cp_head_e_, d_head_cells_, d_cp_eq_;
264 DView d_cp_geo_, d_cp_coef_;
265 DView d_node_pond_area_;
266 DView d_exch_, d_node_drawn_;
267 DView d_node_head_, d_node_depth_, d_node_volume_;
268 DView d_node_invert_, d_node_fulldepth_;
269 std::vector<double> exch_host_;
272 std::array<int, 9> tier_off_{};
273 std::array<int, 9> ftier_off_{};
277 bool have_perot_ =
false;
278 double t_last_sync_ = 0.0;
279 int cycles_since_rebuild_ = 1000;
280 double last_dt_ = 0.0;
281 long last_steps_ = 0, substeps_run_ = 0, face_passes_ = 0;
282 bool initialized_ =
false;
284 std::array<long, 8> tier_occupancy_{};
285 std::vector<std::pair<double, int>> telemetry_;
286 std::string telemetry_path_;
360 void fireFaces(
int tier,
double dt_f,
bool global_step =
false);
374 void fireCells(
int tier,
double dt_c,
bool global_step =
false);
Backend-neutral interface for the 2D surface-routing time integrator.
Unique interior-edge structure for the local-inertial momentum DOFs.
OPENSWMM_PERF=1 launch/fence/deep_copy counters for the Kokkos surface solver, riding the in-process ...
Execution-space selection + view aliases for the Kokkos marcher plugin.
Abstract time integrator for the 2D surface-routing ODE system.
Definition ISurfaceSolver.hpp:61
void reconstructAllDev()
Launch reconstruction of every device cell head/depth from canonical device volume.
Definition ExplicitKokkosSurfaceSolver.cpp:486
void collapseToGlobalDt()
< tighten-only dt0_ between rebuilds (== serial)
Definition ExplicitKokkosSurfaceSolver.cpp:765
void settleAccumulatorsDev()
Gather and zero every cell's own pending lateral side packets on device.
Definition ExplicitKokkosSurfaceSolver.cpp:504
void initialize(MeshData &mesh, SurfaceStateData &state, SolverOptions2D &opts) override
Initialize device geometry, canonical water and publication receipt views.
Definition ExplicitKokkosSurfaceSolver.cpp:199
void syncAndRebuild(double t)
Settle device receipts/sources and rebuild active halos, CFL tiers and compact lists.
Definition ExplicitKokkosSurfaceSolver.cpp:582
void finalize() override
Write optional telemetry and retire the marcher activation flag.
Definition ExplicitKokkosSurfaceSolver.cpp:1629
void pushForcings()
Upload current held surface/boundary forcing to existing device views.
Definition ExplicitKokkosSurfaceSolver.cpp:1373
void pushNodeState()
Upload frozen live-junction node state for one surface window.
Definition ExplicitKokkosSurfaceSolver.cpp:1413
void refreshDt0()
Tighten the current base duration against active-cell CFL limits.
Definition ExplicitKokkosSurfaceSolver.cpp:728
long last_num_steps() const noexcept override
Read the most recent advance base-substep count.
Definition ExplicitKokkosSurfaceSolver.hpp:160
void publishAndCopyBack(double t_current, double t_target)
Publish device water/flux and drain applied receipts additively into host owners.
Definition ExplicitKokkosSurfaceSolver.cpp:1424
void resyncFromVolumes(double t0) override
Upload authoritative host volumes while retaining device momentum.
Definition ExplicitKokkosSurfaceSolver.cpp:1619
double advance(double t_current, double t_target) override
Advance the accepted surface window and publish additive host receipts.
Definition ExplicitKokkosSurfaceSolver.cpp:1509
~ExplicitKokkosSurfaceSolver() override
Retire optional telemetry through finalize() then release owned Kokkos view handles.
Definition ExplicitKokkosSurfaceSolver.hpp:84
friend struct ExplicitKokkosSurfaceSolverTestAccess
Definition ExplicitKokkosSurfaceSolver.hpp:195
void lazySourcesDev(double t)
Apply held cell sources to currently inactive cells through a synchronization horizon.
Definition ExplicitKokkosSurfaceSolver.cpp:540
double last_step_size() const noexcept override
Read the most recent accepted base or tail duration.
Definition ExplicitKokkosSurfaceSolver.hpp:167
void fireCells(int tier, double dt_c, bool global_step=false)
Fire one device cell tier or a global tail selection.
Definition ExplicitKokkosSurfaceSolver.cpp:960
bool is_initialized() const noexcept override
Read whether nonempty device initialization completed.
Definition ExplicitKokkosSurfaceSolver.hpp:192
const std::vector< double > & last_coupling_exchange() const noexcept override
Borrow the published integrated live junction exchange.
Definition ExplicitKokkosSurfaceSolver.hpp:175
RunStats run_stats() const noexcept override
Snapshot accumulated Kokkos marcher work and active-tier telemetry.
Definition ExplicitKokkosSurfaceSolver.cpp:1647
void reinitialize(double t0) override
Upload externally edited host volumes and reset stale device momentum.
Definition ExplicitKokkosSurfaceSolver.cpp:1605
ExplicitKokkosSurfaceSolver()=default
Construct an inactive marcher with empty device views and no borrowed host owners.
void runMacroCycle(double dt0, int nsub)
Execute accepted binary local-time substeps using the current compact tier lists.
Definition ExplicitKokkosSurfaceSolver.cpp:1351
void fireFaces(int tier, double dt_f, bool global_step=false)
< tail: everything to tier 0
Definition ExplicitKokkosSurfaceSolver.cpp:870
Definition ExplicitKokkosSurfaceSolver.cpp:48
Kokkos::View< int *, MemSpace > IView
mutable int array
Definition KokkosTypes.hpp:72
Kokkos::View< double *, MemSpace > DView
mutable double array
Definition KokkosTypes.hpp:70
Canonical unique interior-edge layout + per-cell incidence for the local-inertial scheme.
Definition InertialEdges.hpp:60
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
Definition SolverOptions2D.hpp:257
Definition SurfaceStateData.hpp:64
Definition KokkosPerfCounters.hpp:79