Skip to content

Fix VLE.set_PH when (vle) chemicals exist#100

Closed
yalinli2 wants to merge 1 commit into
masterfrom
fix/vle-no-equilibrium-setup
Closed

Fix VLE.set_PH when (vle) chemicals exist#100
yalinli2 wants to merge 1 commit into
masterfrom
fix/vle-no-equilibrium-setup

Conversation

@yalinli2

@yalinli2 yalinli2 commented Jul 16, 2026

Copy link
Copy Markdown
Member

@yoelcortes
Previously, when NoEquilibrium was raised for no chemicals/vle chemicals, self._N (would be 0 for these cases) was not set, so set_PH does resolve to the correct fix below:

        if self._N == 0:
            thermal_condition.T = self.mixture.xsolve_T_at_HP(
                self._phase_data, H, thermal_condition.T, P
            )
            return

Note: the following block does set thermal_condition and thermal_condition.P, but not thermal_condition.T

        elif P_spec:
            if V_spec:
                try:
                    self.set_PV(P, V, gas_conversion, liquid_conversion, wt=wt)
                except NoEquilibrium:
                    thermal_condition = self._thermal_condition
                    thermal_condition.P = P
            elif H_spec:
                try:
                    self.set_PH(P, H, gas_conversion, liquid_conversion)
                except NoEquilibrium:
                    thermal_condition = self._thermal_condition
                    thermal_condition.P = P

Similar issues might exist for setup_PS as well, thanks.

yoelcortes added a commit that referenced this pull request Jul 19, 2026
@yoelcortes

yoelcortes commented Jul 19, 2026

Copy link
Copy Markdown
Member

Thanks for submitting this issue, @yalinli2. I took care of it in 10afe9f. I removed instances of raising NoEquilibrium error within setup so that set_XY methods handle the special case of no equilibrium chemicals. Thanks for all the helpful details too.

@yoelcortes yoelcortes closed this Jul 19, 2026
@yalinli2
yalinli2 deleted the fix/vle-no-equilibrium-setup branch July 20, 2026 11:56
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.

2 participants