Code Monkey home page Code Monkey logo

neqsim's Introduction

NeqSim Logo

Build Status Build maven Known Vulnerabilities codecov SCM Compliance

NeqSim is the main part of the NeqSim project. NeqSim (Non-Equilibrium Simulator) is a Java library for estimating fluid properties and process design. The basis for NeqSim is a library of fundamental mathematical models related to phase behavior and physical properties of fluids. NeqSim is easilly extended with new models. NeqSim development was initiated at the Norwegian University of Science and Technology (NTNU).

Releases

NeqSim releases are available as a packaged jar file and as source code. NeqSim can be used in a third party application by adding NeqSim jar to the classpath.

Getting started as a NeqSim Java user

NeqSim can be used in a Java application by adding the neqsim-x.x.x.jar found in NeqSim releases to the classpath. A demonstration of downloading the library and running a TPflash benchmark is illustrated in this NeqSim Colab demo. Learn and ask questions in Discussions for use and development of NeqSim. Also see the NeqSim JavaDoc.

Use of the NeqSim package

NeqSim can be set up as a dependency in a Java project via the NeqSim GitHub package distribution.

Getting Started as a NeqSim Java developer

See the NeqSim Java Wiki for how to use the NeqSim API. NeqSim can be built using the Maven build system (https://maven.apache.org/). All NeqSim build dependencies are given in the pom.xml file. Learn and ask questions in Discussions for use and development of NeqSim.

Initial setup

The NeqSim source code is downloaded by cloning the library to your local computer (alternatively fork it to your private reprository). The following commands are dependent on a local installation of GIT and Maven.

git clone https://github.com/equinor/neqsim.git
cd neqsim
./mvnw install

Note The maven wrapper command is dependend on your OS, for Unix use: ./mvnw Windows: mvnw.cmd

An interactive demonstration of how to get started as a NeqSim developer is presented in this NeqSim Colab demo.

Running the tests

The test files are written in JUnit5 and placed in the test directory. Test code shuld be written for all new code added to the project, and all tests have to pass before merging into the master branch.

Test coverage can be examined using jacoco from maven.
Generate a coverage report using ./mvnw jacoco:prepare-agent test install jacoco:report and see results in target/site/jacoco/index.html.

Note The maven wrapper command is dependend on your OS, for Unix use: ./mvnw Windows: mvnw.cmd

Deployment

The NeqSim source code is compiled and distributed as a Java library. NeqSim releases are available for download from the release pages.

Built With

Maven - Dependency Management

Contributing

See the getting started as a NeqSim developer documentation. Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests. An interactive demonstration of how to get started as a NeqSim developer is presented in this NeqSim Colab demo.

Discussion forum

Questions related to neqsim can be posted in the github discussion pages.

Versioning

NeqSim use SemVer for versioning.

Authors and contact persons

Even Solbraa ([email protected]), Marlene Louise Lund

Licence

NeqSim is distributed under the Apache-2.0 licence.

Acknowledgments

A number of master and PhD students at NTNU have contributed to development of NeqSim. We greatly acknowledge their contributions.

NeqSim modules

NeqSim is built upon six base modules:

  1. Thermodynamic Routines
  2. Physical Properties Routines
  3. Fluid Mechanic Routines
  4. Unit Operations
  5. Chemical Reactions Routines
  6. Parameter Fitting Routines
  7. Process simulation routines

File System

neqsim/: main library with all modules

neqsim/thermo/: Main path for thermodynamic routines neqsim/thermo/util/examples/: examples of use of Thermodynamic Models and Routines

neqsim/thermodynamicOperation: Main path for flash routines (TPflash, phase envelopes, etc.) neqsim/thermodynamicOperation/util/example/: examples of use of thermodynamic operations (eg. flash calculations etc.)

neqsim/physicalProperties: Main path for Physical Property methods neqsim/physicalProperties/util/examples/: Examples of use of physical properties calculations

neqsim/physicalProperties: Main path for Physical Property methods neqsim/physicalProperties/util/examples/: Examples of use of physical properties calculations

neqsim/processSimulation: Main path for Process Simulation Calculations neqsim/processSimulation/util/examples/: Examples of use of Process Simulation calculations

changelog.txt : History of what changed between each version. license.txt: license document

Toolboxes

See NeqSim homepage. NeqSim toolboxes are avalable via GitHub for alternative programming languages.

Related open source projects

NeqSim Python/Colab

neqsim's People

Contributors

akistas avatar asmfstatoil avatar dependabot[bot] avatar evensol avatar fannemel avatar jlyshoel avatar jorgenengelsen avatar marlenelund avatar mikaojk avatar snyk-bot avatar sviatose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neqsim's Issues

Implement reactive absorber

A reactive absorber could be used for operations such as:

  • CO2 removal in alkanolamines
  • H2S removal in alkanolamines
  • etc.

add adjuster to process simulation

Add adjuster unit operation. Adjuster will adjust one parameter of a unit operation/stream to obtain a specification on a operation/stream. This can eg. be to adjust a temperature of a stream to obtain a circondenbar, or to adjust a temperature to have a hydrate temperate above a given temperature.

Component name alias

Is your feature request related to a problem? Please describe.
Some API solution using neqsim refers to components with short names and they are not found in the database.

Describe the solution you'd like
Aliases for components:
("H2O", "water");
("N2", "nitrogen");
("C1", "methane");
("C2", "ethane");
("C3", "propane");
("iC4", "i-butane");
("nC4", "n-butane");
("iC5", "i-pentane");
("nC5", "n-pentane");
("C6", "n-hexane");
("O2", "oxygen");
("He", "helium");
("H2", "hydrogen");
("Ar", "argon");
("nC7", "n-heptane");
("nC8", "n-octane");
("nC9", "n-nonane");

Describe alternatives you've considered
Change naming in api callers

Additional context
Add any other context or screenshots about the feature request here.

bug in flash?

%neqsimBugTest1

%% Del 1 dette fluidet gir kun gass og vannfase

EOS ='srk';%'srk';%,'pr','srk-mc','cpa','umr','ScRK','srk-sc?'}; SRK er ikke så god for vanninnhold i gass
LumpingModel = 'PVTlumpingModel'; %Lik som PVTsim
TBPModel = 'PedersenSRK'; %Samme som PVTsim - 'PedersenSRK' 'PedersenPR' 'PedersenSRKHeavyOil' 'RiaziDaubert' Hvordan regnes Tc Pc omega ut fra tetthet og molmasse
NumOfLumpComp = 8;
useVolumeCorrection = true; %Peneloux(T)
MixingRule = 2;%1 no (kij=0), 2 classic, 3 Huron-Vidal, 4 Huron-Vidal, 5 Wong-Sandler, 6 Wong-Sandler, 7 classic-CPA, 8classicdT, 9 classic-CPA_T, 10-classic-CPA, 11 no (kij=0), 15 UMR misingrule(litt spesiell fikk string av even s) %Det er 10 som altid brukes sammen med cpa Solbraa. For SRK og PR brukes classic
Temperature = 10;
Pressure = 10;
%NS.M = M;
%NS.D = D;

