Skip to content

Commit

Permalink
black formatted again
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertLee125 committed May 19, 2024
1 parent 1734d3a commit 8725036
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions gdplib/cstr/gdp_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def build_cstrs(NT: int = 5) -> pyo.ConcreteModel():
"""

# PYOMO MODEL
m = pyo.ConcreteModel(name='gdp_reactors')
m = pyo.ConcreteModel(name="gdp_reactors")

# SETS
m.I = pyo.Set(initialize=['A', 'B'], doc='Set of components')
m.N = pyo.RangeSet(1, NT, doc='Set of units in the superstructure')
m.I = pyo.Set(initialize=["A", "B"], doc="Set of components")
m.N = pyo.RangeSet(1, NT, doc="Set of units in the superstructure")

# PARAMETERS
m.k = pyo.Param(
Expand All @@ -44,7 +44,7 @@ def build_cstrs(NT: int = 5) -> pyo.ConcreteModel():
m.QF0 = pyo.Param(
initialize=1, doc="Inlet volumetric flow [L/s]"
) # Inlet volumetric flow [L/s]
C0_Def = {'A': 0.99, 'B': 0.01}
C0_Def = {"A": 0.99, "B": 0.01}

# Initial concentration of reagents [mol/L]
m.C0 = pyo.Param(
Expand Down Expand Up @@ -399,7 +399,7 @@ def prod_spec_rule(m):
Pyomo.Constraint
The constraint for the product B specification.
"""
return m.QP * 0.95 - m.P['B'] == 0
return m.QP * 0.95 - m.P["B"] == 0

m.prod_spec = pyo.Constraint(rule=prod_spec_rule, doc="Product B Specification")

Expand Down Expand Up @@ -466,8 +466,8 @@ def YPD_rate_calc(disjunct):
The constraint for the calculation of the reaction rate of A for each reactor.
"""
return (
m.rate['A', n] * ((m.Q[n]) ** m.order1) * ((m.Q[n]) ** m.order2)
+ m.k * ((m.F['A', n]) ** m.order1) * ((m.F['B', n]) ** m.order2)
m.rate["A", n] * ((m.Q[n]) ** m.order1) * ((m.Q[n]) ** m.order2)
+ m.k * ((m.F["A", n]) ** m.order1) * ((m.F["B", n]) ** m.order2)
== 0
)

Expand All @@ -490,7 +490,7 @@ def YPD_rate_rel(disjunct):
Pyomo.Constraint
_description_
"""
return m.rate['B', n] + m.rate['A', n] == 0
return m.rate["B", n] + m.rate["A", n] == 0

# Volume activation
@disjunct.Constraint()
Expand Down Expand Up @@ -904,9 +904,9 @@ def obj_rule(m):

if __name__ == "__main__":
m = build_cstrs()
pyo.TransformationFactory('core.logical_to_linear').apply_to(m)
pyo.TransformationFactory('gdp.bigm').apply_to(m)
pyo.SolverFactory('gams').solve(
m, solver='baron', tee=True, add_options=['option optcr=1e-6;']
pyo.TransformationFactory("core.logical_to_linear").apply_to(m)
pyo.TransformationFactory("gdp.bigm").apply_to(m)
pyo.SolverFactory("gams").solve(
m, solver="baron", tee=True, add_options=["option optcr=1e-6;"]
)
display(m)

0 comments on commit 8725036

Please sign in to comment.