diff --git a/example/threephaseseparation.m b/example/threephaseseparation.m new file mode 100644 index 0000000..0aa98dc --- /dev/null +++ b/example/threephaseseparation.m @@ -0,0 +1,65 @@ +%specify defined components +definedcomponents.names = {'water', 'methane', 'ethane', 'propane'} +definedcomponents.composition = [0.02 0.1 0.9 0.05] + +%specify oil components +oilcomponents.names = {'C7', 'C8'} +oilcomponents.composition = [0.10, 0.220] +oilcomponents.molarmass = [0.10, 0.120] +oilcomponents.relativedensity = [0.7, 0.73] +oilcomponents.plusfraction = 1 + +% Create a neqsim fluid based on defined and oil components +fieldFluid = fluid(definedcomponents, oilcomponents); + +%Initializing the process simulation +resetProcessOperations() + +%Create a well stream with the field fluid and set flow, pressure and temperature +fieldWellStream = stream(fieldFluid); +%fieldWellStream.setFlowRate(5.0, 'MSm3/day'); +%fieldWellStream.setTemperature(150.0, 'C'); +%fieldWellStream.setPressure(200.0, 'bara'); + +%Add a three phase separator taking the well stream as input. Set +%separation efficiency +wellStreamSeparator = separator(fieldWellStream); + +% Set fraction of oil and water to be entrained in gas +wellStreamSeparator.setEntrainment(0.01, "", "oil", "gas"); +wellStreamSeparator.setEntrainment(0.01, "", "aqueous", "gas"); +% Set fraction of gas and water to be entrained in oil +wellStreamSeparator.setEntrainment(0.01, "", "gas", "oil"); +wellStreamSeparator.setEntrainment(0.01, "", "aqueous", "oil"); +% Set fraction of gas and oil to be entrained in aqueous +wellStreamSeparator.setEntrainment(0.01, "", "gas", "aqueous"); +wellStreamSeparator.setEntrainment(0.01, "", "oil", "aqueous"); + +% Creating the gas, oil and water streams from the separator +separatedGasStream = stream(wellStreamSeparator.getGasOutStream()); +separatedOilStream = stream(wellStreamSeparator.getOilOutStream()); +separatedAqueousStream = stream(wellStreamSeparator.getWaterOutStream()); + +%running the process +runProcess(); + +deltaT = 10.0; + +% Gas calculations - evaluating effect on density +%reading gas density at separation temperature and pressure +gasDensityAtSeparatorConditions = separatedGasStream.getFluid().getPhase('gas').getDensity('kg/m3'); +gasCompositionAtSeparatorConditions = separatedGasStream.getFluid().getPhase('gas').getComposition('molefraction'); +%To shwo detailed results of the flash calculation, unncomment the follwong commands: +%separatedGasStream.getFluid() +%printfluid(separatedGasStream.getFluid() + +%redusing temperature by a delta T and flash it at constante volume +flash(separatedGasStream.getFluid(), flashtype="TV", (separatedGas.getTemperature()-deltaT), separatedGas.getVolume()) +gasDensityAfterTemperatureReduction = separatedGasStream.getPhase('gas').getFluid().getDensity('kg/m3') +gasCompositionAfterTemperatureReduction = separatedGasStream.getFluid().getPhase('gas').getComposition('molefraction') +pressureAfterTemperatureReduction = separatedGasStream.getFluid().getPressure('bara') +%To shwo detailed results of the flash calculation, unncomment the follwong commands: +%separatedGasStream.getFluid() +%printfluid(separatedGasStream.getFluid() + +%print final results..... \ No newline at end of file diff --git a/ext/NeqSim.jar b/ext/NeqSim.jar index 31b98a7..89d02c9 100644 Binary files a/ext/NeqSim.jar and b/ext/NeqSim.jar differ diff --git a/lib/fluid.m b/lib/fluid.m new file mode 100644 index 0000000..e3651e8 --- /dev/null +++ b/lib/fluid.m @@ -0,0 +1,9 @@ +function fluid = fluid(definedcomponents, oilcomponents) + +unit = 'mole/sec' +fluidClass = neqsim.thermo.Fluid(); +fluid = fluidClass.create2(definedcomponents.names, definedcomponents.composition, unit); +if nargin > 1 + fluid = fluidClass.addOilFractions(oilcomponents.names, oilcomponents.composition ,oilcomponents.molarmass, oilcomponents.relativedensity, oilcomponents.plusfraction); +end +end diff --git a/lib/runProcess.m b/lib/runProcess.m new file mode 100644 index 0000000..203af2b --- /dev/null +++ b/lib/runProcess.m @@ -0,0 +1,11 @@ +function runProcess() +% +% function resetProcessOperations() +% +% DESCRIPTION: +% Wrapper for + +global processOperations + +processOperations.run(); +end \ No newline at end of file