Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Oct 25, 2024
1 parent 4b8010d commit 02ebee9
Show file tree
Hide file tree
Showing 49 changed files with 194 additions and 287 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package neqsim.fluidmechanics.flownode.fluidboundary.heatmasstransfercalc.nonequilibriumfluidboundary;

import Jama.Matrix;
import neqsim.fluidmechanics.flownode.FlowNodeInterface;
import neqsim.thermo.system.SystemInterface;

import Jama.Matrix;



/**
* <p>
* Abstract NonEquilibriumFluidBoundary class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public void setOnesVec(int phase) {
}
}


/**
* Getter for property hattaNumber.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public double getMeasuredValue(String measurement, String unit) {
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
return Double.NaN;
}
// tempFluid.display();
Expand All @@ -148,7 +148,7 @@ public double getMeasuredValue(String measurement, String unit) {
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
return Double.NaN;
}
// tempFluid.display();
Expand All @@ -166,7 +166,7 @@ public double getMeasuredValue(String measurement, String unit) {
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
return Double.NaN;
}
// tempFluid.display();
Expand All @@ -184,7 +184,7 @@ public double getMeasuredValue(String measurement, String unit) {
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
return Double.NaN;
}
// tempFluid.display();
Expand All @@ -203,7 +203,7 @@ public double getMeasuredValue(String measurement, String unit) {
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
return Double.NaN;
}
tempFluid.initPhysicalProperties();
Expand Down Expand Up @@ -237,7 +237,7 @@ public double getMeasuredValue(String measurement, String unit) {
try {
thermoOps.TPflash();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
return Double.NaN;
}
if (!tempFluid.hasPhaseType("gas")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ public CompressorCurve getCurveAtRefSpeed(double refSpeed) {
}
}
String msg = "Does not match any speed in the chart.";
neqsim.util.exception.InvalidInputException ex =
new neqsim.util.exception.InvalidInputException(this, "getCurveAtRefSpeed", "refSpeed",
msg);
throw new RuntimeException(ex);
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"getCurveAtRefSpeed", "refSpeed", msg));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ public default double getFlowRate(String unit) {
*/
public StreamInterface clone(String name);


