Fluid_Linearization - nasa/gunns GitHub Wiki

Fluid Linearization

GUNNS is a linear system solver, but we use it to simulate non-linear systems. We do this by linearizing the system in key places — approximating non-linear equations with linear equations that GUNNS can solve. The fluid flow equations are an important example. Fluid mass flow rate between two points is usually proportional to the square-root of the delta-pressure between the points:

ṁ ∝ dp 1/2

Whether we use our standard GUNNS version of Bernoulli’s equation, or higher-fidelity duct or orifice equations, the above non-linear proportionality is almost always true. Thus, when modeling fluid flow in GUNNS, we are almost always linearizing some non-linear flow equation.

Normally, linearization of a curve employs tangent-line approximation for the best accuracy near the current location on the curve. However, in GUNNS we don’t use this method. Instead, we fit our line between the current point and the ṁ vs. dP origin, as illustrated below:

The reason for this is that it is more stable across the entire range of possible dP solutions. In GUNNS, we generally tend to favor stability and reliability over accuracy because that was the priority of our original customer for which GUNNS was designed1. In the above picture, it is obvious that the tangent-line method is vastly more accurate for delta-pressures near the current point. This means that if the resulting delta-pressure of the ensuing network solution across this conductor link is close to the current point, say between 0.25 < dP < 1 in the above picture, the tangent-line would be the preferable and more accurate method. This occurs in the vast majority of steps in a typical fluid network. However, if the resulting delta-pressure were less than 0.25 or even negative (reversed flow direction), then our GUNNS method is more accurate and in fact, the tangent-line method goes horribly wrong. These rapid pressure and flow direction changes can and do occur quite often in fluid plumbing systems, so we want our system to be able to handle it. In the above example, if the ensuing delta-pressure solution were negative, then the tangent-line method results in a flow direction from lower pressure to higher pressure which is physically impossible. We do not want our networks to ever show that discrepancy. To avoid that discrepancy in the tangent-line method, a solver has to re-linearize the flow equation at the new solution and iterate again, repeating this process and hoping that it converges to a solution that makes sense. Not only does this risk non-convergence, but it also consumes vastly more CPU resources than a single solution. GUNNS avoids both the non-convergence risk and the higher CPU cost by opting for an initial solution that trends properly the first time, albeit less accurately.

The linearization is re-applied to the truth flow equation on each network pass. Thus the error in either approximation method vanishes when the system approaches steady-state.

To date, all GUNNS fluid conductor links use this GUNNS approximation method instead of the tangent-line method. Someday, if we ever develop higher-fidelity links, we may want to use the tangent-line approximation method for better accuracy, especially in transient cases, i.e. non-steady-state. However we’ll have to take extra steps to mitigate the above stability risks. These steps might include smoothing the network inputs that cause rapid flow reversals (like valve positions & pump speeds) or enabling the GUNNS solver’s non-linear iteration mode and living with its higher CPU cost (some electrical aspect links already employ tangent-line approximation in conjunction with this iteration mode).

1 This was also the design choice in PFN, from which GUNNS inherited much of its fluid design.

⚠️ **GitHub.com Fallback** ⚠️