Class ThermodynamicCoupling
java.lang.Object
neqsim.process.equipment.pipeline.twophasepipe.ThermodynamicCoupling
- All Implemented Interfaces:
Serializable
Thermodynamic coupling for the two-fluid transient pipe model.
Provides interface between the two-fluid hydrodynamic solver and NeqSim's thermodynamic calculations. Handles flash calculations to update phase properties and compositions along the pipeline.
Key Functions
- Update phase densities, viscosities, and enthalpies from P-T flash
- Calculate phase compositions and mass transfer rates
- Provide sound speeds for wave propagation
- Support for both rigorous flash and table interpolation
Performance Considerations
Flash calculations are computationally expensive. For transient simulations with many time steps
and grid cells, consider using FlashTable for pre-computed property interpolation.
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult container for thermodynamic property update. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FlashTablePre-computed flash table (optional).private doubleFlash tolerance for convergence.private intMaximum flash iterations.private doubleMaximum pressure for valid flash (Pa).private doubleMaximum temperature for valid flash (K).private doubleMinimum pressure for valid flash (Pa).private doubleMinimum temperature for valid flash (K).private SystemInterfaceReference fluid system for flash calculations.private static final longprivate ThermodynamicOperationsThermodynamic operations object.private booleanWhether to use table interpolation instead of rigorous flash. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.ThermodynamicCoupling(SystemInterface referenceFluid) Constructor with reference fluid. -
Method Summary
Modifier and TypeMethodDescriptiondoublecalcMassTransferRate(TwoFluidSection section, double relaxationTime) Calculate mass transfer rate between phases (evaporation/condensation).doublecalcMixtureSoundSpeed(TwoFluidSection section) Calculate mixture sound speed for wave propagation.flashPH(double pressure, double enthalpy) Perform PH flash (constant pressure and enthalpy) for adiabatic processes.flashPT(double pressure, double temperature) Perform PT flash and extract all thermodynamic properties.Get flash table.doubleGet flash convergence tolerance.intGet maximum flash iterations.Get the reference fluid.booleanCheck if flash table interpolation is enabled.voidsetFlashTable(FlashTable table) Enable flash table interpolation for performance.voidsetFlashTolerance(double tolerance) Set flash convergence tolerance.voidsetMaxFlashIterations(int maxIterations) Set maximum flash iterations.voidsetPressureRange(double min, double max) Set valid pressure range for flash calculations.voidsetReferenceFluid(SystemInterface fluid) Set the reference fluid for thermodynamic calculations.voidsetTemperatureRange(double min, double max) Set valid temperature range for flash calculations.voidupdateAllSections(TwoFluidSection[] sections) Update all sections in an array with thermodynamic properties.voidupdateSectionProperties(TwoFluidSection section) Update a TwoFluidSection with thermodynamic properties at its P-T conditions.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
referenceFluid
Reference fluid system for flash calculations. -
thermoOps
Thermodynamic operations object. -
useFlashTable
private boolean useFlashTableWhether to use table interpolation instead of rigorous flash. -
flashTable
Pre-computed flash table (optional). -
minPressure
private double minPressureMinimum pressure for valid flash (Pa). -
maxPressure
private double maxPressureMaximum pressure for valid flash (Pa). -
minTemperature
private double minTemperatureMinimum temperature for valid flash (K). -
maxTemperature
private double maxTemperatureMaximum temperature for valid flash (K). -
flashTolerance
private double flashToleranceFlash tolerance for convergence. -
maxFlashIterations
private int maxFlashIterationsMaximum flash iterations.
-
-
Constructor Details
-
ThermodynamicCoupling
public ThermodynamicCoupling()Default constructor. -
ThermodynamicCoupling
Constructor with reference fluid.- Parameters:
referenceFluid- Fluid system to use as template for flash calculations
-
-
Method Details
-
setReferenceFluid
Set the reference fluid for thermodynamic calculations.- Parameters:
fluid- Fluid system (will be cloned internally)
-
getReferenceFluid
-
flashPT
Perform PT flash and extract all thermodynamic properties.- Parameters:
pressure- Pressure (Pa)temperature- Temperature (K)- Returns:
- ThermoProperties with all phase properties
-
flashPH
Perform PH flash (constant pressure and enthalpy) for adiabatic processes.- Parameters:
pressure- Pressure (Pa)enthalpy- Specific enthalpy (J/kg)- Returns:
- ThermoProperties with updated temperature and phase properties
-
updateSectionProperties
Update a TwoFluidSection with thermodynamic properties at its P-T conditions.- Parameters:
section- Pipe section to update
-
updateAllSections
Update all sections in an array with thermodynamic properties.- Parameters:
sections- Array of pipe sections
-
calcMassTransferRate
Calculate mass transfer rate between phases (evaporation/condensation).Based on departure from equilibrium. Positive = liquid to gas.
- Parameters:
section- Current section staterelaxationTime- Mass transfer relaxation time (s)- Returns:
- Mass transfer rate (kg/(m³·s))
-
calcMixtureSoundSpeed
Calculate mixture sound speed for wave propagation.Uses Wood's equation for homogeneous mixture.
- Parameters:
section- Pipe section with current state- Returns:
- Mixture sound speed (m/s)
-
setFlashTable
Enable flash table interpolation for performance.- Parameters:
table- Pre-computed flash table
-
getFlashTable
-
isUsingFlashTable
public boolean isUsingFlashTable()Check if flash table interpolation is enabled.- Returns:
- True if using table interpolation
-
setPressureRange
public void setPressureRange(double min, double max) Set valid pressure range for flash calculations.- Parameters:
min- Minimum pressure (Pa)max- Maximum pressure (Pa)
-
setTemperatureRange
public void setTemperatureRange(double min, double max) Set valid temperature range for flash calculations.- Parameters:
min- Minimum temperature (K)max- Maximum temperature (K)
-
setFlashTolerance
public void setFlashTolerance(double tolerance) Set flash convergence tolerance.- Parameters:
tolerance- Convergence tolerance
-
getFlashTolerance
public double getFlashTolerance()Get flash convergence tolerance.- Returns:
- Current tolerance
-
setMaxFlashIterations
public void setMaxFlashIterations(int maxIterations) Set maximum flash iterations.- Parameters:
maxIterations- Maximum iterations
-
getMaxFlashIterations
public int getMaxFlashIterations()Get maximum flash iterations.- Returns:
- Maximum iterations
-