def test_TPflash1(): fluid1 = fluid("srk") # create a fluid using the SRK-EoS fluid1.setTemperature(28.15, "C") fluid1.setPressure(100.0, "bara") fluid1.addComponent("nitrogen", 1.0, "mol/sec") fluid1.addComponent("CO2", 2.3, "mol/sec") fluid1.addComponent("methane", 80.0, "mol/sec") fluid1.addComponent("ethane", 6.0, "mol/sec") fluid1.addComponent("propane", 3.0, "mol/sec") fluid1.addComponent("i-butane", 1.0, "mol/sec") fluid1.addComponent("n-butane", 1.0, "mol/sec") fluid1.addComponent("i-pentane", 0.4, "mol/sec") fluid1.addComponent("n-pentane", 0.2, "mol/sec") fluid1.addComponent("n-hexane", 0.1, "mol/sec") fluid1.setMixingRule("classic") # classic will use binary kij fluid1.setMultiPhaseCheck( True) #True if more than two phases could be present fluidcomposition = [ 0.01, 0.02, 0.9, 0.1, 0.03, 0.02, 0.01, 0.01, 0.01, 0.003 ] fluidComposition(fluid1, fluidcomposition) fluid1.setPressure(101.0, "bara") fluid1.setTemperature(22.3, "C") TPflash(fluid1) fluid1.initThermoProperties() fluid1.initPhysicalProperties() assert fluid1.getViscosity('kg/msec') == 1.574354015664789e-05
Created on Thu Jan 30 19:39:10 2020 @author: esol """ from neqsim.thermo import fluid, addOilFractions, printFrame, dataFrame, fluidcreator,createfluid,createfluid2, TPflash, phaseenvelope from neqsim.process import pump, clearProcess, stream, valve, separator, compressor, runProcess, viewProcess, heater, mixer, recycle from neqsim.thermo import fluid, TPflash, phaseenvelope, fluidComposition from neqsim.process import clearProcess, stream, valve, separator,compressor, runProcess, viewProcess, heater, mixer, recycle # Start by creating a fluid in neqsim uing a predifined fluid (dry gas, rich gas, light oil, black oil) #Set temperature and pressure and do a TPflash. Show results in a dataframe. feedPressure = 50.0 feedTemperature = 30.0 fluid1 = fluid("cpa") # create a fluid using the SRK-EoS fluid1.addComponent("CO2",1e-10) fluid1.addComponent("methane",1e-10) fluid1.addComponent("ethane",1e-10) fluid1.addComponent("propane",1e-10) fluid1.addComponent("water",1e-10) fluid1.addComponent("TEG",1e-10) fluid1.setMixingRule(10) fluid1.setMultiPhaseCheck(True) fluidcomposition = [0.031, 0.9297, 0.0258, 0.0135, 6.48413454028242e-002, 1.0e-15] fluidComposition(fluid1, fluidcomposition) fluid1.setTemperature(feedTemperature, "C") fluid1.setPressure(feedPressure, "bara") fluid1.setTotalFlowRate(5.0, "MSm3/day")
# -*- coding: utf-8 -*- """ Created on Thu Jun 13 12:01:47 2019 @author: esol """ from neqsim.thermo import fluid from neqsim.process import clearProcess, stream, valve, separator, compressor, runProcess, viewProcess # Start by creating a fluid in neqsim fluid1 = fluid("srk") # create a fluid using the SRK-EoS fluid1.setTemperature(28.15, "C") fluid1.setPressure(100.0, "bara") fluid1.addComponent("nitrogen", 10.0, "mol/sec") fluid1.addComponent("n-heptane", 5.0, "mol/sec") fluid1.addComponent("water", 1.0, "kg/sec") fluid1.setMixingRule(2) fluid1.setMultiPhaseCheck(True) # demonstration of setting up a simple process calculation clearProcess() stream1 = stream(fluid1) inletValve = valve(stream1, 50.0) # add valve and set outlet pressure inletSeparator = separator(inletValve.getOutStream()) oilValve = valve(inletSeparator.getLiquidOutStream(), 1.0) compressor1 = compressor(inletSeparator.getGasOutStream(), 100.0) # add compressor and set out pressure #sensoir to read from Omnia #temperatureTranmitter1 = temperatureTransmitter(stream1, "PT20232") #pressureTranmitter1 = pressureTransmitter(stream1,"TIP2030I")
# -*- coding: utf-8 -*- """ Created on Fri Jun 28 12:49:28 2019 @author: esol """ from neqsim.thermo import fluid from neqsim.process import clearProcess, stream, valve, separator, compressor, runProcess, viewProcess, heater fluid1 = fluid('srk') fluid1.addComponent('water', 2.7) fluid1.addComponent('nitrogen', 0.7) fluid1.addComponent('CO2', 2.1) fluid1.addComponent('methane', 70.0) fluid1.addComponent('ethane', 10.0) fluid1.addComponent('propane', 5.0) fluid1.addComponent('i-butane', 3.0) fluid1.addComponent('n-butane', 2.0) fluid1.addComponent('i-pentane', 1.0) fluid1.addComponent('n-pentane', 1.0) fluid1.addTBPfraction( 'C6', 1.49985, 86.3 / 1000.0, 0.7432 ) #adding oil component mol/ molar mass (kg/mol) / relative density (gr/gr) fluid1.addTBPfraction('C7', 0.49985, 103.3 / 1000.0, 0.76432) fluid1.addTBPfraction('C8', 0.39985, 125.0 / 1000.0, 0.78432) fluid1.addTBPfraction('C9', 0.49985, 145.0 / 1000.0, 0.79432) fluid1.addTBPfraction('C10', 0.149985, 165.0 / 1000.0, 0.81) fluid1.setMixingRule('classic') fluid1.setMultiPhaseCheck(True) fluid1.setTemperature(55.0, 'C')
# -*- coding: utf-8 -*- """ Created on Tue Aug 6 09:45:43 2019 @author: esol """ from neqsim.thermo import fluid, TPflash, phaseenvelope, fluidComposition, ionComposition, scaleCheck fluid1 = fluid( "Electrolyte-CPA-EoS") # create a fluid using the Electrolyte-CPA-EoS fluid1.setTemperature(30.0, "C") fluid1.setPressure(50.0, "bara") fluid1.addComponent("nitrogen", 1.0, "mol/sec") fluid1.addComponent("CO2", 2.3, "mol/sec") fluid1.addComponent("methane", 80.0, "mol/sec") fluid1.addComponent("ethane", 6.0, "mol/sec") fluid1.addComponent("propane", 3.0, "mol/sec") fluid1.addComponent("water", 100.0, "mol/sec") fluid1.addComponent("Na+", 0.500, "mol/sec") fluid1.addComponent("Cl-", 0.500, "mol/sec") fluid1.addComponent("Ca++", 0.117200, "mol/sec") fluid1.addComponent("CO3--", 0.117200, "mol/sec") fluid1.addComponent("Fe++", 10.0e-5, "mol/sec") fluid1.chemicalReactionInit() fluid1.setMixingRule(10) # temperature dependent interaction coefficient #fluid1.setMultiPhaseCheck(True) TPflash(fluid1) fluid1.display()
""" from neqsim.thermo import fluid, hydt, addfluids pressure = 150.0 nitrogen = 1.5 CO2 = 2.5 methane = 95.0 ethane = 5.0 propane = 2.5 ibutane = 1.25 nbutane = 1.25 water = 10.25 fluid1 = fluid('cpa') fluid1.addComponent("nitrogen", nitrogen, 'mol/sec') fluid1.addComponent("CO2", CO2, 'mol/sec') fluid1.addComponent("methane", methane, 'mol/sec') fluid1.addComponent("ethane", ethane, 'mol/sec') fluid1.addComponent("propane", propane, 'mol/sec') fluid1.addComponent("i-butane", ibutane, 'mol/sec') fluid1.addComponent("n-butane", nbutane, 'mol/sec') fluid1.addComponent("water", water, 'mol/sec') fluid1.setMixingRule(10) fluid1.setPressure(pressure, 'bara') fluid2 = fluid('cpa') fluid2.addComponent("oxygen", nitrogen, 'mol/sec') fluid2.setMixingRule(10)
""" from neqsim.thermo import fluid, hydt pressure = 150.0 nitrogen = 1.5 CO2 = 2.5 methane = 95.0 ethane = 5.0 propane = 2.5 ibutane = 1.25 nbutane = 1.25 water = 10.25 fluid1 = fluid('cpa') fluid1.addComponent("nitrogen", nitrogen, 'mol/sec') fluid1.addComponent("CO2", CO2, 'mol/sec') fluid1.addComponent("methane", methane, 'mol/sec') fluid1.addComponent("ethane", ethane, 'mol/sec') fluid1.addComponent("propane", propane, 'mol/sec') fluid1.addComponent("i-butane", ibutane, 'mol/sec') fluid1.addComponent("n-butane", nbutane, 'mol/sec') fluid1.addComponent("water", water, 'mol/sec') fluid1.setMixingRule(10) fluid1.setPressure(pressure, 'bara') hydt(fluid1) print("Hydrate equilibrium temperature ",
# -*- coding: utf-8 -*- """ Created on Wed Jun 3 23:45:38 2020 @author: ESOL """ from neqsim.thermo import fluid, fluid_df, addOilFractions, printFrame, dataFrame, fluidcreator, createfluid, createfluid2, TPflash, phaseenvelope import pandas as pd reservoirfluid = fluid('Electrolyte-CPA-EoS') reservoirfluid.addComponent("H2S", 0.12) reservoirfluid.addComponent("nitrogen", 1.0) reservoirfluid.addComponent("methane", 70.0) reservoirfluid.addComponent("ethane", 4.3) reservoirfluid.addComponent("propane", 1.2) reservoirfluid.addComponent("nC10", 1.2) reservoirfluid.addComponent("water", 5.0, "kg/sec") reservoirfluid.addComponent("Na+", 0.010) reservoirfluid.addComponent("Cl-", 0.01) reservoirfluid.addComponent("OH-", 0.0001) reservoirfluid.chemicalReactionInit() reservoirfluid.setMultiPhaseCheck(True) reservoirfluid.setMixingRule(10) reservoirfluid.setTotalFlowRate(1.0, "MSm3/day") reservoirfluid.setTemperature(55.0, "C") reservoirfluid.setPressure(15.0, "bara") TPflash(reservoirfluid)
from neqsim.thermo import fluid, createfluid, TPflash, printFrame, fluidcreator fluid1 = fluid("srk", 303.15, 35.01325) fluid1.addComponent("nitrogen", 0.0028941) fluid1.addComponent("CO2", 0.054069291) fluid1.addComponent("methane", 0.730570915) fluid1.addComponent("ethane", 0.109004002) fluid1.addComponent("propane", 0.061518891) fluid1.addComponent("n-butane", 0.0164998) fluid1.addComponent("i-butane", 0.006585) fluid1.addComponent("n-pentane", 0.005953) fluid1.addComponent("i-pentane", 0.0040184) fluid1.addTBPfraction("C6", 0.6178399, 86.17801 / 1000.0, 0.6639999) fluid1.addComponent("water", 0.27082) fluid1.createDatabase(True) fluid1.setMixingRule(2) fluid1.setMultiPhaseCheck(True) import time start = time.time() print("start benchmark...") temperature = None pressure = None for lp in range(5000): TPflash(fluid1) end = time.time() print("time ", (end - start), " sec") #printFrame(fluid1)
# -*- coding: utf-8 -*- """ Created on Mon Jan 20 08:16:29 2020 @author: esol """ from neqsim.thermo import fluid, TPflash, phaseenvelope, fluidComposition, fluidCompositionPlus, printFrame fluid1 = fluid('srk', 290.0, 11.0) fluid1.getCharacterization().setLumpingModel("PVTlumpingModel") fluid1.getCharacterization().getLumpingModel().setNumberOfPseudoComponents(12) fluid1.addComponent("water", 0.2) fluid1.addComponent("nitrogen", 0.002) fluid1.addComponent("CO2", 0.005) fluid1.addComponent("methane", 0.4) fluid1.addComponent("ethane", 0.03) fluid1.addComponent("propane", 0.01) fluid1.addComponent("n-butane", 0.002) fluid1.addComponent("i-butane", 0.006) fluid1.addComponent("n-pentane", 0.004) fluid1.addComponent("i-pentane", 0.005) fluid1.addTBPfraction("C6", 0.004, 85.0253 / 1000.0, 0.667229) fluid1.addTBPfraction("C7", 0.001, 90.3717 / 1000.0, 0.7463691) fluid1.addTBPfraction("C8", 0.001, 102.46950 / 1000.0, 0.7709114) fluid1.addTBPfraction("C9", 0.001, 115.6 / 1000.0, 0.7901) fluid1.addPlusFraction("C10", 0.02, 225.5046 / 1000.0, 0.8411014) fluid1.getCharacterization().characterisePlusFraction() fluid1.setMixingRule(2)