Opened 6 years ago
Last modified 6 years ago
#5104 closed enhancement
Further inStream optimizations — at Initial Version
Reported by: | Francesco Casella | Owned by: | Vitalij Ruge |
---|---|---|---|
Priority: | normal | Milestone: | 1.13.0 |
Component: | Backend | Version: | |
Keywords: | inStream | Cc: |
Description
The simplifyInStream module of the backend currently implements the substitutions listed in ticket:3885#comment:15
inStream
introduces positiveMax(cref, eps) and positiveMax(-cref, eps)- simplify positiveMax in Backend after removeSimpleEquation and EvaluateParameter and before IndexReduction
- positiveMax(cref, eps) = cref where variable is constant >= 0
- positiveMax(-cref, eps) = -cref where variable is constant <= 0
- positiveMax(cref, eps) = 0 if variable(cref).max <= 0
- positiveMax(-cref, eps) = 0 if variable(cref).min >= 0
The idea of the last two substitutions is that if a fluid never flows out of the stream connector, its contribution is zero. In case of components with only one direction of flow, one can set min=0 at the inlet to activate this optimization.
In fact, when dealing with components without flow reversal, not only the fluid never flows out of the inlet, hence inlet.m_flow.min = 0, but also the fluid never flows in the outlet, hence outlet.m_flow.max = 0. This fact can be stated by setting the max attribute of the outlet port mass flow rate to zero. If this property holds, then
- positiveMax(cref, eps) = cref if variable(cref).min >= 0
- positiveMax(-cref, eps) = 0 if variable(cref).max <= 0
These additional optimizations would allows to remove unnecessary positiveMax function calls, hence eliminating unnecessary hard nonlinearities from the model equations.
@vitalij, if you are willing to implement this, I can prepare the tests ASAP.