Two-fluid solver
The Solvers.TwoFluid module in OpenSTREAM provides classes and tools for simulating two-phase flows using a two-fluid approach. In this method, each phase (liquid and vapor) is modeled as an interpenetrating continuum with its own set of conservation equations for mass, momentum, and energy. This framework enables explicit representation of phase interactions, slip velocities, and non-equilibrium effects, making it well-suited for applications where phase separation, interfacial dynamics, and transient boiling phenomena are significant.
This module includes:
Solver class for two-fluid-based flow simulations:
Solvers.TwoFluid.TwoFluidSolverLiquid and vapor field classes:
Solvers.TwoFluid.Liquid,Solvers.TwoFluid.VaporMixture class:
Solvers.TwoFluid.MixtureTwo-fluid primary properties:
Solvers.TwoFluid.Liquid.W,Solvers.TwoFluid.Liquid.U,Solvers.TwoFluid.Liquid.H,Solvers.TwoFluid.Vapor.W,Solvers.TwoFluid.Vapor.U,Solvers.TwoFluid.Vapor.HKey solver class methods:
Solvers.TwoFluid.TwoFluidSolver.initializeSolver,Solvers.TwoFluid.TwoFluidSolver.solve(),Solvers.TwoFluid.TwoFluidSolver.plotzField class methods for calculating secondary two-fluid parameters.
- Solvers.TwoFluid.TwoFluidSolver.solve(twfSolver)
SOLVE Executes the two-fluid solver for steady-state and transient simulations.
Runs the full solution process for the
Solvers.TwoFluid.TwoFluidSolverobject. It manages initialization, time stepping, axial sweeps, inner iterations, convergence checks, and logging.Workflow:
Enables logging and opens persistent log file
Validates solver state before execution
Runs steady-state initialization (solveINIT = true)
If initial step converges, proceeds with transient simulation
Handles exceptions and ensures proper log closure
Notes:
Uses internal solver function to handle both steady-state and transient modes
Applies relaxation factors for phase flows, velocities, and enthalpies
Supports thermal non-equilibrium modeling
Logs progress and outputs to session directory
- class Solvers.TwoFluid.TwoFluidSolver.TwoFluidSolver(inputSet, mixSolver)
Bases:
Solvers.AbstractSolverTWOFLUIDSOLVER Solver for initializing, solving, and visualizing two-fluid flow.
The TwoFluidSolver class handles the setup, execution, and visualization of thermal-hydraulic simulations using a two-phase two-fluid approach.
Responsibilities:
Initializes solver parameters from an
Inputs.InputSetobjectConstructs
Solvers.TwoFluid.LiquidandSolvers.TwoFluid.Vaporobjects for transient and steady-state analysisProvides plotting utilities for spatial and temporal distributions
Key Components:
Phase construction (liquid/vapor)
Phase mass/momentum/energy transport modeling
Pressure drop gradient obtained from mixture solver
Support for relaxation models
Visualization of results across time and axial domains
- Constructor Summary
- TwoFluidSolver(inputSet, mixSolver)
TWOFLUIDSOLVER Constructor for the TwoFluidSolver class.
Creates a new instance of the TwoFluidSolver class using the provided
Inputs.InputSet. This constructor initializes the solver by calling the abstractSolvers.AbstractSolversuperclass constructor and then sets up all necessary solver parameters and internal data structures viaSolvers.TwoFluid.TwoFluidSolver.initializeSolverInput:
inputSet — An
Inputs.InputSetobject containing model configuration, geometry, boundary conditions, and solver options.
Notes:
This constructor assumes
Inputs.InputSetis fully validated.Solver initialization includes liquid and vapor objects setup.
Time/space discretization and boundary condition interpolation initialized by
Solvers.Mixture.MixtureSolverare used
- Property Summary
- DT = 0
Time step size [s] from
Inputs.Options.TSTEP
- DZ = 0
Axial step size [m]
- NTIME = 0
Number of time steps [-]
- NZ = 0
Number of axial steps [-] from
Inputs.Model.NNODES
- TIME = 0
Time series [s]
- Z = 1.
Elevation [m]
- boundaryConditions
Boundary conditions object
Inputs.BoundaryConditions
- fluid
Fluid object
Inputs.FluidProperties
- inputSet
Input set object
Inputs.InputSet
- liquid
Liquid object
- liquidInit
Null transient liquid object
- mixSolver
Mixture object
Solvers.Mixture.Mixture
- vapor
Vapor object
- vaporInit
Null transient vapor object
- Method Summary
- initializeSolver(twfSolver)
INITIALIZESOLVER Initializes solver parameters and constructs liquid/vapor objects.
Sets up the solver’s internal state using the provided
Inputs.InputSetandSolvers.TwoFluid.TwoFluidSolver, This includes initialization of data structures for transient and steady-state simulations based on the mixture solver solutions.Operations performed:
Initializes liquid and vapor arrays for each time step
Initializes fluid property objects
Sets up mixture object
Assigns initial conditions for phase mass flow rates, velocities, enthalpies
Notes:
The function assumes uniform axial discretization.
Wall heat flux is computed from interpolated boundary conditions.
- plott(twfSolver, zIdx, opt)
PLOTT Plots temporal distributions of two-fluid parameters at a given axial location.
Generates time-series plots of selected two-fluid parameters at a specified axial index. The method supports multiple display modes, wall selections, and plot arrangements.
Inputs:
twfSolver —
Solvers.TwoFluid.TwoFluidSolverobject containing simulation datazIdx — Axial index (scalar, positive integer)
opt.display — Parameters to display (e.g., ‘HFLUX’, ‘W’, ‘U’, etc.)
opt.solveMode — Solve mode: ‘REAL’ or ‘NULL’
opt.wall — Wall index(es) to plot
opt.tIdx — Time indices to include in the plot
opt.reverseTime — Logical flag to reverse time axis
opt.unitTemp — Temperature unit: ‘K’ or ‘C’
opt.arrangement — Plot arrangement: ‘flow’, ‘vertical’, or ‘horizontal’
opt.resize — Resize factor for plot scaling
Notes:
If opt.display is set to ‘ALL’, all supported parameters are plotted.
The function validates that at least two time indices are provided.
Temperature unit conversion is applied if ‘C’ is selected.
Each wall is plotted in a separate tile with appropriate legends and axis scaling.
- plotz(twfSolver, tIdx, opts)
PLOTZ Plots spatial (axial) distributions of two-fluid parameters.
Generates axial plots of selected two-fluid parameters at specified time indices. The function supports multiple display modes, wall selections, and optional animation over time.
Inputs:
twfSolver —
Solvers.TwoFluid.TwoFluidSolverobject containing simulation datatIdx — Time index or indices (vector of positive integers)
opts.display — Parameters to display (e.g., ‘HFLUX’, ‘W’, ‘U’, etc.)
opts.solveMode — Solve mode: ‘REAL’ or ‘NULL’
opts.wall — Wall index(es) to plot
opts.zIdx — Axial indices to include in the plot
opts.obstructions — Logical flag to display obstruction locations
opts.unitTemp — Temperature unit: ‘K’ or ‘C’
opts.arrangement — Plot arrangement: ‘flow’, ‘vertical’, or ‘horizontal’
opts.resize — Resize factor for plot scaling
Notes:
If multiple time indices are provided, the function creates an animated plot.
At least two axial indices must be specified to enable spatial plotting.
Temperature unit conversion is applied if ‘C’ is selected.
Obstruction locations are plotted if opts.obstructions is true.
Each wall is plotted in a separate tile with appropriate legends and axis scaling.
- plotzt(twfSolver, opt)
PLOTZT Plots 2D time/elevation distributions of two-fluid parameters.
Generates surface plots of selected two-fluid related parameters over time and axial (elevation) positions. It supports plotting for liquid and vapor fields, and can handle both real and null (initial) transient data.
Inputs:
twfSolver —
Solvers.TwoFluid.TwoFluidSolverobject containing simulation dataopt.display — Parameter(s) to display (e.g., ‘HFLUX’, ‘U’, etc.)
opt.label — Corresponding labels for display parameters
opt.unit — Units for each parameter
opt.field — Field to plot: ‘liquid’ or ‘vapor’
opt.solveMode — Solve mode: ‘REAL’ or ‘NULL’
opt.wall — Wall index(es) to plot
opt.zIdx — Axial indices (must include at least 2)
opt.tIdx — Time indices (must include at least 2)
opt.reverseTime — Logical flag to reverse time axis
opt.shading — Surface shading style: ‘faceted’, ‘flat’, or ‘interp’
opt.view — View angle for 3D plot [azimuth elevation]
Notes:
If ‘ALL’ is passed to opt.display, all supported parameters are plotted.
The function validates that at least two axial and time indices are provided to enable meaningful 2D plotting.
Each wall is plotted in a separate figure window with appropriate titles and subplot grouping.
- class Solvers.TwoFluid.Liquid(inputSet, fluid)
Bases:
Solvers.AbstractFieldLIQUID Class for modeling liquid field in two-fluid solver
This class encapsulates the physical and numerical properties of the liquid phase, including flow variables, phase interactions, heat transfer,and relaxation models. It supports multiple solver models and provides methods for computing derived quantities and handling flow regime transitions.
- Constructor Summary
- Liquid(inputSet, fluid)
LIQUID Constructor for Liquid class
Initializes the liquid field object with input configuration and fluid properties.
Inputs:
inputSet —
Inputs.InputSetobject containing model, geometry, and boundary conditionsfluid —
Inputs.FluidPropertiesobject containing thermophysical fluid data
- Property Summary
- DT = 0
Time step size [s] from
Inputs.Options.TSTEP
- H = 1E6
Enthalpy [J/kg]
- ITR
Iteration tracking
- NTIME = 0
Number of time steps [-]
- NZ = 0
Number of axial steps [-] from
Inputs.Model.NNODES
- TIDX = 1
Time step index [-]
- TIME = 0
Time series [s]
- U = 1.
Velocity [m/s]
- W = 1.
Mass flow rate [kg/s]
- Z = 1.
Elevation [m]
- mix = NaN
Solvers.TwoFluid.Mixtureobject
- Method Summary
- AREA(liquid, vapor, zIdx)
AREA Liquid cross-section area [m^2]
Computes the effective cross-sectional area occupied by the liquid phase.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- CD(liquid, vapor, zIdx)
CD Drag coefficient for dispersed liquid [-]
Computes the drag coefficient for dispersed liquid based on
Inputs.Model.DROPDRAGmodel.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Values are clamped to a maximum of 1
- FBUOY(liquid, vapor, zIdx)
FBUOY Liquid buoyancy force [N/m]
Computes the buoyancy force acting on the liquid phase due to pressure gradient.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
The pressure gradient from the mixture solver is used
- FDRAG(liquid, vapor, zIdx)
FDRAG Interfacial drag force [N/m]
Computes the interfacial drag force acting on the liquid phase.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Uses smooth transition between dispersed gas and liquid drag based on
Inputs.Model.DISPGAS2DISPLIQmodel.
- FGRAV(liquid, vapor, zIdx)
FGRAV Liquid gravity force [N/m]
Computes the gravitational force acting on the liquid phase.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- FINTCOND(liquid, vapor, zIdx)
FINTCOND Momentum exchange through interfacial condensation [N/m]
Computes the momentum exchange due to interfacial condensation.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- FLOWID(liquid, zIdx)
FLOWID Two-phase flow regime ID
Returns the integer ID corresponding to the flow regime classification.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- FLOWREGIME(liquid, zIdx)
FLOWREGIME Categorical two-phase flow regimes
Classifies flow regime based on equilibrium quality and boiling transition flags.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Returns:
flowregime — Categorical flow regime (from
Solvers.TwoFluid.REGIMES)id — Integer regime ID
- FTOT(liquid, vapor, zIdx)
FTOT Total force [N/m]
Computes the total force acting on the liquid phase, including gravity, buoyancy, wall shear, drag, and interfacial condensation.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- FWALL(liquid, vapor, zIdx)
FWALL Liquid wall shear force [N/m]
Computes the wall shear force acting on the liquid phase, weighted by void fraction.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- HFLUX(liquid, zIdx)
HFLUX Wall heat flux to liquid phase [W/m^2]
Computes the net wall heat flux transferred to the liquid phase, combining direct wall heating and boiling contributions.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Notes:
Combines
Solvers.TwoFluid.Liquid.HWALHEATandSolvers.TwoFluid.Liquid.HFLUXWALEVAPUses wall perimeter from geometry
- HFLUXWALEVAP(liquid, zIdx)
HFLUXWALEVAP Wall evaporation (boiling) heat flux [W/m^2]
Computes the portion of wall heat flux attributed to evaporation (e.g., boiling), based on the wall evaporation mass ratio.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HINT(liquid, vapor, zIdx)
HINT Linear interfacial heat transfer rate [W/m]
Computes the interfacial heat transfer rate using mass transfer and enthalpy difference (based on
Inputs.Model.INTTRANSHmodel).Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Returns:
Hcond — Condensation heat transfer rate [W/m]
Hevap — Evaporation heat transfer rate [W/m]
- HINTCOND(liquid, vapor, zIdx)
HINTCOND Linear interfacial heat condensation rate [W/m]
Extracts the condensation component from
Solvers.TwoFluid.Liquid.HINT.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- HINTEVAP(liquid, vapor, zIdx)
HINTEVAP Linear interfacial heat evaporation rate [W/m]
Extracts the evaporation component from
Solvers.TwoFluid.Liquid.HINT.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- HTOT(liquid, vapor, zIdx)
HTOT Total linear vapor heat rate [W/m]
Computes the total heat transfer to the vapor phase, including interfacial and wall contributions.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- HWALEVAP(liquid, vapor, zIdx)
HWALEVAP Linear wall heat evaporation (boiling) rate [W/m]
Computes the wall boiling heat transfer rate using latent heat (based on
Inputs.Model.INTTRANSHmodel) and wall mass evaporation.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- HWALHEAT(liquid, zIdx)
HWALHEAT Linear wall heat to liquid rate [W/m]
Returns the wall heat generation rate transferred to the liquid phase.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Notes:
Set to zero beyond CBT
- INTAREA(liquid, vapor, zIdx)
INTAREA Volumetric interfacial area [m^-1]
Computes the interfacial area concentration based on flow regime and phase topology.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Uses a smooth transition between dispersed gas and dispersed liquid models
- INTHFLUX(liquid, vapor, zIdx)
INTHFLUX Interfacial heat flux [W/m^2]
Computes the interfacial heat flux due to evaporation and condensation based on
Inputs.Model.INTAREAinterfacial area model.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Returns:
inthflux_evap — Evaporation heat flux [W/m^2]
inthflux_cond — Condensation heat flux [W/m^2]
Notes:
Uses interfacial Nusselt number and length scale
Driven by deviation from saturated temperature
- INTNU(liquid, vapor, zIdx)
INTNU Interfacial Nusselt number for dispersed liquid [-]
Computes the interfacial Nusselt number based on
Inputs.Model.INTNUmodel.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- J(liquid, zIdx)
J Liquid superficial velocity [m/s]
Computes the superficial velocity of the liquid phase.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- L(liquid, zIdx)
L Dispersed liquid interfacial length scale [m]
Returns the characteristic length scale for dispersed liquid (e.g., drop Sauter mean diameter).
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Notes:
Currently uses a constant model
- MINT(liquid, vapor, zIdx)
MINT Linear interfacial mass transfer rates [kg/s/m]
Computes condensation and evaporation mass transfer rates using either heat flux-based or relaxation-based models.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Returns:
Mcond — Condensation mass transfer rate [kg/s/m]
Mevap — Evaporation mass transfer rate [kg/s/m]
Notes:
Supports ‘CONSTANT’, ‘RANZMARSHALL’, and ‘RELAXATION’ models based on
Inputs.Model.INTNUmodelApplies wall-wise distribution
- MINTCOND(liquid, vapor, zIdx)
MINTEVAP Linear interfacial condensation mass transfer [kg/s/m]
Extracts the evaporation component from
Solvers.TwoFluid.Liquid.MINT.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- MINTEVAP(liquid, vapor, zIdx)
MINTEVAP Linear interfacial evaporation mass transfer [kg/s/m]
Extracts the evaporation component from
Solvers.TwoFluid.Liquid.MINT.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- MTOT(liquid, vapor, zIdx)
MTOT Total linear mass transfer [kg/s/m]
Computes the total vapor mass transfer rate by summing interfacial condensation, evaporation, and wall boiling contributions.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- MWALEVAP(liquid, vapor, zIdx)
MWALEVAP Linear wall mass evaporation rate [kg/s/m]
Computes the wall boiling mass transfer rate using latent heat (based on
Inputs.Model.INTTRANSHmodel) and wall heat flux.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- RE(liquid, zIdx)
RE Liquid Reynolds number [-]
Computes the liquid-phase Reynolds number based on flow rate and viscosity.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- REV(liquid, vapor, zIdx)
REV Dispersed liquid Reynolds number [-]
Computes the Reynolds number for dispersed liquid using vapor properties and relative velocity.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- S(liquid, vapor, zIdx)
S Phase vapor/liquid slip ratio [-]
Computes the slip ratio between vapor and liquid velocities.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- T(liquid, zIdx)
T Liquid temperature [K]
Computes the temperature of the liquid phase from enthalpy.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- TAUW(liquid, zIdx)
TAUW Liquid wall shear stress [N/m^2]
Returns the wall shear stress acting on the liquid phase.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- USLIP(liquid, vapor, zIdx)
USLIP Liquid velocity based on input phase slip [m/s]
Computes the liquid velocity using a slip-based void fraction model.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- VF(liquid, vapor, zIdx)
VF Liquid volumetric fraction [-]
Computes the liquid volumetric fraction as the complement of vapor VF.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- VISC(liquid, vapor, zIdx)
VISC Viscosity number for dispersed liquid [-]
Computes the dimensionless viscosity number using vapor properties and interfacial tension.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- VR(liquid, vapor, zIdx)
VR Local relative velocity [m/s]
Computes the relative velocity between vapor and liquid phases using various models (AREAMEAN, SCALED, DRIFT, FLOWREGIME) based on
Inputs.Model.LOCRELVELmodel.Inputs:
liquid —
Solvers.TwoFluid.Liquidobjectvapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- WALEVAPRATIO(liquid, zIdx)
WALEVAPRATIO Wall evaporation mass ratio [-]
Returns the fraction of liquid mass undergoing wall boiling.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- X(liquid, zIdx)
X Liquid mass fraction [-]
Computes the liquid mass fraction relative to the mixture flow.
Inputs:
liquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- XTR_ANN(liquid)
XTR_ANN Quality at onset of annular flow region [-]
Returns the equilibrium quality threshold for the onset of annular flow.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobject
Notes:
Uses minimum value from mix.OAFX
- XTR_ITM(liquid)
XTR_ITM Quality at onset of intermediate region [-]
Returns the equilibrium quality threshold for the onset of the intermediate flow regime.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobject
- XTR_SAT(liquid)
XTR_SAT Quality at saturated boiling transition [-]
Returns the equilibrium quality threshold for the onset of saturated boiling.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobject
- XTR_SUB(liquid)
XTR_SUB Quality at subcooled boiling transition [-]
Returns the equilibrium quality threshold for the onset of subcooled boiling.
Inputs:
liquid —
Solvers.TwoFluid.Liquidobject
- class Solvers.TwoFluid.REGIMES
Bases:
doubleREGIMES Enumeration of two-phase flow regimes
This class defines the available two-phase flow regimes for constitutive model selection, used by the two-fluid solver.
The flow regimes are defined as an enum class to increase computational efficiency while increasing readability of code, particularly when different calculations are carried out for different flow regimes.
Flow regimes:
LIQUID — Single-phase liquid
BUBBLY_SUBCOOLED — Bubbly flow in subcooled region
BUBBLY_SATURATED — Bubble flow in saturated region
INTERMEDIATE — Intermediate flow region
ANNULAR — Annular flow
DFFB — Dispersed Flow Film Boiling
- class Solvers.TwoFluid.Vapor(inputSet, fluid)
Bases:
Solvers.AbstractFieldVAPOR Class for modeling vapor field in two-fluid solver
This class encapsulates the physical and numerical properties of the vapor phase, including flow variables, phase interactions, heat transfer,and relaxation models. It supports multiple solver models and provides methods for computing derived quantities and handling flow regime transitions.
- Constructor Summary
- Vapor(inputSet, fluid)
VAPOR Constructor for Vapor class
Initializes the vapor field object with input configuration and fluid properties.
Inputs:
inputSet —
Inputs.InputSetobject containing model, geometry, and boundary conditionsfluid —
Inputs.FluidPropertiesobject containing thermophysical fluid data
- Property Summary
- DT = 0
Time step size [s] from
Inputs.Options.TSTEP
- H = 1E6
Enthalpy [J/kg]
- ITR
Iteration properties
- NTIME = 0
Number of time steps [-]
- NZ = 0
Number of axial steps [-] from
Inputs.Model.NNODES
- TIDX = 1
Time step index [-]
- TIME = 0
Time series [s]
- U = 1.
Velocity [m/s]
- W = 1.
Mass flow rate [kg/s]
- Z = 1.
Elevation [m]
- mix = NaN
Solvers.TwoFluid.Mixtureobject
- Method Summary
- AREA(vapor, liquid, zIdx)
AREA Vapor cross-section area [m^2]
Computes the effective cross-sectional area occupied by the vapor phase.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- CD(vapor, liquid, zIdx)
CD Drag coefficient for dispersed gas [-]
Computes the drag coefficient for dispersed vapor based on
Inputs.Model.DROPDRAGmodel.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Notes:
Values are clamped to a maximum of 1
- FBUOY(vapor, liquid, zIdx)
FBUOY Vapor buoyancy force [N/m]
Computes the buoyancy force acting on the vapor phase due to pressure gradient.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Notes:
The pressure gradient from the mixture solver is used
- FDRAG(vapor, liquid, zIdx)
FDRAG Interfacial drag force [N/m]
Computes the interfacial drag force acting on the vapor phase by reversing the sign of the liquid-phase drag (
Solvers.TwoFluid.Liquid.FDRAG()).Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- FGRAV(vapor, liquid, zIdx)
FGRAV Vapor gravity force [N/m]
Computes the gravitational force acting on the vapor phase.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- FINTEVAP(vapor, liquid, zIdx)
FINTEVAP Momentum exchange through interfacial evaporation [N/m]
Computes the momentum exchange due to interfacial evaporation.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- FLOWREGIME(vapor, liquid, zIdx)
FLOWREGIME Categorical two-phase flow regimes
Returns the flow regime classification based on liquid-phase criteria (
Solvers.TwoFluid.Liquid.FLOWREGIME)().Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Returns:
flowregime — Flow regime category (from
Solvers.TwoFluid.REGIMES)
- FTOT(vapor, liquid, zIdx)
FTOT Total force [N/m]
Computes the total force acting on the vapor phase, including gravity, buoyancy, wall shear, drag, and interfacial momentum exchanges.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- FWALEVAP(vapor, liquid, zIdx)
FWALEVAP Momentum exchange through wall evaporation [N/m]
Computes the momentum exchange due to wall boiling evaporation.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- FWALL(vapor, liquid, zIdx)
FWALL Wall shear force [N/m]
Computes the wall shear force acting on the vapor phase, weighted by void fraction.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HFLUX(vapor, zIdx)
HFLUX Wall heat flux to vapor phase [W/m^2]
Computes the net wall heat flux transferred to the vapor phase.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Uses
Solvers.TwoFluid.Vapor.HWALHEATdivided by wall perimeter
- HFLUXWALEVAP(vapor, liquid, zIdx)
HFLUXWALEVAP Wall boiling heat flux [W/m^2]
Computes the portion of wall heat flux attributed to boiling (evaporation) for the vapor phase, based on liquid-phase calculations (
Solvers.TwoFluid.Liquid.HFLUXWALEVAP()).Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HINT(vapor, liquid, zIdx)
HINT Linear interfacial heat transfer rate [W/m]
Computes the interfacial heat transfer rate for the vapor phase based on mass transfer and enthalpy difference (based on
Inputs.Model.INTTRANSHmodel).Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Returns:
Hcond — Condensation heat transfer rate [W/m]
Hevap — Evaporation heat transfer rate [W/m]
- HINTCOND(vapor, liquid, zIdx)
HINTCOND Linear interfacial heat condensation rate [W/m]
Extracts the condensation component from
Solvers.TwoFluid.Vapor.HINT.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HINTEVAP(vapor, liquid, zIdx)
HINTEVAP Linear interfacial heat evaporation rate [W/m]
Extracts the evaporation component from
Solvers.TwoFluid.Vapor.HINT.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HTOT(vapor, liquid, zIdx)
HTOT Total linear vapor heat rate [W/m]
Computes the total heat transfer to the vapor phase, including interfacial and wall contributions.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HWALEVAP(vapor, liquid, zIdx)
HWALEVAP Linear wall heat evaporation (boiling) rate [W/m]
Computes the wall boiling heat transfer rate using latent heat (based on
Inputs.Model.INTTRANSHmodel) and wall mass evaporation.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- HWALHEAT(vapor, zIdx)
HWALHEAT Linear wall heat to vapor rate [W/m]
Returns the wall heat generation rate transferred to the vapor phase.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Set to zero before CBT
- INTAREA(vapor, liquid, zIdx)
INTAREA Volumetric interfacial area [m^-1]
Computes the interfacial area concentration using liquid-phase logic (from
Solvers.TwoFluid.Liquid.INTAREA)().Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- INTHFLUX(vapor, liquid, zIdx)
INTHFLUX Interfacial heat flux [W/m^2]
Computes the interfacial heat flux due to evaporation and condensation (delegated to liquid-phase calculation in
Solvers.TwoFluid.Liquid.INTHFLUX()).Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Returns:
inthflux_evap — Evaporation heat flux [W/m^2]
inthflux_cond — Condensation heat flux [W/m^2]
Notes:
Positive toward liquid phase
- INTNU(vapor, liquid, zIdx)
INTNU Interfacial Nusselt number for dispersed vapor [-]
Computes the interfacial Nusselt number based on
Inputs.Model.INTNUmodel.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- J(vapor, zIdx)
J Vapor superficial velocity [m/s]
Computes the superficial velocity of the vapor phase.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- L(vapor, zIdx)
L Dispersed vapor interfacial length scale [m]
Returns the characteristic length scale for dispersed vapor (e.g., bubble diameter).
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Currently uses a constant model
- MINT(vapor, liquid, zIdx)
MINT Linear interfacial mass transfer rates [kg/s/m]
Computes condensation and evaporation mass transfer rates for the vapor phase by reversing the sign of liquid-phase values (attr:Solvers.TwoFluid.Liquid.MINT).
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Returns:
Mcond — Condensation mass transfer rate [kg/s/m]
Mevap — Evaporation mass transfer rate [kg/s/m]
- MINTCOND(vapor, liquid, zIdx)
MINTCOND Linear interfacial condensation mass transfer [kg/s/m]
Extracts the condensation component from
Solvers.TwoFluid.Vapor.MINT.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- MINTEVAP(vapor, liquid, zIdx)
MINTEVAP Linear interfacial evaporation mass transfer [kg/s/m]
Extracts the evaporation component from
Solvers.TwoFluid.Vapor.MINT.Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- MTOT(vapor, liquid, zIdx)
MTOT Total linear mass transfer [kg/s/m]
Computes the total vapor mass transfer rate by reversing the sign of the liquid-phase total (
Solvers.TwoFluid.Liquid.MTOT()).Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- MWALEVAP(vapor, liquid, zIdx)
MWALEVAP Linear wall mass evaporation rate [kg/s/m]
Computes the wall boiling mass transfer rate for vapor by reversing the sign of the liquid-phase value (meth:Solvers.TwoFluid.Liquid.MWALEVAP).
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- RE(vapor, zIdx)
RE Vapor Reynolds number [-]
Computes the vapor-phase Reynolds number based on flow rate and viscosity.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- REL(vapor, liquid, zIdx)
REL Dispersed vapor Reynolds number [-]
Computes the Reynolds number for dispersed vapor using liquid properties and relative velocity.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- S(vapor, liquid, zIdx)
S Phase slip ratio [-]
Returns the slip ratio between vapor and liquid phases.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- T(vapor, zIdx)
T Vapor temperature [K]
Computes the vapor temperature from enthalpy.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- TAUW(vapor, zIdx)
TAUW Wall shear stress [N/m^2]
Returns the wall shear stress acting on the vapor phase.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
Notes:
Uses mixture-level shear stress for consistency
- USLIP(vapor, liquid, zIdx)
USLIP Vapor velocity based on input phase slip [m/s]
Computes the vapor velocity using slip ratio and liquid velocity.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- VF(vapor, liquid, zIdx)
VF Vapor volumetric fraction [-]
Computes the vapor volumetric (i.e., void) fraction using slip ratio and densities.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- VISC(vapor, liquid, zIdx)
VISC Viscosity number for dispersed gas [-]
Computes the dimensionless viscosity number using liquid and vapor properties.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
- WALEVAPRATIO(vapor, liquid, zIdx)
WALEVAPRATIO Wall evaporation mass ratio [-]
Returns the fraction of liquid mass undergoing wall boiling.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.LiquidobjectzIdx — Axial indices to evaluate (optional)
Returns:
walevapratio — Wall boiling mass ratio [-]
- X(vapor, zIdx)
X Vapor mass fraction [-]
Computes the vapor mass fraction relative to the mixture flow.
Inputs:
vapor —
Solvers.TwoFluid.VaporobjectzIdx — Axial indices to evaluate (optional)
- XTR_ANN(vapor, liquid)
XTR_ANN Quality at onset of annular flow region
- XTR_CBT(vapor, liquid)
XTR_CBT Quality at Critical Boiling Transition [-]
Returns the equilibrium quality threshold for the onset of critical boiling transition.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.Liquidobject
- XTR_ITM(vapor, liquid)
XTR_ITM Quality at onset of intermediate region [-]
Returns the equilibrium quality threshold for the onset of the intermediate flow regime.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.Liquidobject
- XTR_SAT(vapor, liquid)
XTR_SAT Quality at end of subcooled boiling transition [-]
Returns the equilibrium quality threshold for the onset of saturated boiling.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.Liquidobject
- XTR_SUB(vapor, liquid)
XTR_SUB Quality at onset of subcooled boiling transition [-]
Returns the equilibrium quality threshold for the onset of subcooled boiling.
Inputs:
vapor —
Solvers.TwoFluid.Vaporobjectliquid —
Solvers.TwoFluid.Liquidobject
- class Solvers.TwoFluid.Mixture(mixture, liquid, vapor)
Bases:
Solvers.AbstractPhaseMIXTURE Class for two-fluid mixture properties in thermal-hydraulic solver
Represents combined properties of liquid and vapor phases in a two-fluid solver. Provides methods to compute mixture-level quantities such as mass flow, density, velocity, heat flux, and thermodynamic quality.
Responsibilities:
Aggregate liquid and vapor properties into mixture-level results
Compute derived quantities (void fraction, equilibrium quality, CHF)
Provide access to geometry and fluid properties for calculations
Key features:
Supports axial indexing for spatially resolved calculations
Interfaces with liquid and vapor sub-objects for phase-specific data
- Constructor Summary
- Mixture(mixture, liquid, vapor)
MIXTURE Constructor for Mixture class
Initializes the mixture object by linking liquid and vapor phase objects and copying solver configuration and fluid properties.
- Inputs:
mixture —
Solvers.Mixture.Mixtureobject liquid —Solvers.TwoFluid.Liquidobject vapor —Solvers.TwoFluid.Vaporobject
- Method Summary
- AFDISTR(mix, param1, param2, zIdx)
AFDISTR Annular flow distribution function [-]
Computes the annular flow distribution function for given parameters.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject param1 — First parameter for distribution function param2 — Second parameter for distribution function zIdx — Axial indices to evaluate (optional)
- CBT(mix, zIdx)
CBT Critical Boiling Transition flag [-]
Returns the CBT flag for each axial location.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- CHF(mix, zIdx)
CHF Critical Heat Flux [W/m^2]
Returns the CHF value for each axial location.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- DPDZ(mix, zIdx)
DPDZ Pressure gradient [Pa/m]
Computes the axial pressure gradient from mixture pressure drop.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- H(mix, zIdx)
H Mixture enthalpy [J/kg]
Calculates the mixture enthalpy as a mass-weighted average of phase enthalpies.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- HFLUX(mix, zIdx)
HFLUX Wall heat flux [W/m^2]
Returns the wall heat flux distribution along the axial domain.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- LHGR(mix, zIdx)
LHGR Linear heat generation rate [W/m]
Computes the linear heat generation rate from wall heat flux and perimeter.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- MFLUX(mix, zIdx)
MFLUX Mixture mass flux [kg/m^2/s]
Calculates the mixture mass flux using total flow and channel area.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- OAFX(mix, zIdx)
OAFX Onset of annular flow equilibrium quality [-]
Returns the OAF quality from the mixture object.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- RELAXTCOND(mix, zIdx)
RELAXTCOND Time relaxation for interfacial evaporation [s]
Returns the relaxation time applied to interfacial evaporation processes in the two-fluid mixture model.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- RELAXTEVAP(mix, zIdx)
RELAXTEVAP Time relaxation for interfacial condensation [s]
Returns the relaxation time applied to interfacial condensation processes in the two-fluid mixture model.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- RHO(mix, zIdx)
RHO Mixture density [kg/m^3]
Computes the mixture density based on void fraction and phase densities.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- TAUW(mix, zIdx)
TAUW Wall shear stress [N/m^2]
Returns the wall shear stress from the mixture object.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- TIME(mix)
TIME Time series [s]
Returns the time array from the mixture object.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject
- U(mix, zIdx)
U Mixture velocity [m/s]
Calculates the mixture velocity as a mass-weighted average of phase velocities.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- VF(mix, zIdx)
VF Void fraction [-]
Computes the vapor volume fraction in the mixture.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- W(mix, zIdx)
W Mixture mass flow rate [kg/s]
Computes the total mass flow rate as the sum of liquid and vapor flows.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- WALEVAPRATIO(mix, zIdx)
WALEVAPRATIO Wall mass evaporation ratio [-]
Returns the ratio of wall heat flux converted to evaporation.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- XEQ(mix, zIdx)
XEQ Equilibrium thermodynamic quality [-]
Returns the equilibrium quality from the mixture object.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)
- Z(mix, zIdx)
Z Axial nodes [m]
Returns the axial positions for the mixture domain.
- Inputs:
mix —
Solvers.TwoFluid.Mixtureobject zIdx — Axial indices to evaluate (optional)