Skip to content

Revised vapor composition constraints fix ZeroDivisionError when gdp.hull reformulation is applied#47

Open
tristantc wants to merge 2 commits intokaibelfrom
tristantc/issue44
Open

Revised vapor composition constraints fix ZeroDivisionError when gdp.hull reformulation is applied#47
tristantc wants to merge 2 commits intokaibelfrom
tristantc/issue44

Conversation

@tristantc
Copy link
Copy Markdown
Contributor

@tristantc tristantc commented Aug 13, 2024

This PR fix the ZeroDivisionError when gdp.hull reformulation is applied in the Kaibel instance.

File:gdplib/kaibel/kaibel_solve_gdp.py

    tray_exists[1,1].bottom_vapor_composition[1]
    tray_exists[2,1].feedside_vapor_composition[1]
    tray_exists[3,1].productside_vapor_composition[1]
    tray_exists[4,1].top_vapor_composition[1]

@ZedongPeng ZedongPeng requested a review from bernalde August 13, 2024 21:58
@ZedongPeng
Copy link
Copy Markdown
Member

As long as there are no errors, this PR is ready to be merged. @bernalde

Copy link
Copy Markdown
Member

@bernalde bernalde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides some small changes the most important part is verifying that both the Big-M and HR can provided the right solution to the problem and that the new introduced variables/constraints did not modify the optimal solution

m.dHvap[comp] = dHvapb[comp] / m.Hscale

## Heat capacity calculation for liquid and vapor phases using Ruczika-D method for each component in the feed, section, and tray
## Heat capacity calculation for liquid and vapor phases for each component in the feed, section, and tray
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the comment on the method? Is that method not used? If it is used, leave the comment and add a reference

m.prop[comp, 'TC'] / m.Tup,
m.prop[comp, 'TC'] / m.Tlo,
), # (0, None),
initialize=lambda m, sec, tray, comp: m.T0[sec, tray] / m.Tlo,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this way of defining bounds and initializations!

m.prop[comp, 'TC']
/ m.T[1, n_tray]
m.Tr[1, n_tray, comp]
# m.prop[comp, 'TC']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why leave these lines here? If the code works, remove the comments as they become confusing

)
)
/ m.P[1, n_tray]
# / m.P[1, n_tray]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment as pressure multiplied in the other side of the equality

"""
return m.Tr[4, n_tray, comp] * m.T[4, n_tray] == m.prop[comp, 'TC']

@disj.Constraint(m.comp, doc="Top scetion 4 vapor composition")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here in section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants