gtopt/reservoir_seepage.hpp file

Piecewise-linear water seepage (seepage) from a reservoir.

Defines the ReservoirSeepage structure modeling water seepage from a waterway into an adjacent reservoir. The seepage flow is modelled as a piecewise-linear function of the reservoir's average volume:

seepage [m³/s] = slope_i × avg_volume [hm³] + constant_i [m³/s]

When segments is non-empty, the active segment i is the one whose volume breakpoint is the largest that is ≤ the current reservoir volume (matches PLP Fortran FFiltracionesi):

Piecewise-linear evaluation (PLP formula)

Find segment i such that: segments[i].volume ≤ V < segments[i+1].volume
seepage(V) = constant_i + slope_i × V

Here constant_i is the y-intercept (seepage at V = 0 for segment i's linear equation), matching the PLP file format (plpfilemb.dat Constante field and FiltParam(PFiltConst) in Fortran). This is not the value at the breakpoint — the conversion constant_at_breakpoint = constant_y + slope × volume applies when comparing with the legacy gtopt representation.

Per-stage slope/constant schedules (PLP plpmanfi.dat)

slope and constant accept the same "number | array | filename" syntax used by other schedule fields:

  • Scalar – same value for all stages (legacy behaviour).
  • Array – one value per stage index.
  • Filename – Parquet/CSV table in input_directory/ReservoirSeepage/.

When per-stage schedules are used, the LP matrix coefficients for each stage are set to the stage-specific values directly in the LP (not via LP bounds), analogous to how ReservoirProductionFactor updates the turbine conversion-rate coefficient. If segments is also present, the piecewise-linear volume-dependent update takes precedence (via ReservoirSeepageLP::update_lp).

JSON Example

{
  "uid": 1,
  "name": "filt1",
  "waterway": "w1_2",
  "reservoir": "r1",
  "slope": 0.02,
  "constant": 0.5,
  "segments": [
    { "volume": 0.0, "slope": 0.0003, "constant": 0.5 },
    { "volume": 500.0, "slope": 0.0001, "constant": 0.65 }
  ]
}

Per-stage schedule (from plpmanfi.dat):

{ "uid": 1, "name": "filt1", "waterway": 1, "reservoir": 1,
  "slope": "slope", "constant": "constant" }

Namespaces

namespace gtopt

Classes

struct gtopt::ReservoirSeepage
Piecewise-linear seepage model between a waterway and a reservoir.
struct gtopt::ReservoirSeepageCoeffs
LP constraint coefficients for volume-dependent seepage.
struct gtopt::ReservoirSeepageSegment
One segment of the piecewise-linear seepage curve.