Skip to content

Commit

Permalink
Whitespace style (#955)
Browse files Browse the repository at this point in the history
* style: whitespace and comment fixes
  • Loading branch information
asmfstatoil authored Mar 15, 2024
1 parent e38f402 commit 099a0d9
Show file tree
Hide file tree
Showing 123 changed files with 1,901 additions and 2,010 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static void main(String[] args) {
// satPresSim.getThermoSystem().display();
/*
* double saturationPressure = 350.0; double saturationTemperature = 273.15 + 80;
*
*
* TuningInterface tuning = new TuneToSaturation(satPresSim);
* tuning.setSaturationConditions(saturationTemperature, saturationPressure); tuning.run();
* tuning.getSimulation().getThermoSystem().display();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static void main(String[] args) {
// satPresSim.getThermoSystem().display();
/*
* double saturationPressure = 350.0; double saturationTemperature = 273.15 + 80;
*
*
* TuningInterface tuning = new TuneToSaturation(satPresSim);
* tuning.setSaturationConditions(saturationTemperature, saturationPressure); tuning.run();
* tuning.getSimulation().getThermoSystem().display();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ public double innerStep(int i, double[] n_omega, int check, double step, boolean
* public double step(){ double step=1.0; int i, check=0; double[] F = new double[NSPEC]; double[]
* F_omega = new double[NSPEC]; double[] chem_pot = new double[NSPEC]; double[] n_omega = new
* double[NSPEC];
*
*
* Matrix F_matrix, F_omega_matrix, fs_matrix, f_matrix, f_omega_matrix; double fs,f,f_omega;
*
*
* for(i = 0;i<NSPEC;i++){ n_omega[i] = n_mol[i]+d_n[i]; if (n_omega[i]<0){ check = i; return
* step; } else { if(system.getPhase(phasenumb).getComponents()[components[i].
* getComponentNumber()].getReferenceStateType().equals("solvent")){ F[i] =
Expand All @@ -537,18 +537,18 @@ public double innerStep(int i, double[] n_omega, int check, double step, boolean
* Math.log(n_omega[i]) - Math.log(n_t) + Math.log(activityVec[i]));
* System.out.println("F "+activityVec[i]);
* system.addComponent(components[i].getComponentNumber(), -d_n[i], phasenumb); calcRefPot(); } }
*
*
* F_matrix = new Matrix(F,1); //F_matrix.print(5,5); F_omega_matrix = new Matrix(F_omega,1);
*
*
* //F_matrix = F_matrix.minus((A_Jama_matrix.transpose().times(x_solve.getMatrix(0,NELE-1,0,
* 0))).transpose()); //F_omega_matrix =
* F_omega_matrix.minus((A_Jama_matrix.transpose().times(x_solve.getMatrix(0,
* NELE-1,0,0))).transpose());
*
*
* fs_matrix = F_matrix.transpose().times(F_matrix); fs = (-1)*fs_matrix.get(0,0); f_matrix =
* F_matrix.times(F_matrix.transpose()); f = 0.5*f_matrix.get(0,0); f_omega_matrix =
* F_omega_matrix.times(F_omega_matrix.transpose()); f_omega = 0.5*f_omega_matrix.get(0,0);
*
*
* step = (-1)*fs/(2*(f_omega-f-fs)); //System.out.println("f "+f);
* //System.out.println("f_omega "+f_omega); //System.out.println("fs "+fs);
* //System.out.println("step " + step); //if (step > 0.5) step = 0.5; return step; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,101 +202,89 @@ public void changePrimaryComponents() {
* //System.out.println("Ans"); //Ans.print(10,8); //Print statements added by Neeraj
* System.out.println("lagranges: "); lagrangeTemp.print(10,2); System.out.println("refpot: ");
* mutemp.print(10,2); System.out.println("A: "); atemp.print(10,2);
*
*
*
* Matrix rTemp = new Matrix(atemp.getRowDimension(),1); rTemp.set(0,0,inertMoles/bVector[0]);
* for(int i=1;i<atemp.getRowDimension();i++){ rTemp.set(i,0, bVector[i]/bVector[0]); }
*
*
* // System.out.println("rMatTemp: "); // rTemp.print(10,5);
*
*
*
*
* Matrix zTemp = new Matrix(atemp.getRowDimension(),1); for(int
* i=0;i<atemp.getRowDimension();i++){ //Neeraj -- Source of error //lagrange have very high +ve
* values. So, their exp becomes infinity zTemp.set(i,0, Math.exp(lagrangeTemp.get(i,0))); }
*
*
* System.out.println("zMatTemp: "); //zTemp.print(10,5);
*
*
*
* Matrix phiMatTemp = new Matrix(atemp.getRowDimension(),1);
* //atemp.transpose().solve(mutemp.transpose()); for(int i=0;i<atemp.getRowDimension();i++) {
* phiMatTemp.set(i,0,zTemp.get(i,0)); } for(int i=1;i<atemp.getRowDimension();i++){
* phiMatTemp.set(0,0,phiMatTemp.get(0,0)*Math.pow(phiMatTemp.get(i,0),rTemp.get (i,0))); }
* //System.out.println("phiMatTemp: "); //phiMatTemp.print(10,10);
*
*
*
*
* Matrix betaTemp = atemp.copy(); for(int j=0;j<atemp.getColumnDimension();j++){
* betaTemp.set(0,j,1.0 + rTemp.get(0,0)*atemp.get(0,j)); }
*
*
* for(int i=1;i<atemp.getRowDimension();i++) { for(int j=0;j<atemp.getColumnDimension();j++){
* betaTemp.set(i,j,atemp.get(i,j)-rTemp.get(i,0)*atemp.get(0,j)); } }
*
*
* // System.out.println("betaTemp: "); // betaTemp.print(10,10);
*
*
*
* Matrix alphaTemp = betaTemp.copy(); for(int j=0;j<Amatrix[0].length;j++){
* alphaTemp.set(0,j,atemp.get(0,j)); } // System.out.println("alphaTemp: ");
* alphaTemp.print(10,10);
*
*
*
* do{ double[] fVal = new double[atemp.getRowDimension()]; double[][] dfVal = new
* double[atemp.getRowDimension()][atemp.getRowDimension()];
*
*
* //creates f-vlas
*
*
*
* for(int i=0;i<atemp.getRowDimension();i++) { fVal[i]=0; for(int
* j=0;j<atemp.getColumnDimension();j++){ double phiTemp = 1.0; for(int
* k=0;k<atemp.getRowDimension();k++) { phiTemp =
* phiTemp*Math.pow(phiMatTemp.get(k,0),alphaTemp.get(k,j)); } fVal[i] +=
* betaTemp.get(i,j)*Math.exp(-chemRefPot[j]/(R*system.getPhase(phase).
* getTemperature()))*phiTemp; } // System.out.println("fval: " + fVal[i]); } fVal[0] = fVal[0] -
* 1.0;
*
*
* for(int i=0;i<atemp.getRowDimension();i++){ for(int j=0;j<atemp.getRowDimension();j++) {
* for(int k=0;k<atemp.getColumnDimension();k++){ double phiTemp = 1.0; for(int
* p=0;p<atemp.getRowDimension();p++) { phiTemp =
* phiTemp*Math.pow(phiMatTemp.get(p,0),alphaTemp.get(p,k)); } dfVal[i][j] +=
* betaTemp.get(i,k)*alphaTemp.get(j,k)*Math.exp(-chemRefPot[k]/(R*system.
* getPhase(phase).getTemperature()))*phiTemp; } } }
*
*
*
* // System.out.println("solved: "); Matrix fMatrix = new Matrix(fVal,1); Matrix dfMatrix = new
* Matrix(dfVal); solved = dfMatrix.solve(fMatrix.timesEquals(-1.0).transpose());
*
*
* //fMatrix.print(10,2); //dfMatrix.print(10,2); //System.out.println("solved: ");
* //solved.print(10,6);
*
*
* for(int i=0;i<atemp.getRowDimension();i++) {
* phiMatTemp.set(i,0,Math.exp(solved.get(i,0))*phiMatTemp.get(i,0)); }
* //System.out.println("phiMatTemp: "); //phiMatTemp.print(10,10); }
* while(Math.abs(solved.norm2())>1e-10);
*
*
* double temp=1.0; for(int i=1;i<atemp.getRowDimension();i++) { zTemp.set(i,0,
* phiMatTemp.get(i,0)); temp = temp*Math.pow(zTemp.get(i,0),rTemp.get(i,0)); }
* zTemp.set(0,0,phiMatTemp.get(0,0)/temp);
*
*
* xEts = new double[atemp.getColumnDimension()]; double sum=0; for(int
* k=0;k<atemp.getColumnDimension();k++){ xEts[k] =
* Math.exp(-chemRefPot[k]/(R*system.getPhase(0).getTemperature()));
* //System.out.println("x check1: " + xEts[k]); for(int i=0;i<atemp.getRowDimension();i++) {
* xEts[k] = xEts[k]*Math.pow(zTemp.get(i,0),atemp.get(i,k)); } sum += xEts[k];
* //System.out.println("x check2: " + xEts[k]); } //System.out.println("sum: " + sum);
*
*
* double moles=0; for(int k=0;k<atemp.getColumnDimension();k++){ moles += xEts[k]*atemp.get(0,k);
* } //Print added by Neeraj //System.out.println("mole tot " + moles); moles = 1.0/moles *
* bVector[0];
*
*
*
* double[] nEts = new double[atemp.getColumnDimension()]; double totm=0.0; for(int
* k=0;k<atemp.getColumnDimension();k++){ nEts[k] = xEts[k]*moles;
* //system.getPhases()[1].getNumberOfMolesInPhase(); totm += nEts[k];
* //System.out.println("N check: " + " comp " + components[k].getComponentName() + " " +
* nEts[k]); } //System.out.println("tot moles : " + system.getPhase(1).getNumberOfMolesInPhase()
* + " tot " +totm);
*
*
*
* return nEts; }
*/

Expand Down Expand Up @@ -327,15 +315,11 @@ public void calcx(Matrix atemp, Matrix lagrangeTemp) {
* btemp; Matrix mutemp = new
* Matrix(chemRefPot,1).times(1.0/(R*system.getPhase(phase).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); //atemp.print(5,1); //btemp.print(5,5); //mutemp.print(5,5); ntemp =
* { 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);
* //atemp.print(5,1); //btemp.print(5,5); //mutemp.print(5,5); ntemp =
* atemp.solve(btemp.transpose()); ntemp.print(5,5); for (i=0;i<7;i++) n[i] = ntemp.get(i,0); int
* rank = atemp.rank(); return n;
*
*
* }
* rank = atemp.rank(); return n; }
*/

// Method updated to use Apache Commons Math 3 by Marlene 07.12.18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public ChemicalReaction(String name, String[] names, double[] stocCoefs, double[
double activationEnergy, double refT) {
/*
* this.names = names; this.stocCoefs = stocCoefs; this.K = K;
*
*/
super(name);
this.names = new String[names.length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,20 @@ public static void main(String[] args) {

/*
* double length = 0;
*
*
* double[][] temperatures2 = new double[3][1000]; int k = 0; for (int i = 0; i < 11; i++) {
* length += test.getLengthOfNode(); test.initFlowCalc(); test.calcFluxes(); if (i > 1 && (i %
* 1) == 0) { k++; test.display("length " + length); test.getBulkSystem().display("length " +
* length); test.getInterphaseSystem().display("length " + length);
* //test.getFluidBoundary().display("length " + length); test.setLengthOfNode(0.000005 +
* test.getLengthOfNode() / 2.0); temperatures2[0][k] = length; temperatures2[1][k] =
* test.getGeometry().getTemperature(); test.getFluidBoundary().display("test"); }
*
*
* //test.getBulkSystem().display(); test.update(); test.getFluidBoundary().display("length " +
* length); test.getInterphaseSystem().display("length " + length);
*
*
*
* //test.getFluidBoundary().display("test"); }
*
*
* for (int i = 0; i < k; i++) { System.out.println("len temp " + temperatures2[0][i] + " " +
* temperatures2[1][i]); }
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static void main(String[] args) {
* System.out.println("Starter....."); SystemSrkEos testSystem = new SystemSrkEos(275.3,
* ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new
* ThermodynamicOperations(testSystem); PipeData pipe1 = new PipeData(10.0, 0.025);
*
*
* testSystem.addComponent("methane", 0.011152181, 0); testSystem.addComponent("ethane",
* 0.00011152181, 0); testSystem.addComponent("water", 0.00462204876, 1);
* testSystem.addComponent("methane", 0.061152181, 0); testSystem.addComponent("water",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void initProfiles() {

/*
* do{ err=0; pipe.getNode(0).init(); for(int i = 0;i<numberOfNodes-1;i++){
*
*
* //setting temperatures oldTemp = pipe.getNode(i+1).getBulkSystem().getTemperature(); dpdx =
* (pipe.getNode(i+1).getBulkSystem().getPressure()-pipe.getNode(i).
* getBulkSystem().getPressure())/((pipe.getNode(i+1).getGeometry().
Expand All @@ -170,7 +170,7 @@ public void initProfiles() {
* ).getPhases()[0].getJouleThomsonCoefficient()*dpdx)*(pipe.getNode(i+1).
* getGeometry().getNodeLength()+pipe.getNode(i).getGeometry().getNodeLength())* 0.5 +
* pipe.getNode(i).getBulkSystem().getTemperature()); pipe.getNode(i+1).init();
*
*
* // setting pressures oldPres = pipe.getNode(i+1).getBulkSystem().getPressure();
* pipe.getNode(i+1).getBulkSystem().setPressure(-pipe.getNode(i). getWallFrictionFactor()*
* pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity()*pipe.velocity[i]*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void calcPoints(String name) {
}
/*
* try { System.out.println("points: " + points.length);
*
*
* if (pressurePoint.length > 1) { System.out.println("3D plot "); plot = new
* neqsim.dataPresentation.visAD.visAd3D.visAd3DPlot("title[0]", "title[1]", "title[2]");
* ((neqsim.dataPresentation.visAD.visAd3D.visAd3DPlot) plot).setXYvals(150, 160,
Expand Down Expand Up @@ -138,7 +138,7 @@ public void displayResult(String name) {
}
/*
* try { System.out.println("points: " + points.length);
*
*
* if (pressurePoint.length > 1) { System.out.println("3D plot "); plot = new
* neqsim.dataPresentation.visAD.visAd3D.visAd3DPlot("title[0]", "title[1]", "title[2]");
* ((neqsim.dataPresentation.visAD.visAd3D.visAd3DPlot) plot).setXYvals(150, 160,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void displayResult(String name) {
* file.setYvalues(interfaceTemperaturePoint[0][0], "gas interface temperature", "sec");
* file.setYvalues(interfaceTemperaturePoint[1][0], "liquid interface temperature", "sec");
* file.setYvalues(interphaseContactLength[0][0], "interphase contact length", "sec");
*
*
* for (int p = 0; p < flowNodes[0][0].getNumberOfComponents(); p++) { String comp =
* "component molefraction " + p; file.setYvalues(bulkComposition[0][p][0], ("gas " + comp + p),
* "sec"); file.setYvalues(bulkComposition[1][p][0], ("liquid " + comp + p), "sec");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* method assumes the number of components to be two or more, and that the species set is equal and
* in the same component order for both phases.
*
*
* Near a fluid-fluid interface, we consider the variation of densities of chemical species,
* \f$\boldsymbol{n}(z)\f$, as function of position, \f$z\f$, where element \f$k\f$ of the vector
* \f$\boldsymbol{n}(z)\f$ is the number density of chemical species \f$k\f$ in the mixture. The
Expand Down Expand Up @@ -185,7 +184,6 @@ public static double solveWithRefcomp(SystemInterface system, int interface1, in
* Tolerances for the odesystem.abstol and .reltol should be less than the integrator tolerances
* for stability. Default Newton-Rhapson values are odesystem.normtol = 1e-10; odesystem.reltol
* = 1e-8;
*
*/
odesystem.normtol = 1e-10;
odesystem.reltol = 1e-8;
Expand Down Expand Up @@ -216,7 +214,6 @@ public static double solveWithRefcomp(SystemInterface system, int interface1, in
* results. The boundary conditions are the homogeneous densities of the two fluids in contact, as
* calculated by a flash calculation.
*
*
* We approximate the solution on a equi-spaced grid with \f$2^N+1\f$ points where \f$N\f$ is an
* integer. Using a Finite Difference approximation, the equation for \f$\delta\mu\f$ can then be
* written as an equation system for the internal grid points, \f$i=2,3,...,2^N\f$:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public double calcMixLPViscosity() {
* phase.getPhase().getComponent(i).getx() *
* Math.pow(phase.getPhase().getComponent(i).getMolarMass(), 2.0); Mmtemp +=
* phase.getPhase().getComponent(i).getx() * phase.getPhase().getComponent(i).getMolarMass(); }
*
*
* PCmix = 8.0 * tempPC1 / (tempPC2 * tempPC2); TCmix = tempTC1 / tempTC2; Mmix = (Mmtemp +
* 1.304e-4 * (Math.pow(Mwtemp / Mmtemp, 2.303) - Math.pow(Mmtemp, 2.303))) * 1e3;
* //phase.getPhase().getMolarMass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.logging.log4j.Logger;

/**
* Abstract class for Viscosity property.
*
* @author Even Solbraa
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.apache.logging.log4j.Logger;

/**
* Abstract class Conductivity.
*
* @author Even Solbraa
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import org.apache.logging.log4j.Logger;

/**
*
* * Abstract class for Viscosity property.
*
* @author Even Solbraa
*/
abstract class Viscosity extends
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void calcDesign() {
/*
* Pipeline pipeline = (Pipeline) getProcessEquipment(); double flow = ((AdiabaticPipe)
* getProcessEquipment()).getOutStream().getThermoSystem().getVolume() / 1e5;
*
*
* double innerArea = Math.PI * innerDiameter * innerDiameter / 4.0; double gasVelocity = flow /
* innerArea; double wallThickness = 0.0;
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ default void initMechanicalDesign() {}
* </p>
*
* @return true or false
*
*/
public default boolean needRecalculation() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public static void main(String[] args) {
* double[] surgeflow = new double[] { 453.2, 550.0, 700.0, 800.0 }; double[] surgehead = new
* double[] { 6000.0, 7000.0, 8000.0, 10000.0 };
* comp1.getCompressorChart().getSurgeCurve().setCurve(chartConditions, surgeflow, surgehead);
*
*
* double[] stoneWallflow = new double[] { 923.2, 950.0, 980.0, 1000.0 }; double[] stoneWallHead
* = new double[] { 6000.0, 7000.0, 8000.0, 10000.0 };
* comp1.getCompressorChart().getStoneWallCurve().setCurve(chartConditions, stoneWallflow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public void run(UUID id) {
/*
* HYSYS method double oldPolyt = 10.5; int iter = 0; do {
*
*
* iter++; double n = Math.log(thermoSystem.getPressure() / presinn) /
* Math.log(thermoSystem.getDensity() / densInn); double k =
* Math.log(thermoSystem.getPressure() / presinn) / Math.log(densOutIdeal / densInn); double
Expand All @@ -98,11 +97,9 @@ public void run(UUID id) {
* 1.0); oldPolyt = polytropicEfficiency; polytropicEfficiency = factor *
* isentropicEfficiency; dH = thermoSystem.getEnthalpy() - hinn; hout = hinn + dH /
* polytropicEfficiency; thermoOps.PHflash(hout, 0); System.out.println(" factor " + factor +
* " n " + n + " k " + k + " polytropic effici " + polytropicEfficiency + " iter " + iter);
*
* } while (Math.abs((oldPolyt - polytropicEfficiency) / oldPolyt) > 1e-5 && iter < 500); //
* " n " + n + " k " + k + " polytropic effici " + polytropicEfficiency + " iter " + iter); }
* while (Math.abs((oldPolyt - polytropicEfficiency) / oldPolyt) > 1e-5 && iter < 500); //
* polytropicEfficiency = isentropicEfficiency * ();
*
*/
} else {
getThermoSystem().setPressure(pressure);
Expand Down
Loading

0 comments on commit 099a0d9

Please sign in to comment.