Skip to content

Commit

Permalink
Merge branch 'master' into checkstyle-config
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Sep 20, 2022
2 parents ac4970e + a2098bc commit 2638ea8
Show file tree
Hide file tree
Showing 20 changed files with 1,031 additions and 1,036 deletions.
260 changes: 130 additions & 130 deletions src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,143 +12,143 @@
* @version $Id: $Id
*/
public class SeparatorTest extends BasePVTsimulation {
double[] temperature = null;
double[] pressure = null;
double[] Sm3gas, m3oil;
private double[] Bofactor;
private double[] GOR = null;
double oilVolumeStdCond = 0;
double[] temperature = null;
double[] pressure = null;
double[] Sm3gas, m3oil;
private double[] Bofactor;
private double[] GOR = null;
double oilVolumeStdCond = 0;

/**
* <p>
* Constructor for SeparatorTest.
* </p>
*
* @param tempSystem a {@link neqsim.thermo.system.SystemInterface} object
*/
public SeparatorTest(SystemInterface tempSystem) {
super(tempSystem);
}
/**
* <p>
* Constructor for SeparatorTest.
* </p>
*
* @param tempSystem a {@link neqsim.thermo.system.SystemInterface} object
*/
public SeparatorTest(SystemInterface tempSystem) {
super(tempSystem);
}

/**
* <p>
* setSeparatorConditions.
* </p>
*
* @param temperature an array of {@link double} objects
* @param pressure an array of {@link double} objects
*/
public void setSeparatorConditions(double[] temperature, double[] pressure) {
this.pressure = pressure;
this.temperature = temperature;
}
/**
* <p>
* setSeparatorConditions.
* </p>
*
* @param temperature an array of {@link double} objects
* @param pressure an array of {@link double} objects
*/
public void setSeparatorConditions(double[] temperature, double[] pressure) {
this.pressure = pressure;
this.temperature = temperature;
}

/**
* <p>
* runCalc.
* </p>
*/
public void runCalc() {
Sm3gas = new double[pressure.length];
m3oil = new double[pressure.length];
GOR = new double[pressure.length];
Bofactor = new double[pressure.length];
for (int i = 0; i < pressure.length; i++) {
thermoOps.setSystem(getThermoSystem());
getThermoSystem().setPressure(pressure[i]);
getThermoSystem().setTemperature(temperature[i]);
thermoOps.TPflash();
if (getThermoSystem().getNumberOfPhases() > 1) {
m3oil[i] = getThermoSystem().getPhase(1).getVolume();
} else {
m3oil[i] = getThermoSystem().getVolume();
}
if (getThermoSystem().getNumberOfPhases() > 1
&& getThermoSystem().getPhase(0).getPhaseTypeName().equals("gas")) {
getThermoSystem().getPhase(0).setPressure(1.01325);
getThermoSystem().getPhase(0).setTemperature(288.15);
getThermoSystem().init(1);
Sm3gas[i] = getThermoSystem().getPhase(0).getVolume();
setThermoSystem(getThermoSystem().phaseToSystem(1));
}
}
getThermoSystem().setPressure(1.01325);
getThermoSystem().setTemperature(288.15);
thermoOps.TPflash();
oilVolumeStdCond = getThermoSystem().getPhase("oil").getVolume();
/**
* <p>
* runCalc.
* </p>
*/
public void runCalc() {
Sm3gas = new double[pressure.length];
m3oil = new double[pressure.length];
GOR = new double[pressure.length];
Bofactor = new double[pressure.length];
for (int i = 0; i < pressure.length; i++) {
thermoOps.setSystem(getThermoSystem());
getThermoSystem().setPressure(pressure[i]);
getThermoSystem().setTemperature(temperature[i]);
thermoOps.TPflash();
if (getThermoSystem().getNumberOfPhases() > 1) {
m3oil[i] = getThermoSystem().getPhase(1).getVolume();
} else {
m3oil[i] = getThermoSystem().getVolume();
}
if (getThermoSystem().getNumberOfPhases() > 1
&& getThermoSystem().getPhase(0).getPhaseTypeName().equals("gas")) {
getThermoSystem().getPhase(0).setPressure(1.01325);
getThermoSystem().getPhase(0).setTemperature(288.15);
getThermoSystem().init(1);
Sm3gas[i] = getThermoSystem().getPhase(0).getVolume();
setThermoSystem(getThermoSystem().phaseToSystem(1));
}
}
getThermoSystem().setPressure(1.01325);
getThermoSystem().setTemperature(288.15);
thermoOps.TPflash();
oilVolumeStdCond = getThermoSystem().getPhase("oil").getVolume();

for (int i = 0; i < pressure.length; i++) {
if (Sm3gas[i] > 1e-10) {
GOR[i] = Sm3gas[i] / oilVolumeStdCond;
Bofactor[i] = m3oil[i] / oilVolumeStdCond;
}
System.out.println("GOR " + getGOR()[i] + " Bo " + Bofactor[i]);
}
for (int i = 0; i < pressure.length; i++) {
if (Sm3gas[i] > 1e-10) {
GOR[i] = Sm3gas[i] / oilVolumeStdCond;
Bofactor[i] = m3oil[i] / oilVolumeStdCond;
}
System.out.println("GOR " + getGOR()[i] + " Bo " + Bofactor[i]);
}
}

/**
* <p>
* main.
* </p>
*
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
SystemInterface tempSystem = new SystemSrkEos(298.0, 300.0);
tempSystem.addComponent("nitrogen", 0.64);
tempSystem.addComponent("CO2", 3.53);
tempSystem.addComponent("methane", 70.78);
tempSystem.addComponent("ethane", 8.94);
tempSystem.addComponent("propane", 5.05);
tempSystem.addComponent("i-butane", 0.85);
tempSystem.addComponent("n-butane", 1.68);
tempSystem.addComponent("i-pentane", 0.62);
tempSystem.addComponent("n-pentane", 0.79);
tempSystem.addComponent("n-hexane", 0.83);
tempSystem.addTBPfraction("C7", 1.06, 92.2 / 1000.0, 0.7324);
tempSystem.addTBPfraction("C8", 1.06, 104.6 / 1000.0, 0.7602);
tempSystem.addTBPfraction("C9", 0.79, 119.1 / 1000.0, 0.7677);
tempSystem.addTBPfraction("C10", 0.57, 133.0 / 1000.0, 0.79);
tempSystem.addTBPfraction("C11", 0.38, 155.0 / 1000.0, 0.795);
tempSystem.addTBPfraction("C12", 0.37, 162.0 / 1000.0, 0.806);
tempSystem.addTBPfraction("C13", 0.32, 177.0 / 1000.0, 0.824);
tempSystem.addTBPfraction("C14", 0.27, 198.0 / 1000.0, 0.835);
tempSystem.addTBPfraction("C15", 0.23, 202.0 / 1000.0, 0.84);
tempSystem.addTBPfraction("C16", 0.19, 215.0 / 1000.0, 0.846);
tempSystem.addTBPfraction("C17", 0.17, 234.0 / 1000.0, 0.84);
tempSystem.addTBPfraction("C18", 0.13, 251.0 / 1000.0, 0.844);
tempSystem.addTBPfraction("C19", 0.13, 270.0 / 1000.0, 0.854);
tempSystem.addPlusFraction("C20", 10.62, 381.0 / 1000.0, 0.88);
tempSystem.getCharacterization().characterisePlusFraction();
tempSystem.createDatabase(true);
tempSystem.setMixingRule(2);
/**
* <p>
* main.
* </p>
*
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String[] args) {
SystemInterface tempSystem = new SystemSrkEos(298.0, 300.0);
tempSystem.addComponent("nitrogen", 0.64);
tempSystem.addComponent("CO2", 3.53);
tempSystem.addComponent("methane", 70.78);
tempSystem.addComponent("ethane", 8.94);
tempSystem.addComponent("propane", 5.05);
tempSystem.addComponent("i-butane", 0.85);
tempSystem.addComponent("n-butane", 1.68);
tempSystem.addComponent("i-pentane", 0.62);
tempSystem.addComponent("n-pentane", 0.79);
tempSystem.addComponent("n-hexane", 0.83);
tempSystem.addTBPfraction("C7", 1.06, 92.2 / 1000.0, 0.7324);
tempSystem.addTBPfraction("C8", 1.06, 104.6 / 1000.0, 0.7602);
tempSystem.addTBPfraction("C9", 0.79, 119.1 / 1000.0, 0.7677);
tempSystem.addTBPfraction("C10", 0.57, 133.0 / 1000.0, 0.79);
tempSystem.addTBPfraction("C11", 0.38, 155.0 / 1000.0, 0.795);
tempSystem.addTBPfraction("C12", 0.37, 162.0 / 1000.0, 0.806);
tempSystem.addTBPfraction("C13", 0.32, 177.0 / 1000.0, 0.824);
tempSystem.addTBPfraction("C14", 0.27, 198.0 / 1000.0, 0.835);
tempSystem.addTBPfraction("C15", 0.23, 202.0 / 1000.0, 0.84);
tempSystem.addTBPfraction("C16", 0.19, 215.0 / 1000.0, 0.846);
tempSystem.addTBPfraction("C17", 0.17, 234.0 / 1000.0, 0.84);
tempSystem.addTBPfraction("C18", 0.13, 251.0 / 1000.0, 0.844);
tempSystem.addTBPfraction("C19", 0.13, 270.0 / 1000.0, 0.854);
tempSystem.addPlusFraction("C20", 10.62, 381.0 / 1000.0, 0.88);
tempSystem.getCharacterization().characterisePlusFraction();
tempSystem.createDatabase(true);
tempSystem.setMixingRule(2);

SeparatorTest sepSim = new SeparatorTest(tempSystem);
double[] temps = {313.15, 313.15, 313.15, 313.15, 313.15, 313.15, 313.15};
double[] pres = {500, 400, 200, 100, 50.0, 5.0, 1.01325};
sepSim.setSeparatorConditions(temps, pres);
sepSim.runCalc();
}
SeparatorTest sepSim = new SeparatorTest(tempSystem);
double[] temps = {313.15, 313.15, 313.15, 313.15, 313.15, 313.15, 313.15};
double[] pres = {500, 400, 200, 100, 50.0, 5.0, 1.01325};
sepSim.setSeparatorConditions(temps, pres);
sepSim.runCalc();
}

/**
* <p>
* getGOR.
* </p>
*
* @return the GOR
*/
public double[] getGOR() {
return GOR;
}
/**
* <p>
* getGOR.
* </p>
*
* @return the GOR
*/
public double[] getGOR() {
return GOR;
}

/**
* <p>
* getBofactor.
* </p>
*
* @return the Bofactor
*/
public double[] getBofactor() {
return Bofactor;
}
/**
* <p>
* getBofactor.
* </p>
*
* @return the Bofactor
*/
public double[] getBofactor() {
return Bofactor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ default public StreamInterface getInStream() {

/**
* Get outlet Stream of twoport.
*
* @deprecated use {@link #getOutletStream()} instead
*
* @return outlet Stream of TwoPortEquipment
* @deprecated use {@link #getOutletStream()} instead
*/
@Deprecated
default public StreamInterface getOutStream() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void initializeModule() {
double tolerance = 1e-2;
HPliquidRecycle.setTolerance(tolerance);
HPliquidRecycle.addStream(gasScrubber.getLiquidOutStream());
inletSeparator.addStream(HPliquidRecycle.getOutStream());
inletSeparator.addStream(HPliquidRecycle.getOutletStream());

Compressor firstStageCompressor =
new Compressor("1st stage compressor", gasScrubber.getGasOutStream());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void initializeModule() {
double tolerance = 1e-10;
HPliquidRecycle.setTolerance(tolerance);
HPliquidRecycle.addStream(gasInletScrubber.getLiquidOutStream());
inletSeparator.addStream(HPliquidRecycle.getOutStream());
inletSeparator.addStream(HPliquidRecycle.getOutletStream());

getOperations().add(inletSeparator);
getOperations().add(liquidOutHeater);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public abstract class StatisticsBaseClass implements Cloneable, StatisticsInterf

protected double xVal[][];
protected double[] expVal;
protected double absDev[];
protected double[] absDev;

protected double reldeviation[];
protected double[] reldeviation;

protected double[] calcVal;
protected String[][] valTable;
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/neqsim/statistics/test.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/neqsim/thermo/system/SystemInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ public default String[][] calcResultTable() {
* method to return exergy in a specified unit.
*
* @param temperatureOfSurroundings in Kelvin
* @return exergy in specified unit
* @param exergyUnit a {@link java.lang.String} object
* @return exergy in specified unit
*/
public double getExergy(double temperatureOfSurroundings, String exergyUnit);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,37 +69,32 @@ public void runTEGProcessTest() {
recycleGasFromStripper.addStream(stripper.getGasOutStream());
recycleGasFromStripper.setOutletStream(gasToReboiler);

Heater coolerPipe = new Heater(column.getGasOutStream());
coolerPipe.setName("heat loss cooling");
Heater coolerPipe = new Heater("heat loss cooling", column.getGasOutStream());
coolerPipe.setOutTemperature(273.15 + 81.0);

Heater coolerRegenGas = new Heater(coolerPipe.getOutStream());
coolerRegenGas.setName("regen gas cooler");
Heater coolerRegenGas = new Heater("regen gas cooler", coolerPipe.getOutletStream());
coolerRegenGas.setOutTemperature(273.15 + 25.0);

Separator sepregenGas = new Separator(coolerRegenGas.getOutStream());
sepregenGas.setName("regen gas separator");
Separator sepregenGas = new Separator("regen gas separator", coolerRegenGas.getOutletStream());

Compressor blower = new Compressor(sepregenGas.getGasOutStream());
Compressor blower = new Compressor("blower", sepregenGas.getGasOutStream());
blower.setOutletPressure(0.2, "barg");

Heater gasHeater = new Heater(blower.getOutStream());
Heater gasHeater = new Heater("heater", blower.getOutletStream());
gasHeater.setOutTemperature(273.15 + 53.0);

Recycle recycleGasfEED = new Recycle("FEED gas recirc");
recycleGasfEED.addStream(gasHeater.getOutStream());
recycleGasfEED.addStream(gasHeater.getOutletStream());
recycleGasfEED.setOutletStream(strippingGas);
recycleGasfEED.setPriority(200);

Heater coolerStripper = new Heater(stripper.getSolventOutStream());
coolerStripper.setName("TEG cooler");
Heater coolerStripper = new Heater("TEG cooler", stripper.getSolventOutStream());
coolerStripper.setOutTemperature(273.15 + 98.0);

Stream liquidToTreatment = new Stream(sepregenGas.getLiquidOutStream());
liquidToTreatment.setName("water to treatment");
Stream liquidToTreatment = new Stream("water to treatment", sepregenGas.getLiquidOutStream());

Mixer TEGWaterMixer = new Mixer("TEG water mixer");
TEGWaterMixer.addStream(coolerStripper.getOutStream());
TEGWaterMixer.addStream(coolerStripper.getOutletStream());
TEGWaterMixer.addStream(liquidToTreatment);

neqsim.processSimulation.processSystem.ProcessSystem operations =
Expand Down
Loading

0 comments on commit 2638ea8

Please sign in to comment.