Giter Site home page Giter Site logo

Comments (2)

EvenSol avatar EvenSol commented on June 15, 2024 1

Hi.
I think the error is due to the component names. See available components in this file:
https://github.com/equinor/neqsim/blob/master/src/main/resources/neqsim_component_names.txt

Try to run the following code:

from neqsim.thermo import fluid,fluid_df,TPflash,printFrame
import pandas as pd

gas = {"methane": 95, "nitrogen": 1, "CO2": 0.2, "ethane": 1, "propane": 0.6, "n-butane": 0.3, "n-pentane": 0.08, "n-hexane": 0.4, "oxygen": 0.05}

fluid = fluid('srk')
for key in gas.keys():
    fluid.addComponent(key, gas[key], "mol/sec")

fluid.setTemperature(320.0, 'K')
fluid.setPressure(10.0, 'bara')
TPflash(fluid)
printFrame(fluid)

#Alternative way of creating the fluid

naturalgas = {'ComponentName':  ["nitrogen", "CO2", "methane", "ethane", "propane", "i-butane", "n-butane", "i-pentane", "n-pentane", "n-hexane"], 
        'MolarComposition[-]':  [0.34, 0.84, 90.4, 5.199, 2.06, 0.36, 0.55, 0.14, 0.097, 0.014]
} 

naturalgasdf = pd.DataFrame(naturalgas) 
naturalgasFluid = fluid_df(naturalgasdf)

naturalgasFluid.setTemperature(320.0, 'K')
naturalgasFluid.setPressure(10.0, 'bara')
TPflash(naturalgasFluid)
printFrame(naturalgasFluid)

from neqsim-python.

UniqASL avatar UniqASL commented on June 15, 2024 1

Thank you very much for the reply. Indeed, I think it was also not correct before, but as I did not get a feedback from neqsim, I did not noticed that something was wrong.

I guess the fact that I am now getting an error message is because of the new Java bridge since v. 2.3.0. Thanks for that, it is useful to get feedback from the tool.

And thanks for the alternative method to create a fluid.

from neqsim-python.

Related Issues (16)

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.