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

chore: removed unused variables, suppressed some warnings #305

Merged
merged 1 commit into from
Feb 8, 2022
Merged
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 @@ -19,7 +19,7 @@ public class newtonRhapson implements java.io.Serializable {
int order;
double[] polyConstants;
double funkVal = 0, derivVal = 0, dubDerivVal = 0;
private int maxIterations = 500, times = 0;
private int maxIterations = 500;
double xNew = 0, xNew2, x = 0;

/**
Expand Down Expand Up @@ -117,8 +117,6 @@ public double dubDerivValue(double x) {
public double solve(double xin) {
int iterations = 0;

times++;

x = xin;
xNew = x;
xNew2 = x;
Expand Down Expand Up @@ -177,8 +175,6 @@ public double solve(double xin) {
public double solve1order(double xin) {
int iterations = 0;

times++;

x = xin;
xNew = x;
xNew2 = x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.util.ArrayList;

import ucar.ma2.Array;
import ucar.nc2.Dimension;
import ucar.nc2.NetcdfFileWriter;
Expand Down Expand Up @@ -101,8 +102,8 @@ public void createFile() {

for (int i = 0; i < yLength; i++) {
lonD.add(ncfile.addDimension(null, yName2[i], yvalues2[i].length));
Variable u =
ncfile.addVariable(null, lonD.get(i).getName(), ucar.ma2.DataType.DOUBLE, dim2);
// Variable u = ncfile.addVariable(null, lonD.get(i).getName(),
// ucar.ma2.DataType.DOUBLE, dim2);
// u.addAttribute(new Attribute("units", "degrees_east"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public OnePhaseFixedStaggeredGrid clone() {
* </p>
*/
public void initProfiles() {
double err = 0, oldPres = 0, oldTemp = 0, dpdx = 0;
double err = 0, oldPres = 0, dpdx = 0;

do {
// pipe.getNode(0).setVelocityIn(pipe.getNode(0).getVelocity());
Expand All @@ -101,7 +101,6 @@ public void initProfiles() {
for (int i = 0; i < numberOfNodes - 1; i++) {
// setting temperatures
pipe.getNode(i).init();
oldTemp = pipe.getNode(i + 1).getBulkSystem().getTemperature();
pipe.getNode(i + 1).getBulkSystem().setTemperature((4.0
* pipe.getNode(i).calcTotalHeatTransferCoefficient(0)
* (pipe.getNode(i).getGeometry().getSurroundingEnvironment()
Expand Down Expand Up @@ -706,7 +705,7 @@ public void initFinalResults() {
public void solveTDMA() {
double d[];
int iter = 0, iterTop = 0;
double maxDiff = 1.0, maxDiffOld = 0;
double maxDiff = 1.0;
double diff = 0;
xNew = new double[pipe.getNode(0).getBulkSystem().getPhases()[0]
.getNumberOfComponents()][numberOfNodes];
Expand All @@ -716,7 +715,6 @@ public void solveTDMA() {
initMatrix();

do {
maxDiffOld = maxDiff;
maxDiff = 0;
iterTop++;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public class PipeWall extends Wall {
* PipeWall.
* </p>
*/
public void PipeWall() {}
public PipeWall() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.ejml.dense.row.factory.DecompositionFactory_DDRM;
import org.ejml.interfaces.decomposition.SingularValueDecomposition;
import org.ejml.interfaces.decomposition.SingularValueDecomposition_F64;

import neqsim.thermo.system.SystemInterface;

/**
Expand Down Expand Up @@ -106,7 +107,7 @@ public GTSurfaceTensionODE(SystemInterface flashedSystem, int phase1, int phase2
this.sys.setNumberOfPhases(1);
this.sys.getPhase(0).setTotalVolume(1.0);
this.sys.useVolumeCorrection(false);
this.sys.removeMoles();
this.sys.setEmptyFluid();
double nv[] = new double[this.ncomp];
for (i = 0; i < ncomp; i++) {
nv[i] = this.rho_ph1[i] * Pa;
Expand Down Expand Up @@ -174,7 +175,7 @@ public void computeDerivatives(double t, double[] y, double[] yDot) {
double[][] jac = new double[this.ncomp][this.ncomp];
double[] rho = new double[this.ncomp];
double delta_omega, dsigma, cij;
double rho_ref, rho0;
double rho0;

DMatrixRMaj df, dn_dnref, ms;
SingularValueDecomposition<DMatrixRMaj> svd;
Expand Down Expand Up @@ -256,15 +257,14 @@ public void computeDerivatives(double t, double[] y, double[] yDot) {
*/
private void solveRho(double[] rho, double[] mu, double[][] dmu_drho, double[] p, double[] f,
double[][] jac) {
double normf, norm0, norm, rho_ref, s;
int i, j, k, iter;
double normf, norm0, norm, s;
int i, j, iter;
DMatrixRMaj A = new DMatrixRMaj(this.ncomp - 1, this.ncomp - 1);
DMatrixRMaj b = new DMatrixRMaj(this.ncomp - 1, 1);
DMatrixRMaj x = new DMatrixRMaj(this.ncomp - 1, 1);
DMatrixRMaj x0 = new DMatrixRMaj(this.ncomp - 1, 1);
DMatrixRMaj c = new DMatrixRMaj(this.ncomp - 1, 1);

rho_ref = rho[this.refcomp];
GTSurfaceTensionUtils.mufun(this.sys, this.ncomp, this.t, rho, mu, dmu_drho, p);
fjacfun(mu, dmu_drho, f, jac);
for (i = 0; i < this.ncomp - 1; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import neqsim.processSimulation.costEstimation.compressor.CompressorCostEstimate;
import neqsim.processSimulation.mechanicalDesign.MechanicalDesign;
import neqsim.processSimulation.mechanicalDesign.designStandards.CompressorDesignStandard;
Expand Down Expand Up @@ -126,10 +128,10 @@ public void calcDesign() {
// double moduleWidth = 0.0, moduleHeight = 0.0, moduleLength = 0.0;
double materialsCost = 0.0;

double molecularWeight =
((Compressor) getProcessEquipment()).getThermoSystem().getMolarMass() * 1000.0;
double flowRate =
((Compressor) getProcessEquipment()).getThermoSystem().getVolume() / 1.0e5;
// double molecularWeight = ((Compressor)
// getProcessEquipment()).getThermoSystem().getMolarMass() * 1000.0;
// double flowRate = ((Compressor)
// getProcessEquipment()).getThermoSystem().getVolume() / 1.0e5;
// double gasDensity = ((Compressor)
// getProcessEquipment()).getThermoSystem().getPhase(0).getPhysicalProperties().getDensity();
// double liqDensity = ((Compressor)
Expand All @@ -147,12 +149,9 @@ public void calcDesign() {
System.out.println("inner Diameter " + innerDiameter);

// alternative design
double bubbleDiameter = 250.0e-6;
double bubVelocity = 1;// 9.82 * Math.pow(bubbleDiameter, 2.0) * (liqDensity - gasDensity) /
// 18.0 /
// liqViscosity;
double Ar = 1.0;// ((Separator)
// getProcessEquipment()).getThermoSystem().getPhase(1).getVolume()
// double bubbleDiameter = 250.0e-6;
// double bubVelocity = 1;// 9.82 * Math.pow(bubbleDiameter, 2.0) * (liqDensity
double Ar = 1.0;// ((Separator) getProcessEquipment()).getThermoSystem().getPhase(1).getVolume()
// / 1e5 / bubVelocity;
double Daim = Math.sqrt(Ar / 4.0);
double Length2 = 4.0 * Daim;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.standards.gasQuality.Standard_ISO6976;
import neqsim.standards.gasQuality.Standard_ISO6976_2016;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.thermo.system.SystemInterface;

/**
Expand Down Expand Up @@ -106,7 +107,6 @@ public void generateLumpedComposition(Characterise charac) {
// int firstPS = charac.getPlusFractionModel().getFirstTBPFractionNumber();
double Maverage = 0.0, denstemp1 = 0.0, denstemp2 = 0.0;
double totalNumberOfMoles = system.getNumberOfMoles();
int numbComp = system.getPhase(0).getNumberOfComponents();
int i = 0;
int added = 0;
if (charac.getPlusFractionModel().hasPlusFraction()) {
Expand Down Expand Up @@ -246,7 +246,6 @@ public void generateLumpedComposition(Characterise charac) {
lumpedComponentNames = new String[numberOfLumpedComponents];
fractionOfHeavyEnd = new double[numberOfLumpedComponents];
double[] zPlus = new double[numberOfLumpedComponents];
double[] zPLus = new double[numberOfLumpedComponents];

for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) {
if ((system.getPhase(0).getComponent(i).isIsTBPfraction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import Jama.Matrix;
import neqsim.thermo.system.SystemInterface;

Expand Down Expand Up @@ -72,7 +73,6 @@ public void setfvec() {
*/
public void setJac() {
Jac.timesEquals(0.0);
double dij = 0.0;

double f0 = 0.0;
for (int i = characterizeClass.getFirstPlusFractionNumber(); i < characterizeClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import Jama.Matrix;
import neqsim.thermo.system.SystemInterface;

Expand Down Expand Up @@ -90,10 +91,8 @@ public void setfvec() {
*/
public void setJac() {
Jac.timesEquals(0.0);
double dij = 0.0;

double tempJ = 0.0, sumdyidbeta = 0, sumdxidbeta = 0;
int nofc = numberOfComponents;
double tempJ = 0.0;

for (int i = 0; i < characterizeClass.getLength(); i++) {
for (int j = 0; j < 4; j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp
* @param mixRule an array of {@link java.lang.String} objects
* @return a double
*/
@SuppressWarnings("unused")
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
double pressure, int phasetype, double[][] WSalpha, double[][] WSgij, double[][] WSgijT,
double[][] intparam, String[][] mixRule) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public ComponentGEUniquacmodifiedHV(String component_name, double moles, double
@Override
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
double pressure, int phasetype) {
double V = 0, F = 0, a, gammaC = 0, gammaR = 0, temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0,
temp5 = 0, gamma;
int j, k;

// PhaseGEInterface phaseny = (PhaseGEInterface) phase.getPhase();
// PhaseGEInterface GEPhase = phaseny.getGEphase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public ComponentGeNRTL(String component_name, double moles, double molesInPhase,

/** {@inheritDoc} */
@Override
@SuppressWarnings("unused")
public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature,
double pressure, int phasetype, double[][] HValpha, double[][] HVgij,
double[][] intparam, String[][] mixRule) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/neqsim/thermo/phase/PhasePrCPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,12 @@ public double calc_lngni(int comp) {
* @return a double
*/
public double calc_lngV() {
double gv = 0.0, gv2 = 0.0;
double gv = 0.0;
gv = -2.0 * getB() * (10.0 * getTotalVolume() - getB()) / getTotalVolume()
/ ((8.0 * getTotalVolume() - getB()) * (4.0 * getTotalVolume() - getB()));

// gv2 = 1.0/(2.0-getB()/(4.0*getTotalVolume()))*getB()/(4.0*Math.pow(getTotalVolume()
// double gv2 =
// 1.0/(2.0-getB()/(4.0*getTotalVolume()))*getB()/(4.0*Math.pow(getTotalVolume()
// ,2.0))
// - 3.0/(1.0-getB()/(4.0*getTotalVolume()))*getB()/(4.0*Math.pow(getTotalVolume() ,2.0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Jamal() {
* @param args the command line arguments
*/
public static void main(String[] args) {
double temperature, x, pressure;
double temperature, x;

for (temperature = 278; temperature <= 500; temperature += 5) {
x = 1e-4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardtFunction;
import neqsim.thermo.phase.PhaseModifiedFurstElectrolyteEos;

Expand Down Expand Up @@ -58,6 +59,7 @@ public double calcTrueValue(double val) {

/** {@inheritDoc} */
@Override
@SuppressWarnings("unused")
public void setFittingParams(int i, double value) {
params[i] = value;
int MDEAplusNumb = 0, MDEANumb = 0, CO2Numb = 0, HCO3numb = 0, Waternumb = 0, CO3numb = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardtFunction;
import neqsim.thermo.mixingRule.HVmixingRuleInterface;
import neqsim.thermo.phase.PhaseEosInterface;
Expand Down Expand Up @@ -337,6 +338,7 @@ public void setFittingParams5(int i, double value) {
* @param i a int
* @param value a double
*/
@SuppressWarnings("unused")
public void setFittingParams3(int i, double value) {
params[i] = value;
int MDEAplusNumb = 0, MDEANumb = 0, CO2Numb = 0, HCO3numb = 0, Waternumb = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardtFunction;
import neqsim.thermo.mixingRule.HVmixingRuleInterface;
import neqsim.thermo.phase.PhaseEosInterface;
Expand Down Expand Up @@ -46,6 +47,7 @@ public double calcTrueValue(double val) {

/** {@inheritDoc} */
@Override
@SuppressWarnings("unused")
public void setFittingParams(int i, double value) {
params[i] = value;
int MDEAplusNumb = 0, MDEANumb = 0, methanenumb = 0, CO2Numb = 0, HCO3numb = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardtFunction;
import neqsim.thermo.phase.PhaseModifiedFurstElectrolyteEos;

Expand Down Expand Up @@ -45,6 +46,7 @@ public double calcTrueValue(double val) {

/** {@inheritDoc} */
@Override
@SuppressWarnings("unused")
public void setFittingParams(int i, double value) {
params[i] = value;
int PiperazineplusNumb = 0, CO2Numb = 0, HCO3numb = 0, Waternumb = 0, PiperazineNumb = 0;
Expand Down Expand Up @@ -355,6 +357,7 @@ public void setFittingParams5(int i, double value) {
* @param i a int
* @param value a double
*/
@SuppressWarnings("unused")
public void setFittingParams3(int i, double value) {
params[i] = value;
int MDEAplusNumb = 0, MDEANumb = 0, CO2Numb = 0, HCO3numb = 0, Waternumb = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import neqsim.thermo.phase.PhaseEosInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

/**
* <p>
Expand Down
Loading