Skip to content

Commit

Permalink
fix: flow induced vibrations (#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sviatose authored Jun 21, 2024
1 parent 098761f commit 987979d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.ProcessEquipmentBaseClass;
import neqsim.processSimulation.processEquipment.ProcessEquipmentInterface;
import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.mixer.Mixer;
import neqsim.processSimulation.processEquipment.mixer.StaticMixer;
import neqsim.processSimulation.processEquipment.stream.Stream;
Expand All @@ -20,12 +20,11 @@
* @author Even Solbraa
* @version $Id: $Id
*/
public class FlowRateAdjuster extends ProcessEquipmentBaseClass {
public class FlowRateAdjuster extends TwoPortEquipment {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(Adjuster.class);

StreamInterface adjustedStream;
StreamInterface outletStream;
String name = "Flow Rate Adjuster";

public double desiredGasFlow;
public double desiredOilFlow;
Expand Down Expand Up @@ -61,7 +60,7 @@ public class FlowRateAdjuster extends ProcessEquipmentBaseClass {
*/
@Deprecated
public FlowRateAdjuster() {
this("FlowRateAdjuster");
this("Flow Rate Adjuster");
}

/**
Expand All @@ -75,14 +74,8 @@ public FlowRateAdjuster(String name) {
super(name);
}

/**
* <p>
* setAdjustedVariable.
* </p>
*
*/
public void setAdjustedStream(StreamInterface adjustedStream) {
this.adjustedStream = adjustedStream;
public FlowRateAdjuster(String name, StreamInterface inStream) {
super(name, inStream);
}

/**
Expand All @@ -102,7 +95,7 @@ public void setAdjustedFlowRates(Double desiredGasFlow, Double desiredOilFlow,
/** {@inheritDoc} */
@Override
public void run(UUID id) {
SystemInterface adjustedFluid = adjustedStream.getFluid();
SystemInterface adjustedFluid = inStream.getFluid();
ThermodynamicOperations thermoOps = new ThermodynamicOperations(adjustedFluid);
try {
thermoOps.TPflash();
Expand All @@ -122,8 +115,8 @@ public void run(UUID id) {
double oilDensity = oilFluid.getDensity("kg/m3");
double waterDensity = waterFluid.getDensity("kg/m3");

double temperature = adjustedStream.getTemperature("C");
double pressure = adjustedStream.getPressure("bara");
double temperature = inStream.getTemperature("C");
double pressure = inStream.getPressure("bara");

Stream gasStream = new Stream("Gas Stream", gasFluid);
gasStream.setTemperature(temperature, "C");
Expand Down Expand Up @@ -156,13 +149,10 @@ public void run(UUID id) {
wellStramMixer.addStream(waterStream);
wellStramMixer.run();

outletStream = wellStramMixer.getOutletStream();
outStream.setThermoSystem(wellStramMixer.getOutletStream().getFluid());
outStream.run();
outStream.setCalculationIdentifier(id);

setCalculationIdentifier(id);
}


public StreamInterface getOutletStream() {
return outletStream;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.junit.jupiter.api.Test;
import neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills;
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.processSimulation.processEquipment.util.FlowRateAdjuster;
import neqsim.processSimulation.processSystem.ProcessSystem;
import neqsim.thermo.ThermodynamicConstantsInterface;
Expand Down Expand Up @@ -77,44 +76,20 @@ public void testSetUnit() {
testSystem.useVolumeCorrection(true);
testSystem.setPressure(pressure, "bara");
testSystem.setTemperature(temperature, "C");
testSystem.setTotalFlowRate(1000.0, "kg/hr");
testSystem.setTotalFlowRate(100.0, "kg/hr");
testSystem.setMultiPhaseCheck(true);

ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
testSystem.initPhysicalProperties();

Stream stream_1 = new Stream("Stream1", testSystem);
stream_1.setFlowRate(1000.0, "kg/hr");

FlowRateAdjuster flowRateAdj = new FlowRateAdjuster("Flow rate adjuster");
flowRateAdj.setAdjustedStream(stream_1);
flowRateAdj.setAdjustedFlowRates(41886.7, 88700.0, 22000.0, "kg/hr");
flowRateAdj.run();

StreamInterface adjustedStream = flowRateAdj.getOutletStream();

double adjGasMass = adjustedStream.getFluid().getPhase("gas").getFlowRate("kg/hr");
double adjOilMass = adjustedStream.getFluid().getPhase("oil").getFlowRate("kg/hr");
double adjWaterMass = adjustedStream.getFluid().getPhase("aqueous").getFlowRate("kg/hr");

Assertions.assertEquals(adjGasMass, 41886.7, 0.05);
Assertions.assertEquals(adjOilMass, 88700.0, 0.05);
Assertions.assertEquals(adjWaterMass, 22000.0, 0.05);
stream_1.setFlowRate(100.0, "kg/hr");

FlowRateAdjuster flowRateAdj = new FlowRateAdjuster("Flow rate adjuster", stream_1);
flowRateAdj.setAdjustedFlowRates(gas_flow_rate, oil_flow_rate, water_flow_rate, "Sm3/hr");
flowRateAdj.run();

StreamInterface adjustedStream2 = flowRateAdj.getOutletStream();
double adjGasVol = adjustedStream2.getFluid().getPhase("gas").getFlowRate("Sm3/hr");
double adjOilVol = adjustedStream2.getFluid().getPhase("oil").getFlowRate("m3/hr");
double adjWaterVol = adjustedStream2.getFluid().getPhase("aqueous").getFlowRate("m3/hr");

Assertions.assertEquals(adjGasVol, gas_flow_rate, 0.05);
Assertions.assertEquals(adjOilVol, oil_flow_rate, 0.05);
Assertions.assertEquals(adjWaterVol, water_flow_rate, 0.05);

PipeBeggsAndBrills pipe = new PipeBeggsAndBrills(adjustedStream2);
PipeBeggsAndBrills pipe = new PipeBeggsAndBrills(flowRateAdj.getOutStream());
pipe.setPipeWallRoughness(1e-6);
pipe.setLength(25);
pipe.setElevation(0.0);
Expand All @@ -128,10 +103,12 @@ public void testSetUnit() {
flowInducedVibrationAnalyserFRMS =
new FlowInducedVibrationAnalyser("Flow Induced Vibrations Analyzer FRMS", pipe);
flowInducedVibrationAnalyserFRMS.setMethod("FRMS");
pipe.getOutletStream();

neqsim.processSimulation.processSystem.ProcessSystem operations =
new neqsim.processSimulation.processSystem.ProcessSystem();
operations.add(stream_1);
operations.add(flowRateAdj);
operations.add(pipe);
operations.add(flowInducedVibrationAnalyser);
operations.add(flowInducedVibrationAnalyserFRMS);
Expand Down

0 comments on commit 987979d

Please sign in to comment.