Skip to content

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

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

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.

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.

1 participant