Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 25, 2023
1 parent 935deb8 commit c000018
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class PipeBeggsAndBrills extends Pipeline {
// Roughness of the pipe wall [m]
private double pipeWallRoughness = 1e-5;

// Flag to run isothermal calculations
// Flag to run isothermal calculations
private boolean runIsothermal = false;

// Flow pattern of the fluid in the pipe
Expand Down Expand Up @@ -109,7 +109,7 @@ public class PipeBeggsAndBrills extends Pipeline {

private double cumulativeElevation;

//For segment calculation
// For segment calculation
double length;
double elevation;

Expand Down Expand Up @@ -340,7 +340,7 @@ public void calculateMissingValue() {
throw new RuntimeException(
new neqsim.util.exception.InvalidInputException("PipeBeggsAndBrills", "calcMissingValue",
"elevation or length or angle", "cannot be null"));
}
}

}

Expand Down Expand Up @@ -675,7 +675,7 @@ public void run(UUID id) {
testOps.TPflash();
system.initProperties();

if (!runIsothermal){
if (!runIsothermal) {
enthalpyInlet = system.getEnthalpy();
}
double pipeInletPressure = system.getPressure();
Expand All @@ -700,7 +700,7 @@ public void run(UUID id) {
}

system.setPressure(pressureOut);
if (!runIsothermal){
if (!runIsothermal) {
testOps.PHflash(enthalpyInlet);
}
system.initProperties();
Expand All @@ -711,6 +711,21 @@ public void run(UUID id) {
outStream.setCalculationIdentifier(id);
}

/**
* {@inheritDoc}
*
* <p>
* runTransient.
* </p>
*/
@Override
public void runTransient(double dt, UUID id) {
run(id);
increaseTime(dt);
return;

}

/** {@inheritDoc} */
@Override
public void displayResult() {
Expand Down Expand Up @@ -740,14 +755,14 @@ public double getAngle() {


/**
* @return total length of the pipe in m
* @return total length of the pipe in m
*/
public double getLength() {
return cumulativeLength;
}

/**
* @return total elevation of the pipe in m
/**
* @return total elevation of the pipe in m
*/
public double getElevation() {
return cumulativeElevation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package neqsim.processSimulation.processEquipment.reservoir;

import org.junit.jupiter.api.Test;
import neqsim.processSimulation.processEquipment.pipeline.PipeBeggsAndBrills;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.processSimulation.processEquipment.util.Adjuster;
import neqsim.processSimulation.processSystem.ProcessSystem;

public class WellFlowTest {
Expand Down Expand Up @@ -39,20 +41,80 @@ void testRun() {
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");

process.setTimeStep(60 * 60 * 24 * 365);
}

@Test
void testRunTransient() {
neqsim.thermo.system.SystemInterface fluid1 =
new neqsim.thermo.system.SystemPrEos(373.15, 100.0);
fluid1.addComponent("water", 3.599);
fluid1.addComponent("nitrogen", 0.599);
fluid1.addComponent("CO2", 0.51);
fluid1.addComponent("methane", 62.8);
fluid1.addComponent("n-heptane", 12.8);
fluid1.setMixingRule(2);
fluid1.setMultiPhaseCheck(true);

SimpleReservoir reservoirOps = new SimpleReservoir("Well 1 reservoir");
reservoirOps.setReservoirFluid(fluid1, 1e9, 10.0, 10.0e7);

StreamInterface producedGasStream = reservoirOps.addGasProducer("gasproducer_1");
producedGasStream.setFlowRate(1.0, "MSm3/day");

WellFlow wellflow = new WellFlow("well flow unit");
wellflow.setInletStream(producedGasStream);
wellflow.setWellProductionIndex(5.000100751427403E-4);

PipeBeggsAndBrills pipe = new PipeBeggsAndBrills(wellflow.getOutletStream());
pipe.setPipeWallRoughness(5e-6);
pipe.setLength(300.0);
pipe.setElevation(100);
pipe.setDiameter(0.325);

for (int i = 0; i < 3; i++) {
process.runTransient();
PipeBeggsAndBrills pipeline = new PipeBeggsAndBrills(wellflow.getOutletStream());
pipeline.setPipeWallRoughness(5e-6);
pipeline.setLength(60000.0);
pipeline.setElevation(200);
pipeline.setDiameter(0.325);

Adjuster adjuster = new Adjuster("adjuster");
adjuster.setTargetVariable(pipeline.getOutletStream(), "pressure", 80.0, "bara");
adjuster.setAdjustedVariable(producedGasStream, "molarFlow");


ProcessSystem process = new ProcessSystem();
process.add(reservoirOps);
process.add(wellflow);
process.add(pipe);
process.add(pipeline);
process.add(adjuster);
process.run();

System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));

System.out.println("production index " + wellflow.getWellProductionIndex() + " MSm3/day/bar^2");
System.out.println("reservoir pressure " + producedGasStream.getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");
System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");

// process.setTimeStep(60 * 60 * 24 * 365);

for (int i = 0; i < 5; i++) {
reservoirOps.runTransient(60 * 60 * 24 * 365);
process.run();
System.out.println("production flow rate " + producedGasStream.getFlowRate("MSm3/day"));
System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");
}

}

@Test
void testRunTransient() {
System.out.println("xmas pressure " + pipe.getOutletStream().getPressure("bara") + " bara");
System.out
.println("top side pressure " + pipeline.getOutletStream().getPressure("bara") + " bara");

}
}


Expand Down

0 comments on commit c000018

Please sign in to comment.