Class MultiScenarioVFPGenerator
- All Implemented Interfaces:
Serializable
For each combination of (flow rate, outlet pressure, water cut, GOR), calculates the required inlet pressure by running the process simulation. This is the standard Eclipse VFP format for export systems/pipelines.
Table Format
BHP[rate][outletP][WC][GOR] = required inlet pressure (bara) Where: - BHP = inlet pressure required to achieve the given rate - THP = outlet pressure constraint - rate = target flow rate (Sm3/d or kg/hr) - WC = water cut (fraction 0-1) - GOR = gas-oil ratio (Sm3/Sm3)
Thread Safety
The generator uses a process factory to create fresh ProcessSystem instances for parallel execution, ensuring thread safety. This pattern follows the established approach in eclipse_lift_curve_manifold_pressure_paralell_run.ipynb.
Usage Example
// Setup fluid input and generator
FluidMagicInput input = FluidMagicInput.fromE300File("FLUID.E300");
input.setGORRange(250, 10000);
input.setWaterCutRange(0.05, 0.60);
input.separateToStandardConditions();
RecombinationFlashGenerator flashGen = new RecombinationFlashGenerator(input);
// Create VFP generator with process factory
MultiScenarioVFPGenerator vfpGen = new MultiScenarioVFPGenerator(() -> createMyProcess(), // Factory
// for
// thread-safe
// execution
"Feed", "Export");
vfpGen.setFlashGenerator(flashGen);
// Configure table axes
vfpGen.setFlowRates(new double[] {5000, 10000, 20000, 40000, 60000});
vfpGen.setOutletPressures(new double[] {50, 60, 70, 80});
vfpGen.setWaterCuts(new double[] {0.05, 0.20, 0.40, 0.60});
vfpGen.setGORs(new double[] {250, 500, 1000, 2000, 5000, 10000});
// Generate table
VFPTable table = vfpGen.generateVFPTable();
// Export to Eclipse format
vfpGen.exportVFPEXP("process_vfp.inc", 1);
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classResult of a single VFP point calculation.static classVFP table containing all calculated points.private static classTask for calculating a single VFP point. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate Stringprivate RecombinationFlashGeneratorprivate double[]private Stringprivate double[]private doubleprivate static final org.apache.logging.log4j.LoggerLogger object for class.private doubleprivate doubleprivate intprivate double[]private Stringprivate doubleprivate Supplier<ProcessSystem> private static final longSerialization version UID.private double[] -
Constructor Summary
ConstructorsConstructorDescriptionMultiScenarioVFPGenerator(Supplier<ProcessSystem> processFactory, String feedStreamName, String outletStreamName) Constructor with process factory for thread-safe parallel execution.MultiScenarioVFPGenerator(ProcessSystem process, String feedStreamName, String outletStreamName) Constructor with single process (for sequential execution or when process is thread-safe). -
Method Summary
Modifier and TypeMethodDescriptionCalculate single VFP point with fresh process system (thread-safe).private voidExecute tasks in parallel using ThreadPoolExecutor.private voidExecute tasks sequentially.voidexportVFPEXP(String filePath, int tableNumber) Export to Eclipse VFPEXP format.voidexportVFPEXP(Path filePath, int tableNumber) Export to Eclipse VFPEXP format.Generate the VFP table by simulating all combinations.Get the flash generator.double[]Get flow rates.Get flow rate unit.double[]getGORs()Get GOR values.doubleGet inlet temperature.double[]Get outlet pressures.Get the generated VFP table.double[]Get water cuts.voidsetEnableParallel(boolean enable) Enable or disable parallel execution.voidsetFlashGenerator(RecombinationFlashGenerator flashGenerator) Set the recombination flash generator.voidsetFlowRates(double[] flowRates) Set flow rates for VFP table.voidsetFlowRateUnit(String unit) Set flow rate unit.voidsetFluidInput(FluidMagicInput fluidInput) Set fluid input configuration (convenience method).voidsetGORs(double[] gors) Set GOR values for VFP table.voidsetInletTemperature(double temperatureK) Set inlet temperature for fluid generation.voidsetMaxInletPressure(double pressure) Set maximum inlet pressure for binary search.voidsetMinInletPressure(double pressure) Set minimum inlet pressure for binary search.voidsetNumberOfWorkers(int workers) Set number of worker threads.voidsetOutletPressures(double[] outletPressures) Set outlet pressures (THP) for VFP table.voidsetPressureTolerance(double tolerance) Set pressure tolerance for binary search.voidsetWaterCuts(double[] waterCuts) Set water cuts for VFP table.toVFPEXPString(int tableNumber) Generate Eclipse VFPEXP format string.private booleantryInletPressure(ProcessSystem process, StreamInterface feedStream, SystemInterface fluid, double flowRate, double targetOutletP, double inletP) Try running process at given inlet pressure, check if outlet target achieved.private voidValidate configuration before running.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object for class. -
processFactory
-
feedStreamName
-
outletStreamName
-
flashGenerator
-
inletTemperature
private double inletTemperature -
flowRates
private double[] flowRates -
outletPressures
private double[] outletPressures -
waterCuts
private double[] waterCuts -
GORs
private double[] GORs -
flowRateUnit
-
minInletPressure
private double minInletPressure -
maxInletPressure
private double maxInletPressure -
pressureTolerance
private double pressureTolerance -
enableParallel
private boolean enableParallel -
numberOfWorkers
private int numberOfWorkers -
vfpTable
-
-
Constructor Details
-
MultiScenarioVFPGenerator
public MultiScenarioVFPGenerator(Supplier<ProcessSystem> processFactory, String feedStreamName, String outletStreamName) Constructor with process factory for thread-safe parallel execution.- Parameters:
processFactory- factory function that creates a fresh process systemfeedStreamName- name of inlet streamoutletStreamName- name of outlet stream (pressure target)
-
MultiScenarioVFPGenerator
public MultiScenarioVFPGenerator(ProcessSystem process, String feedStreamName, String outletStreamName) Constructor with single process (for sequential execution or when process is thread-safe).- Parameters:
process- the process system (will be copied for parallel execution)feedStreamName- name of inlet streamoutletStreamName- name of outlet stream
-
-
Method Details
-
generateVFPTable
Generate the VFP table by simulating all combinations.For each (rate, outletP, WC, GOR) combination, finds the minimum inlet pressure required to achieve the target rate at the specified outlet pressure.
- Returns:
- VFPTable with all results
-
executeSequential
Execute tasks sequentially.- Parameters:
tasks- list of VFP tasks
-
executeParallel
Execute tasks in parallel using ThreadPoolExecutor.- Parameters:
tasks- list of VFP tasks
-
calculateVFPPoint
private MultiScenarioVFPGenerator.VFPPoint calculateVFPPoint(MultiScenarioVFPGenerator.VFPTask task) Calculate single VFP point with fresh process system (thread-safe).Uses binary search to find minimum inlet pressure that achieves target outlet pressure at the specified flow rate.
- Parameters:
task- the VFP task to calculate- Returns:
- VFPPoint with results
-
tryInletPressure
private boolean tryInletPressure(ProcessSystem process, StreamInterface feedStream, SystemInterface fluid, double flowRate, double targetOutletP, double inletP) Try running process at given inlet pressure, check if outlet target achieved.- Parameters:
process- the process systemfeedStream- the feed stream to modifyfluid- the fluid compositionflowRate- target flow ratetargetOutletP- target outlet pressureinletP- inlet pressure to try- Returns:
- true if target achieved
-
validateConfiguration
private void validateConfiguration()Validate configuration before running. -
exportVFPEXP
Export to Eclipse VFPEXP format.- Parameters:
filePath- output file pathtableNumber- VFP table number- Throws:
IOException- if writing fails
-
exportVFPEXP
Export to Eclipse VFPEXP format.- Parameters:
filePath- output file pathtableNumber- VFP table number- Throws:
IOException- if writing fails
-
toVFPEXPString
Generate Eclipse VFPEXP format string.- Parameters:
tableNumber- VFP table number- Returns:
- VFPEXP format string
-
setFluidInput
Set fluid input configuration (convenience method).This is a convenience method that creates a
RecombinationFlashGeneratorfrom the fluid input and automatically configures the water cut and GOR arrays from the fluid input settings.- Parameters:
fluidInput- the fluid input configuration
-
setFlashGenerator
Set the recombination flash generator.- Parameters:
flashGenerator- the flash generator
-
getFlashGenerator
Get the flash generator.- Returns:
- the flash generator
-
setFlowRates
public void setFlowRates(double[] flowRates) Set flow rates for VFP table.- Parameters:
flowRates- array of flow rates
-
getFlowRates
public double[] getFlowRates()Get flow rates.- Returns:
- array of flow rates
-
setOutletPressures
public void setOutletPressures(double[] outletPressures) Set outlet pressures (THP) for VFP table.- Parameters:
outletPressures- array of outlet pressures in bara
-
getOutletPressures
public double[] getOutletPressures()Get outlet pressures.- Returns:
- array of outlet pressures
-
setWaterCuts
public void setWaterCuts(double[] waterCuts) Set water cuts for VFP table.- Parameters:
waterCuts- array of water cuts (0-1)
-
getWaterCuts
public double[] getWaterCuts()Get water cuts.- Returns:
- array of water cuts
-
setGORs
public void setGORs(double[] gors) Set GOR values for VFP table.- Parameters:
gors- array of GOR values in Sm3/Sm3
-
getGORs
public double[] getGORs()Get GOR values.- Returns:
- array of GOR values
-
setFlowRateUnit
Set flow rate unit.- Parameters:
unit- flow rate unit (e.g., "Sm3/day", "kg/hr")
-
getFlowRateUnit
-
setInletTemperature
public void setInletTemperature(double temperatureK) Set inlet temperature for fluid generation.- Parameters:
temperatureK- temperature in Kelvin
-
getInletTemperature
public double getInletTemperature()Get inlet temperature.- Returns:
- temperature in Kelvin
-
setMinInletPressure
public void setMinInletPressure(double pressure) Set minimum inlet pressure for binary search.- Parameters:
pressure- minimum pressure in bara
-
setMaxInletPressure
public void setMaxInletPressure(double pressure) Set maximum inlet pressure for binary search.- Parameters:
pressure- maximum pressure in bara
-
setPressureTolerance
public void setPressureTolerance(double tolerance) Set pressure tolerance for binary search.- Parameters:
tolerance- tolerance in bara
-
setEnableParallel
public void setEnableParallel(boolean enable) Enable or disable parallel execution.- Parameters:
enable- true to enable parallel execution
-
setNumberOfWorkers
public void setNumberOfWorkers(int workers) Set number of worker threads.- Parameters:
workers- number of workers
-
getVfpTable
Get the generated VFP table.- Returns:
- VFP table or null if not yet generated
-