DLR-SR / ThermofluidStream

The DLR Thermofluid Stream Library
BSD 3-Clause "New" or "Revised" License
65 stars 27 forks source link

Source sink flow asserts #132

Closed kentrutan closed 1 year ago

kentrutan commented 1 year ago

This adds to the Source and Sink components an assert on m_flow direction similar to what is already in the PartialVolume components.

Some models in Examples such as SimpleStream and WaterHammer do not have volumes so without this commit there is no check for invalid mass flow direction when users modify the models. This also catches a mass flow reversal in the EspressoMachine example that is larger than the default threshold, so the threshold for that example has been increased so there is no assert.

With this commit, some topologies may still have invalid flow direction without an assert. To make a complete check, the SISOFlow or Inlet and Outlet connectors need an assert, but that will lead to many more assert messages. This commit is a compromise to catch most errors with fewer messages.