95#ifndef OPENSWMM_ENGINE_FV_PRESSURIZED_HEAD_SOLVER_HPP
96#define OPENSWMM_ENGINE_FV_PRESSURIZED_HEAD_SOLVER_HPP
140 const std::vector<std::uint8_t>*
node_alg =
nullptr;
273 const std::vector<std::uint8_t>&
foldedNodes() const noexcept {
return node_fold_; }
298 const auto uc =
static_cast<std::size_t
>(cell);
299 if (!state.cell_tpa.empty())
300 return state.cell_tpa[uc] != 0;
321 const auto uf =
static_cast<std::size_t
>(f);
326 const int cl = mesh.
face_cl[uf];
327 const int cr = mesh.
face_cr[uf];
329 if (nd < 0 && (cl < 0 || cr < 0))
332 bool pl =
false, pr =
false, cell_side_press =
false;
335 cell_side_press = cell_side_press || pl;
339 cell_side_press = cell_side_press || pr;
348 if (!cell_side_press)
367 const auto uf =
static_cast<std::size_t
>(f);
375 mesh.
geom[
static_cast<std::size_t
>(mesh.
cell_geom[
static_cast<std::size_t
>(other)])];
385 if (!state.cell_tpa.empty() && state.cell_tpa[
static_cast<std::size_t
>(other)] != 0 &&
388 const double hg = state.node_head[
static_cast<std::size_t
>(nd)] - mesh.
face_zb[uf];
395 std::uint8_t mode =
kNone;
412 std::vector<std::uint8_t> cell_press_;
413 std::vector<std::uint8_t> node_fold_;
414 std::vector<int> cell_unk_;
415 std::vector<int> node_unk_;
416 std::vector<ImpFace> imp_faces_;
421 std::vector<int> unk_entity_;
422 std::vector<double> unk_eta0_;
423 std::vector<double> unk_store_;
424 std::vector<double> unk_rhs_ext_;
425 std::vector<int> unk_comp_;
426 std::vector<double> unk_head_;
429 std::vector<int> uf_parent_;
445 void ufUnion(
int a,
int b);
448 std::vector<int> comp_ptr_, comp_unks_;
449 std::vector<double> thom_a_, thom_b_, thom_c_, thom_d_;
450 std::vector<int> path_order_, degree_, adj_ptr_, adj_idx_;
451 std::vector<double> adj_c_;
452 std::vector<double> cg_r_, cg_p_, cg_ap_, cg_z_;
462 void buildComponents();
477 void prepare(
const PressurizedView& v,
double dt);
489 void assembleRhs(
const PressurizedView& v,
double dt);
504 void solveComponent(
int comp,
const PressurizedView& v,
double dt);
517 void backSubstitute(
const PressurizedView& v);
530 void linearSolve(
const std::vector<int>& unks,
const std::vector<double>& diag,
531 const std::vector<double>& rhs);
534 std::vector<double> diag_, rhs_;
535 std::vector<std::uint8_t> unk_dirichlet_;
536 std::vector<double> unk_dirvalue_;
537 NonlinearPressureStorage candidate_;
538 std::vector<NonlinearPressureStorage::Row> candidate_rows_;
539 std::vector<NonlinearPressureStorage::Edge> candidate_edges_;
540 std::vector<double> candidate_head_, candidate_residual_, candidate_budget_;
Single-source scalar kernels for the explicit FV 1D network solver.
Backend-neutral interface for the explicit FV 1D network integrator.
SoA storage for the 1D finite-volume network mesh and its state.
Nonlinear pressure and physical storage equations for finite-volume trials.
Definition PressurizedHeadSolver.hpp:146
void solve(const PressurizedView &v, double dt)
Predict fully pressurized face discharges with an implicit head system.
Definition PressurizedHeadSolver.cpp:447
bool verifyCandidateEndpoint(const PressurizedView &v, double dt, const NonlinearPressureStorage::Controls &controls)
Check the actual post-update endpoint against the last nonlinear candidate equations.
Definition PressurizedHeadSolver.cpp:656
NonlinearPressureStorage::Result solveCandidate(const PressurizedView &v, double dt, const NonlinearPressureStorage::Controls &controls)
Try a guarded nonlinear SLOT-storage pressure predictor.
Definition PressurizedHeadSolver.cpp:595
static bool cellPressurized(const NetworkMeshData &mesh, const NetworkStateData &state, int cell)
Test pressure membership shared by classification and timestep census.
Definition PressurizedHeadSolver.hpp:296
@ kDelta
Definition PressurizedHeadSolver.hpp:170
@ kNone
Definition PressurizedHeadSolver.hpp:170
@ kFull
Definition PressurizedHeadSolver.hpp:170
bool classify(const PressurizedView &v)
Rebuild pressure membership, implicit face ownership and union-find connectivity.
Definition PressurizedHeadSolver.cpp:166
void finalizeCells(const PressurizedView &v)
Replace pressure-cell discharge with its solved face through-flow after conservative update.
Definition PressurizedHeadSolver.cpp:1060
const std::vector< std::uint8_t > & foldedNodes() const noexcept
Borrow the last classification folded-node mask.
Definition PressurizedHeadSolver.hpp:273
bool anyImplicit() const noexcept
Report whether the last classification contains any fully implicit face.
Definition PressurizedHeadSolver.hpp:280
static std::uint8_t faceModeOf(const NetworkMeshData &mesh, const NetworkStateData &state, int f)
Classify one face as explicit, full pressure or a pressure/free transition.
Definition PressurizedHeadSolver.hpp:319
static bool ghostPressurized(const NetworkMeshData &mesh, const NetworkStateData &state, int f)
Test the node-side ghost pressure state in the adjacent cell geometry.
Definition PressurizedHeadSolver.hpp:365
Definition Controls.cpp:47
Definition AcceptedWaterVolumes.hpp:8
Cross-section closure for one conduit's cell chain.
Definition NetworkMeshData.hpp:71
uint8_t is_open
open section: no crown, no slot taper
Definition NetworkMeshData.hpp:100
double y_crown
Definition NetworkMeshData.hpp:86
Knobs for FLOW_ROUTING FV.
Definition FvOptions.hpp:123
Definition INetworkSolver.hpp:58
SoA mesh geometry and topology for the FV network solver.
Definition NetworkMeshData.hpp:123
std::vector< int > cell_geom
index into geom
Definition NetworkMeshData.hpp:129
std::vector< double > node_sur_depth
SURCHARGE_DEPTH above the rim (ft)
Definition NetworkMeshData.hpp:361
std::vector< double > face_zb
bed elevation at the interface (ft)
Definition NetworkMeshData.hpp:219
std::vector< int > face_cr
right cell (-1 ⇒ node on the right)
Definition NetworkMeshData.hpp:162
std::vector< int > face_cl
left cell (-1 ⇒ node on the left)
Definition NetworkMeshData.hpp:161
std::vector< int > face_node
coupled node (-1 for interior faces)
Definition NetworkMeshData.hpp:163
std::vector< int > face_culvert
Definition NetworkMeshData.hpp:218
std::vector< uint8_t > face_gate
Definition NetworkMeshData.hpp:213
std::vector< FvGeometry > geom
Definition NetworkMeshData.hpp:401
Mutable solver state — the conserved variables and the node volumes.
Definition NetworkMeshData.hpp:519
Definition NonlinearPressureStorage.hpp:44
Definition NonlinearPressureStorage.hpp:65
Definition PressurizedHeadSolver.hpp:111
const std::vector< int > * active_faces
Definition PressurizedHeadSolver.hpp:134
kernels::FaceState * f_state_r
Definition PressurizedHeadSolver.hpp:121
NetworkStateData * state
Definition PressurizedHeadSolver.hpp:113
const std::vector< std::uint8_t > * node_lat_div
Definition PressurizedHeadSolver.hpp:142
const std::vector< double > * uf_grad
Definition PressurizedHeadSolver.hpp:132
const double * cell_eta
Definition PressurizedHeadSolver.hpp:125
const std::vector< double > * cell_qlat
Definition PressurizedHeadSolver.hpp:143
const FvStepForcing * forcing
Definition PressurizedHeadSolver.hpp:115
const FvOptions * opts
Definition PressurizedHeadSolver.hpp:114
const NetworkMeshData * mesh
Definition PressurizedHeadSolver.hpp:112
const std::vector< double > * node_qstruct
Definition PressurizedHeadSolver.hpp:138
kernels::FaceFlux * f_flux
Definition PressurizedHeadSolver.hpp:122
std::vector< double > * node_carry
Definition PressurizedHeadSolver.hpp:139
double * cell_u
Definition PressurizedHeadSolver.hpp:126
const std::vector< std::uint8_t > * node_alg
Definition PressurizedHeadSolver.hpp:140
const std::vector< double > * node_vfull
Definition PressurizedHeadSolver.hpp:141
double * f_sstar
Definition PressurizedHeadSolver.hpp:119
kernels::FaceState * f_state_l
Definition PressurizedHeadSolver.hpp:120
double * f_mass
Definition PressurizedHeadSolver.hpp:118
const std::vector< char > * cell_active
Definition PressurizedHeadSolver.hpp:135
Result of a face flux evaluation.
Definition FvKernels.hpp:259
One side of a face after hydrostatic reconstruction.
Definition FvKernels.hpp:245