Gibbs Reactor¶
![]()
Represents a Gibbs Reactor that determines the equilibrium product composition by minimising the total Gibbs free energy of the system. Two solving approaches are available: direct minimisation (elemental balance constraints) and reaction-extent minimisation.
DWSIM.UnitOperations.Reactors.Reactor_Gibbs
Assembly DWSIM.UnitOperations.dll · Object ← BaseClass ← UnitOpBaseClass ← Reactor ← Reactor_Gibbs
At a glance¶

| Port | Index | Connected in the example |
|---|---|---|
| Inlet, material | 0 |
Feed |
| Inlet, energy | 1 |
Q |
| Outlet, material | 0 |
Syngas |
| Outlet, material | 1 |
Liquid |
Example¶
This code runs on every build of this site, and the output below is what it printed.
compounds = ["Methane", "Water", "Carbon monoxide", "Carbon dioxide", "Hydrogen"]
fs = (Flowsheet.Create("GibbsReactorExample")
.WithCompounds(*compounds)
.WithPropertyPackage(PropertyPackages.PengRobinson))
# methane and steam, steam to carbon ratio 3
feed = (fs.AddMaterialStream("Feed")
.At(Q.Celsius(850.0), Q.Bar(15.0))
.WithMolarFlow(Q.MolPerSecond(4.0))
.SetCompoundMolarFlow("Methane", 1.0)
.SetCompoundMolarFlow("Water", 3.0))
syngas = fs.AddMaterialStream("Syngas")
liquid = fs.AddMaterialStream("Liquid") # empty here, but the port must be connected
duty = fs.AddEnergyStream("Q")
reformer = (fs.AddGibbsReactor("R-1")
.Isothermal()
.WithPressureDrop(Q.Bar(0.0))
.ConnectFeed(feed, 0)
.ConnectProduct(syngas, 0)
.ConnectProduct(liquid, 1)
.ConnectEnergyFeed(duty, 1))
# compounds that take part in the minimization; the element matrix is built from the feed
ids = List[String]()
for c in compounds:
ids.Add(c)
reformer.Object.ComponentIDs = ids
reformer.Object.CreateElementMatrix()
fs.AutoLayout()
fs.Solve()
y = {c: syngas.OverallMoleFraction(c) for c in compounds}
p_bar = 15.0
k_smr = y["Carbon monoxide"] * y["Hydrogen"] ** 3 * p_bar ** 2 / (y["Methane"] * y["Water"])
print(f"CH4 conversion = {100.0 * reformer.Object.ComponentConversions['Methane']:.1f} %")
print(f"Syngas H2 / CO = {100.0 * y['Hydrogen']:.2f} / {100.0 * y['Carbon monoxide']:.2f} mol %")
print(f"Syngas CH4 = {100.0 * y['Methane']:.2f} mol %")
print(f"Kp reforming = {k_smr:.0f} bar2 (ln K = 30.114 - 26830/T: {math.exp(30.114 - 26830.0 / 1123.15):.0f} bar2)")
print(f"Heat supplied = {reformer.HeatDutyKW:.1f} kW")
Output
CH4 conversion = 89.1 %
Syngas H2 / CO = 51.69 / 9.95 mol %
Syngas CH4 = 1.89 mol %
Kp reforming = 529 bar2 (ln K = 30.114 - 26830/T: 506 bar2)
Heat supplied = 191.3 kW
DWSIM 10.2.11.0, generated 2026-10-08.
Properties¶
IDs accepted by GetPropertyValue, SetPropertyValue, the sensitivity analysis, the optimizer, the Adjust block and dynamic events. Units are SI; pass another unit system to GetPropertyValue to get them converted.
| ID | Name | Unit (SI) | Input |
|---|---|---|---|
PROP_GR_0 |
Pressure Drop | Pa | yes |
PROP_GR_1 |
Outlet Temperature | K | yes |
Calculation Mode |
Select the calculation mode of this reactor. | result | |
Initial Gibbs Energy |
kW | result | |
Final Gibbs Energy |
kW | result | |
Element Balance Residue |
result | ||
Methane: Conversion |
% | result | |
Water: Conversion |
% | result | |
Carbon monoxide: Conversion |
% | result | |
Carbon dioxide: Conversion |
% | result | |
Hydrogen: Conversion |
% | result |
Dynamic mode¶
Extra properties used when the flowsheet runs in dynamic mode.
| Name | Unit |
|---|---|
| Operating Pressure (Dynamics) | Pa |
| Liquid Level | m |
| Volume | m3 |
| Height | m |
| Minimum Pressure | Pa |
| Initialize using Inlet Stream | |
| Reset Contents |
Learn more¶
-
User guide
-
FluentAPI
API members¶
Public members declared by this class. Inherited members are documented on the base classes.
Constructors¶
Reactor_Gibbs(): Initializes a new default instance of the Reactor_Gibbs class.
Initializes a new default instance of the Reactor_Gibbs class.
Reactor_Gibbs(string, string): Initializes a new instance of the Reactor_Gibbs class with a name and description.
Initializes a new instance of the Reactor_Gibbs class with a name and description.
| Parameter | Type | Description |
|---|---|---|
name |
String |
The display name of the Gibbs reactor. |
description |
String |
A brief description of the Gibbs reactor. |
Properties¶
AlternateSolvingMethod: Gets or sets whether the alternate (Lagrange multiplier) solving method is used.
Gets or sets whether the alternate (Lagrange multiplier) solving method is used.
ComponentIDs: Gets or sets the list of compound IDs used in direct minimisation.
Gets or sets the list of compound IDs used in direct minimisation.
ComponentIDs_RE: Gets or sets the list of compound IDs used in reaction-extent mode.
Gets or sets the list of compound IDs used in reaction-extent mode.
DampingLowerLimit: Gets or sets the lower bound for the damping factor.
Gets or sets the lower bound for the damping factor.
DampingUpperLimit: Gets or sets the upper bound for the damping factor.
Gets or sets the upper bound for the damping factor.
DerivativePerturbation: Gets or sets the relative perturbation used for numerical derivative estimation.
Gets or sets the relative perturbation used for numerical derivative estimation.
ElementBalance: Gets or sets the relative element balance error after convergence.
Gets or sets the relative element balance error after convergence.
ElementMatrix: Gets or sets the element–compound formula matrix used for elemental balance constraints.
Gets or sets the element–compound formula matrix used for elemental balance constraints.
Elements: Gets or sets the array of chemical element symbols involved in the minimisation.
Gets or sets the array of chemical element symbols involved in the minimisation.
EnableDamping: Gets or sets whether damping is applied to the Newton step during the Lagrange method iteration.
Gets or sets whether damping is applied to the Newton step during the Lagrange method iteration.
FinalGibbsEnergy: Gets or sets the final total Gibbs free energy after minimisation.
Gets or sets the final total Gibbs free energy after minimisation.
HasPropertiesForDynamicMode: Gets a value indicating whether this reactor exposes dedicated dynamic-mode properties.
Gets a value indicating whether this reactor exposes dedicated dynamic-mode properties.
InitialEstimates: Gets or sets the list of user-supplied initial estimates for the minimisation variables.
Gets or sets the list of user-supplied initial estimates for the minimisation variables.
InitialGibbsEnergy: Gets or sets the initial total Gibbs free energy before minimisation.
Gets or sets the initial total Gibbs free energy before minimisation.
InitializeFromPreviousSolution: Gets or sets whether the solver initialises from the previous converged solution.
Gets or sets whether the solver initialises from the previous converged solution.
InternalTolerance: Gets or sets the convergence tolerance for the inner minimisation loop.
Gets or sets the convergence tolerance for the inner minimisation loop.
LagrangeCoeffsEstimationTemperature: Gets or sets the temperature (K) used to estimate initial Lagrange coefficients.
Gets or sets the temperature (K) used to estimate initial Lagrange coefficients.
MaximumInternalIterations: Gets or sets the maximum number of iterations for the inner minimisation loop.
Gets or sets the maximum number of iterations for the inner minimisation loop.
MobileCompatible: Gets a value indicating whether this reactor is compatible with mobile/cross-platform interfaces.
Gets a value indicating whether this reactor is compatible with mobile/cross-platform interfaces.
PreviousSolution: Gets or sets the list of variable values from the previous solution, used for warm-starting.
Gets or sets the list of variable values from the previous solution, used for warm-starting.
ReactionExtents: Gets the dictionary of calculated reaction extents, keyed by reaction ID.
Gets the dictionary of calculated reaction extents, keyed by reaction ID.
ReactivePhaseBehavior: Gets or sets the reactive-phase behaviour for the Gibbs minimisation.
Gets or sets the reactive-phase behaviour for the Gibbs minimisation.
SupportsDynamicMode: Gets a value indicating whether this reactor supports dynamic simulation mode.
Gets a value indicating whether this reactor supports dynamic simulation mode.
TotalElements: Gets or sets the array of total element amounts (mol) in the feed.
Gets or sets the array of total element amounts (mol) in the feed.
UseIPOPTSolver: Gets or sets whether the IPOPT solver is used for the Gibbs minimisation.
Gets or sets whether the IPOPT solver is used for the Gibbs minimisation.
Methods¶
Calculate(object): Performs the Gibbs reactor calculation, delegating to either direct minimisation or Lagrange multiplier method...
Performs the Gibbs reactor calculation, delegating to either direct minimisation or Lagrange multiplier method depending on the selected solving approach.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
Optional. If True, indicates a dynamic-mode call. |
Calculate_GibbsMin(object): Solves the Gibbs minimisation using IPOPT or simplex subject to elemental balance constraints.
Solves the Gibbs minimisation using IPOPT or simplex subject to elemental balance constraints.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
Calculate_Lagrange(object): Solves the Gibbs minimisation using the Lagrange multiplier (simultaneous correction) method.
Solves the Gibbs minimisation using the Lagrange multiplier (simultaneous correction) method.
| Parameter | Type | Description |
|---|---|---|
args |
Object |
CheckCompoundIDs(): Validates and updates the compound ID list, removing compounds no longer present in the simulation.
Validates and updates the compound ID list, removing compounds no longer present in the simulation.
CloneXML(): Creates a deep copy of this reactor via XML serialization.
Creates a deep copy of this reactor via XML serialization.
CloseEditForm(): Closes and disposes the editing form.
Closes and disposes the editing form.
CreateDynamicProperties(): Registers the dynamic properties for dynamic simulation mode.
Registers the dynamic properties for dynamic simulation mode.
CreateElementMatrix(): Builds the element–compound formula matrix from the compound database, identifying which chemical elements are...
Builds the element–compound formula matrix from the compound database, identifying which chemical elements are present and their stoichiometric counts per compound.
DeCalculate(): Clears the calculated results from the outlet material streams.
Clears the calculated results from the outlet material streams.
DisplayDynamicsEditForm(): Opens or activates the dynamics property editor form for this reactor.
Opens or activates the dynamics property editor form for this reactor.
DisplayEditForm(): Opens or activates the editing form for this reactor.
Opens or activates the editing form for this reactor.
GetDisplayDescription(): Returns the localised display description for this reactor.
Returns the localised display description for this reactor.
GetDisplayName(): Returns the localised display name for this reactor.
Returns the localised display name for this reactor.
GetIconBitmapBytes(): Returns the icon bitmap as a byte array.
Returns the icon bitmap as a byte array.
GetProperties(PropertyType): Returns an array of property identifiers for the specified property type.
Returns an array of property identifiers for the specified property type.
| Parameter | Type | Description |
|---|---|---|
proptype |
PropertyType |
GetPropertyDescription(string): Returns a human-readable description of the specified property.
Returns a human-readable description of the specified property.
| Parameter | Type | Description |
|---|---|---|
p |
String |
GetPropertyUnit(string, IUnitsOfMeasure): Returns the unit string for the specified property.
Returns the unit string for the specified property.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
|
su |
IUnitsOfMeasure |
GetPropertyValue(string, IUnitsOfMeasure): Returns the value of the specified property, converted to the given unit system.
Returns the value of the specified property, converted to the given unit system.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
|
su |
IUnitsOfMeasure |
GetReport(IUnitsOfMeasure, CultureInfo, string): Generates a plain-text report of the reactor results using the specified units and format.
Generates a plain-text report of the reactor results using the specified units and format.
| Parameter | Type | Description |
|---|---|---|
su |
IUnitsOfMeasure |
|
ci |
CultureInfo |
|
numberformat |
String |
GetStructuredReport(): Generates a structured report of the reactor results as a list of typed tuples.
Generates a structured report of the reactor results as a list of typed tuples.
LoadData(List<XElement>): Restores the reactor state, including element matrices and initial estimates, from XML.
Restores the reactor state, including element matrices and initial estimates, from XML.
| Parameter | Type | Description |
|---|---|---|
data |
List<XElement> |
RunDynamicModel(): Executes one dynamic simulation time step for the Gibbs reactor.
Executes one dynamic simulation time step for the Gibbs reactor.
SaveData(): Serializes the reactor state, including element matrices and compound lists, to XML.
Serializes the reactor state, including element matrices and compound lists, to XML.
SetPropertyValue(string, object, IUnitsOfMeasure): Sets the value of the specified property from the given value and unit system.
Sets the value of the specified property from the given value and unit system.
| Parameter | Type | Description |
|---|---|---|
prop |
String |
|
propval |
Object |
|
su |
IUnitsOfMeasure |
UpdateEditForm(): Refreshes the editing form with updated data.
Refreshes the editing form with updated data.
Validate(): Validates that inlet and outlet streams are connected before calculation.
Validates that inlet and outlet streams are connected before calculation.
Fields¶