Coder Social home page Coder Social logo

feos-core's People

Contributors

g-bauer avatar prehner avatar

Watchers

 avatar  avatar

Forkers

yyfdemajia

feos-core's Issues

Use `Verbosity` in critical point calculations.

In critical_point_binary, verbosity of VLEOptions is not used - neither in the final computation nor in the Brent optimization. We could add the option into the strut that implements ArgminOp. E.g.:

struct CritOp<U: EosUnit, E: EquationOfState> {
    eos: Rc<E>,
    tp: TPSpec<U>,
    opts: VLEOptions,
}

impl<U: EosUnit, E: EquationOfState> CritOp<U, E> {
    fn new(eos: &Rc<E>, tp: TPSpec<U>, opts: VLEOptions) -> Self {
        Self {
            eos: eos.clone(),
            tp,
            opts
        }
    }
}

yielding

    pub(crate) fn critical_point_binary(
        eos: &Rc<E>,
        tp: TPSpec<U>,
        options: VLEOptions,
    ) -> EosResult<Self>
    where
        QuantityScalar<U>: std::fmt::Display,
    {
        let solver = Brent::new(1e-10, 1.0 - 1e-10, options.tol.unwrap_or(TOL_CRIT_POINT));
        let cost = CritOp::new(eos, tp, options.clone());
        let x = Executor::new(cost, solver, 0.5)
            .max_iters(options.max_iter.unwrap_or(MAX_ITER_CRIT_POINT) as u64)
            .run()?
            .state
            .best_param;
        let moles = arr1(&[x, 1.0 - x]) * U::reference_moles();
        State::critical_point(eos, Some(&moles), None, options)
    }

Error message for mixture critical point

For a mixture:

cpm = State.critical_point(dft)

returns the error message: RuntimeError: Equation of state is initialized for 2 components while the input specifies 1 components.

The error can be prevented by specifying moles as

cpm = State.critical_point(dft, moles=np.array([1.5, 1.5])*MOL)

A nicer error message could state that specification of moles is required.

Initial temperatures in critical point calculations of mixtures.

For some equations of state, the initial temperatures are problematic. E.g. for model fluids such as LJ fluids with somewhat sensible parameters critical points can be around 100 Kelvin. For pure substances this is not as much of a problem, since we can provide initial estimates. For binary mixtures, this is not possible. We should either make initial guesses more robust or provide ways to allow initial estimates as input.

units in `PhaseDiagramPure`

In some cases, it would be convenient to directly access (mass) specific densities from a PhaseDiagramPure. Maybe as a getter?

Rename `VLEOptions`

The name of the VLEOptions struct is a relic from when PhaseEquilibrium was still named VLEState. It is appropriate to give it a clearer name, e.g. SolverOptions

Rust API documentation for cubic eos

The cubic module and PengRobinson equation of state lack docstrings.

Also, to be consistent with other records, PengRobinsonRecord should have a new constructor.

Incorporate new PyO3 features

PyO3 0.16.0 provides new features that can be useful for our crate. In particular the added support for simple enums like Contributions and Verbosity can be exploited.

Proper README

We should add more information to the README. Although the primary use case for all FeOs crates (from an users standpoint) will be the python package (feos) it might be helpful to have an example on how to use this crate in rust.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.