Skip to content

Commit

Permalink
feat: new function phase.getComponentName
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Jan 6, 2025
1 parent 6d1cf1d commit 6ee6cec
Showing 51 changed files with 201 additions and 161 deletions.
Original file line number Diff line number Diff line change
@@ -178,7 +178,7 @@ public void setReactiveComponents() {
if (name.equals(allComponentNames[i])) {
components[k++] = system.getPhase(phase).getComponent(j);
// System.out.println("reactive comp " +
// system.getPhases()[1].getComponent(j).getName());
// system.getPhases()[1].getComponentName(j));
}
}
}
Original file line number Diff line number Diff line change
@@ -256,7 +256,7 @@ public void initMoleNumbers(PhaseInterface phase, ComponentInterface[] component
for (int i = 0; i < names.length; i++) {
for (int j = 0; j < components.length; j++) {
// System.out.println("names: " + names[i] + " " +
// system.getPhases()[0].getComponent(j).getName());
// system.getPhases()[0].getComponentName(j));
if (this.names[i].equals(components[j].getName())) {
for (int k = 0; k < Amatrix.length; k++) {
tempAmatrix.set(k, i, Amatrix[k][j]);
@@ -317,7 +317,7 @@ public void init(PhaseInterface phase) {
// System.out.println("K: " + Math.exp(lnK));
for (int i = 0; i < names.length; i++) {
for (int j = 0; j < phase.getNumberOfComponents(); j++) {
if (this.names[i].equals(phase.getComponent(j).getName())) {
if (this.names[i].equals(phase.getComponentName(j))) {
moles[i] = phase.getComponent(j).getNumberOfMolesInPhase();
}
}
Original file line number Diff line number Diff line change
@@ -346,10 +346,10 @@ public void calcReacMatrix(PhaseInterface phase) {
while (e.hasNext()) {
reaction = e.next();
for (int j = 0; j < reaction.getNames().length; j++) {
if (phase.getComponent(i).getName().equals(reaction.getNames()[j])) {
if (phase.getComponentName(i).equals(reaction.getNames()[j])) {
for (int k = 0; k < phase.getNumberOfComponents(); k++) {
for (int o = 0; o < reaction.getNames().length; o++) {
if (phase.getComponent(k).getName().equals(reaction.getNames()[o])) {
if (phase.getComponentName(k).equals(reaction.getNames()[o])) {
// System.out.println("comp1 " +
// system.getPhases()[1].getComponent(i).getComponentName() +
// " comp2 "
7 changes: 3 additions & 4 deletions src/main/java/neqsim/fluidmechanics/flownode/FlowNode.java
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import neqsim.fluidmechanics.flownode.fluidboundary.heatmasstransfercalc.FluidBoundaryInterface;
import neqsim.fluidmechanics.flownode.fluidboundary.interphasetransportcoefficient.InterphaseTransportCoefficientBaseClass;
import neqsim.fluidmechanics.flownode.fluidboundary.interphasetransportcoefficient.InterphaseTransportCoefficientInterface;
import neqsim.fluidmechanics.flownode.twophasenode.TwoPhaseFlowNode;
import neqsim.fluidmechanics.geometrydefinitions.GeometryDefinitionInterface;
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
@@ -670,7 +669,7 @@ public String[][] createTable(String name) {
FieldPosition test = new FieldPosition(0);
for (int i = 0; i < bulkSystem.getNumberOfPhases(); i++) {
for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] = bulkSystem.getPhases()[0].getComponent(j).getName();
table[j + 1][0] = bulkSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(bulkSystem.getPhase(bulkSystem.getPhaseIndex(i)).getComponent(j).getx(), buf,
@@ -680,7 +679,7 @@ public String[][] createTable(String name) {

for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][0] =
getInterphaseSystem().getPhases()[0].getComponent(j).getName();
getInterphaseSystem().getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] =
nf.format(getInterphaseSystem().getPhase(getInterphaseSystem().getPhaseIndex(i))
@@ -690,7 +689,7 @@ public String[][] createTable(String name) {

for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][0] =
bulkSystem.getPhases()[0].getComponent(j).getName();
bulkSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] =
nf.format(getFluidBoundary().getInterphaseMolarFlux(j), buf, test).toString();
Original file line number Diff line number Diff line change
@@ -439,8 +439,7 @@ public String[][] createTable(String name) {
FieldPosition test = new FieldPosition(0);
for (int i = 0; i < bulkSystem.getNumberOfPhases(); i++) {
for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] =
"eff. mass trans coef. " + bulkSystem.getPhases()[0].getComponent(j).getName();
table[j + 1][0] = "eff. mass trans coef. " + bulkSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(getEffectiveMassTransferCoefficient(i, j), buf, test).toString();
@@ -450,7 +449,7 @@ public String[][] createTable(String name) {
getEnhancementFactor().calcEnhancementVec(i);
for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][0] =
"enhancement " + getInterphaseSystem().getPhases()[0].getComponent(j).getName();
"enhancement " + getInterphaseSystem().getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] =
nf.format(getEnhancementFactor().getEnhancementVec(j), buf, test).toString();
@@ -460,7 +459,7 @@ public String[][] createTable(String name) {
getBulkSystem().getPhase(i).getPhysicalProperties().calcEffectiveDiffusionCoefficients();
for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][0] =
"schmidt " + bulkSystem.getPhases()[0].getComponent(j).getName();
"schmidt " + bulkSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf.format(
getBulkSystem().getPhase(i).getPhysicalProperties().getEffectiveSchmidtNumber(j), buf,
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ public void calcEnhancementVec(int phaseNum) {
double hatta = 0.0;
for (int j = 0; j < fluidBoundary.getBulkSystem().getPhase(phaseNum)
.getNumberOfComponents(); j++) {
if (fluidBoundary.getBulkSystem().getPhase(phaseNum).getComponent(j).getName().equals("CO2")
if (fluidBoundary.getBulkSystem().getPhase(phaseNum).getComponentName(j).equals("CO2")
&& phaseNum == 1) {
enhancementVec[j] = fluidBoundary.getBulkSystem().getChemicalReactionOperations()
.solveKinetics(phaseNum, fluidBoundary.getInterphaseSystem().getPhase(phaseNum), j);
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ public void createSystem() {
double oldMoles = getThermoSystem().getTotalNumberOfMoles();

for (int i = 0; i < getThermoSystem().getPhase(0).getNumberOfComponents(); i++) {
getThermoSystem().addComponent(getThermoSystem().getPhase(0).getComponent(i).getName(),
getThermoSystem().addComponent(getThermoSystem().getPhase(0).getComponentName(i),
(initialNumberOffMoles - oldMoles)
* getThermoSystem().getPhase(0).getComponent(i).getz());
}
@@ -293,7 +293,7 @@ public void solveTransient(int type, UUID id) {
this.standardISO6976.setReferenceType("volume");

for (int i = 0; i < getThermoSystem().getPhase(0).getNumberOfComponents(); i++) {
getThermoSystem().addComponent(getThermoSystem().getPhase(0).getComponent(i).getName(),
getThermoSystem().addComponent(getThermoSystem().getPhase(0).getComponentName(i),
-xgas[i] * molarBoilOffRate);
}
}
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ public GTSurfaceTensionODE(SystemInterface flashedSystem, int phase1, int phase2
double[] nv = new double[this.ncomp];
for (i = 0; i < ncomp; i++) {
nv[i] = this.rho_ph1[i] * Pa;
// this.sys.addComponent(this.sys.getPhase(0).getComponent(i).getName(),
// this.sys.addComponent(this.sys.getPhase(0).getComponentName(i),
// this.rho_ph1[i]*Pa);
}
this.sys.setMolarComposition(nv);
Original file line number Diff line number Diff line change
@@ -101,9 +101,9 @@ public double calcSurfaceTension(int interface1, int interface2) {
.getChemicalPotential(system.getPhase(interface1));
den_interface[0][i] = 1e5 * system.getPhase(interface1).getComponent(i).getx()
/ system.getPhase(interface1).getMolarVolume();
localSystem.addComponent(localSystem.getPhase(0).getComponent(i).getName(),
localSystem.addComponent(localSystem.getPhase(0).getComponentName(i),
-system.getPhase(0).getComponent(i).getNumberOfmoles());
localSystem.addComponent(localSystem.getPhase(0).getComponent(i).getName(),
localSystem.addComponent(localSystem.getPhase(0).getComponentName(i),
system.getPhase(interface1).getComponent(i).getx()
/ system.getPhase(interface1).getMolarVolume());
}
@@ -201,7 +201,7 @@ public double calcSurfaceTension(int interface1, int interface2) {
for (int i = 0; i < localSystem.getPhase(0).getNumberOfComponents(); i++) {
den_interface[j][i] = den_interface[j - 1][i] + del_den_interface[i];
totalDens += den_interface[j][i];
localSystem.addComponent(localSystem.getPhase(0).getComponent(i).getName(),
localSystem.addComponent(localSystem.getPhase(0).getComponentName(i),
(del_den_interface[i] - del_den_interface_old[i]) / 1.0e5);
del_den_interface_old[i] = del_den_interface[i];
}
@@ -283,8 +283,8 @@ public double calcSurfaceTension(int interface1, int interface2) {
kappai = del_den_interface[i] / del_den_interface[referenceComponentNumber];
mu_times_den[j] += den_interface[j][i] * (mu_inter[j][i] - mu_equi[i]);
for (int k = 0; k < localSystem.getPhase(0).getNumberOfComponents(); k++) {
if ((localSystem.getPhase(0).getComponent(i).getName().equals("water")
|| localSystem.getPhase(0).getComponent(k).getName().equals("water")) && i != k) {
if ((localSystem.getPhase(0).getComponentName(i).equals("water")
|| localSystem.getPhase(0).getComponentName(k).equals("water")) && i != k) {
interact = 0.0;
} else {
interact = 0.0;
Original file line number Diff line number Diff line change
@@ -84,9 +84,9 @@ public double calcSurfaceTension(int interface1, int interface2) {
/ system.getPhase(interface1).getMolarVolume())
/ (ite_step * 1.0);
del_den_interface_old[i] = 0.0;
localSystem.addComponent(localSystem.getPhase(0).getComponent(i).getName(),
localSystem.addComponent(localSystem.getPhase(0).getComponentName(i),
-system.getPhase(0).getComponent(i).getNumberOfmoles());
localSystem.addComponent(localSystem.getPhase(0).getComponent(i).getName(),
localSystem.addComponent(localSystem.getPhase(0).getComponentName(i),
system.getPhase(interface1).getComponent(i).getx()
/ system.getPhase(interface1).getMolarVolume());
}
@@ -116,7 +116,7 @@ public double calcSurfaceTension(int interface1, int interface2) {

for (int i = 0; i < localSystem.getPhase(0).getNumberOfComponents(); i++) {
den_interface[j][i] = den_interface[j - 1][i] + del_den_interface[i];
localSystem.addComponent(localSystem.getPhase(0).getComponent(i).getName(),
localSystem.addComponent(localSystem.getPhase(0).getComponentName(i),
(del_den_interface[i] - del_den_interface_old[i]) / 1.0e5);
del_den_interface_old[i] = del_den_interface[i];
}
@@ -153,10 +153,10 @@ public double calcSurfaceTension(int interface1, int interface2) {

mu_times_den[j] += den_interface[j][i] * (mu_inter[j][i] - mu_equi[i]);
for (int k = 0; k < localSystem.getPhase(0).getNumberOfComponents(); k++) {
if ((localSystem.getPhase(0).getComponent(i).getName().equals("water")
|| localSystem.getPhase(0).getComponent(k).getName().equals("water")) && i != k) {
if ((localSystem.getPhase(0).getComponent(i).getName().equals("MEG")
|| localSystem.getPhase(0).getComponent(k).getName().equals("MEG")) && i != k) {
if ((localSystem.getPhase(0).getComponentName(i).equals("water")
|| localSystem.getPhase(0).getComponentName(k).equals("water")) && i != k) {
if ((localSystem.getPhase(0).getComponentName(i).equals("MEG")
|| localSystem.getPhase(0).getComponentName(k).equals("MEG")) && i != k) {
interact = 0.2;
} else {
interact = 0.35;
Original file line number Diff line number Diff line change
@@ -129,8 +129,7 @@ public void mixStream() {
for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0]
.getNumberOfComponents(); i++) {
boolean gotComponent = false;
String componentName =
streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName();
String componentName = streams.get(k).getThermoSystem().getPhases()[0].getComponentName(i);
// System.out.println("adding: " + componentName);

double moles =
@@ -139,11 +138,11 @@ public void mixStream() {
// mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents());
for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0]
.getNumberOfComponents(); p++) {
if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName()
if (mixedStream.getThermoSystem().getPhases()[0].getComponentName(p)
.equals(componentName)) {
gotComponent = true;
compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
.getComponentName();
compName =
streams.get(0).getThermoSystem().getPhases()[0].getComponent(p).getComponentName();
}
}

@@ -448,7 +447,7 @@ public void displayResult() {

for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) {
for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName();
table[j + 1][0] = thermoSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
Original file line number Diff line number Diff line change
@@ -128,8 +128,7 @@ public void mixStream() {
for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0]
.getNumberOfComponents(); i++) {
boolean gotComponent = false;
String componentName =
streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName();
String componentName = streams.get(k).getThermoSystem().getPhases()[0].getComponentName(i);
// System.out.println("adding: " + componentName);

double moles =
@@ -138,12 +137,12 @@ public void mixStream() {
// mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents());
for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0]
.getNumberOfComponents(); p++) {
if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName()
if (mixedStream.getThermoSystem().getPhases()[0].getComponentName(p)
.equals(componentName)) {
gotComponent = true;

compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
.getComponentName();
compName =
streams.get(0).getThermoSystem().getPhases()[0].getComponent(p).getComponentName();
}
}

@@ -400,7 +399,7 @@ public void displayResult() {

for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) {
for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName();
table[j + 1][0] = thermoSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
Original file line number Diff line number Diff line change
@@ -893,7 +893,7 @@ public void displayResult() {

for (int i = 0; i < getThermoSystem().getNumberOfPhases(); i++) {
for (int j = 0; j < getThermoSystem().getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] = getThermoSystem().getPhases()[0].getComponent(j).getName();
table[j + 1][0] = getThermoSystem().getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] = nf
.format(getThermoSystem().getPhases()[i].getComponent(j).getx(), buf, test).toString();
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ public void displayResult() {

for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) {
for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName();
table[j + 1][0] = thermoSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
8 changes: 3 additions & 5 deletions src/main/java/neqsim/process/equipment/mixer/Mixer.java
Original file line number Diff line number Diff line change
@@ -121,8 +121,7 @@ public void mixStream() {
for (int i = 0; i < streams.get(k).getThermoSystem().getPhase(0)
.getNumberOfComponents(); i++) {
boolean gotComponent = false;
String componentName =
streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getName();
String componentName = streams.get(k).getThermoSystem().getPhase(0).getComponentName(i);
// System.out.println("adding: " + componentName);

double moles =
@@ -131,8 +130,7 @@ public void mixStream() {
// mixedStream.getThermoSystem().getPhase(0).getNumberOfComponents());
for (int p = 0; p < mixedStream.getThermoSystem().getPhase(0)
.getNumberOfComponents(); p++) {
if (mixedStream.getThermoSystem().getPhase(0).getComponent(p).getName()
.equals(componentName)) {
if (mixedStream.getThermoSystem().getPhase(0).getComponentName(p).equals(componentName)) {
gotComponent = true;
index =
streams.get(0).getThermoSystem().getPhase(0).getComponent(p).getComponentNumber();
@@ -283,7 +281,7 @@ public void displayResult() {

for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) {
for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) {
table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName();
table[j + 1][0] = thermoSystem.getPhases()[0].getComponentName(j);
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
Loading

0 comments on commit 6ee6cec

Please sign in to comment.