Skip to content

Commit

Permalink
refact: rename phase -> phasenum (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil authored Nov 23, 2024
1 parent 6564c83 commit 4ad8c72
Show file tree
Hide file tree
Showing 111 changed files with 338 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,9 @@ public void setDeltaReactionHeat(double deltaReactionHeat) {
this.deltaReactionHeat = deltaReactionHeat;
}

// public Matrix calcReacRates(int phase){
// // System.out.println(" vol " + system.getPhases()[0].getMolarVolume());
// return getReactionList().calcReacRates(system.getPhase(phase), components);
// public Matrix calcReacRates(int phaseNum){
// // System.out.println(" vol " + system.getPhase()[0].getMolarVolume());
// return getReactionList().calcReacRates(system.getPhase(phaseNum), components);
// }

// /** Setter for property reactionList.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ public class ChemicalEquilibrium implements java.io.Serializable {
* @param b_element an array of type double
* @param system a {@link neqsim.thermo.system.SystemInterface} object
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
* @param phase a int
* @param phaseNum a int
*/
public ChemicalEquilibrium(double[][] A_matrix, double[] b_element, SystemInterface system,
ComponentInterface[] components, int phase) {
ComponentInterface[] components, int phaseNum) {
this.system = system;
phasenumb = phase;
phasenumb = phaseNum;
this.A_matrix = A_matrix;
this.b_element = b_element;
this.components = components;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public class LinearProgrammingChemicalEquilibrium
* @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects
* @param elements an array of {@link java.lang.String} objects
* @param operations a {@link neqsim.chemicalreactions.ChemicalReactionOperations} object
* @param phase a int
* @param phaseNum a int
*/
public LinearProgrammingChemicalEquilibrium(double[] chemRefPot, ComponentInterface[] components,
String[] elements, ChemicalReactionOperations operations, int phase) {
String[] elements, ChemicalReactionOperations operations, int phaseNum) {
this.operations = operations;
this.chemRefPot = chemRefPot;
this.components = components;
Expand All @@ -79,8 +79,8 @@ public LinearProgrammingChemicalEquilibrium(double[] chemRefPot, ComponentInterf
// Commented out by Neeraj
// Arrays.sort(components,new ReferencePotComparator());
// this.changePrimaryComponents();
if (operations.calcChemRefPot(phase) != null) {
System.arraycopy(operations.calcChemRefPot(phase), 0, this.chemRefPot, 0,
if (operations.calcChemRefPot(phaseNum) != null) {
System.arraycopy(operations.calcChemRefPot(phaseNum), 0, this.chemRefPot, 0,
this.chemRefPot.length);
for (int i = 0; i < components.length; i++) {
components[i].setReferencePotential(chemRefPot[i]);
Expand All @@ -90,9 +90,9 @@ public LinearProgrammingChemicalEquilibrium(double[] chemRefPot, ComponentInterf
do {
System.out.println("shifting primary components.....");
this.changePrimaryComponents();
} while (operations.calcChemRefPot(phase) == null);
} while (operations.calcChemRefPot(phaseNum) == null);
// System.out.println("shifting components....." );
System.arraycopy(operations.calcChemRefPot(phase), 0, this.chemRefPot, 0,
System.arraycopy(operations.calcChemRefPot(phaseNum), 0, this.chemRefPot, 0,
this.chemRefPot.length);
for (int i = 0; i < components.length; i++) {
components[i].setReferencePotential(chemRefPot[i]);
Expand Down Expand Up @@ -193,9 +193,9 @@ public void changePrimaryComponents() {
// Method commented out by Neeraj
/*
* public double[] generateInitialEstimates(SystemInterface system, double[] bVector, double
* inertMoles, int phase){ Matrix solved; Matrix atemp = new
* inertMoles, int phaseNum){ Matrix solved; Matrix atemp = new
* Matrix(Amatrix).getMatrix(0,Amatrix.length-1,0,Amatrix[0].length-1).copy(); Matrix mutemp = new
* Matrix(chemRefPot,1).times(1.0/(R*system.getPhase(phase).getTemperature())). copy(); Matrix
* Matrix(chemRefPot,1).times(1.0/(R*system.getPhase(phaseNum).getTemperature())). copy(); Matrix
* lagrangeTemp = atemp.transpose().solve(mutemp.transpose()).copy(); //bmatrix and Ans Added by
* Neeraj //bmatrix = new Matrix(bVector,1); //int rank = atemp.rank();
* //System.out.println("Rank of A "+rank); //Ans = atemp.solve(bmatrix.transpose());
Expand Down Expand Up @@ -311,9 +311,9 @@ public void calcx(Matrix atemp, Matrix lagrangeTemp) {
// Method added by Neeraj
/*
* public double[] generateInitialEstimates(SystemInterface system, double[] bVector, double
* inertMoles, int phase){ int i,j; double[] n = new double[components.length]; Matrix atemp,
* inertMoles, int phaseNum){ int i,j; double[] n = new double[components.length]; Matrix atemp,
* btemp; Matrix mutemp = new
* Matrix(chemRefPot,1).times(1.0/(R*system.getPhase(phase).getTemperature())). copy(); Matrix
* Matrix(chemRefPot,1).times(1.0/(R*system.getPhase(phaseNum).getTemperature())). copy(); Matrix
* ntemp; atemp = new Matrix(7,7); btemp = new Matrix(1,7); //for (i=0;i<4;i++) for (i=0;i<5;i++)
* { for (j=0;j<7;j++) atemp.set(i,j,Amatrix[i][j]); btemp.set(0,i,bVector[i]); }
* atemp.set(5,4,1); atemp.set(6,5,1); //atemp.set(4,4,1); //atemp.set(5,5,1); //atemp.set(6,1,1);
Expand All @@ -331,16 +331,16 @@ public void calcx(Matrix atemp, Matrix lagrangeTemp) {
* @param system a {@link neqsim.thermo.system.SystemInterface} object
* @param bVector an array of type double
* @param inertMoles a double
* @param phase a int
* @param phaseNum a int
* @return an array of type double
*/
public double[] generateInitialEstimates(SystemInterface system, double[] bVector,
double inertMoles, int phase) {
double inertMoles, int phaseNum) {
int i;
int j;
double rhs = 0.0;
Matrix mutemp =
new Matrix(chemRefPot, 1).times(1.0 / (R * system.getPhase(phase).getTemperature())).copy();
Matrix mutemp = new Matrix(chemRefPot, 1)
.times(1.0 / (R * system.getPhase(phaseNum).getTemperature())).copy();
double[] v = new double[components.length + 1];
for (i = 0; i < components.length; i++) {
v[i + 1] = mutemp.get(0, i);
Expand Down Expand Up @@ -369,7 +369,7 @@ public double[] generateInitialEstimates(SystemInterface system, double[] bVecto
return null;
}

int compNumb = system.getPhase(phase).getNumberOfComponents();
int compNumb = system.getPhase(phaseNum).getNumberOfComponents();
double[] lp_solution = new double[compNumb];
double[] temp = optimal.getPoint();
for (i = 0; i < compNumb - (compNumb - components.length); i++) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/neqsim/datapresentation/jfreechart/Graph2b.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -302,6 +303,7 @@ public ChartPanel getChartPanel() {
*
* @param args the command line arguments
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
new Graph2b().setVisible(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -69,6 +70,7 @@ public double[] calcFluxes() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
System.out.println("Starter.....");
SystemSrkEos testSystem = new SystemSrkEos(295.3, 11.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -58,8 +59,10 @@ public void createSystem() {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure);
SystemInterface testSystem =
new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure);
PipeData pipe1 = new PipeData(10.0, 0.025);

testSystem.addComponent("methane", 0.061152181, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -65,6 +66,7 @@ public void createSystem() {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
SystemInterface testSystem =
new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -340,6 +341,7 @@ public void solve() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
System.out.println("Starter.....");
SystemSrkEos testSystem = new SystemSrkEos(295.3, 3.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -119,6 +120,7 @@ public FlowNodeInterface getNextNode() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
SystemInterface testSystem = new SystemSrkEos(273.15 + 40.0, 10.0);
// SystemInterface testSystem = new SystemSrkCPAstatoil(275.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -71,6 +72,7 @@ public double calcReynoldsNumber() {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
System.out.println("Starter.....");
SystemSrkEos testSystem = new SystemSrkEos(300.3, 200.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -123,6 +124,7 @@ public FlowNodeInterface getNextNode() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
System.out.println("Starter.....");
String fileName = "c:/labsim/exp-heat.txt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import neqsim.fluidmechanics.geometrydefinitions.pipe.PipeData;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -150,6 +151,7 @@ public FlowNodeInterface getNextNode() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
SystemInterface testSystem =
new neqsim.thermo.system.SystemSrkSchwartzentruberEos(295.3, 50.01325);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -232,6 +233,7 @@ public static void mainOld(String[] args) {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 5.0, 10.0e-3);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import neqsim.fluidmechanics.geometrydefinitions.pipe.PipeData;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -122,6 +123,7 @@ public FlowNodeInterface getNextNode() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
// SystemInterface testSystem = new SystemSrkEos(273.15 + 11.0, 60.0);
SystemInterface testSystem = new neqsim.thermo.system.SystemSrkCPAstatoil(325.3, 100.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -216,6 +217,7 @@ public void update() {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
SystemInterface testSystem = new SystemFurstElectrolyteEos(313.315, 50.01325);
// SystemInterface testSystem = new SystemSrkEos(295.3, 100.01325);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import neqsim.thermo.system.SystemFurstElectrolyteEos;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -127,6 +128,7 @@ public FlowNodeInterface getNextNode() {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
/*
* System.out.println("Starter....."); SystemSrkEos testSystem = new SystemSrkEos(275.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkCPAstatoil;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -225,6 +226,7 @@ public void setDt(double dt) {
* @param args an array of {@link java.lang.String} objects
*/
@SuppressWarnings("unused")
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
// SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3,
// ThermodynamicConstantsInterface.referencePressure);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,13 @@ public void initTemperature(int phaseNum) {
* initPhaseFraction.
* </p>
*
* @param phase a int
* @param phaseNum a int
*/
public void initPhaseFraction(int phase) {
public void initPhaseFraction(int phaseNum) {
for (int i = 0; i < numberOfNodes; i++) {
pipe.getNode(i).setPhaseFraction(phase,
pipe.getNode(i).getPhaseFraction(phase) + 0.8 * diffMatrix.get(i, 0));
pipe.getNode(i).setPhaseFraction(0, 1.0 - pipe.getNode(i).getPhaseFraction(phase));
pipe.getNode(i).setPhaseFraction(phaseNum,
pipe.getNode(i).getPhaseFraction(phaseNum) + 0.8 * diffMatrix.get(i, 0));
pipe.getNode(i).setPhaseFraction(0, 1.0 - pipe.getNode(i).getPhaseFraction(phaseNum));
pipe.getNode(i).init();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicoperations.ThermodynamicOperations;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -404,6 +405,7 @@ public String[][] getResults(String name) {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
// thermo.system.SystemInterface testSystem = new
// thermo.system.SystemGERG2004Eos(273.15 - 161.4, 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.UUID;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.ExcludeFromJacocoGeneratedReport;

/**
* <p>
Expand Down Expand Up @@ -105,6 +106,7 @@ public void solveTransient(int solverType, UUID id) {
*
* @param args an array of {@link java.lang.String} objects
*/
@ExcludeFromJacocoGeneratedReport
public static void main(String[] args) {
// Initierer et nyt rorsystem
neqsim.fluidmechanics.flowsystem.FlowSystemInterface pipe = new StirredCellSystem();
Expand Down
Loading

0 comments on commit 4ad8c72

Please sign in to comment.