Skip to content

AddedSevereSlug #560

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 9 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
@@ -0,0 +1,84 @@
package neqsim.processSimulation.measurementDevice.simpleFlowRegime;

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

public class FluidSevereSlug {

private double liqDensity = 1000.0;
private double liqVisc = 0.001;
private double molecularWeight = 0.029;
private double gasConstant = 8314 / molecularWeight*1000;

private double oilDensity = 0;
private double waterDensity = 0;
private double waterWtFraction = 0;


private double oilViscosity = 0;
private double waterViscosity = 0;
private double oilWtFraction = 0;

private int phaseNumber;

FluidSevereSlug(SystemInterface fluid){
ThermodynamicOperations ops = new ThermodynamicOperations(fluid);
ops.TPflash();
fluid.initProperties();
if ((fluid.getNumberOfPhases())<2){
System.out.println("There is only one phase");
}
if (fluid.hasPhaseType("oil")){
phaseNumber = fluid.getPhaseNumberOfPhase("oil");
oilDensity = fluid.getPhase("oil").getDensity("kg/m3");
oilViscosity = fluid.getPhase("oil").getViscosity("kg/msec");
oilWtFraction = fluid.getWtFraction(phaseNumber) * 100;
}
if (fluid.hasPhaseType("aqueous")){
phaseNumber = fluid.getPhaseNumberOfPhase("aqueous");
waterDensity = fluid.getPhase("aqueous").getDensity("kg/m3");
waterViscosity = fluid.getPhase("aqueous").getViscosity("kg/msec");
waterWtFraction = fluid.getWtFraction(phaseNumber) * 100;
}

this.liqDensity = waterWtFraction*waterDensity + oilWtFraction*oilDensity;
this.liqVisc = waterWtFraction*waterViscosity + oilWtFraction*oilViscosity;
this.molecularWeight = fluid.getPhase("gas").getMolarMass();
}

FluidSevereSlug(double liqDensity, double liqVisc, double molecularWeight){
this.setLiqDensity(liqDensity);
this.setLiqVisc(liqVisc);
this.setMolecularWeight(molecularWeight);
this.gasConstant = 8314/(molecularWeight*1000);
}

public void setLiqDensity(double liqDensity) {
this.liqDensity = liqDensity;
}

public double getLiqDensity() {
return liqDensity;
}

public void setLiqVisc(double liqVisc) {
this.liqVisc = liqVisc;
}

public double getliqVisc() {
return liqVisc;
}

public void setMolecularWeight(double molecularWeight) {
this.molecularWeight = molecularWeight;
}

public double getMolecularWeight() {
return molecularWeight;
}

public double getGasConstant() {
return gasConstant;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Create a Pipe Object
package neqsim.processSimulation.measurementDevice.simpleFlowRegime;

public class Pipe {
private String name = "Default severe slug pipe";
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);
this.setInternalDiameter(internalDiameter);
this.setLeftLength(leftLength);
this.setRightLength(rightLength);
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
public void setName(String name) {
this.name = name;
}

public String getName() {
return name;
}

// 2. Pipe Internal Diameter encapsulation
public void setInternalDiameter(double internalDiameter) {
this.internalDiameter = internalDiameter;
}

public double getInternalDiameter() {
return internalDiameter;
}

// 3. Pipe Internal Diameter encapsulation
public void setLeftLength(double leftLength) {
this.leftLength = leftLength;
}

public double getLeftLength() {
return leftLength;
}

// 4. Pipe Right Length encapsulation
public void setRightLength(double rightLength) {
this.rightLength = rightLength;
}

public double getRightLength() {
return rightLength;
}

// 4. Pipe Angle encapsulation
public void setAngle(double angle) {
this.angle = angle;
}

public double getAngle(String unit) {
if (unit == "Degree"){
return this.angle;
}
else if(unit == "Radian"){
return this.angle*pi/180;
}
return this.angle;
}

public double getArea(){
return pi*Math.pow(this.internalDiameter,2)/4;
}

}
Loading