Skip to content

Commit

Permalink
minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed Dec 24, 2023
1 parent 610c28e commit 935deb8
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package neqsim.processSimulation.processEquipment.reservoir;

import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.processSimulation.processEquipment.TwoPortEquipment;
import neqsim.processSimulation.processEquipment.stream.StreamInterface;
import neqsim.processSimulation.processEquipment.valve.ThrottlingValve;
import neqsim.thermo.system.SystemInterface;

/**
* <p>
Expand All @@ -14,6 +18,14 @@
*/
public class WellFlow extends TwoPortEquipment {
private static final long serialVersionUID = 1000;
static Logger logger = LogManager.getLogger(ThrottlingValve.class);
SystemInterface thermoSystem;
private double wellProductionIndex = 0;
double pressureOut = 1.0;
String pressureUnit = "bara";
boolean useWellProductionIndex = false;
boolean calcpressure = true;


/**
* <p>
Expand All @@ -38,15 +50,49 @@ public void setInletStream(StreamInterface stream) {
/** {@inheritDoc} */
@Override
public void run(UUID id) {



thermoSystem = getInletStream().getThermoSystem().clone();
thermoSystem.setPressure(pressureOut, pressureUnit);
outStream.setThermoSystem(thermoSystem);
if (useWellProductionIndex) {
if (calcpressure) {
double presout = Math.sqrt(Math.pow(getInletStream().getPressure("bara"), 2.0)
- getInletStream().getFlowRate("MSm3/day") / wellProductionIndex);
outStream.setPressure(presout, "bara");
} else {
double flow = wellProductionIndex * (Math.pow(getInletStream().getPressure("bara"), 2.0)
- Math.pow(thermoSystem.getPressure("bara"), 2.0));
outStream.setFlowRate(flow, "MSm3/day");
}
} else {
wellProductionIndex = getInletStream().getFlowRate("MSm3/day")
/ (Math.pow(getInletStream().getPressure("bara"), 2.0)
- Math.pow(thermoSystem.getPressure("bara"), 2.0));
}
outStream.run();
}

/** {@inheritDoc} */
@Override
public void runTransient(double dt, UUID id) {
if (getCalculateSteadyState()) {
run(id);
increaseTime(dt);
return;
}
double flow = wellProductionIndex * (Math.pow(getInletStream().getPressure("bara"), 2.0)
- Math.pow(thermoSystem.getPressure("bara"), 2.0));

outStream.setFlowRate(flow, "MSm3/day");
outStream.run();
}

public double getWellProductionIndex() {
return wellProductionIndex;
}

public void setWellProductionIndex(double wellProductionIndex) {
useWellProductionIndex = true;
this.wellProductionIndex = wellProductionIndex;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,39 @@ void testRun() {
fluid1.addComponent("nitrogen", 0.599);
fluid1.addComponent("CO2", 0.51);
fluid1.addComponent("methane", 62.8);
fluid1.addPlusFraction("C7", 10.5, 180.0 / 1000.0, 840.0 / 1000.0);
fluid1.getCharacterization().characterisePlusFraction();
fluid1.addComponent("n-heptane", 12.8);
fluid1.setMixingRule(2);
fluid1.setMultiPhaseCheck(true);

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

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

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

ProcessSystem process = new ProcessSystem();
process.add(reservoirOps);
process.add(producedGasStream);
process.add(wellflow);

process.run();

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");

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

for (int i = 0; i < 3; i++) {
process.runTransient();
System.out.println("reservoir pressure " + wellflow.getInletStream().getPressure("bara"));
System.out
.println("pres bottomhole " + wellflow.getOutletStream().getPressure("bara") + " bara");
}

}

Expand Down

0 comments on commit 935deb8

Please sign in to comment.