-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hello, I'm trying to implement a valve leak that persists throughout my simulation, but the setMalfLeakThru() function in GunnsFluidHiFiValve only works when the valve is partially open. When the valve is completely closed (position = 0), no leakage occurs even though the malfunction is active. This doesn't match what I'd expect from a real valve leak, which should happen regardless of the commanded valve position.
The root cause is a circular dependency in the leak area calculation within updateState() and getEffectiveArea() methods. The leak area calculation requires existing flow conditions (massFlux) to compute mLeakArea = mMalfLeakThruValue / massFlux, but when the valve is closed, no flow exists to calculate massFlux. Without massFlux, mLeakArea remains 0, and without leak area, getEffectiveArea() returns 0, preventing any flow.
This circular dependency means the valve needs flow to calculate leak area, but needs leak area to create flow.
if (massFlux > DBL_EPSILON) {
mLeakArea = MsMath::limitRange(0.0, mMalfLeakThruValue / massFlux, mThroatArea);
}
When the valve is closed, massFlux is essentially zero (or very close to it), so the condition massFlux > DBL_EPSILON fails, and mLeakArea never gets calculated, remaining at 0. The Hi-Fi valve tries to calculate what area would be needed to produce the desired leak rate, but it needs existing flow conditions to make that calculation.
Is this intentional? Or should I use the GunnsFluidLeak instead?
