feos-org / feos

FeOs - A Framework for Equations of State and Classical Density Functional Theory
Other
115 stars 22 forks source link

Add custom PhaseDiagram constructor #113

Closed prehner closed 1 year ago

prehner commented 1 year ago

This allows code like

PhaseDiagram(
    [
        State(eos, temperature, pressure=p, moles=feed).tp_flash()
        for p in pressure
        if not State(eos, temperature, pressure=p, moles=feed).is_stable()
    ]
)

From the resulting PhaseDiagram object, the properties can then be obtained without having to write loops.

Similar to that StateVec is exposed in Python and gets a corresponding constructor, that can be used like this:

StateVec([State(eos, temperature, pressure=p, moles=feed) for p in pressure])

Other smaller changes: