Skip to content

Commit dbe599a

Browse files
committed
fix docs
1 parent 369a3ee commit dbe599a

11 files changed

+138
-134
lines changed

docs/examples/EclipseE300ExportImportExample.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import neqsim.thermodynamicoperations.ThermodynamicOperations;
77

88
/**
9-
* Example demonstrating how to export a NeqSim fluid to Eclipse E300 compositional format and read
9+
* Example demonstrating how to export a NeqSim fluid to Eclipse E300
10+
* compositional format and read
1011
* it back.
1112
*
1213
* <p>
@@ -136,7 +137,7 @@ private static void printFluidSummary(SystemInterface fluid) {
136137
}
137138
if (fluid.hasPhaseType("oil")) {
138139
System.out.println(" Oil density: "
139-
+ String.format("%.2f", fluid.getOilPhase().getDensity("kg/m3")) + " kg/m3");
140+
+ String.format("%.2f", fluid.getPhase("oil").getDensity("kg/m3")) + " kg/m3");
140141
}
141142
}
142143

@@ -159,8 +160,8 @@ private static void compareFluidProperties(SystemInterface original, SystemInter
159160
}
160161

161162
if (original.hasPhaseType("oil") && imported.hasPhaseType("oil")) {
162-
double origOilDens = original.getOilPhase().getDensity("kg/m3");
163-
double impOilDens = imported.getOilPhase().getDensity("kg/m3");
163+
double origOilDens = original.getPhase("oil").getDensity("kg/m3");
164+
double impOilDens = imported.getPhase("oil").getDensity("kg/m3");
164165
double oilDiff = Math.abs(origOilDens - impOilDens) / origOilDens * 100;
165166
System.out.println(" Oil density difference: " + String.format("%.2f", oilDiff) + "%");
166167
}

docs/examples/MultiScenarioVFPExample.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import neqsim.process.util.optimizer.RecombinationFlashGenerator;
1616
import neqsim.thermo.system.SystemInterface;
1717
import neqsim.thermo.system.SystemSrkEos;
18+
import java.util.function.Supplier;
1819

1920
/**
2021
* Example demonstrating multi-scenario VFP generation.
@@ -52,15 +53,15 @@ public static void main(String[] args) {
5253

5354
// Step 2: Configure fluid input with GOR/WC scenarios
5455
System.out.println("2. Configuring GOR and water cut scenarios...");
55-
FluidMagicInput fluidInput = FluidMagicInput.fromFluid(referenceFluid, 120.0, 0.0);
56+
FluidMagicInput fluidInput = FluidMagicInput.fromFluid(referenceFluid);
5657

5758
// GOR: 80 to 350 Sm3/Sm3 (5 values) - using convenience method
5859
fluidInput.setGORRange(80.0, 350.0, 5);
59-
System.out.println(" GOR values: " + arrayToString(fluidInput.getGORValues()));
60+
System.out.println(" GOR values: " + arrayToString(fluidInput.generateGORValues()));
6061

6162
// Water cut: 0% to 60% (4 values) - using convenience method
6263
fluidInput.setWaterCutRange(0.0, 0.6, 4);
63-
System.out.println(" WC values: " + arrayToString(fluidInput.getWaterCutValues()));
64+
System.out.println(" WC values: " + arrayToString(fluidInput.generateWaterCutValues()));
6465

6566
// Step 3: Demonstrate recombination generator
6667
System.out.println("\n3. Testing recombination fluid generator...");
@@ -83,8 +84,8 @@ public static void main(String[] args) {
8384
// Step 6: Report results
8485
System.out.println("\n6. VFP Table Results:");
8586
System.out.println(
86-
" Feasible points: " + table.getFeasibleCount() + " / " + table.getTotalCount());
87-
double coverage = 100.0 * table.getFeasibleCount() / table.getTotalCount();
87+
" Feasible points: " + table.getFeasibleCount() + " / " + table.getTotalPoints());
88+
double coverage = 100.0 * table.getFeasibleCount() / table.getTotalPoints();
8889
System.out.println(" Coverage: " + String.format("%.1f", coverage) + "%");
8990

9091
// Check for low coverage warning
@@ -143,8 +144,6 @@ private static SystemInterface createReferenceFluid() {
143144
fluid.setMultiPhaseCheck(true);
144145

145146
System.out.println(" Components: " + fluid.getNumberOfComponents());
146-
System.out
147-
.println(" Total mole fraction: " + String.format("%.4f", fluid.getTotalMoleFraction()));
148147

149148
return fluid;
150149
}
@@ -158,8 +157,8 @@ private static void demonstrateRecombination(FluidMagicInput fluidInput) {
158157
RecombinationFlashGenerator generator = new RecombinationFlashGenerator(fluidInput);
159158

160159
// Generate a few sample fluids
161-
double[] testGORs = {100.0, 200.0, 300.0};
162-
double[] testWCs = {0.0, 0.3};
160+
double[] testGORs = { 100.0, 200.0, 300.0 };
161+
double[] testWCs = { 0.0, 0.3 };
163162

164163
for (double gor : testGORs) {
165164
for (double wc : testWCs) {
@@ -186,12 +185,13 @@ private static void demonstrateRecombination(FluidMagicInput fluidInput) {
186185
*/
187186
private static MultiScenarioVFPGenerator createVFPGenerator(FluidMagicInput fluidInput) {
188187
// Process factory creates a fresh well model for each calculation
189-
MultiScenarioVFPGenerator.ProcessFactory wellFactory = (fluid, rate) -> {
188+
Supplier<ProcessSystem> wellFactory = () -> {
190189
ProcessSystem process = new ProcessSystem();
191190

192-
// Wellhead stream
191+
// Wellhead stream - use reference fluid
192+
SystemInterface fluid = fluidInput.getReferenceFluid().clone();
193193
Stream wellhead = new Stream("wellhead", fluid);
194-
wellhead.setFlowRate(rate, "m3/hr");
194+
wellhead.setFlowRate(100.0, "m3/hr");
195195
process.add(wellhead);
196196

197197
// Well tubing
@@ -206,18 +206,18 @@ private static MultiScenarioVFPGenerator createVFPGenerator(FluidMagicInput flui
206206
};
207207

208208
// Create generator using convenience method
209-
MultiScenarioVFPGenerator generator =
210-
new MultiScenarioVFPGenerator(wellFactory, "wellhead", "tubing");
209+
MultiScenarioVFPGenerator generator = new MultiScenarioVFPGenerator(wellFactory, "wellhead", "tubing");
211210

212-
// Use convenience method to set fluid input (creates flash generator + sets GOR/WC arrays)
211+
// Use convenience method to set fluid input (creates flash generator + sets
212+
// GOR/WC arrays)
213213
generator.setFluidInput(fluidInput);
214214

215215
// Configure rate dimension (liquid rates at stock tank conditions)
216-
generator.setFlowRates(new double[] {50.0, 100.0, 200.0, 400.0, 600.0});
216+
generator.setFlowRates(new double[] { 50.0, 100.0, 200.0, 400.0, 600.0 });
217217
System.out.println(" Rates: [50, 100, 200, 400, 600] m3/hr");
218218

219219
// Configure outlet pressure dimension (THP)
220-
generator.setOutletPressures(new double[] {15.0, 25.0, 35.0, 45.0});
220+
generator.setOutletPressures(new double[] { 15.0, 25.0, 35.0, 45.0 });
221221
System.out.println(" THPs: [15, 25, 35, 45] bara");
222222

223223
// GOR and water cut dimensions already set by setFluidInput()
@@ -237,12 +237,12 @@ private static MultiScenarioVFPGenerator createVFPGenerator(FluidMagicInput flui
237237
/**
238238
* Prints sample slices of the VFP table.
239239
*
240-
* @param table the VFP table
240+
* @param table the VFP table
241241
* @param fluidInput the fluid input for labels
242242
*/
243243
private static void printSampleSlices(VFPTable table, FluidMagicInput fluidInput) {
244-
double[] gorValues = fluidInput.getGORValues();
245-
double[] wcValues = fluidInput.getWaterCutValues();
244+
double[] gorValues = fluidInput.generateGORValues();
245+
double[] wcValues = fluidInput.generateWaterCutValues();
246246

247247
// Print slice at WC=0%, lowest GOR
248248
System.out.println("\n Slice: WC=0%, GOR=" + gorValues[0] + " Sm3/Sm3");
@@ -264,7 +264,7 @@ private static void printSampleSlices(VFPTable table, FluidMagicInput fluidInput
264264
/**
265265
* Prints the first N lines of a string.
266266
*
267-
* @param text the text to print
267+
* @param text the text to print
268268
* @param maxLines maximum lines to print
269269
*/
270270
private static void printFirstLines(String text, int maxLines) {

docs/examples/MultiScenarioVFP_Tutorial.ipynb

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
}
100100
],
101101
"source": [
102-
"# Create reference fluid at standard conditions (15°C = 288.15 K, 1.01325 bara)\n",
102+
"# Create reference fluid at standard conditions (15\u00b0C = 288.15 K, 1.01325 bara)\n",
103103
"reference_fluid = SystemSrkEos(288.15, 1.01325)\n",
104104
"\n",
105105
"# Add components (typical light oil composition)\n",
@@ -531,7 +531,7 @@
531531
" \n",
532532
" ax1.plot(valid_rates, bhps, 'o-', linewidth=2, markersize=8, label=f'GOR={gor:.0f}')\n",
533533
"\n",
534-
"ax1.set_xlabel('Liquid Rate (m³/h)', fontsize=12)\n",
534+
"ax1.set_xlabel('Liquid Rate (m\u00b3/h)', fontsize=12)\n",
535535
"ax1.set_ylabel('Bottom Hole Pressure (bara)', fontsize=12)\n",
536536
"ax1.set_title(f'VFP Curves at THP={target_thp} bara, WC=0%', fontsize=14)\n",
537537
"ax1.legend(fontsize=10)\n",
@@ -565,7 +565,7 @@
565565
" \n",
566566
" ax2.plot(valid_rates, bhps, 's-', linewidth=2, markersize=8, label=f'WC={wc*100:.0f}%')\n",
567567
"\n",
568-
"ax2.set_xlabel('Liquid Rate (m³/h)', fontsize=12)\n",
568+
"ax2.set_xlabel('Liquid Rate (m\u00b3/h)', fontsize=12)\n",
569569
"ax2.set_ylabel('Bottom Hole Pressure (bara)', fontsize=12)\n",
570570
"ax2.set_title(f'VFP Curves at THP={target_thp} bara, GOR={fixed_gor}', fontsize=14)\n",
571571
"ax2.legend(fontsize=10)\n",
@@ -666,16 +666,16 @@
666666
"ax1.set_xticklabels([f'{g:.0f}' for g in gor_values])\n",
667667
"ax1.set_yticks(range(len(wc_values)))\n",
668668
"ax1.set_yticklabels([f'{w*100:.0f}%' for w in wc_values])\n",
669-
"ax1.set_xlabel('GOR (Sm³/Sm³)', fontsize=12)\n",
669+
"ax1.set_xlabel('GOR (Sm\u00b3/Sm\u00b3)', fontsize=12)\n",
670670
"ax1.set_ylabel('Water Cut', fontsize=12)\n",
671-
"ax1.set_title(f'VFP Feasibility (BHP {max_bhp} bara)\\nRate={test_rate} m³/h, THP={target_thp} bara', fontsize=14)\n",
671+
"ax1.set_title(f'VFP Feasibility (BHP \u2264 {max_bhp} bara)\\nRate={test_rate} m\u00b3/h, THP={target_thp} bara', fontsize=14)\n",
672672
"cbar1 = plt.colorbar(im1, ax=ax1, ticks=[0, 1])\n",
673673
"cbar1.set_ticklabels(['Infeasible', 'Feasible'])\n",
674674
"\n",
675675
"# Add text annotations\n",
676676
"for i in range(len(wc_values)):\n",
677677
" for j in range(len(gor_values)):\n",
678-
" text = '' if feasibility[i, j] == 1 else ''\n",
678+
" text = '\u2713' if feasibility[i, j] == 1 else '\u2717'\n",
679679
" color = 'white' if feasibility[i, j] == 1 else 'red'\n",
680680
" ax1.text(j, i, text, ha='center', va='center', color=color, fontsize=16, fontweight='bold')\n",
681681
"\n",
@@ -686,9 +686,9 @@
686686
"ax2.set_xticklabels([f'{g:.0f}' for g in gor_values])\n",
687687
"ax2.set_yticks(range(len(wc_values)))\n",
688688
"ax2.set_yticklabels([f'{w*100:.0f}%' for w in wc_values])\n",
689-
"ax2.set_xlabel('GOR (Sm³/Sm³)', fontsize=12)\n",
689+
"ax2.set_xlabel('GOR (Sm\u00b3/Sm\u00b3)', fontsize=12)\n",
690690
"ax2.set_ylabel('Water Cut', fontsize=12)\n",
691-
"ax2.set_title(f'Required BHP (bara)\\nRate={test_rate} m³/h, THP={target_thp} bara', fontsize=14)\n",
691+
"ax2.set_title(f'Required BHP (bara)\\nRate={test_rate} m\u00b3/h, THP={target_thp} bara', fontsize=14)\n",
692692
"cbar2 = plt.colorbar(im2, ax=ax2)\n",
693693
"cbar2.set_label('BHP (bara)')\n",
694694
"\n",
@@ -734,16 +734,17 @@
734734
"import neqsim.process.util.optimizer.*;\n",
735735
"\n",
736736
"// 1. Create fluid input (using convenience methods)\n",
737-
"FluidMagicInput fluidInput = FluidMagicInput.fromFluid(referenceFluid, 120.0, 0.0);\n",
737+
"FluidMagicInput fluidInput = FluidMagicInput.fromFluid(referenceFluid);\n",
738738
"fluidInput.setGORRange(80.0, 350.0, 5); // min, max, count\n",
739739
"fluidInput.setWaterCutRange(0.0, 0.6, 4); // min, max, count\n",
740740
"\n",
741741
"// 2. Define process factory (well model)\n",
742-
"ProcessFactory wellFactory = (fluid, rate) -> {\n",
742+
"Supplier<ProcessSystem> wellFactory = () -> {\n",
743743
" ProcessSystem process = new ProcessSystem();\n",
744744
" \n",
745+
" SystemInterface fluid = referenceFluid.clone();\n",
745746
" Stream wellhead = new Stream(\"wellhead\", fluid);\n",
746-
" wellhead.setFlowRate(rate, \"m3/hr\");\n",
747+
" wellhead.setFlowRate(100.0, \"m3/hr\");\n",
747748
" process.add(wellhead);\n",
748749
" \n",
749750
" AdiabaticPipe tubing = new AdiabaticPipe(\"tubing\", wellhead);\n",
@@ -772,8 +773,8 @@
772773
" VFPTable table = vfpGen.generateVFPTable();\n",
773774
" vfpGen.exportVFPEXP(\"WELL_A_VFP.inc\", 1);\n",
774775
" \n",
775-
" double coverage = 100.0 * table.getFeasibleCount() / table.getTotalCount();\n",
776-
" System.out.println(\"Feasible: \" + table.getFeasibleCount() + \" / \" + table.getTotalCount());\n",
776+
" double coverage = 100.0 * table.getFeasibleCount() / table.getTotalPoints();\n",
777+
" System.out.println(\"Feasible: \" + table.getFeasibleCount() + \" / \" + table.getTotalPoints());\n",
777778
" System.out.println(\"Coverage: \" + String.format(\"%.1f\", coverage) + \"%\");\n",
778779
" \n",
779780
" if (coverage < 50.0) {\n",
@@ -841,4 +842,4 @@
841842
},
842843
"nbformat": 4,
843844
"nbformat_minor": 5
844-
}
845+
}

docs/examples/MultiScenarioVFP_Tutorial.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,16 +613,17 @@ java_example = '''
613613
import neqsim.process.util.optimizer.*;
614614
615615
// 1. Create fluid input (using convenience methods)
616-
FluidMagicInput fluidInput = FluidMagicInput.fromFluid(referenceFluid, 120.0, 0.0);
616+
FluidMagicInput fluidInput = FluidMagicInput.fromFluid(referenceFluid);
617617
fluidInput.setGORRange(80.0, 350.0, 5); // min, max, count
618618
fluidInput.setWaterCutRange(0.0, 0.6, 4); // min, max, count
619619
620-
// 2. Define process factory (well model)
621-
ProcessFactory wellFactory = (fluid, rate) -> {
620+
// 2. Define process supplier (well model)
621+
// VFP generator replaces the feed fluid and rate for each point
622+
Supplier<ProcessSystem> wellFactory = () -> {
622623
ProcessSystem process = new ProcessSystem();
623-
624+
SystemInterface fluid = referenceFluid.clone();
624625
Stream wellhead = new Stream("wellhead", fluid);
625-
wellhead.setFlowRate(rate, "m3/hr");
626+
wellhead.setFlowRate(100.0, "m3/hr");
626627
process.add(wellhead);
627628
628629
AdiabaticPipe tubing = new AdiabaticPipe("tubing", wellhead);
@@ -651,8 +652,8 @@ try {
651652
VFPTable table = vfpGen.generateVFPTable();
652653
vfpGen.exportVFPEXP("WELL_A_VFP.inc", 1);
653654
654-
double coverage = 100.0 * table.getFeasibleCount() / table.getTotalCount();
655-
System.out.println("Feasible: " + table.getFeasibleCount() + " / " + table.getTotalCount());
655+
double coverage = 100.0 * table.getFeasibleCount() / table.getTotalPoints();
656+
System.out.println("Feasible: " + table.getFeasibleCount() + " / " + table.getTotalPoints());
656657
System.out.println("Coverage: " + String.format("%.1f", coverage) + "%");
657658
658659
if (coverage < 50.0) {

0 commit comments

Comments
 (0)