NewCompNames = {'water' 'nitrogen' 'CO2' 'methane' 'ethane' 'propane' 'i-butane' 'n-butane' 'i-pentane' 'n-pentane' 'C6' 'C7' 'C8' 'C9' 'C10'};
MolPerec = {82.9707025451087;0.0666535828183601;0.187774718697095;7.07713715223514;0.672169855603433;0.444683688548461;0.209592099228299;0.693295020726668;0.508165688139769;0.617972892756542;0.739241843326858;1.07508213518218;1.07194639755329;0.611128861166707;3.05445351890850};
MW = {18.0153400000000;28.0135200000000;44.0098000000000;16.0428800000000;30.0698200000000;44.0967600000000;58.1237000000000;58.1237000000000;72.1506400000000;72.1506400000000;86.1775867056215;90.3453968002884;102.444091821606;115.600000000000;225.500000000000};
Dens = {999;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;-1.00000000000000e+19;667.260997428482;746.520646503967;770.940816960541;790.100000000000;841.100000000000};

     if ~exist('processOperations','var')
         pathNeqSim_gebh_jip
     end

pressure = 10.0; % pressure in bara
temperature = 303.15; % temperature in Kelvin
fluid = thermo(EOS, temperature,pressure); % setting EOS P and T
fluid.getCharacterization().setTBPModel(TBPModel); % setting characterization method (method to calculate Tc, Pc, omega)
fluid.getCharacterization().setLumpingModel(LumpingModel); % setting lumping model to pedersen
fluid.getCharacterization().getLumpingModel().setNumberOfLumpedComponents(NumOfLumpComp); % set number of lumped components to 8
fluid.useVolumeCorrection(useVolumeCorrection);
PlusFluid = false;

