Skip to content

Commit

Permalink
applying black
Browse files Browse the repository at this point in the history
  • Loading branch information
JavalVyas2000 committed Mar 26, 2024
1 parent 197c589 commit 9e36206
Show file tree
Hide file tree
Showing 8 changed files with 4,426 additions and 2,064 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class _StateBlock(StateBlock):
This Class contains methods which should be applied to Property Blocks as a
whole, rather than individual elements of indexed Property Blocks.
"""

def initialize(
self,
state_args=None,
Expand Down Expand Up @@ -206,6 +207,7 @@ def release_state(self, flags, outlvl=idaeslog.NOTSET):
revert_state_vars(self, flags)
init_log.info("State Released.")


@declare_process_block_class("AqPhaseStateBlock", block_class=_StateBlock)
class AqPhaseStateBlockData(StateBlockData):
"""
Expand Down Expand Up @@ -253,9 +255,9 @@ def _make_state_vars(self):

def material_flow_expression(self, j):
if j == "H2O":
return self.flow_vol*self.params.dens_mass
return self.flow_vol * self.params.dens_mass
else:
return self.conc_mass_comp[j]*self.flow_vol
return self.conc_mass_comp[j] * self.flow_vol

self.material_flow_expression = Expression(
self.component_list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@
m.fs.lex.aqueous_inlet.flow_vol.fix(100 * pyo.units.L / pyo.units.hour)
m.fs.lex.aqueous_inlet.temperature.fix(300 * pyo.units.K)
m.fs.lex.aqueous_inlet.pressure.fix(1 * pyo.units.atm)
m.fs.lex.aqueous_inlet.conc_mass_comp[0, "NaCl"].fix(
0.15 * pyo.units.g / pyo.units.L
)
m.fs.lex.aqueous_inlet.conc_mass_comp[0, "KNO3"].fix(
0.2 * pyo.units.g / pyo.units.L
)
m.fs.lex.aqueous_inlet.conc_mass_comp[0, "CaSO4"].fix(
0.1 * pyo.units.g / pyo.units.L
)
m.fs.lex.aqueous_inlet.conc_mass_comp[0, "NaCl"].fix(0.15 * pyo.units.g / pyo.units.L)
m.fs.lex.aqueous_inlet.conc_mass_comp[0, "KNO3"].fix(0.2 * pyo.units.g / pyo.units.L)
m.fs.lex.aqueous_inlet.conc_mass_comp[0, "CaSO4"].fix(0.1 * pyo.units.g / pyo.units.L)

print(degrees_of_freedom(m))

Expand All @@ -66,4 +60,3 @@
m.fs.lex.aqueous_outlet.flow_vol.display()
m.fs.lex.organic_outlet.flow_vol.display()
pyo.assert_optimal_termination(results)

Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def build(self):
self.solutes,
initialize={"NaCl": 2.15, "KNO3": 3, "CaSO4": 1.5},
within=PositiveReals,
mutable=True
mutable=True,
)

@classmethod
Expand Down Expand Up @@ -216,10 +216,11 @@ def release_state(self, flags, outlvl=idaeslog.NOTSET):
revert_state_vars(self, flags)
init_log.info("State Released.")


@declare_process_block_class("OrgPhaseStateBlock", block_class=_StateBlock)
class LiqPhaseStateBlockData(StateBlockData):
"""
An example property package for Organic phase for liquid liquid extraction
An example property package for Organic phase for liquid liquid extraction
"""

def build(self):
Expand Down Expand Up @@ -261,9 +262,9 @@ def _make_state_vars(self):

def material_flow_expression(self, j):
if j == "solvent":
return self.flow_vol*self.params.dens_mass
return self.flow_vol * self.params.dens_mass
else:
return self.flow_vol*self.conc_mass_comp[j]
return self.flow_vol * self.conc_mass_comp[j]

self.material_flow_expression = Expression(
self.component_list,
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,3 @@ def rule_material_liq_balance(self, t, j):
rule=rule_material_liq_balance,
doc="Unit level material balances Org",
)


0 comments on commit 9e36206

Please sign in to comment.