Skip to content

Commit

Permalink
Flow Induced Vibrations (#1025)
Browse files Browse the repository at this point in the history
* feat: LOF calc

---------

Co-authored-by: Even Solbraa <[email protected]>
  • Loading branch information
Sviatose and EvenSol authored Jun 18, 2024
1 parent 658d17f commit 79b9500
Show file tree
Hide file tree
Showing 7 changed files with 618 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
package neqsim.processSimulation.measurementDevice;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills;

/**
* <p>
* FlowInducedVibrationAnalyser class.
* </p>
*
* @author SEROS
* @version $Id: $Id
*/
public class FlowInducedVibrationAnalyser extends MeasurementDeviceBaseClass {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(WaterDewPointAnalyser.class);

private double supportDistance = 3;

private Boolean calcSupportArrangement = false;

private String supportArrangement = "Stiff"; // Consult with a mechanical engineer regarding
// either the support distance or
// natural frequency of vibrations, especially if measurements have been taken

private String method = "LOF"; // Likelihood of failure
private PipeBeggsAndBrills pipe;
private Boolean segmentSet = false;
private int segment;
private double FRMSConstant = 6.7;


/**
* <p>
* Constructor for WaterDewPointAnalyser.
* </p>
*
* @param pipe a {@link neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills}
* object
*/
public FlowInducedVibrationAnalyser(PipeBeggsAndBrills pipe) {
this("Pipeline Flow Induced Vibration Analyzer", pipe);
}

/**
* <p>
* Constructor for FlowInducedVibrationAnalyser.
* </p>
*
* @param name Name of FlowInducedVibrationAnalyser
* @param pipe a {@link neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills}
* object
*/
public FlowInducedVibrationAnalyser(String name, PipeBeggsAndBrills pipe) {
super(name, "pipe");
this.pipe = pipe;
}

/** {@inheritDoc} */
@Override
public void displayResult() {
try {
} finally {
}
}

/** {@inheritDoc} */
@Override
public double getMeasuredValue(String unit) {
if (!segmentSet) {
segment = pipe.getNumberOfIncrements();
}
double mixDensity = pipe.getSegmentMixtureDensity(segment);
double mixVelocity = pipe.getSegmentMixtureSuperficialVelocity(segment);
double gasVelocity = pipe.getSegmentGasSuperficialVelocity(segment);
double GVF = gasVelocity / mixVelocity;
if (method.equals("LOF")) {
double FVF = 1.0;
if (GVF > 0.88) {
if (GVF > 0.99) {
FVF = Math.sqrt(pipe.getSegmentMixtureViscosity(segment) / Math.sqrt(0.001));
} else {
FVF = -27.882 * GVF * GVF + 45.545 * GVF - 17.495;
}
}
double externalDiamater = (pipe.getDiameter() + 2 * pipe.getThickness()) * 1000;// mm
double alpha = 0.0;
double betta = 0.0;
if (supportArrangement == "Stiff") {
alpha = 446187 + 646 * externalDiamater
+ 9.17E-4 * externalDiamater * externalDiamater * externalDiamater;
betta = 0.1 * Math.log(externalDiamater) - 1.3739;
} else if (supportArrangement == "Medium stiff") {
alpha = 283921 + 370 * externalDiamater;
betta = 0.1106 * Math.log(externalDiamater) - 1.501;
} else if (supportArrangement == "Medium") {
alpha = 150412 + 209 * externalDiamater;
betta = 0.0815 * Math.log(externalDiamater) - 1.3269;
} else {
alpha = 41.21 * Math.log(externalDiamater) + 49397;
betta = 0.0815 * Math.log(externalDiamater) - 1.3842;
}
double diameterOverThickness = externalDiamater / (1000 * pipe.getThickness());
double Fv = alpha * Math.pow(diameterOverThickness, betta);
double LOF = mixDensity * mixVelocity * mixVelocity * FVF / Fv;
return LOF;
} else if (method == "FRMS") {
if (GVF < 0.8) {
return GVF;
} else {
return 1 + 5 * (1 - GVF) * Math.pow(pipe.getDiameter(), 1.6) * FRMSConstant
* Math.pow(pipe.getSegmentLiquidDensity(segment), 0.6) * Math.pow(mixVelocity, 1.2);
}
}
return Double.NaN;
}


/**
* <p>
* Getter for the field <code>method</code>.
* </p>
*
* @return a {@link java.lang.String} object
*/
public String getMethod() {
return method;
}

/**
* <p>
* Setter for the field <code>method</code>.
* </p>
*
* @param method a {@link java.lang.String} object
*/
public void setMethod(String method) {
this.method = method;
}

/**
* <p>
* Setter for the field <code>segment</code>.
* </p>
*
* @param segment a {@link java.lang.Double} object
*/
public void setSegment(int segment) {
this.segment = segment;
this.segmentSet = true;
}


public void setFRMSConstant(double frms) {
this.FRMSConstant = frms;
}

/**
* <p>
* Setter for the support arrangement <code>supportArrangement</code>.
* </p>
*
* @param arrangement a {@link java.lang.String} object
*/
public void setSupportArrangement(String arrangement) {
this.supportArrangement = arrangement;
}


/**
* <p>
* Setter for the support distance <code></code>.
* </p>
*
* @param distance a {@link java.lang.Double} object
*/
public void setSupportDistance(Double distance) {
this.supportDistance = distance;
}



}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package neqsim.processSimulation.processEquipment.pipeline;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand All @@ -20,6 +21,10 @@ public class PipeBeggsAndBrills extends Pipeline {

int iteration;

private double nominalDiameter;

private Boolean PipeSpecSet = false;

// Inlet pressure of the pipeline (initialization)
private double inletPressure = Double.NaN;

Expand All @@ -35,6 +40,9 @@ public class PipeBeggsAndBrills extends Pipeline {
// Inside diameter of the pipe [m]
private double insideDiameter = Double.NaN;

// Thickness diameter of the pipe [m]
private double pipeThickness = Double.NaN;

// Roughness of the pipe wall [m]
private double pipeWallRoughness = 1e-5;

Expand All @@ -51,7 +59,7 @@ public class PipeBeggsAndBrills extends Pipeline {
private double mixtureFroudeNumber;

// Specification of the pipe
private String pipeSpecification = "AP02";
private String pipeSpecification = "LD201";

// Ref. Beggs and Brills
private double A;
Expand Down Expand Up @@ -128,6 +136,7 @@ public class PipeBeggsAndBrills extends Pipeline {

private List<Double> mixtureViscosityProfile;
private List<Double> mixtureDensityProfile;
private List<Double> liquidDensityProfile;

private List<Double> liquidHoldupProfile;
private List<Double> mixtureReynoldsNumber;
Expand Down Expand Up @@ -181,12 +190,31 @@ public PipeBeggsAndBrills(String name, StreamInterface inStream) {
* Setter for the field <code>pipeSpecification</code>.
* </p>
*
* @param nominalDiameter a double
* @param nominalDiameter a double in inch
* @param pipeSec a {@link java.lang.String} object
*/
public void setPipeSpecification(double nominalDiameter, String pipeSec) {
pipeSpecification = pipeSec;
insideDiameter = nominalDiameter / 1000.0;
this.pipeSpecification = pipeSec;
this.nominalDiameter = nominalDiameter;
this.PipeSpecSet = true;

neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase();
java.sql.ResultSet dataSet =
database.getResultSet("SELECT * FROM pipedata where Size='" + nominalDiameter + "'");
try {
if (dataSet.next()) {
this.pipeThickness = Double.parseDouble(dataSet.getString(pipeSpecification)) / 1000;
this.insideDiameter =
(Double.parseDouble(dataSet.getString("OD"))) / 1000 - 2 * this.pipeThickness;
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

/** {@inheritDoc} */
Expand Down Expand Up @@ -228,6 +256,30 @@ public void setDiameter(double diameter) {
insideDiameter = diameter;
}

/**
* <p>
* setThickness.
* </p>
*
* @param pipeThickness the thickness to set
*/
public void setThickness(double pipeThickness) {
this.pipeThickness = pipeThickness;
}


/**
* <p>
* getThickness.
* </p>
*
*/
public double getThickness() {
return this.pipeThickness;
}



/**
* <p>
* Setter for the field <code>angle</code>.
Expand Down Expand Up @@ -586,24 +638,30 @@ public double calcFrictionPressureLoss() {
+ (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
muNoSlip = mixtureLiquidViscosity * inputVolumeFractionLiquid
+ (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
liquidDensityProfile.add(mixtureLiquidDensity * 16.01846);
} else {
rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3")) * inputVolumeFractionLiquid
+ (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
muNoSlip = system.getPhase(1).getViscosity("cP") * inputVolumeFractionLiquid
+ (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
liquidDensityProfile.add((system.getPhase(1).getDensity("lb/ft3")) * 16.01846);
}
rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3")) * inputVolumeFractionLiquid
+ (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
muNoSlip = system.getPhase(1).getViscosity("cP") * inputVolumeFractionLiquid
+ (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
} else {
rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3")) * inputVolumeFractionLiquid
+ (system.getPhase(0).getDensity("lb/ft3")) * (1 - inputVolumeFractionLiquid);
muNoSlip = system.getPhase(1).getViscosity("cP") * inputVolumeFractionLiquid
+ (system.getPhase(0).getViscosity("cP")) * (1 - inputVolumeFractionLiquid);
liquidDensityProfile.add((system.getPhase(1).getDensity("lb/ft3")) * 16.01846);
}
} else {
if (system.hasPhaseType("gas")) {
rhoNoSlip = (system.getPhase(0).getDensity("lb/ft3"));
muNoSlip = (system.getPhase(0).getViscosity("cP"));
liquidDensityProfile.add(0.0);
} else {
rhoNoSlip = (system.getPhase(1).getDensity("lb/ft3"));
muNoSlip = (system.getPhase(1).getViscosity("cP"));
liquidDensityProfile.add(rhoNoSlip * 16.01846);
}
}

Expand Down Expand Up @@ -648,6 +706,7 @@ public double calcPressureDrop() {
/** {@inheritDoc} */
@Override
public void run(UUID id) {

iteration = 0;

pressureProfile = new ArrayList<>();
Expand All @@ -662,6 +721,7 @@ public void run(UUID id) {

mixtureViscosityProfile = new ArrayList<>();
mixtureDensityProfile = new ArrayList<>();
liquidDensityProfile = new ArrayList<>();
liquidHoldupProfile = new ArrayList<>();
mixtureReynoldsNumber = new ArrayList<>();

Expand Down Expand Up @@ -965,6 +1025,12 @@ public List<Double> getMixtureDensityProfile() {
return new ArrayList<>(mixtureDensityProfile);
}


public List<Double> getLiquidDensityProfile() {
return new ArrayList<>(liquidDensityProfile);
}


/**
* @return list of hold-up
*/
Expand Down Expand Up @@ -1060,6 +1126,20 @@ public Double getSegmentMixtureDensity(int index) {
}
}


/**
* @param index segment number
* @return Double
*/
public Double getSegmentLiquidDensity(int index) {
if (index >= 0 && index <= liquidDensityProfile.size()) {
return liquidDensityProfile.get(index);
} else {
throw new IndexOutOfBoundsException("Index is out of bounds.");
}
}


/**
* @param index segment number
* @return Double
Expand Down
Loading

0 comments on commit 79b9500

Please sign in to comment.