#pragma once #include "FluidSim/Fluid.hpp" #include namespace fluidsim::port { struct JunctionEnd { int pipe; bool left; float discharge{1.f}; }; // Finite-volume N-port fitting: its specified physical volume stores gas and // energy. All ports share pressure and mixture, with bidirectional nozzle flow. // T, Y, cross and collectors share this model; angles require calibrated losses. class Junction : public Volume0D { public: using Volume0D::Volume0D; void connect(BoundarySystem& boundaries, const std::vector& pipes, std::span ends) { if(connected_ || ends.size()<2) throw std::invalid_argument("junction needs at least two distinct ends and one connection call"); for(std::size_t i=0;i=pipes.size() || !std::isfinite(e.discharge) || e.discharge<=0 || e.discharge>1) throw std::invalid_argument("invalid junction endpoint"); for(std::size_t j=0;j areas_; // stable addresses for boundary area references bool connected_{}; }; }