Skip to content

Commit

Permalink
fix: ensure constructors require name
Browse files Browse the repository at this point in the history
docfix
refact: SevereSlugAnalyser
  • Loading branch information
asmfstatoil committed Oct 24, 2024
1 parent 6ada756 commit 75f177a
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,10 @@ public PFCTViscosityMethodMod86(
/** {@inheritDoc} */
@Override
public double calcViscosity() {
double Pc0 = referenceSystem.getPhase(0).getComponent(0).getPC();
double Tc0 = referenceSystem.getPhase(0).getComponent(0).getTC();
double M0 = referenceSystem.getPhase(0).getComponent(0).getMolarMass() * 1e3;
final double Pc0 = referenceSystem.getPhase(0).getComponent(0).getPC();
final double Tc0 = referenceSystem.getPhase(0).getComponent(0).getTC();
final double M0 = referenceSystem.getPhase(0).getComponent(0).getMolarMass() * 1e3;
double PCmix = 0.0;
double TCmix = 0.0;
double Mmix = 0.0;
double alfa0 = 1.0;
double alfaMix = 1.0;
double tempTC1 = 0.0;
double tempTC2 = 0.0;
double tempPC1 = 0.0;
Expand Down Expand Up @@ -97,8 +93,9 @@ public double calcViscosity() {
return 0.0;
}
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();
double TCmix = tempTC1 / tempTC2;
double Mmix =
(Mmtemp + 1.304e-4 * (Math.pow(Mwtemp / Mmtemp, 2.303) - Math.pow(Mmtemp, 2.303))) * 1e3; // phase.getPhase().getMolarMass();

referenceSystem.setTemperature(phase.getPhase().getTemperature()
* referenceSystem.getPhase(0).getComponent(0).getTC() / TCmix);
Expand All @@ -112,8 +109,8 @@ public double calcViscosity() {
double critMolDens = 10.15; // 1.0/referenceSystem.getPhase(0).getComponent(0).getCriticalVolume();
double redDens = molDens / critMolDens;

alfaMix = 1.0 + 7.378e-3 * Math.pow(redDens, 1.847) * Math.pow(Mmix, 0.5173);
alfa0 = 1.0 + 7.378e-3 * Math.pow(redDens, 1.847)
double alfaMix = 1.0 + 7.378e-3 * Math.pow(redDens, 1.847) * Math.pow(Mmix, 0.5173);
double alfa0 = 1.0 + 7.378e-3 * Math.pow(redDens, 1.847)
* Math.pow(referenceSystem.getMolarMass() * 1.0e3, 0.5173);
// alfa0 = 1.0 + 8.374e-4 * Math.pow(redDens, 4.265);
// System.out.println("func " + 7.475e-5*Math.pow(16.043, 0.8579));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ public class HydrateEquilibriumTemperatureAnalyser extends StreamMeasurementDevi

private double referencePressure = 0;

/**
* <p>
* Constructor for HydrateEquilibriumTemperatureAnalyser.
* </p>
*
* @param stream a {@link neqsim.processsimulation.processequipment.stream.StreamInterface} object
*/
public HydrateEquilibriumTemperatureAnalyser(StreamInterface stream) {
this("HydrateEquilibriumTemperatureAnalyser", stream);
}

/**
* <p>
* Constructor for HydrateEquilibriumTemperatureAnalyser.
Expand All @@ -40,7 +29,7 @@ public HydrateEquilibriumTemperatureAnalyser(StreamInterface stream) {
* @param stream a {@link neqsim.processsimulation.processequipment.stream.StreamInterface} object
*/
public HydrateEquilibriumTemperatureAnalyser(String name, StreamInterface stream) {
super("HydrateEquilibriumTemperatureAnalyser", "K", stream);
super(name, "K", stream);
setConditionAnalysisMaxDeviation(1.0);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Create a Pipe Object
package neqsim.processsimulation.measurementdevice.simpleflowregime;

/**
Expand All @@ -10,22 +9,13 @@
* @version $Id: $Id
*/
public class Pipe {
private String name = "Default severe slug pipe";
private String name;
private double internalDiameter = 0.05;
private double leftLength = 167.0;
private double rightLength = 7.7;
private double angle = 2.0;
final double pi = 3.1415926;

// Default Constructor:
Pipe() {
this.setName(name);
this.setInternalDiameter(internalDiameter);
this.setLeftLength(leftLength);
this.setRightLength(rightLength);
this.setAngle(angle);
}

// User Defined pipe parameters including pipe name (constructor):
Pipe(String name, double internalDiameter, double leftLength, double rightLength, double angle) {
this.setName(name);
Expand All @@ -35,14 +25,6 @@ public class Pipe {
this.setAngle(angle);
}

// User Defined pipe parameters excluding pipe name (constructor):
Pipe(double internalDiameter, double leftLength, double rightLength, double angle) {
this.setInternalDiameter(internalDiameter);
this.setLeftLength(leftLength);
this.setRightLength(rightLength);
this.setAngle(angle);
}

// Encapsulation: Get and Set Methods. This keyword referes to the current object
// 1. Pipe name encapsulation
/**
Expand Down Expand Up @@ -153,15 +135,17 @@ public void setAngle(double angle) {
* Getter for the field <code>angle</code>.
* </p>
*
* @param unit a {@link java.lang.String} object
* @return a double
* @param unit Unit
* @return Angle in unit. Defaults to Degree
*/
public double getAngle(String unit) {
if (unit.equals("Degree")) {
return this.angle;
} else if (unit.equals("Radian")) {
return this.angle * pi / 180;
}
return this.angle;
throw new RuntimeException(
new neqsim.util.exception.InvalidInputException(this, "getAngle", "unit"));
}

/**
Expand Down
Loading

0 comments on commit 75f177a

Please sign in to comment.