Skip to content

Commit 39fb4fe

Browse files
authored
fix doc (#1933)
1 parent 4d98585 commit 39fb4fe

22 files changed

+443
-428
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ gas.setMixingRule("classic");
2626
// Perform flash calculation
2727
ThermodynamicOperations ops = new ThermodynamicOperations(gas);
2828
ops.TPflash();
29+
gas.initProperties();
2930

3031
// Get properties
3132
System.out.println("Density: " + gas.getDensity("kg/m3") + " kg/m³");

docs/cookbook/pipeline-recipes.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pipe = TwoFluidPipe("Flowline", inlet_stream)
9292
pipe.setLength(20000)
9393
pipe.setDiameter(0.25)
9494
pipe.setNumberOfSections(100) # Computational cells
95-
pipe.setOuterTemperature(278.15) # 5°C ambient
95+
pipe.setOuterTemperatures([278.15]) # 5°C ambient (array)
9696

9797
process.add(pipe)
9898
process.run()
@@ -263,7 +263,7 @@ time = 0.0
263263
while time < t_end:
264264
pipe.runTransient(dt, run_id)
265265
time += dt
266-
266+
267267
# Ramp up flow rate after 60 seconds
268268
if time > 60.0:
269269
inlet.setFlowRate(25.0, "kg/sec")
@@ -343,8 +343,7 @@ pipe.setDiameter(0.15) # 150 mm (promotes slugging)
343343
pipe.setNumberOfSections(400) # Fine grid for slug resolution
344344

345345
# Enable Lagrangian slug tracking
346-
pipe.enableSlugTracking(True)
347-
pipe.setSlugDetectionThreshold(0.7) # Holdup threshold for slug
346+
pipe.setEnableSlugTracking(True)
348347

349348
# Set terrain to promote terrain-induced slugging
350349
elevations = []
@@ -363,12 +362,12 @@ pipe.run()
363362
run_id = str(uuid.uuid4())
364363
for step in range(600): # 5 minutes @ 0.5s steps
365364
pipe.runTransient(0.5, run_id)
366-
365+
367366
# Monitor slugs every 30 seconds
368367
if step % 60 == 0:
369-
slug_count = pipe.getSlugCount()
370-
avg_slug_length = pipe.getAverageSlugLength()
371-
slug_frequency = pipe.getSlugFrequency()
368+
slug_count = pipe.getSlugTracker().getSlugCount()
369+
avg_slug_length = pipe.getSlugTracker().getAverageSlugLength()
370+
slug_frequency = pipe.getSlugTracker().getSlugFrequency()
372371
print(f"Time: {step*0.5:.0f}s - Slugs: {slug_count}, "
373372
f"Avg length: {avg_slug_length:.1f}m, "
374373
f"Frequency: {slug_frequency:.3f} Hz")
@@ -463,25 +462,25 @@ dx = 25000 / num_sections
463462
elevations = []
464463
for i in range(num_sections):
465464
x = i * dx
466-
465+
467466
# Start at platform (-50m), descend to seabed, undulations, rise to FPSO
468-
467+
469468
# Riser down (0-500m)
470469
if x < 500:
471470
elev = -50 - (x / 500) * 300 # Descend 300m
472-
471+
473472
# Seabed section with undulations (500m - 24000m)
474473
elif x < 24000:
475474
base = -350 # Base seabed depth
476475
# Add hills and valleys
477476
undulation = 20 * math.sin(x / 2000 * 2 * math.pi) # ±20m
478477
valley = -40 * math.exp(-((x - 12000) / 3000)**2) # Deep valley mid-pipe
479478
elev = base + undulation + valley
480-
479+
481480
# Riser up (24000m - 25000m)
482481
else:
483482
elev = -350 + ((x - 24000) / 1000) * 340 # Rise to -10m
484-
483+
485484
elevations.append(elev)
486485

487486
pipe.setElevationProfile(elevations)
@@ -518,7 +517,7 @@ process.add(section1)
518517

519518
# Section 2: Reduced diameter spur
520519
section2 = TwoFluidPipe("Spur Line", section1.getOutletStream())
521-
section2.setLength(8000) # 8 km
520+
section2.setLength(8000) # 8 km
522521
section2.setDiameter(0.25) # 250 mm
523522
section2.setNumberOfSections(80)
524523
process.add(section2)
@@ -566,8 +565,8 @@ pipe.setLength(30000)
566565
pipe.setDiameter(0.3)
567566

568567
# Heat transfer
569-
pipe.setOuterTemperature(277.15) # 4°C seawater
570-
pipe.setPipeHeatTransferCoefficient(10.0) # W/m²K (overall U-value)
568+
pipe.setConstantSurfaceTemperature(4.0, "C") # 4°C seawater
569+
pipe.setHeatTransferCoefficient(10.0) # W/m²K (overall U-value)
571570

572571
process.add(pipe)
573572
process.run()
@@ -581,14 +580,14 @@ print(f"Temperature drop: {inlet_T - outlet_T:.1f} °C")
581580

582581
```python
583582
# Higher insulation = lower U-value
584-
pipe.setPipeHeatTransferCoefficient(2.0) # W/m²K (well insulated)
583+
pipe.setHeatTransferCoefficient(2.0) # W/m²K (well insulated)
585584
```
586585

587586
### Buried Pipeline
588587

589588
```python
590-
pipe.setOuterTemperature(283.15) # 10°C soil temperature
591-
pipe.setPipeHeatTransferCoefficient(5.0) # W/m²K (buried)
589+
pipe.setConstantSurfaceTemperature(10.0, "C") # 10°C soil temperature
590+
pipe.setHeatTransferCoefficient(5.0) # W/m²K (buried)
592591
```
593592

594593
---
@@ -653,7 +652,7 @@ print(f"Flow regime: {flow_pattern}")
653652
pipe = TwoFluidPipe("Slugging Line", inlet_stream)
654653
pipe.setLength(5000)
655654
pipe.setDiameter(0.15)
656-
pipe.setNumberOfNodes(200)
655+
pipe.setNumberOfSections(200)
657656

658657
process.add(pipe)
659658
process.run()
@@ -701,7 +700,7 @@ flowline1.setLength(5000)
701700
flowline1.setDiameter(0.2)
702701
process.add(flowline1)
703702

704-
# Well 2 stream
703+
# Well 2 stream
705704
well2 = Stream("Well-2", fluid2)
706705
well2.setFlowRate(20000, "kg/hr")
707706
process.add(well2)

docs/cookbook/process-recipes.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,10 @@ process.run()
333333
```python
334334
Adjuster = jneqsim.process.equipment.util.Adjuster
335335

336-
# Adjust compressor outlet pressure to achieve target flow
336+
# Adjust compressor outlet pressure to achieve target gas volume flow
337337
adjuster = Adjuster("Adjust-1")
338-
adjuster.setAdjustedVariable(compressor, "outlet pressure")
339-
adjuster.setTargetVariable(outlet_stream, "flow rate", "kg/hr")
340-
adjuster.setTargetValue(5000) # Target 5000 kg/hr
338+
adjuster.setAdjustedVariable(compressor, "pressure", "bara")
339+
adjuster.setTargetVariable(outlet_stream, "gasVolumeFlow", 5000.0, "Am3/hr")
341340
adjuster.setTolerance(1e-4)
342341
process.add(adjuster)
343342

docs/cookbook/thermodynamics-recipes.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ print(f"Phases: {fluid.getNumberOfPhases()}")
100100
fluid.initProperties()
101101
H_initial = fluid.getEnthalpy("J")
102102

103-
# Change pressure, calculate new T
104-
new_pressure = 30.0 # bara
105-
ops.PHflash(new_pressure * 1e5, H_initial) # P in Pa!
103+
# Set new pressure, then flash at constant enthalpy
104+
fluid.setPressure(30.0, "bara")
105+
ops.PHflash(H_initial)
106106

107107
print(f"New temperature: {fluid.getTemperature() - 273.15:.2f} °C")
108108
```
@@ -114,9 +114,9 @@ print(f"New temperature: {fluid.getTemperature() - 273.15:.2f} °C")
114114
fluid.initProperties()
115115
S_initial = fluid.getEntropy("J/K")
116116

117-
# Isentropic expansion
118-
new_pressure = 20.0 # bara
119-
ops.PSflash(new_pressure * 1e5, S_initial)
117+
# Set new pressure, then flash at constant entropy
118+
fluid.setPressure(20.0, "bara")
119+
ops.PSflash(S_initial)
120120

121121
print(f"New temperature: {fluid.getTemperature() - 273.15:.2f} °C")
122122
```
@@ -186,7 +186,7 @@ for i in range(fluid.getNumberOfComponents()):
186186
comp = fluid.getComponent(i)
187187
name = str(comp.getComponentName())
188188
z = comp.getz() # Overall mole fraction
189-
189+
190190
print(f"{name}: z={z:.4f}, Tc={comp.getTC():.1f} K, Pc={comp.getPC():.1f} bara")
191191
```
192192

@@ -257,8 +257,8 @@ print(f"Cricondentherm: {cricondentherm_T:.2f} °C at {cricondentherm_P:.2f} bar
257257
| **Heavy oil** | PR or CPA | `SystemPrEos`, `SystemSrkCPAstatoil` |
258258
| **CO₂ systems** | CPA | `SystemSrkCPAstatoil` |
259259
| **CO₂ + water** | CPA or Electrolyte-CPA | `SystemSrkCPAstatoil` |
260-
| **Natural gas (custody)** | GERG-2008 | `SystemGERG2008` |
261-
| **LNG** | GERG-2008 or PR | `SystemGERG2008`, `SystemPrEos` |
260+
| **Natural gas (custody)** | GERG-2008 | `SystemGERG2008Eos` |
261+
| **LNG** | GERG-2008 or PR | `SystemGERG2008Eos`, `SystemPrEos` |
262262
| **Aqueous systems** | CPA | `SystemSrkCPAstatoil` |
263263
| **Electrolytes** | Electrolyte-CPA | See electrolyte guide |
264264

@@ -277,7 +277,7 @@ fluid = jneqsim.thermo.system.SystemPrEos(T, P)
277277
fluid = jneqsim.thermo.system.SystemSrkCPAstatoil(T, P)
278278

279279
# For custody transfer (natural gas)
280-
fluid = jneqsim.thermo.system.SystemGERG2008(T, P)
280+
fluid = jneqsim.thermo.system.SystemGERG2008Eos(T, P)
281281
```
282282

283283
---
@@ -290,9 +290,6 @@ fluid = jneqsim.thermo.system.SystemGERG2008(T, P)
290290
# Full fluid state as JSON
291291
json_str = fluid.toJson()
292292
print(json_str)
293-
294-
# Component-specific JSON
295-
comp_json = fluid.getComponent(0).toJson()
296293
```
297294

298295
### Export to Python Dictionary

docs/development/CODE_PATTERNS.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ ops.PSflash(entropy);
120120

121121
// Phase envelope
122122
ops.calcPTphaseEnvelope();
123-
double[][] phaseEnvelope = ops.get2phaseTVPdata();
123+
double[] dewT = ops.get("dewT");
124+
double[] dewP = ops.get("dewP");
125+
double[] bubT = ops.get("bubT");
126+
double[] bubP = ops.get("bubP");
124127
```
125128

126129
---
@@ -414,11 +417,10 @@ process.add(recycle);
414417
### Adjuster (Match a Spec)
415418

416419
```java
417-
// Adjust one variable to match a target
418-
Adjuster adj = new Adjuster("water dew point adj");
419-
adj.setAdjustedVariable(tegStream, "flow rate", "kg/hr"); // what to vary
420-
adj.setTargetVariable(gasOut, "waterDewPointTemperature", "C"); // what to match
421-
adj.setTargetValue(-18.0); // target value
420+
// Adjust flow to match a target outlet pressure
421+
Adjuster adj = new Adjuster("pressure adj");
422+
adj.setAdjustedVariable(stream1, "flow", "MSm3/day"); // what to vary
423+
adj.setTargetVariable(outletStream, "pressure", 50.0, "bara"); // target spec
422424
adj.setMaxAdjustmentSteps(50);
423425
process.add(adj);
424426
```

docs/development/TASK_SOLVING_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ fluid.addComponent("methane", 1.0);
255255
fluid.setMixingRule("classic");
256256
ThermodynamicOperations ops = new ThermodynamicOperations(fluid);
257257
ops.TPflash();
258-
fluid.init(3);
258+
fluid.initProperties();
259259
System.out.println("Density: " + fluid.getDensity("kg/m3"));
260260
```
261261

0 commit comments

Comments
 (0)