@@ -92,7 +92,7 @@ pipe = TwoFluidPipe("Flowline", inlet_stream)
9292pipe.setLength(20000 )
9393pipe.setDiameter(0.25 )
9494pipe.setNumberOfSections(100 ) # Computational cells
95- pipe.setOuterTemperature( 278.15 ) # 5°C ambient
95+ pipe.setOuterTemperatures([ 278.15 ] ) # 5°C ambient (array)
9696
9797process.add(pipe)
9898process.run()
@@ -263,7 +263,7 @@ time = 0.0
263263while 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)
343343pipe.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
350349elevations = []
@@ -363,12 +362,12 @@ pipe.run()
363362run_id = str (uuid.uuid4())
364363for 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
463462elevations = []
464463for 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
487486pipe.setElevationProfile(elevations)
@@ -518,7 +517,7 @@ process.add(section1)
518517
519518# Section 2: Reduced diameter spur
520519section2 = TwoFluidPipe(" Spur Line" , section1.getOutletStream())
521- section2.setLength(8000 ) # 8 km
520+ section2.setLength(8000 ) # 8 km
522521section2.setDiameter(0.25 ) # 250 mm
523522section2.setNumberOfSections(80 )
524523process.add(section2)
@@ -566,8 +565,8 @@ pipe.setLength(30000)
566565pipe.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
572571process.add(pipe)
573572process.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}")
653652pipe = TwoFluidPipe(" Slugging Line" , inlet_stream)
654653pipe.setLength(5000 )
655654pipe.setDiameter(0.15 )
656- pipe.setNumberOfNodes (200 )
655+ pipe.setNumberOfSections (200 )
657656
658657process.add(pipe)
659658process.run()
@@ -701,7 +700,7 @@ flowline1.setLength(5000)
701700flowline1.setDiameter(0.2 )
702701process.add(flowline1)
703702
704- # Well 2 stream
703+ # Well 2 stream
705704well2 = Stream(" Well-2" , fluid2)
706705well2.setFlowRate(20000 , " kg/hr" )
707706process.add(well2)
0 commit comments