for i=1:length(NewCompNames)
if isequal(NewCompNames{i},'NaCl')
fluid.addSalt(NewCompNames{i}, MolPerec(i));
elseif isequal(NewCompNames{i},'C6')||isequal(NewCompNames{i},'C7')||isequal(NewCompNames{i},'C7')||isequal(NewCompNames{i},'C8')||isequal(NewCompNames{i},'C9')
fluid.addTBPfraction(NewCompNames{i}, MolPerec{i}, MW{i}./1000,Dens{i}./1000);
PlusFluid = true;

elseif isequal(NewCompNames{i},'C10')
    fluid.addPlusFraction('C10',MolPerec{i}, MW{i}./1000, Dens{i}./1000); 
     PlusFluid = true;
     
else
    fluid.addComponent(NewCompNames{i}, MolPerec{i}); 
end

end

% fluid_1.addComponent('methane', 10.0); % adding 1 mole/second of methane
% fluid_1.addTBPfraction('C7', 1.0, 0.102, 0.81); % adding 1 mole/second of a pseudo component C7
% fluid_1.addTBPfraction('C8', 0.4, 0.112, 0.83); % adding 1 mole/second of a psceudo component C8
% fluid_1.addTBPfraction('C9', 0.2, 0.132, 0.84); % adding 1 mole/second of a pseudo component C9
% fluid_1.addPlusFraction('C10', 1.0, 0.190, 0.87); %adding plus fraction C10+

if PlusFluid
fluid.getCharacterization().characterisePlusFraction(); % characterisation of the fluid if plus fluid
end
fluid.createDatabase(1); % reading parameters from database
%fluid_1.setMixingRule('HV', 'UNIFAC_UMRPRU');

fluid.setMixingRule(MixingRule); % using classic mixing rule with kij

fluid.setMultiPhaseCheck(1) % specifies that calculations should check for more than two fluid phases

%TPflash(fluid_1,0); % doing a TPflash at constant pressure and temperature
fluid.init(0);%initiate fluid

%% Del to dette resulterer i kun olje og vannfase

Temperature = 9;
Pressure = 23.5;
fluid.setTemperature(Temperature , 'C');
fluid.setPressure(Pressure , 'barg');
TPflash(fluid,0);
%fluid.init(0);
fluid.initPhysicalProperties(); %denne må gjøres for å få ut bare fysiskalske
fluid.initProperties();

Linear algebra wrapper

A number of linear algebra libraries are used in NeqSim. The currently most used linear algebra library in NeqSim is EJML (because of speed). Examples of such libraries are JAMA, EJML, ojAlgo, commonMath, etc. To reduce the number of libraries used (eg. standardize on EJML), and make it easy to change to another library, a linear algebra wrapper could be made in NeqSim. This will improve flexibility and reduce number of dependencies.

error valve simulation from 300 to 4 bar for nitrogen and methane

Describe the bug
The basic program is working - with the exception of the throttling valve (reduction from 300 to 4 bar). I noticed that the drop in temperature due to the JT effect is not always consistent with the pressure drop.

I made the short program attached only to test the valve, to compare enthalpies of the inlet and outlet stream. It seems that, whenever the temperature is dropped below -20°C in the inlet, the throttling process is no longer isenthalpic. What can explain this?

I am using Peng Robinson EoS, and simulating the same valve conditions using Hysys with PR, I do get an isenthalpic process.

Wax calculations when working with embedded database

NeqSim currently is not able to do wax calculations when working with the embedded Derby database (because of need of creating temporary tables).

A solution for wax calculations using the embedded database needs to be developed.

Diffusion clone bug

Describe the bug
Fails cloning Diffusion objects when components have been added after creation

To Reproduce
SystemInterface airThermoSystem = neqsim.thermo.Fluid.create("air");
airThermoSystem.addComponent("CO2", 0.0);
airThermoSystem.addComponent("water", 0.0);
airThermoSystem.clone();

Expected behavior
Not failing in Diffusivity clone method

Compressor surge factor 1 error

Describe the bug
Compressor runsj in ifinite loop when surge factor is 1 (eg. 1.05 is ok)

To Reproduce

Expected behavior
Should converge fast

Screenshots

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

jar file

