Skip to content

refact: remove warnings #356

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

Merged
merged 3 commits into from
Mar 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 @@ -182,7 +182,7 @@ public void solveTransient(int type) {
if (backCalculate) {
molarBoilOffRate = -molarBoilOffRate;
}
double orginalMolarBoilOff = molarBoilOffRate;
// double orginalMolarBoilOff = molarBoilOffRate;
logger.info("end Volume " + endVolume);
int iterations = 0;
double boilOffCorrection = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,7 @@ public static void main(String[] args) {

// Definerer termodyanmikken5
neqsim.thermo.system.SystemInterface testSystem =
new neqsim.thermo.system.SystemSrkEos(295.3, 5.0); // initierer
// et
// system
// som
// benytter
// SRK
// tilstandsligning
// med trykk 305.3 K og 125 bar
neqsim.thermodynamicOperations.ThermodynamicOperations testOps =
new neqsim.thermodynamicOperations.ThermodynamicOperations(testSystem); // gjor
// termodyanmiske
// Flash
// rutiner
// tilgjengelige
new neqsim.thermo.system.SystemSrkEos(295.3, 5.0);
testSystem.addComponent("methane", 0.11152181, 0);
// testSystem.addComponent("ethane", 0.0011152181, 0);
testSystem.addComponent("water", 0.04962204876, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ public double calcSurfaceTension(int interface1, int interface2) {
for (int i = 0; i < localSystem.getPhase(0).getNumberOfComponents(); i++) {
mu_inter[j][i] = localSystem.getPhase(0).getComponent(i)
.getChemicalPotential(localSystem.getPhase(0));
if (java.lang.Double.isNaN(mu_inter[j][i])) {
double chemicalPotential = localSystem.getPhase(0).getComponent(i)
.getChemicalPotential(localSystem.getPhase(0));
}
/*
* if (java.lang.Double.isNaN(mu_inter[j][i])) { double chemicalPotential =
* localSystem.getPhase(0).getComponent(i)
* .getChemicalPotential(localSystem.getPhase(0)); }
*/

for (int k = 0; k < localSystem.getPhase(0).getNumberOfComponents(); k++) {
dmudn[j][i][k] = localSystem.getPhase(0).getComponent(i)
.getChemicalPotentialdNTV(k, localSystem.getPhase(0));
Expand Down Expand Up @@ -389,7 +391,7 @@ public double[] getPressure() {
* @return a double
*/
public double getInfluenceParameter(double interfaceTension, int componentNumber) {
double startGuess = calcSurfaceTension(0, 1);
// double startGuess = calcSurfaceTension(0, 1);
double oldInfluenceParameter = influenceParam[componentNumber];
double calcVal = 0.0, oldCalcVal = 0.0, dSurfTensdinfluence = 0.0;
int iter = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package neqsim.physicalProperties.interfaceProperties.surfaceTension;

import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.phase.PhaseInterface;
import neqsim.thermo.system.SystemInterface;

Expand Down Expand Up @@ -49,12 +48,10 @@ public static void mufun(SystemInterface sys, int ncomp, double t, double[] rho,
phase.setTotalVolume(v);

for (i = 0; i < ncomp; i++) {
ComponentInterface component;

if (rho[i] < 0.) {
throw new RuntimeException("Number density is negative.");
}
component = phase.getComponent(i);
// ComponentInterface component = phase.getComponent(i);
n = rho[i] * Pa;
nv[i] = n;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ public double getPureComponentViscosity(int i) {
public void initChungPureComponentViscosity() {
double tempVar = 0;
double A = 1.16145, B = 0.14874, C = 0.52487, D = 0.77320, E = 2.16178, F = 2.43787;
double A2 = 1.06036, B2 = 0.15610, C2 = 0.19300, D2 = 0.47635, E2 = 1.03587, F2 = 1.52996,
G2 = 1.76474, H2 = 3.89411;

double chungy = 0, chungG1 = 0, chungG2 = 0, chungviskstartstar = 0, chungviskstar = 0;

for (int i = 0; i < gasPhase.getPhase().getNumberOfComponents(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ public void mixStream() {
/** {@inheritDoc} */
@Override
public void run() {
double enthalpy = 0.0;
for (int k = 0; k < streams.size(); k++) {
streams.get(k).getThermoSystem().init(3);
enthalpy += streams.get(k).getThermoSystem().getEnthalpy();
}

mixedStream.setThermoSystem((streams.get(0).getThermoSystem().clone()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void solve() {
Matrix oldParameters =
new Matrix(sampleSet.getSample(0).getFunction().getFittingParams(), 1).copy();
newParameters = oldParameters.copy().plus(solvedMatrix.transpose());
Matrix diffMat = newParameters.copy().minus(oldParameters);
// Matrix diffMat = newParameters.copy().minus(oldParameters);
this.checkBounds(newParameters);
this.setFittingParameters(newParameters.copy().getArray()[0]);
newChiSquare = calcChiSquare();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package neqsim.thermo.characterization;

import Jama.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import Jama.Matrix;
import neqsim.thermo.system.SystemInterface;
import org.apache.logging.log4j.*;

/**
* <p>
Expand Down Expand Up @@ -92,10 +93,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 j = 0; j < 3; j++) {
double nTot = 0.0, mTot = 0.0, nTot2 = 0.0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package neqsim.thermo.characterization;

import Jama.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import Jama.Matrix;
import neqsim.thermo.system.SystemInterface;
import org.apache.logging.log4j.*;

/**
* <p>
Expand Down Expand Up @@ -64,7 +65,7 @@ public PedersenPlusModelSolver(SystemInterface system,
* </p>
*/
public void setfvecAB() {
double zSum = 0.0, mSum = 0.0, densSum = 0.0;
double zSum = 0.0, mSum = 0.0;
for (int i = characterizeClass.getFirstPlusFractionNumber(); i < characterizeClass
.getLastPlusFractionNumber(); i++) {
double ztemp =
Expand All @@ -88,13 +89,11 @@ public void setfvecAB() {
*/
public void setJacAB() {
JacAB.timesEquals(0.0);
double dij = 0.0;

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

for (int j = 0; j < 2; j++) {
double nTot = 0.0, mTot = 0.0, nTot2 = 0.0;
double nTot = 0.0, nTot2 = 0.0;
for (int i = characterizeClass.getFirstPlusFractionNumber(); i < characterizeClass
.getLastPlusFractionNumber(); i++) {
nTot += Math.exp(characterizeClass.getCoef(0) + characterizeClass.getCoef(1) * i);
Expand All @@ -110,7 +109,7 @@ public void setJacAB() {
}

for (int j = 0; j < 2; j++) {
double mTot1 = 0.0, mTot2 = 0.0, mSum = 0.0, zSum2 = 0.0, zSum = 0.0, zSum3 = 0.0;
double mTot1 = 0.0, mTot2 = 0.0, zSum2 = 0.0, zSum = 0.0, zSum3 = 0.0;
for (int i = characterizeClass.getFirstPlusFractionNumber(); i < characterizeClass
.getLastPlusFractionNumber(); i++) {
mTot1 += (characterizeClass.PVTsimMolarMass[i - 6] / 1000.0)
Expand Down Expand Up @@ -164,14 +163,11 @@ public void setfvecCD() {
public void setJacCD() {
JacCD.timesEquals(0.0);

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

JacCD.set(0, 0, 1);
JacCD.set(0, 1, Math.log(characterizeClass.getFirstPlusFractionNumber() - 1));

double temp = 0.0, temp2 = 0, temp3 = 0;
double deriv = 0;
// double deriv = 0;
for (int i = characterizeClass.getFirstPlusFractionNumber(); i < characterizeClass
.getLastPlusFractionNumber(); i++) {
temp += Math.exp(characterizeClass.getCoef(0) + characterizeClass.getCoef(1) * (i))
Expand All @@ -183,11 +179,12 @@ public void setJacCD() {
* characterizeClass.PVTsimMolarMass[i - 6]
/ Math.pow(characterizeClass.getCoef(2)
+ characterizeClass.getCoef(3) * Math.log(i), 2.0);
deriv += 1.0
/ ((characterizeClass.getCoef(2) + characterizeClass.getCoef(3) * Math.log(i))
* characterizeClass.PVTsimMolarMass[i - 6]
/ Math.pow(characterizeClass.getCoef(2)
+ characterizeClass.getCoef(3) * Math.log(i), 2.0));
/*
* deriv += 1.0 / ((characterizeClass.getCoef(2) + characterizeClass.getCoef(3) *
* Math.log(i)) characterizeClass.PVTsimMolarMass[i - 6] /
* Math.pow(characterizeClass.getCoef(2) + characterizeClass.getCoef(3) * Math.log(i),
* 2.0));
*/
}

double dAdC = temp3 * 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,17 @@ public void setCoefs(double[] coefs) {
firsttime = false;
}

double zSum = 0.0, mSum = 0.0, densSum = 0.0;
double mSum = 0.0, densSum = 0.0;
int iter = 0;
do {
iter++;
zSum = 0.0;
mSum = 0.0;
densSum = 0.0;
for (int i = this.getFirstPlusFractionNumber(); i < this
.getLastPlusFractionNumber(); i++) {
double ztemp = Math.exp(this.getCoef(0) + this.getCoef(1) * (i));
double M = PVTsimMolarMass[i - 6] / 1000.0;
double dens = this.getCoef(2) + this.getCoef(3) * Math.log(i);
zSum += ztemp;
mSum += ztemp * M;
densSum += (ztemp * M / dens);
}
Expand Down Expand Up @@ -232,7 +230,6 @@ public void addCharacterizedPlusFraction() {
}

double meanWeightFrac = weightTot / (numberOfPseudocomponents + 0.000001);
int pluscomp = 0;
zPlus = new double[numberOfPseudocomponents];
MPlus = new double[numberOfPseudocomponents];
int k = 0;
Expand All @@ -253,7 +250,6 @@ public void addCharacterizedPlusFraction() {
// System.out.println("weigth " + weightFrac + " i" + i);
if (weightFrac >= meanWeightFrac || !pseudocomponents
|| i == getLastPlusFractionNumber() - 1) {
pluscomp++;
String name = (i == firstPS) ? "PC" + Integer.toString(firstPS)
: "PC" + Integer.toString(firstPS) + "-" + Integer.toString(i);
system.addTBPfraction(name, totalNumberOfMoles * zPlus[k], Maverage / zPlus[k],
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/neqsim/thermo/component/ComponentHydrate.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,14 @@ public double getEmptyHydrateVapourPressureConstant(int hydrateStructure, int pa
public double calcChemPotEmpty(PhaseInterface phase, int numberOfComps, double temp,
double pres, int hydrateStruct) {
double dGf = 0.0, dHf = 0.0, Cpa = getCpA(), Cpb = getCpB(), Cpc = getCpC(), Cpd = getCpD();
double molarvolume = 1.0 / (55493.0);// *0.9);
double deltaMolarVolume = 0.0;
if (hydrateStruct == 1) {
dGf = getDGfHydrate()[1];
dHf = getDHfHydrate()[1];
molarvolume = getMolarVolumeHydrate(hydrateStruct, temp);
deltaMolarVolume = 5.0e-6;
} else {
dGf = getDGfHydrate()[0];
dHf = getDHfHydrate()[0];
molarvolume = getMolarVolumeHydrate(hydrateStruct, temp);
deltaMolarVolume = 4.6e-6;
}
double T0 = 298.15;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public double fugcoef(PhaseInterface phase, int numberOfComps, double temp, doub
*/
public double dfugdt(PhaseInterface phase, int numberOfComps, double temp, double pres) {
if (componentName.equals("water")) {
double solvol =
1.0 / getPureComponentSolidDensity(getMeltingPointTemperature()) * molarMass;
// double solvol =1.0 / getPureComponentSolidDensity(getMeltingPointTemperature()) *
// molarMass;
dfugdt = Math
.log((getEmptyHydrateStructureVapourPressuredT(hydrateStructure, temp)) / pres);
} else {
Expand Down Expand Up @@ -368,10 +368,10 @@ public double getPot(int intnumb, double radius, int struccture, int cavityType,
*/
public double delt(int intnumb, double n, double radius, int struccture, int cavityType,
PhaseInterface phase) {
double lenjonsenergy = Math.sqrt(this.getLennardJonesEnergyParameter()
* phase.getComponent("water").getLennardJonesEnergyParameter());
double diam = (this.getLennardJonesMolecularDiameter()
+ phase.getComponent("water").getLennardJonesMolecularDiameter()) / 2.0;
// double lenjonsenergy = Math.sqrt(this.getLennardJonesEnergyParameter() *
// phase.getComponent("water").getLennardJonesEnergyParameter());
// double diam = (this.getLennardJonesMolecularDiameter() +
// phase.getComponent("water").getLennardJonesMolecularDiameter()) / 2.0;
double corerad = (this.getSphericalCoreRadius()
+ phase.getComponent("water").getSphericalCoreRadius()) / 2.0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,11 @@ public double calcSolventdiElectricdn(PhaseInterface phase, int numberOfComponen
if (getIonicCharge() != 0) {
return 0.0;
}
double ans2 = 0.0;
for (int i = 0; i < numberOfComponents; i++) {
if (phase.getComponent(i).getIonicCharge() == 0) {
ans2 += phase.getComponent(i).getNumberOfMolesInPhase();
}
}
/*
* double ans2 = 0.0; for (int i = 0; i < numberOfComponents; i++) { if
* (phase.getComponent(i).getIonicCharge() == 0) { ans2 +=
* phase.getComponent(i).getNumberOfMolesInPhase(); } }
*/
return 0.0;
// return getDiElectricConstant(temperature)/ans2 -
// ((PhaseModifiedFurstElectrolyteEosMod2004)
Expand All @@ -411,12 +410,11 @@ public double calcSolventdiElectricdndn(int j, PhaseInterface phase, int numberO
.getIonicCharge() != 0) {
return 0.0;
}
double ans2 = 0.0;
for (int i = 0; i < numberOfComponents; i++) {
if (phase.getComponent(i).getIonicCharge() == 0) {
ans2 += phase.getComponent(i).getNumberOfMolesInPhase();
}
}
/*
* double ans2 = 0.0; for (int i = 0; i < numberOfComponents; i++) { if
* (phase.getComponent(i).getIonicCharge() == 0) { ans2 +=
* phase.getComponent(i).getNumberOfMolesInPhase(); } }
*/
return 0.0;
// return -getDiElectricConstant(temperature)/(ans2*ans2) -
// ((ComponentModifiedFurstElectrolyteEosMod2004)((PhaseModifiedFurstElectrolyteEosMod2004)
Expand All @@ -441,12 +439,11 @@ public double calcSolventdiElectricdndT(PhaseInterface phase, int numberOfCompon
if (getIonicCharge() != 0) {
return 0.0;
}
double ans2 = 0.0;
for (int i = 0; i < numberOfComponents; i++) {
if (phase.getComponent(i).getIonicCharge() == 0) {
ans2 += phase.getComponent(i).getNumberOfMolesInPhase();
}
}
/*
* double ans2 = 0.0; for (int i = 0; i < numberOfComponents; i++) { if
* (phase.getComponent(i).getIonicCharge() == 0) { ans2 +=
* phase.getComponent(i).getNumberOfMolesInPhase(); } }
*/
return 0.0;
// return getDiElectricConstantdT(temperature)/ans2 -
// ((PhaseModifiedFurstElectrolyteEosMod2004)
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ && getComponents()[k].getComponentName().equals("MDEA")) {
this.aij[l][k] = this.aij[k][l];
}
} else {
int templ = l, tempk = k;
// int templ = l, tempk = k;
// database = new util.database.NeqSimDataBase();
java.sql.ResultSet dataSet = database
.getResultSet("SELECT * FROM inter WHERE (comp1='" + component_name
Expand All @@ -82,8 +82,8 @@ && getComponents()[k].getComponentName().equals("MDEA")) {

if (dataSet.getString("comp1").trim()
.equals(getComponents()[l].getComponentName())) {
templ = k;
tempk = l;
// templ = k;
// tempk = l;
}
this.aij[k][l] = Double.parseDouble(dataSet.getString("aijDesMath"));
this.bij[k][l] = Double.parseDouble(dataSet.getString("bijDesMath"));
Expand Down Expand Up @@ -250,8 +250,6 @@ public double getSolventWeight() {
* @return a double
*/
public double getSolventDensity() {
double moles = 0.0;

return 1020.0;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void initQmixdN() {
* @return a double
*/
public double getQmix(String name) {
int test = ((ComponentGEUnifac) componentArray[0]).getUnifacGroups().length;
// int test = ((ComponentGEUnifac) componentArray[0]).getUnifacGroups().length;
for (int i = 0; i < gropuNames.length; i++) {
if (name.equals(gropuNames[i]))
return Qmix[i];
Expand All @@ -160,7 +160,7 @@ public double getQmix(String name) {
* @return an array of {@link double} objects
*/
public double[] getQmixdN(String name) {
int test = ((ComponentGEUnifac) componentArray[0]).getUnifacGroups().length;
// int test = ((ComponentGEUnifac) componentArray[0]).getUnifacGroups().length;
for (int i = 0; i < gropuNames.length; i++) {
if (name.equals(gropuNames[i]))
return QmixdN[i];
Expand Down
Loading