Skip to content
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

Addwaterproducer #778

Merged
merged 3 commits into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -484,6 +484,34 @@ public double getOilProdution(String unit) {
return volume;
}

/**
* <p>
* getWaterProdution.
* </p>
*
* @param unit a {@link java.lang.String} object
* @return a double
*/
public double getWaterProdution(String unit) {
double volume = 0.0;
for (int i = 0; i < gasProducer.size(); i++) {
volume += gasProducer.get(i).getStdWaterProduction();
}
for (int i = 0; i < oilProducer.size(); i++) {
volume += oilProducer.get(i).getStdWaterProduction();
}
for (int i = 0; i < waterProducer.size(); i++) {
volume += waterProducer.get(i).getStdWaterProduction();
}
if (unit.equals("Sm3/sec")) {
} else if (unit.equals("Sm3/day")) {
volume = volume * 60.0 * 60 * 24;
} else if (unit.equals("Sm3/hr")) {
volume = volume * 60.0 * 60;
}
return volume;
}

/** {@inheritDoc} */
@Override
public void runTransient(double dt, UUID id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public double getStdGasProduction() {
locStream.setPressure(1.01325);
ThermodynamicOperations ops = new ThermodynamicOperations(locStream);
ops.TPflash();
double volume = Double.NaN;
double volume = 0;
if (locStream.hasPhaseType("gas")) {
volume = locStream.getPhase("gas").getVolume("m3");
}
Expand All @@ -117,10 +117,30 @@ public double getStdOilProduction() {
locStream.setPressure(1.01325);
ThermodynamicOperations ops = new ThermodynamicOperations(locStream);
ops.TPflash();
double volume = Double.NaN;
double volume = 0;
if (locStream.hasPhaseType("oil")) {
volume = locStream.getPhase("oil").getVolume("m3");
}
return volume;
}

/**
* <p>
* getStdWaterProduction.
* </p>
*
* @return a double
*/
public double getStdWaterProduction() {
SystemInterface locStream = (stream.getFluid()).clone();
locStream.setTemperature(288.15);
locStream.setPressure(1.01325);
ThermodynamicOperations ops = new ThermodynamicOperations(locStream);
ops.TPflash();
double volume = 0;
if (locStream.hasPhaseType("aqueous")) {
volume = locStream.getPhase("aqueous").getVolume("m3");
}
return volume;
}
}
13 changes: 13 additions & 0 deletions src/main/java/neqsim/thermo/phase/Phase.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import neqsim.physicalProperties.PhysicalPropertyHandler;
import neqsim.thermo.ThermodynamicConstantsInterface;
import neqsim.thermo.component.ComponentInterface;
import neqsim.thermo.system.SystemInterface;
import neqsim.util.exception.InvalidInputException;
Expand Down Expand Up @@ -2137,6 +2138,18 @@ public double getFlowRate(String flowunit) {
return numberOfMolesInPhase * 60.0;
} else if (flowunit.equals("mole/hr")) {
return numberOfMolesInPhase * 3600.0;
} else if (flowunit.equals("Sm3/sec")) {
return numberOfMolesInPhase * ThermodynamicConstantsInterface.R
* ThermodynamicConstantsInterface.standardStateTemperature / 101325.0;
} else if (flowunit.equals("Sm3/hr")) {
return numberOfMolesInPhase * 3600.0 * ThermodynamicConstantsInterface.R
* ThermodynamicConstantsInterface.standardStateTemperature / 101325.0;
} else if (flowunit.equals("Sm3/day")) {
return numberOfMolesInPhase * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R
* ThermodynamicConstantsInterface.standardStateTemperature / 101325.0;
} else if (flowunit.equals("MSm3/day")) {
return numberOfMolesInPhase * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R
* ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 / 1.0e6;
} else {
throw new RuntimeException("failed.. unit: " + flowunit + " not supported");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void testRun2() {
producedOilStream.setFlowRate(6500.0 / 0.86 * 1000.0 * 4, "kg/day");

StreamInterface producedWaterStream = reservoirOps.addWaterProducer("waterproducer_1");
producedWaterStream.setFlowRate(0.0 * 1000.0 * 4, "kg/day");
producedWaterStream.setFlowRate(10000, "kg/day");

StreamInterface injectorGasStream = reservoirOps.addGasInjector("gasinjector_1");
neqsim.thermo.system.SystemInterface fluidGas = fluid1.clone();
Expand All @@ -59,6 +59,6 @@ void testRun2() {
reservoirOps.runTransient(deltaTime);
}
Assertions.assertEquals(352.274030, reservoirOps.getReservoirFluid().getPressure("bara"), 0.1);

Assertions.assertEquals(11.698, reservoirOps.getWaterProdution("Sm3/day"), 0.1);
}
}