The only file I need is the jar file? It contains the GUI or is only the calculation librarie?

Thanks

Uee GERG-2008 for internal compressor calculations

Implement the possibility to specify GERG-2008 to be used internally in the compressor unit operation (eg. for calculation of power, polytropic head and efficiency). See example following code:

#Setting up a simple process (one stream and a compressor)
inputStream = stream(naturalgasFluid)
compressor_1 = compressor(inputStream)
compressor_1.setOutletPressure(pressureOut)
compressor_1.setUseGERG2008(True)

Improve method to set flow rate for a fluid

updated method setTotalFlowRate()

init(0) is used to update fluid before flow is updated. This is a relatively computational demanding task, and a method should be developed that does not use init(0).

Problem running DistillationColumn

I was trying to create a absorption-distillation example in Python but I had problems displaying the results from the DistillationColumns.
So I switched to Java.
Following the instructions at this link:
https://colab.research.google.com/drive/1XkQ_CrVj2gLTtJvXhFQMWALzXii522CL#scrollTo=rLXNemTqighl

I'm trying to run the following:
java -cp NeqSim.jar neqsim.processSimulation.processEquipment.distillation.DistillationColumn

This causes a lot of "ERROR neqsim.thermo.phase.PhaseEos - Failed to solve for molarVolume within the iteration limit".
Can you please help me?

Characterize/Lumping similar as PVTsim

Can you make a LumpingModel that lump in the same way as PVT-sim: keeping C6,..C9 and start lumping from C10.... Also it would be nice to the make names traceable f.eks C13-C15 etc.

Error/Exception when using a 3 phase separator for a stream with only gas and oil

Example when we get the error:
In this case the water in the feed is set to 0, and we will only have gas and oil in inlet separator.

feedFluid = {'ComponentName': ['water', 'MEG', "methane", "ethane", "propane","i-butane", "n-butane","i-pentane","n-pentane", "C6", "C7", "C8", "C9", "C10"],
'MolarComposition[-]': [0.0, 0.0, 80.0, 6.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.01, 0.05, 1.01],
'MolarMass[kg/mol]': [None,None, None,None,None,None, None,None,None,0.091, 0.110, 0.13, 0.15, 0.25],
'RelativeDensity[-]': [None,None, None,None,None,None, None,None,None, 0.7, 0.78, 0.8, 0.82, 0.83]
}

    reservoirFluiddf = pd.DataFrame(feedFluid)
    fluid7 = fluid_df(reservoirFluiddf).autoSelectModel()
    fluid7.setMultiPhaseCheck(True)

    glycolFluid = fluid7.clone()
    glycolFluid.setMolarComposition([0.0, 1.0, 0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0, 0.0,0.0,0.0])

    clearProcess()
    feedStream = stream(fluid7)
    feedStream.setFlowRate(self.feedFlowRateTrain1, 'kg/hr')
    feedStream.setPressure(self.feedPressure, 'barg')
    feedStream.setTemperature(self.feedTemperature, 'C')

    glycolFeedStream = stream(glycolFluid)
    glycolFeedStream.setFlowRate(self.glycolFlow, 'kg/hr')
    glycolFeedStream.setTemperature(self.feedTemperature, 'C')
    glycolFeedStream.setPressure(self.feedPressure, 'barg')

    slugCatcher = separator3phase(feedStream)

    saturatedGasFromSlugCatcher = saturator(slugCatcher.getGasOutStream(), 'water saturator')

    valve1 = valve(saturatedGasFromSlugCatcher.getOutStream())
    valve1.setOutletPressure(self.sep1Pressure)

    sep1 = separator3phase(valve1.getOutStream())

    cooler1 = cooler(sep1.getGasOutStream())
    cooler1.setOutTemperature(self.cooler1T, 'C')

    sep2 = separator3phase(cooler1.getOutStream())

    mixer1 = mixer()
    mixer1.addStream(sep2.getGasOutStream())
    mixer1.addStream(glycolFeedStream)

    expander1 = expander(mixer1.getOutStream(), self.expOutPressure)

    sep3 = separator3phase(expander1.getOutStream())

    gasToExport = stream(sep3.getGasOutStream())

    runProcess()

enhancements and bug fixes

  1. Flash a fluid at 0 kg / s flow
  2. HV seems to crash
  3. Write C10 + for composition to characterized fluid.
  4. UMR mixing rule appears to crash with pseudo components.

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.