/**
* <p>
* flashStream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ public void run(UUID id) {
try {
inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
inStream.getThermoSystem().init(3);
} catch (Exception e) {
logger.error(e.getMessage(), e);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
// inletStream.run(id);

Expand Down Expand Up @@ -572,15 +572,15 @@ public void runTransient(double dt, UUID id) {
inStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
inStream.getThermoSystem().init(1);
inStream.run(id);
} catch (Exception e) {
logger.error(e.getMessage(), e);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
try {
outStream.getThermoSystem().setTotalNumberOfMoles(molarFlow);
outStream.getThermoSystem().init(1);
outStream.run(id);
} catch (Exception e) {
logger.error(e.getMessage(), e);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
setCalculationIdentifier(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ public StreamResponse(StreamInterface inputStream) {
Double.toString(
inputStream.getTVP(37.8, "C", neqsim.util.unit.Units.getSymbol("pressure"))),
neqsim.util.unit.Units.getSymbol("pressure")));
} catch (Exception e) {
logger.error(e.getMessage(), e);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
try {
newdata.put("RVP",
Expand All @@ -220,8 +220,8 @@ public StreamResponse(StreamInterface inputStream) {
newdata.put("relative density", new Value(
Double.toString(inputStream.getFluid().getPhase(name).getDensity("kg/m3") / 1000.0),
"-"));
} catch (Exception e) {
logger.error(e.getMessage(), e);
} catch (Exception ex) {
logger.error(ex.getMessage());
}
} else if (name.equals("gas")) {
Standard_ISO6976 standard = inputStream.getISO6976("volume", 15.0, 15.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,8 @@ public double getValue(String returnParameter) {
} else if (returnParameter.equals("NM")) {
return NM;
} else {
neqsim.util.exception.InvalidInputException ex =
new neqsim.util.exception.InvalidInputException(this, "getValue", "returnParameter",
"parameter not supported");
throw new RuntimeException(ex);
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this, "getValue",
"returnParameter", "parameter not supported"));
}
}

Expand Down
6 changes: 2 additions & 4 deletions src/main/java/neqsim/thermo/atomelement/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ public String[] getElementNames() {
*/
public double getNumberOfElements(String elementName) {
if (nameArray == null) {
neqsim.util.exception.InvalidInputException ex =
new neqsim.util.exception.InvalidInputException(this, "getNumberOfElements", elementName,
"component not in element database..");
throw new RuntimeException(ex);
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"getNumberOfElements", elementName, "component not in element database.."));
}
for (int i = 0; i < nameArray.length; i++) {
if (nameArray[i].equals(elementName)) {
Expand Down
20 changes: 7 additions & 13 deletions src/main/java/neqsim/thermo/characterization/LumpingModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,9 @@ public void generateLumpedComposition(Characterise charac) {
@Override
public double getFractionOfHeavyEnd(int i) {
if (fractionOfHeavyEnd == null) {
neqsim.util.exception.ThermoException ex =
throw new RuntimeException(
new neqsim.util.exception.NotInitializedException(this, "getFractionOfHeavyEnd",
"fractionOfHeavyEnd", "characterisePlusFraction or generateLumpedComposition");
logger.error(ex.getMessage(), ex);
throw new RuntimeException(ex);
"fractionOfHeavyEnd", "characterisePlusFraction or generateLumpedComposition"));
}
return fractionOfHeavyEnd[i];
}
Expand Down Expand Up @@ -312,11 +310,9 @@ public void generateLumpedComposition(Characterise charac) {
@Override
public double getFractionOfHeavyEnd(int i) {
if (fractionOfHeavyEnd == null) {
neqsim.util.exception.ThermoException ex =
throw new RuntimeException(
new neqsim.util.exception.NotInitializedException(this, "getFractionOfHeavyEnd",
"fractionOfHeavyEnd", "characterisePlusFraction or generateLumpedComposition");
logger.error(ex.getMessage(), ex);
throw new RuntimeException(ex);
"fractionOfHeavyEnd", "characterisePlusFraction or generateLumpedComposition"));
}
return fractionOfHeavyEnd[i];
}
Expand Down Expand Up @@ -399,7 +395,7 @@ public void generateLumpedComposition(Characterise charac) {
pseudoNumber++;
String addName = "C" + Integer.toString(starti) + "-" + Integer.toString(i);
getLumpedComponentNames()[k] = addName;
//System.out.println("adding " + addName);
// System.out.println("adding " + addName);
fractionOfHeavyEnd[k] = zPlus[k] / molFracTot;
system.addTBPfraction(addName, totalNumberOfMoles * zPlus[k], Maverage / zPlus[k],
denstemp1 / denstemp2);
Expand All @@ -416,11 +412,9 @@ public void generateLumpedComposition(Characterise charac) {
@Override
public double getFractionOfHeavyEnd(int i) {
if (fractionOfHeavyEnd == null) {
neqsim.util.exception.ThermoException ex =
throw new RuntimeException(
new neqsim.util.exception.NotInitializedException(this, "getFractionOfHeavyEnd",
"fractionOfHeavyEnd", "characterisePlusFraction or generateLumpedComposition");
logger.error(ex.getMessage(), ex);
throw new RuntimeException(ex);
"fractionOfHeavyEnd", "characterisePlusFraction or generateLumpedComposition"));
}
return fractionOfHeavyEnd[i];
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/neqsim/thermo/phase/PhaseGE.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ public PhaseGE() {
public void init(double temperature, double pressure, double totalNumberOfMoles, double beta,
int numberOfComponents, PhaseType pt, int phase) {
if (totalNumberOfMoles <= 0) {
new neqsim.util.exception.InvalidInputException(this, "init", "totalNumberOfMoles",
"must be larger than zero.");
// todo: throw this exception?
/*
* new neqsim.util.exception.InvalidInputException(this, "init", "totalNumberOfMoles",
* "must be larger than zero.");
*/
}
for (int i = 0; i < numberOfComponents; i++) {
// todo: Conflating init type and phase type?
Expand Down
1 change: 0 additions & 1 deletion src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,6 @@ public boolean solveX2(int maxIter) {
}
}


/**
* <p>
* Getter for the field <code>dFdNtemp</code>.
Expand Down
19 changes: 7 additions & 12 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,13 @@ public SystemThermo() {
public SystemThermo(double T, double P, boolean checkForSolids) {
this();
if (T < 0.0) {
neqsim.util.exception.InvalidInputException ex =
new neqsim.util.exception.InvalidInputException(this.getClass().getSimpleName(),
"SystemThermo", "T", "is negative");
throw new RuntimeException(ex);
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"SystemThermo", "T", "is negative"));
}

if (P < 0.0) {
neqsim.util.exception.InvalidInputException ex =
new neqsim.util.exception.InvalidInputException(this.getClass().getSimpleName(),
"SystemThermo", "P", "is negative");
throw new RuntimeException(ex);
throw new RuntimeException(new neqsim.util.exception.InvalidInputException(this,
"SystemThermo", "P", "is negative"));
}

this.solidPhaseCheck = checkForSolids;
Expand Down Expand Up @@ -379,9 +375,8 @@ public void addComponent(String componentName, double moles, int phaseNumber) {
// Add new component
if (moles < 0.0) {
String msg = "Negative input number of moles.";
neqsim.util.exception.InvalidInputException ex =
new neqsim.util.exception.InvalidInputException(this, "addComponent", "moles", msg);
throw new RuntimeException(ex);
throw new RuntimeException(
new neqsim.util.exception.InvalidInputException(this, "addComponent", "moles", msg));
}

componentNames.add(componentName);
Expand Down Expand Up @@ -4918,7 +4913,7 @@ public void setTotalFlowRate(double flowRate, String flowunit) {
try {
init(1);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
logger.error(ex.getMessage());
}
double density = 0.0;
if (flowunit.equals("Am3/hr") || flowunit.equals("Am3/min") || flowunit.equals("gallons/min")
Expand Down
Loading

0 comments on commit 02ebee9

Please sign in to comment.