Skip to content

Commit

Permalink
Merge branch 'master' into bug--operations-do-not-converge
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil authored Feb 22, 2024
2 parents 5cc77ba + 4a4fc76 commit bac6e2f
Show file tree
Hide file tree
Showing 118 changed files with 1,063 additions and 960 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>${revision}${sha1}${changelist}</version>

<properties>
<revision>2.5.16</revision>
<revision>2.5.17</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1/>
Expand Down Expand Up @@ -39,12 +39,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.22.0</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.22.0</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>org.ojalgo</groupId>
<artifactId>ojalgo</artifactId>
<version>53.1.1</version>
<version>53.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions pomJava21.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>${revision}${sha1}${changelist}</version>

<properties>
<revision>2.5.16</revision>
<revision>2.5.17</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1/>
Expand Down Expand Up @@ -39,12 +39,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.22.0</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.22.0</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
6 changes: 3 additions & 3 deletions pomJava8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>${revision}${sha1}${changelist}-Java8</version>

<properties>
<revision>2.5.16</revision>
<revision>2.5.17</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sha1 />
Expand All @@ -28,12 +28,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.20.0</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
<version>2.22.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,7 @@ public double step() {
double[] n_omega = new double[NSPEC];
double[] chem_pot_omega = new double[NSPEC];
double[] chem_pot = new double[NSPEC];
double G_1;

double G_0;
check = 0;
step = 1;

Expand All @@ -262,8 +260,8 @@ public double step() {
}
}

G_1 = 0;

double G_0;
double G_1 = 0;
for (i = 0; i < NSPEC; i++) {
G_1 += chem_pot_omega[i] * d_n[i];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ public void updateMoles() {
phasenumb);
}


// changeMoles += n_mol[i] -
// system.getPhase(phasenumb).getComponents()[components[i].getComponentNumber()]
// .getNumberOfMolesInPhase();
Expand Down
22 changes: 16 additions & 6 deletions src/main/java/neqsim/fluidMechanics/flowNode/FlowNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,12 @@ public void display(String name) {
JTable Jtab = new JTable(table, names);
JScrollPane scrollpane = new JScrollPane(Jtab);
dialogContentPane.add(scrollpane);
Jtab.setRowHeight(dialog.getHeight() / table.length);
Jtab.setFont(new Font("Serif", Font.PLAIN,
dialog.getHeight() / table.length - dialog.getHeight() / table.length / 10));
// dialog.pack();
if (table.length > 0) {
Jtab.setRowHeight(dialog.getHeight() / table.length);
Jtab.setFont(new Font("Serif", Font.PLAIN,
dialog.getHeight() / table.length - dialog.getHeight() / table.length / 10));
// dialog.pack();
}
dialog.setVisible(true);
}

