Skip to content

Commit

Permalink
refact: removed warnings (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
fannemel authored Jan 6, 2022
1 parent e9192fc commit f00de64
Show file tree
Hide file tree
Showing 82 changed files with 361 additions and 391 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<version>1.2.2</version>
<configuration>
<updatePomFile>true</updatePomFile>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public TuneToSaturation(SimulationInterface simulation) {
/** {@inheritDoc} */
@Override
public void run() {
double error = 1.0;
// double error = 1.0;
double maxError = 0.01;
int plusNumber = 0;
double plusMolarMass = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,16 @@ public void chemSolve() {
*/
public void updateMoles() {
upMoles++;
double changeMoles = 0.0;
// double changeMoles = 0.0;
for (int i = 0; i < components.length; i++) {
system.addComponent(components[i].getComponentNumber(), (n_mol[i]
- system.getPhase(phasenumb).getComponents()[components[i].getComponentNumber()]
.getNumberOfMolesInPhase()),
phasenumb);
changeMoles += n_mol[i]
- system.getPhase(phasenumb).getComponents()[components[i].getComponentNumber()]
.getNumberOfMolesInPhase();

// changeMoles += n_mol[i] -
// system.getPhase(phasenumb).getComponents()[components[i].getComponentNumber()]
// .getNumberOfMolesInPhase();
}
system.initBeta(); // this was added for mass trans calc
system.init_x_y();
Expand All @@ -268,10 +269,10 @@ public void updateMoles() {
public boolean solve() {
double error = 1e10, errOld = 1e10, thisError = 0;
double p = 1.0;
boolean negN = false;
// boolean negN = false;
double maxError = 1e-8;
upMoles = 0;
double old = 0;
// double old = 0;
try {
do {
p++;
Expand Down Expand Up @@ -308,9 +309,7 @@ public boolean solve() {
}
// Print statement added by Neeraj
// System.out.println("Error " + error);
} // Number of iterations changed to 1000 by Neeraj (initially only 350
// interations were performed)
while (((errOld > maxError && Math.abs(error) > maxError) && p < 350) || p < 2);
} while (((errOld > maxError && Math.abs(error) > maxError) && p < 350) || p < 2);
} catch (Exception e) {
e.printStackTrace();
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class LinearProgrammingChemicalEquilibrium
*/
public LinearProgrammingChemicalEquilibrium() {}

@SuppressWarnings("unchecked")
/**
* <p>
* Constructor for LinearProgrammingChemicalEquilibrium.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void closeDocument() {
*/
public void generatePDF(neqsim.thermo.system.SystemInterface thermoSystem) {
document.addTitle("NeqSim Simulation Report");
String temp = "Temperature " + Double.toString(thermoSystem.getTemperature());
// String temp = "Temperature " + Double.toString(thermoSystem.getTemperature());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public String[][] createTable(String name) {
nf.applyPattern("#.#####E0");

String[][] table = new String[bulkSystem.getPhases()[0].getNumberOfComponents() * 10][5];
String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
// String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
table[0][0] = "";
table[0][1] = "";
table[0][2] = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,10 @@ public double getMolarFlux(int componentNumber) {
/** {@inheritDoc} */
@Override
public void solve() {
double d[];
// double d[];
int iter = 0, iterTop = 0;
double maxDiff = 0, maxDiffOld = 0;
double maxDiff = 0;
// double maxDiffOld = 0;
double diff = 0;
xNew = new double[boundary.getNode(0).getBulkSystem().getPhases()[0]
.getNumberOfComponents()][boundary.getNumberOfNodes()];
Expand All @@ -251,7 +252,7 @@ public void solve() {
" vol " + boundary.getNode(2).getBulkSystem().getPhases()[0].getMolarVolume());

do {
maxDiffOld = maxDiff;
// maxDiffOld = maxDiff;
maxDiff = 0;
iterTop++;
iter = 0;
Expand All @@ -277,6 +278,7 @@ public void solve() {
} while (diff > 1e-15 && iter < 100);

System.out.println("maxDiff " + maxDiff);
} while (Math.abs(maxDiff) > 1e-10 && iterTop < 10);// diffMatrix.norm2()/sol2Matrix.norm2())>0.1);
} while (Math.abs(maxDiff) > 1e-10 && iterTop < 10);
// diffMatrix.norm2()/sol2Matrix.norm2())>0.1);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,13 @@ public void heatTransSolve() {
@Override
public void massTransSolve() {
int iter = 1;
double err = 1.0e10, oldErr = 0.0;
double err = 1.0e10;
// double oldErr = 0.0;
double factor = 10.0;
// if(bulkSystem.isChemicalSystem()) factor=100.0;
setuMassTrans();
do {
oldErr = err;
// oldErr = err;
iter++;
init();
setfvecMassTrans2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public void initFlowCalc() {
phaseFraction[0] -= phaseFraction[0] / step;
}
phaseFraction[1] = 1.0 - phaseFraction[0];
} // while(Math.abs((f-fOld)/f)>1e-8 && iterations<10000);
while (Math.abs(f) > 1e-2 && iterations < 100);
} while (Math.abs(f) > 1e-2 && iterations < 100);
// while(Math.abs((f-fOld)/f)>1e-8 && iterations<10000);

if (iterations == 10000) {
if (iterations == 100) {
System.out.println("error in void init calc");
}
this.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void calcDesign() {
double moduleWidth = 0.0, moduleHeight = 0.0, moduleLength = 0.0;

double materialsCost = 0.0;
double sepLength = 0.0;
// double sepLength = 0.0;

double gasDensity = ((Separator) getProcessEquipment()).getGasOutStream().getThermoSystem()
.getPhase(0).getPhysicalProperties().getDensity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void readDesignSpecifications() {
public void calcDesign() {
super.calcDesign();
SimpleAdsorber separator = (SimpleAdsorber) getProcessEquipment();
double Fg = 1.0;
// double Fg = 1.0;

double emptyVesselWeight = 0.0, internalsWeight = 0.0, externalNozzelsWeight = 0.0;
double pipingWeight = 0.0, structualWeight = 0.0, electricalWeight = 0.0;
Expand All @@ -72,12 +72,12 @@ public void calcDesign() {
double moduleWidth = 0.0, moduleHeight = 0.0, moduleLength = 0.0;

double materialsCost = 0.0;
double sepLength = 0.0;
// double sepLength = 0.0;

double gasDensity = ((SeparatorInterface) getProcessEquipment()).getThermoSystem()
.getPhase(0).getPhysicalProperties().getDensity();
double liqDensity = ((SeparatorInterface) getProcessEquipment()).getThermoSystem()
.getPhase(1).getPhysicalProperties().getDensity();
// double gasDensity = ((SeparatorInterface)
// getProcessEquipment()).getThermoSystem().getPhase(0).getPhysicalProperties().getDensity();
// double liqDensity = ((SeparatorInterface)
// getProcessEquipment()).getThermoSystem().getPhase(1).getPhysicalProperties().getDensity();

// maxDesignVolumeFlow = volumeSafetyFactor * ((Separator)
// getProcessEquipment()).getThermoSystem().getPhase(0).getVolume() / 1e5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class PipelineDesignStandard extends DesignStandard {
public PipelineDesignStandard(String name, MechanicalDesign equipmentInn) {
super(name, equipmentInn);

double wallT = 0;
double maxAllowableStress = equipment.getMaterialDesignStandard().getDivisionClass();
// double wallT = 0;
// double maxAllowableStress = equipment.getMaterialDesignStandard().getDivisionClass();
// double jointEfficiency =
// equipment.getJointEfficiencyStandard().getJEFactor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import neqsim.processSimulation.mechanicalDesign.designStandards.PipelineDesignStandard;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
import neqsim.processSimulation.processEquipment.pipeline.AdiabaticPipe;
import neqsim.processSimulation.processEquipment.pipeline.Pipeline;
import neqsim.processSimulation.processEquipment.stream.Stream;

/**
Expand Down Expand Up @@ -58,17 +57,13 @@ public void readDesignSpecifications() {
@Override
public void calcDesign() {
super.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;
/*
* 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;
*/

// ASME/ANSI Code B31.8
if (designStandardCode.equals("ANSI/ASME Standard B31.8")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ public double calcNTU(double y0, double y1, double yb, double ymix) {
@Override
public void run() {
try {
double y0 = 0.0, y1 = 0.0,
yN = gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx();
double y0 = 0.0, y1 = 0.0;
// double yN = gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx();
double absorptionEffiency = 0.0;
mixedStream.setThermoSystem((streams.get(0).getThermoSystem().clone()));
mixedStream.getThermoSystem().setNumberOfPhases(2);
Expand Down Expand Up @@ -398,20 +398,20 @@ public void run() {
gasInStream.getThermoSystem().getPhase(0).getComponent("water").getx(), yMean));
// System.out.println("NTU " + getNTU());

double Ks = 0.055;
// double Ks = 0.055;
getSolventOutStream().getThermoSystem().initPhysicalProperties();
getGasOutStream().getThermoSystem().initPhysicalProperties();
double vtemp = Ks * Math.sqrt((getSolventOutStream().getThermoSystem().getPhase(0)
.getPhysicalProperties().getDensity()
- getGasOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
.getDensity())
/ getSolventOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
.getDensity());
double d = Math.sqrt(4.0 * getGasOutStream().getMolarRate()
* getGasOutStream().getThermoSystem().getPhase(0).getMolarMass()
/ getGasOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
.getDensity()
/ 3.14 / vtemp);

// double vtemp = Ks * Math.sqrt((getSolventOutStream().getThermoSystem().getPhase(0)
// .getPhysicalProperties().getDensity() -
// getGasOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
// .getDensity()) /
// getSolventOutStream().getThermoSystem().getPhase(0).getPhysicalProperties().getDensity());

// double d = Math.sqrt(4.0 * getGasOutStream().getMolarRate() *
// getGasOutStream().getThermoSystem().getPhase(0).getMolarMass() /
// getGasOutStream().getThermoSystem().getPhase(0).getPhysicalProperties()
// .getDensity()/ 3.14 / vtemp);
// System.out.println("diameter " + d);
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,10 @@ public void run() {
// thermoSystem.getFlowRate("m3/hr")));
}
if (surgeCheck && getAntiSurge().isActive()) {
double surgeFLow =
getCompressorChart().getSurgeCurve().getSurgeFlow(polytropicHead);
double correction = surgeFLow / thermoSystem.getFlowRate("m3/hr");
// double surgeFLow =
// getCompressorChart().getSurgeCurve().getSurgeFlow(polytropicHead);

// double correction = surgeFLow / thermoSystem.getFlowRate("m3/hr");
thermoSystem.setTotalNumberOfMoles(getAntiSurge().getSurgeControlFactor()
* thermoSystem.getTotalNumberOfMoles());
thermoSystem.init(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author ESOL
* @version $Id: $Id
*/
public class Condenser extends neqsim.processSimulation.processEquipment.distillation.SimpleTray {
public class Condenser extends SimpleTray {
private static final long serialVersionUID = 1000;

private double refluxRatio = 0.1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package neqsim.processSimulation.processEquipment.distillation;

import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;

/**
* <p>
* DistillationInterface interface.
Expand All @@ -8,25 +10,7 @@
* @author esol
* @version $Id: $Id
*/
public interface DistillationInterface {
/**
* <p>
* setName.
* </p>
*
* @param name a {@link java.lang.String} object
*/
public void setName(String name);

/**
* <p>
* getName.
* </p>
*
* @return a {@link java.lang.String} object
*/
public String getName();

public interface DistillationInterface extends ProcessEquipmentInterface {
/**
* <p>
* setNumberOfTrays.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public void run() {
ThermodynamicOperations thermoOps = new ThermodynamicOperations(getThermoSystem());
thermoOps = new ThermodynamicOperations(thermoSystem);
thermoSystem.init(3);
double presinn = getThermoSystem().getPressure();
// double presinn = getThermoSystem().getPressure();
double hinn = getThermoSystem().getEnthalpy();
double densInn = getThermoSystem().getDensity();
// double densInn = getThermoSystem().getDensity();
double entropy = getThermoSystem().getEntropy();
inletEnthalpy = hinn;

Expand Down Expand Up @@ -99,7 +99,7 @@ public void run() {

// System.out.println("entropy inn.." + entropy);
thermoOps.PSflash(entropy);
double densOutIdeal = getThermoSystem().getDensity();
// double densOutIdeal = getThermoSystem().getDensity();
if (!powerSet) {
dH = (getThermoSystem().getEnthalpy() - hinn) * isentropicEfficiency;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ public void run() {
testOps = new ThermodynamicOperations(system);
testOps.TPflash();
}
boolean test = false;

// boolean test = false;
do {
iter++;
oldPressure = system.getPressure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public void run() {
// outStreamAir.getFluid().setTemperature(800.0);
// outStreamAir.getFluid().createDatabase(true);
double moleMethane = outStreamAir.getFluid().getComponent("methane").getNumberOfmoles();
double moleEthane = outStreamAir.getFluid().getComponent("ethane").getNumberOfmoles();
double molePropane = outStreamAir.getFluid().getComponent("propane").getNumberOfmoles();
// double moleEthane = outStreamAir.getFluid().getComponent("ethane").getNumberOfmoles();
// double molePropane = outStreamAir.getFluid().getComponent("propane").getNumberOfmoles();

outStreamAir.run();
Heater locHeater = new Heater(outStreamAir);
Expand Down
Loading

0 comments on commit f00de64

Please sign in to comment.