Class PlugFlowReactor
java.lang.Object
neqsim.util.NamedBaseClass
neqsim.process.SimulationBaseClass
neqsim.process.equipment.ProcessEquipmentBaseClass
neqsim.process.equipment.TwoPortEquipment
neqsim.process.equipment.reactor.PlugFlowReactor
- All Implemented Interfaces:
Serializable, Runnable, ProcessEquipmentInterface, TwoPortInterface, ProcessElementInterface, SimulationInterface, NamedInterface
Plug flow reactor (PFR) for rigorous kinetic modeling of chemical reactions.
Models chemical transformation along a tubular reactor by solving coupled ordinary differential equations for species molar flows, temperature, and pressure as a function of axial position. The reactor supports homogeneous gas-phase and heterogeneous catalytic reactions with multiple reaction types (power-law, LHHW, reversible).
Governing Equations
- Species balance: dFi/dz = Ac * sum(nu_ij * r_j)
- Energy balance: dT/dz = (-sum(r_j * dH_j) * Ac + U*pi*D*(Tc-T)) / sum(Fi*Cp_i)
- Pressure drop: dP/dz from Ergun equation (packed bed) or friction factor (empty tube)
Operating Modes
| Mode | Description |
|---|---|
| ADIABATIC | No heat transfer; T changes from reaction enthalpy only |
| ISOTHERMAL | T held constant; heat duty calculated |
| COOLANT | Heat exchange with coolant at Tc via overall U |
Integration Methods
- Forward Euler (simple, first-order)
- Classical 4th-order Runge-Kutta (RK4, default, higher accuracy)
Usage Example
// Create reaction
KineticReaction rxn = new KineticReaction("A to B");
rxn.addReactant("methane", 1, 1.0);
rxn.addProduct("hydrogen", 2);
rxn.setPreExponentialFactor(1e10);
rxn.setActivationEnergy(150000.0);
rxn.setHeatOfReaction(-75000.0);
// Configure catalyst
CatalystBed catalyst = new CatalystBed();
catalyst.setParticleDiameter(3.0, "mm");
catalyst.setVoidFraction(0.40);
catalyst.setBulkDensity(800.0);
// Build reactor
PlugFlowReactor pfr = new PlugFlowReactor("PFR-1", feedStream);
pfr.addReaction(rxn);
pfr.setCatalystBed(catalyst);
pfr.setLength(5.0, "m");
pfr.setDiameter(0.10, "m");
pfr.setEnergyMode(PlugFlowReactor.EnergyMode.ADIABATIC);
pfr.run();
double conversion = pfr.getConversion();
ReactorAxialProfile profile = pfr.getAxialProfile();
- Version:
- 1.0
- Author:
- esol
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnergy balance mode.static enumODE integration method. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ReactorAxialProfileAxial profile results.private CatalystBedCatalyst bed properties (null for homogeneous reactors).private doubleCoolant temperature [K] (used in COOLANT mode).private doubleReactor tube inner diameter [m].private PlugFlowReactor.EnergyModeEnergy balance mode.private doubleTotal heat duty [W] (positive = heat added, negative = heat removed).Integration method.private StringKey component name for conversion tracking.private doubleReactor tube length [m].private static final org.apache.logging.log4j.LoggerLogger object for class.private intNumber of integration steps.private intNumber of parallel tubes (multi-tube reactor).private doubleOutlet temperature [K].private doubleOverall conversion of key component [-].private doubleOverall heat transfer coefficient U [W/(m2*K)] (used in COOLANT mode).private doubleTotal pressure drop [bar].private intRe-flash thermodynamic properties every N steps.private List<KineticReaction> List of kinetic reactions.private doubleMean residence time [s].private static final longSerialization version UID.Fields inherited from class TwoPortEquipment
inStream, outStreamFields inherited from class ProcessEquipmentBaseClass
conditionAnalysisMessage, energyStream, hasController, isSolved, properties, reportFields inherited from class SimulationBaseClass
calcIdentifier, calculateSteadyState, timeFields inherited from class NamedBaseClass
name -
Constructor Summary
ConstructorsConstructorDescriptionPlugFlowReactor(String name) Constructor for PlugFlowReactor.PlugFlowReactor(String name, StreamInterface inletStream) Constructor for PlugFlowReactor with inlet stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReaction(KineticReaction reaction) Add a kinetic reaction to the reactor.private double[]addScaled(double[] base, double[] delta, double scale) Add scaled vector: result[i] = base[i] + scale * delta[i].private double[]calculateDerivatives(SystemInterface system, double[] state, int nComp, double totalArea, double perimeter, String[] compNames) Calculate derivatives dF/dz, dT/dz, dP/dz for the state vector.private doublecalculateIsothermalHeatDuty(SystemInterface system, double[] molFlows, String[] compNames) Calculate isothermal heat duty by summing reaction enthalpies over the reactor.private doublecalculateResidenceTime(SystemInterface system, double totalArea) Calculate mean residence time.private doublecalculateTotalReactionRate(SystemInterface system, String[] compNames) Calculate total reaction rate for profile storage.private doubleconvertRateToVolumetric(double rate, KineticReaction rxn) Convert reaction rate from its native basis to volumetric basis [mol/(m3_reactor * s)].private voidEnsure that all product components from reactions exist in the system.private doubleestimateTotalHeatCapacityFlow(SystemInterface system, double[] state, int nComp) Estimate total heat capacity flow sum(Fi * Cp_i) [J/(s*K)].Get the axial profile results.Get catalyst bed properties.doubleGet overall conversion of the key component.doubleGet coolant temperature [K].doubleGet reactor tube inner diameter [m].Get energy balance mode.private doublegetGasDensity(SystemInterface system) Get gas density from the thermodynamic system.private doublegetGasViscosity(SystemInterface system) Get gas viscosity from the thermodynamic system.doubleGet total heat duty.doublegetHeatDuty(String unit) Get total heat duty in specified unit.Returns all inlet streams connected to this equipment.Get integration method.Get key component name.doubleGet reactor tube length [m].intGet number of integration steps.intGet number of parallel tubes.Returns all outlet streams produced by this equipment.doubleGet outlet temperature.doubleGet overall heat transfer coefficient [W/(m2*K)].doubleGet total pressure drop across the reactor.intGet property update frequency.Get the list of reactions.doubleGet mean residence time.doubleGet gas hourly space velocity.private doublegetSuperVelocity(SystemInterface system, double totalArea) Calculate superficial velocity through the reactor tubes.private double[]packState(double[] molFlows, double temperature, double pressure) Pack molar flows, temperature, and pressure into a state vector.voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.voidsetCatalystBed(CatalystBed catalystBed) Set catalyst bed properties.voidsetCoolantTemperature(double temperature, String unit) Set coolant temperature for COOLANT energy mode.voidsetDiameter(double diameter, String unit) Set reactor tube inner diameter.voidsetEnergyMode(PlugFlowReactor.EnergyMode energyMode) Set energy balance mode.voidsetIntegrationMethod(String method) Set integration method.voidsetKeyComponent(String componentName) Set key component for conversion tracking.voidSet reactor tube length.voidsetNumberOfSteps(int steps) Set number of integration steps.voidsetNumberOfTubes(int numberOfTubes) Set number of parallel tubes.voidsetOverallHeatTransferCoefficient(double coefficient) Set overall heat transfer coefficient for COOLANT mode.voidsetPropertyUpdateFrequency(int frequency) Set frequency of thermodynamic property updates.private voidunpackState(double[] state, double[] molFlows, int nComp) Unpack molar flows from state vector.private voidupdateSystemState(SystemInterface system, double[] molFlows, double temperature, double pressure) Update the thermodynamic system to reflect current molar flows, T, and P.Methods inherited from class TwoPortEquipment
getInletPressure, getInletStream, getInletTemperature, getMassBalance, getOutletPressure, getOutletStream, setInletPressure, setInletStream, setInletTemperature, setOutletPressure, setOutletPressure, setOutletStream, setOutletTemperature, setOutletTemperature, toJson, toJson, validateSetupMethods inherited from class ProcessEquipmentBaseClass
addCapacityConstraint, addController, copy, displayResult, equals, getAvailableMargin, getAvailableMarginPercent, getBottleneckConstraint, getCapacityConstraints, getConditionAnalysisMessage, getConstraintEvaluationReport, getController, getController, getControllers, getEffectiveCapacityFactor, getEnergyStream, getEntropyProduction, getExergyChange, getFailureMode, getMassBalance, getMaxUtilization, getMaxUtilizationPercent, getMechanicalDesign, getMinimumFlow, getPressure, getPressure, getProperty, getReferenceDesignation, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, getUtilizationSummary, hashCode, initElectricalDesign, initializeDefaultConstraints, initInstrumentDesign, initMechanicalDesign, isActive, isActive, isCapacityAnalysisEnabled, isCapacityExceeded, isFailed, isHardLimitExceeded, isNearCapacityLimit, isSetEnergyStream, reportResults, restoreFromFailure, run_step, runConditionAnalysis, setCapacityAnalysisEnabled, setController, setEnergyStream, setEnergyStream, setFailureMode, setFlowValveController, setMinimumFlow, setPressure, setReferenceDesignation, setRegulatorOutSignal, setSpecification, setTemperature, simulateDegradedOperation, simulateTrip, solvedMethods inherited from class SimulationBaseClass
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTimeMethods inherited from class NamedBaseClass
getName, getTagNumber, setName, setTagNumberMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NamedInterface
getName, getTagName, getTagNumber, setName, setTagName, setTagNumberMethods inherited from interface ProcessEquipmentInterface
getCapacityDuty, getCapacityMax, getElectricalDesign, getEquipmentState, getExergyChange, getExergyDestruction, getExergyDestruction, getFluid, getInstrumentDesign, getOperatingEnvelopeViolation, getOutletFlowRate, getOutletPressure, getOutletTemperature, getReferenceDesignationString, getRestCapacity, getSimulationValidationErrors, isSimulationValid, isWithinOperatingEnvelope, needRecalculationMethods inherited from interface SimulationInterface
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, run, run_step, runTransient, runTransient, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTimeMethods inherited from interface TwoPortInterface
getInStream, getOutStream, setOutPressure, setOutPressure, setOutTemperature, setOutTemperature
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object for class. -
length
private double lengthReactor tube length [m]. -
diameter
private double diameterReactor tube inner diameter [m]. -
numberOfTubes
private int numberOfTubesNumber of parallel tubes (multi-tube reactor). -
reactions
List of kinetic reactions. -
catalystBed
Catalyst bed properties (null for homogeneous reactors). -
energyMode
Energy balance mode. -
coolantTemperature
private double coolantTemperatureCoolant temperature [K] (used in COOLANT mode). -
overallHeatTransferCoefficient
private double overallHeatTransferCoefficientOverall heat transfer coefficient U [W/(m2*K)] (used in COOLANT mode). -
numberOfSteps
private int numberOfStepsNumber of integration steps. -
integrationMethod
Integration method. -
propertyUpdateFrequency
private int propertyUpdateFrequencyRe-flash thermodynamic properties every N steps. -
keyComponent
Key component name for conversion tracking. -
axialProfile
Axial profile results. -
overallConversion
private double overallConversionOverall conversion of key component [-]. -
heatDuty
private double heatDutyTotal heat duty [W] (positive = heat added, negative = heat removed). -
pressureDrop
private double pressureDropTotal pressure drop [bar]. -
outletTemperatureK
private double outletTemperatureKOutlet temperature [K]. -
residenceTime
private double residenceTimeMean residence time [s].
-
-
Constructor Details
-
PlugFlowReactor
Constructor for PlugFlowReactor.- Parameters:
name- equipment name
-
PlugFlowReactor
Constructor for PlugFlowReactor with inlet stream.- Parameters:
name- equipment nameinletStream- the inlet feed stream
-
-
Method Details
-
run
In this method all thermodynamic and unit operations will be calculated in a steady state calculation.
- Parameters:
id- UUID
-
calculateDerivatives
private double[] calculateDerivatives(SystemInterface system, double[] state, int nComp, double totalArea, double perimeter, String[] compNames) Calculate derivatives dF/dz, dT/dz, dP/dz for the state vector.- Parameters:
system- thermodynamic system for property evaluationstate- packed state [F1..Fn, T, P]nComp- number of componentstotalArea- total cross-sectional area of all tubes [m2]perimeter- tube perimeter [m] (single tube)compNames- component names- Returns:
- derivative vector [dF1/dz..dFn/dz, dT/dz, dP/dz]
-
convertRateToVolumetric
Convert reaction rate from its native basis to volumetric basis [mol/(m3_reactor * s)].- Parameters:
rate- rate in native unitsrxn- the kinetic reaction- Returns:
- volumetric rate [mol/(m3_reactor * s)]
-
estimateTotalHeatCapacityFlow
Estimate total heat capacity flow sum(Fi * Cp_i) [J/(s*K)].- Parameters:
system- thermodynamic systemstate- current state vectornComp- number of components- Returns:
- total heat capacity flow [J/(s*K)]
-
getGasDensity
Get gas density from the thermodynamic system.- Parameters:
system- thermodynamic system- Returns:
- gas density [kg/m3]
-
getGasViscosity
Get gas viscosity from the thermodynamic system.- Parameters:
system- thermodynamic system- Returns:
- gas dynamic viscosity [Pa*s]
-
getSuperVelocity
Calculate superficial velocity through the reactor tubes.- Parameters:
system- thermodynamic systemtotalArea- total cross-sectional area [m2]- Returns:
- superficial velocity [m/s]
-
calculateTotalReactionRate
Calculate total reaction rate for profile storage.- Parameters:
system- thermodynamic systemcompNames- component names- Returns:
- total absolute reaction rate [mol/(m3*s)]
-
calculateIsothermalHeatDuty
private double calculateIsothermalHeatDuty(SystemInterface system, double[] molFlows, String[] compNames) Calculate isothermal heat duty by summing reaction enthalpies over the reactor.- Parameters:
system- thermodynamic systemmolFlows- current molar flowscompNames- component names- Returns:
- heat duty [W]
-
calculateResidenceTime
Calculate mean residence time.- Parameters:
system- thermodynamic systemtotalArea- total cross-sectional area [m2]- Returns:
- residence time [s]
-
packState
private double[] packState(double[] molFlows, double temperature, double pressure) Pack molar flows, temperature, and pressure into a state vector.- Parameters:
molFlows- molar flows [mol/s]temperature- temperature [K]pressure- pressure [bara]- Returns:
- state vector [F1..Fn, T, P]
-
unpackState
private void unpackState(double[] state, double[] molFlows, int nComp) Unpack molar flows from state vector.- Parameters:
state- state vectormolFlows- output molar flows arraynComp- number of components
-
addScaled
private double[] addScaled(double[] base, double[] delta, double scale) Add scaled vector: result[i] = base[i] + scale * delta[i].- Parameters:
base- base vectordelta- delta vectorscale- scaling factor- Returns:
- result vector
-
updateSystemState
private void updateSystemState(SystemInterface system, double[] molFlows, double temperature, double pressure) Update the thermodynamic system to reflect current molar flows, T, and P.- Parameters:
system- thermodynamic systemmolFlows- current molar flows [mol/s]temperature- current temperature [K]pressure- current pressure [bara]
-
ensureProductComponentsExist
Ensure that all product components from reactions exist in the system.- Parameters:
system- thermodynamic system to check/update
-
addReaction
Add a kinetic reaction to the reactor.- Parameters:
reaction- the kinetic reaction to add
-
getReactions
Get the list of reactions.- Returns:
- list of kinetic reactions
-
setCatalystBed
Set catalyst bed properties.- Parameters:
catalystBed- catalyst bed (null for homogeneous reactor)
-
getCatalystBed
Get catalyst bed properties.- Returns:
- catalyst bed (null if homogeneous)
-
setLength
Set reactor tube length.- Parameters:
length- length valueunit- "m", "cm", "ft"
-
getLength
public double getLength()Get reactor tube length [m].- Returns:
- length in meters
-
setDiameter
Set reactor tube inner diameter.- Parameters:
diameter- diameter valueunit- "m", "mm", "cm", "in"
-
getDiameter
public double getDiameter()Get reactor tube inner diameter [m].- Returns:
- diameter in meters
-
setNumberOfTubes
public void setNumberOfTubes(int numberOfTubes) Set number of parallel tubes.- Parameters:
numberOfTubes- number of tubes (1 or more)
-
getNumberOfTubes
public int getNumberOfTubes()Get number of parallel tubes.- Returns:
- number of tubes
-
setEnergyMode
Set energy balance mode.- Parameters:
energyMode- ADIABATIC, ISOTHERMAL, or COOLANT
-
getEnergyMode
-
setCoolantTemperature
Set coolant temperature for COOLANT energy mode.- Parameters:
temperature- temperature valueunit- "K", "C", "F"
-
getCoolantTemperature
public double getCoolantTemperature()Get coolant temperature [K].- Returns:
- coolant temperature in Kelvin
-
setOverallHeatTransferCoefficient
public void setOverallHeatTransferCoefficient(double coefficient) Set overall heat transfer coefficient for COOLANT mode.- Parameters:
coefficient- U [W/(m2*K)]
-
getOverallHeatTransferCoefficient
public double getOverallHeatTransferCoefficient()Get overall heat transfer coefficient [W/(m2*K)].- Returns:
- U
-
setNumberOfSteps
public void setNumberOfSteps(int steps) Set number of integration steps.- Parameters:
steps- number of steps (minimum 10)
-
getNumberOfSteps
public int getNumberOfSteps()Get number of integration steps.- Returns:
- number of steps
-
setIntegrationMethod
Set integration method.- Parameters:
method- "EULER" or "RK4"
-
getIntegrationMethod
Get integration method.- Returns:
- integration method
-
setPropertyUpdateFrequency
public void setPropertyUpdateFrequency(int frequency) Set frequency of thermodynamic property updates.- Parameters:
frequency- re-flash every N steps
-
getPropertyUpdateFrequency
public int getPropertyUpdateFrequency()Get property update frequency.- Returns:
- frequency in steps
-
setKeyComponent
Set key component for conversion tracking.- Parameters:
componentName- name of key component (typically limiting reactant)
-
getKeyComponent
-
getConversion
public double getConversion()Get overall conversion of the key component.- Returns:
- conversion [0-1]
-
getAxialProfile
Get the axial profile results.- Returns:
- reactor axial profile (null if not yet run)
-
getHeatDuty
public double getHeatDuty()Get total heat duty.- Returns:
- heat duty in Watts (positive = heat added)
-
getHeatDuty
Get total heat duty in specified unit.- Parameters:
unit- "W", "kW", or "MW"- Returns:
- heat duty in specified unit
-
getPressureDrop
public double getPressureDrop()Get total pressure drop across the reactor.- Returns:
- pressure drop [bar]
-
getOutletTemperature
public double getOutletTemperature()Get outlet temperature.- Specified by:
getOutletTemperaturein interfaceTwoPortInterface- Overrides:
getOutletTemperaturein classTwoPortEquipment- Returns:
- outlet temperature [K]
-
getResidenceTime
public double getResidenceTime()Get mean residence time.- Returns:
- residence time [s]
-
getSpaceVelocity
public double getSpaceVelocity()Get gas hourly space velocity.- Returns:
- GHSV [1/hr]
-
getInletStreams
Returns all inlet streams connected to this equipment. Subclasses override to report their specific inlets. Used by graph builders, DEXPI export, and auto-instrumentation to discover topology withoutinstanceofchecks.- Specified by:
getInletStreamsin interfaceProcessEquipmentInterface- Overrides:
getInletStreamsin classTwoPortEquipment- Returns:
- unmodifiable list of inlet streams (empty by default)
-
getOutletStreams
Returns all outlet streams produced by this equipment. Subclasses override to report their specific outlets. Used by graph builders, DEXPI export, and auto-instrumentation to discover topology withoutinstanceofchecks.- Specified by:
getOutletStreamsin interfaceProcessEquipmentInterface- Overrides:
getOutletStreamsin classTwoPortEquipment- Returns:
- unmodifiable list of outlet streams (empty by default)
-