Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new function phase.getComponentName #1236

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,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));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,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]);
Expand Down Expand Up @@ -318,7 +318,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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,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 "
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/neqsim/fluidmechanics/flownode/FlowNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,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,
Expand All @@ -681,7 +681,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))
Expand All @@ -691,7 +691,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,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();
Expand All @@ -452,7 +451,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();
Expand All @@ -462,7 +461,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,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());
}
Expand Down Expand Up @@ -295,7 +295,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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,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());
}
Expand Down Expand Up @@ -203,7 +203,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];
}
Expand Down Expand Up @@ -285,8 +285,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,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());
}
Expand Down Expand Up @@ -117,7 +117,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];
}
Expand Down Expand Up @@ -154,10 +154,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,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 =
Expand All @@ -141,7 +140,7 @@ 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 =
Expand Down Expand Up @@ -450,7 +449,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,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 =
Expand All @@ -140,7 +139,7 @@ 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;

Expand Down Expand Up @@ -402,7 +401,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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();
Expand Down
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
Expand Up @@ -123,8 +123,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 =
Expand All @@ -133,8 +132,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();
Expand Down Expand Up @@ -285,7 +283,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@ 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 =
streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles();
// System.out.println("moles: " + moles + " " +
// 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;
index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
Expand Down
Loading