Expand Down Expand Up @@ -643,11 +645,19 @@ public void setFlowDirection(int flowDirection, int i) {
* @return an array of {@link java.lang.String} objects
*/
public String[][] createTable(String name) {
int rows = 0;
if (bulkSystem == null) {
String[][] table = new String[0][5];
return table;
}

rows = bulkSystem.getPhases()[0].getNumberOfComponents() * 10;
String[][] table = new String[rows][5];

DecimalFormat nf = new DecimalFormat();
nf.setMaximumFractionDigits(5);
nf.applyPattern("#.#####E0");

String[][] table = new String[bulkSystem.getPhases()[0].getNumberOfComponents() * 10][5];
table[0][0] = "";
table[0][1] = "";
table[0][2] = "";
Expand Down Expand Up @@ -689,7 +699,6 @@ public String[][] createTable(String name) {
table[3 * bulkSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[-]";

// Double.longValue(system.getPhase(phaseIndex[i]).getBeta());

buf = new StringBuffer();
table[3 * bulkSystem.getPhases()[0].getNumberOfComponents() + 6][0] = "Velocity";
table[3 * bulkSystem.getPhases()[0].getNumberOfComponents() + 6][i + 1] =
Expand Down Expand Up @@ -739,6 +748,7 @@ public String[][] createTable(String name) {
table[3 * bulkSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name;
table[3 * bulkSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-";
}

return table;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,15 @@ public String[][] createTable(String name) {
nf.setMaximumFractionDigits(5);
nf.applyPattern("#.#####E0");

String[][] table = new String[bulkSystem.getPhases()[0].getNumberOfComponents() * 10][5];
int rows = 0;
if (bulkSystem == null) {
String[][] table = new String[0][5];
return table;
}

rows = bulkSystem.getPhases()[0].getNumberOfComponents() * 10;
String[][] table = new String[rows][5];

// String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
table[0][0] = "";
table[0][1] = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ public double initVelocity() {
/** {@inheritDoc} */
@Override
public void initFlowCalc() {

initVelocity();
init();

Expand Down Expand Up @@ -402,7 +401,9 @@ public void update() {
}

/**
* <p>update.</p>
* <p>
* update.
* </p>
*
* @param deltaTime a double
*/
Expand All @@ -424,6 +425,5 @@ public void update(double deltaTime) {
getBulkSystem().initBeta();
getBulkSystem().init_x_y();
getBulkSystem().initProperties();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public Viscosity clone() {
public double calcViscosity() {
double tempVar = 0;
double tempVar2 = 0;
double viscosity = 0;
this.calcPureComponentViscosity();

// method og Grunberg and Nissan [87]
Expand All @@ -85,7 +84,7 @@ public double calcViscosity() {
// liquidPhase.getPhase().getComponents()[i].getx()*liquidPhase.getPhase().getComponents()[j].getx()*liquidPhase.getMixingRule().getViscosityGij(i,j);
}
}
viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2
double viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2
return viscosity;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public ControllerDeviceBaseClass() {
this("controller");
}


/** {@inheritDoc} */
@Override
public void setActive(boolean isActive) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ public HydrateEquilibriumTemperatureAnalyser(String name, StreamInterface stream
/** {@inheritDoc} */
@Override
public void displayResult() {
try {
// System.out.println("total water production [kg/dag]" +
// stream.getThermoSystem().getPhase(0).getComponent("water").getNumberOfmoles() *
// stream.getThermoSystem().getPhase(0).getComponent("water").getMolarMass()*3600*24);
// System.out.println("water in phase 1 (ppm) " +
// stream.getThermoSystem().getPhase(0).getComponent("water").getx()*1e6);
} finally {
}
/*
* try { // System.out.println("total water production [kg/dag]" + //
* stream.getThermoSystem().getPhase(0).getComponent("water").getNumberOfmoles() * //
* stream.getThermoSystem().getPhase(0).getComponent("water").getMolarMass()*3600*24); //
* System.out.println("water in phase 1 (ppm) " + //
* stream.getThermoSystem().getPhase(0).getComponent("water").getx()*1e6); } finally { }
*/
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class MultiPhaseMeter extends StreamMeasurementDeviceBaseClass {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(MultiPhaseMeter.class);

double pressure = 10.0;
double temperature = 298.15;
double pressure = 1.01325;
double temperature = 288.15;
String unitT;
String unitP;

Expand Down Expand Up @@ -111,15 +111,15 @@ public double getMeasuredValue(String unit) {
*/
public double getMeasuredValue(String measurement, String unit) {
if (measurement.equals("mass rate")) {
return stream.getThermoSystem().getFlowRate(unit);
return stream.getFlowRate(unit);
}

if (stream.getThermoSystem().getFlowRate("kg/hr") < 1e-10) {
if (stream.getFlowRate("kg/hr") < 1e-10) {
return Double.NaN;
}

if (measurement.equals("GOR")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();
SystemInterface tempFluid = stream.getFluid().clone();
tempFluid.setTemperature(temperature, unitT);
tempFluid.setPressure(pressure, unitP);
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
Expand Down Expand Up @@ -231,6 +231,7 @@ public double getMeasuredValue(String measurement, String unit) {
return 0.0;
} else if (measurement.equals("GOR_std")) {
SystemInterface tempFluid = stream.getThermoSystem().clone();

tempFluid.setTemperature(15.0, "C");
tempFluid.setPressure(ThermodynamicConstantsInterface.referencePressure, "bara");
ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid);
Expand All @@ -247,6 +248,21 @@ public double getMeasuredValue(String measurement, String unit) {
return Double.NaN;
}
tempFluid.initPhysicalProperties("density");

double GOR_in_sm3_sm3 = tempFluid.getPhase("gas").getFlowRate("Sm3/hr")
/ tempFluid.getPhase("oil").getFlowRate("m3/hr");
double GOR_via_corrected_volume = tempFluid.getPhase("gas").getCorrectedVolume()
/ tempFluid.getPhase("oil").getCorrectedVolume();

System.out.println("Stream 2 (results inside MPM) " + " GOR sm3/sm3 " + GOR_in_sm3_sm3
+ " GOR Corrected by volume " + GOR_via_corrected_volume);

System.out.println("Stream 2 (results inside MPM) getPhase(gas).getCorrectedVolume() "
+ tempFluid.getPhase("gas").getCorrectedVolume());
System.out.println("Stream 2 (results inside MPM) getPhase(oil).getCorrectedVolume() "
+ tempFluid.getPhase("oil").getCorrectedVolume());

// GOR_via_corrected_volume and GOR_in_sm3_sm3 should not be so different ?
return tempFluid.getPhase("gas").getCorrectedVolume()
/ tempFluid.getPhase("oil").getCorrectedVolume();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class WaterDewPointAnalyser extends StreamMeasurementDeviceBaseClass {
*/
public WaterDewPointAnalyser(StreamInterface stream) {
this("WaterDewPointAnalyser", stream);

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,4 @@ public double getAngle(String unit) {
public double getArea() {
return pi * Math.pow(this.internalDiameter, 2) / 4;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ public double stratifiedHoldUp(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnaly
logger.debug("Could not find solution for stratified flow holdup");
} else {
holdUp = (gamma - 0.5 * Math.sin(2 * gamma)) / (pi);

}
return holdUp;
}
Expand Down Expand Up @@ -754,7 +753,6 @@ public static void main(String[] args) {
// inputStream.setFlowRate(0.00001, "MSm^3/day");
// System.out.println(inputStream.getFlowRate("kg/sec"));
// mySevereSlug4.getPredictedFlowRegime();

}

// To be implemented
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public void setMaterialDesignStandard(MaterialPlateDesignStandard materialDesign
public double moduleLength = 0.0;
public Hashtable<String, DesignStandard> designStandard = new Hashtable<String, DesignStandard>();
public UnitCostEstimateBaseClass costEstimate = null;
double defaultLiquidDensity = 1000.0;
double defaultLiquidViscosity = 0.001012;

/**
* <p>
Expand Down Expand Up @@ -424,7 +426,7 @@ public void setPressureMarginFactor(double pressureMarginFactor) {
* @return a double
*/
public double getOuterDiameter() {
return 1.0; // processEquipment.getInternalDiameter();
return outerDiameter;
}

/**
Expand Down Expand Up @@ -1023,11 +1025,11 @@ public void displayResults() {
Container dialogContentPane = dialog.getContentPane();
dialogContentPane.setLayout(new BorderLayout());

String[] names = {"", "Volume", "Weight"};
String[][] table = new String[3][3]; // createTable(getProcessEquipment().getName());
table[1][0] = getProcessEquipment().getName();
table[1][1] = Double.toString(getWeightTotal());
table[1][2] = Double.toString(getVolumeTotal());
String[] names = {"", "Volume", "Weight"};
JTable Jtab = new JTable(table, names);
JScrollPane scrollpane = new JScrollPane(Jtab);
dialogContentPane.add(scrollpane);
Expand Down Expand Up @@ -1081,6 +1083,22 @@ public UnitCostEstimateBaseClass getCostEstimate() {
return costEstimate;
}

public void setDefaultLiquidDensity(double defaultLiqDens) {
this.defaultLiquidDensity = defaultLiqDens;
}

public double getDefaultLiquidDensity() {
return defaultLiquidDensity;
}

public void setDefaultLiquidViscosity(double defaultLiqVisc) {
this.defaultLiquidViscosity = defaultLiqVisc;
}

public double getDefaultLiquidViscosity() {
return defaultLiquidViscosity;
}

/** {@inheritDoc} */
@Override
public int hashCode() {
Expand Down
Loading

0 comments on commit bac6e2f

Please sign in to comment.