fix(process): scale LiquidRemover mass rate by gas mass fraction#1546
Open
fix(process): scale LiquidRemover mass rate by gas mass fraction#1546
Conversation
kjbrak
reviewed
May 8, 2026
Comment on lines
+37
to
+40
| if inlet_molar_mass > 0.0: | ||
| gas_mass_fraction = inlet_stream.vapor_fraction_molar * new_fluid.molar_mass / inlet_molar_mass | ||
| else: | ||
| gas_mass_fraction = 1.0 |
Contributor
There was a problem hiding this comment.
Consider failing explicitly when inlet_molar_mass <= 0.0 rather than preserving the full inlet mass rate. A non-positive molar mass is non-physical, and gas_mass_fraction = 1.0 would hide the invalid thermodynamic state while carrying all removed-liquid mass downstream again for that edge case.
If using InvalidStreamException, the matching import also needs to be added.
Suggested change
| if inlet_molar_mass > 0.0: | |
| gas_mass_fraction = inlet_stream.vapor_fraction_molar * new_fluid.molar_mass / inlet_molar_mass | |
| else: | |
| gas_mass_fraction = 1.0 | |
| if inlet_molar_mass <= 0.0: | |
| raise InvalidStreamException( | |
| f"Cannot remove liquid from stream with non-positive molar mass: {inlet_molar_mass}" | |
| ) | |
| gas_mass_fraction = inlet_stream.vapor_fraction_molar * new_fluid.molar_mass / inlet_molar_mass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Work
See here (internal): https://github.com/equinor/ecalc-internal/discussions/1044
Have you remembered and considered?
docs/drafts/next.draft.md)docs/docs/migration_guides/)BREAKING:in footer or!in headerWhat is this PR all about?
When
LiquidRemoveractivates on a two-phase inlet, it removes the liquid phase from the composition but previously kept the total mass rate unchanged — so the dropped-out liquid mass was effectively re-injected into the gas stream downstream.This PR scales the outlet mass rate by the gas mass fraction so the removed liquid is no longer carried by the gas:
Pure-vapor inlets are unchanged.
What else did you consider?
Also exposing the removed liquid as a separate outlet stream (e.g. for routing to an oil pump or emissions accounting). Left as a docstring note — it would change
propagate_stream's contract and there is no consumer for it yet.Between the lines?
Resolves equinor/ecalc-internal#1767