hydrobricks
Loading...
Searching...
No Matches
SolverSequential Class Referenceabstract

#include <SolverSequential.h>

Inheritance diagram for SolverSequential:
Solver SolverAnalyticLinear SolverCrankNicolson SolverExponentialEuler SolverImplicitEuler

Public Member Functions

void InitializeContainers () override
 
bool Solve (double timeStepInDays) final
 
- Public Member Functions inherited from Solver
void Connect (Processor *processor)
 

Protected Member Functions

virtual void ComputeBrickRates (Brick *brick, double content, double inflow, double timeStepInDays, int iRateStart)=0
 

Static Protected Member Functions

static double TotalRateAt (Brick *brick, double *contentDelta, double offset)
 
static void StoreRatesAtCurrentContent (Brick *brick, vecDouble &rates)
 

Protected Attributes

axd _rates
 
- Protected Attributes inherited from Solver
Processor_processor
 

Additional Inherited Members

- Static Public Member Functions inherited from Solver
static std::unique_ptr< SolverFactory (const SolverSettings &solverSettings)
 

Detailed Description

Base class for the sequential solvers.

The bricks are processed one by one in declaration order (upstream before downstream). Each brick receives its inflows as a constant rate over the time step; the subclass computes the brick's average outflow rates over the step. The resulting rates go through the standard constraint and flux machinery, so water propagates through a cascade within the same step.

Member Function Documentation

◆ ComputeBrickRates()

virtual void SolverSequential::ComputeBrickRates ( Brick * brick,
double content,
double inflow,
double timeStepInDays,
int iRateStart )
protectedpure virtual

Compute the average outflow rates of the brick over the time step and store them in the _rates slice starting at iRateStart (one value per process connection, in process declaration order).

Parameters
brickThe brick to solve.
contentStart-of-step content [mm], including instantaneous deposits.
inflowInflows as a constant rate over the step [mm/d].
timeStepInDaysThe time step in days.
iRateStartIndex of the brick's first connection in _rates.

Implemented in SolverAnalyticLinear, SolverCrankNicolson, SolverExponentialEuler, and SolverImplicitEuler.

◆ InitializeContainers()

void SolverSequential::InitializeContainers ( )
overridevirtual

Allocate the internal rate and state buffers to the needed size. Must be called after Connect(), once the processor knows its connection and state counts.

Implements Solver.

◆ Solve()

bool SolverSequential::Solve ( double timeStepInDays)
finalvirtual

Apply the solver.

Parameters
timeStepInDaysThe time step in days.
Returns
True if success, false otherwise.

Implements Solver.

◆ StoreRatesAtCurrentContent()

void SolverSequential::StoreRatesAtCurrentContent ( Brick * brick,
vecDouble & rates )
staticprotected

Store the per-connection rates of the brick's processes, evaluated at the current content, into the provided vector (resized to the connection count).

Parameters
brickThe brick to evaluate.
ratesThe vector receiving the rates.

◆ TotalRateAt()

double SolverSequential::TotalRateAt ( Brick * brick,
double * contentDelta,
double offset )
staticprotected

Sum the rates of all processes of the brick, evaluated at the given content offset. Temporarily writes the offset into the container's dynamic change; the caller must restore it to zero before the constraint pass.

Parameters
brickThe brick to evaluate.
contentDeltaPointer to the container's dynamic content change.
offsetContent offset from the start-of-step content [mm].
Returns
the total outflow rate [mm/d].

The documentation for this class was generated from the following files: