Skip to content

Commit b808038

Browse files
author
Moreno
committed
Modifications in anchor class to include mass_update flag and minor capacity model examples updates
1 parent 8efe33f commit b808038

File tree

4 files changed

+23
-16
lines changed

4 files changed

+23
-16
lines changed

famodel/anchors/anchor.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -634,20 +634,18 @@ def getCapacityAnchor(self, Hm, Vm, zlug, line_type=None, d=None, w=None, mass_u
634634
self.anchorCapacity['Rotational displacement'] = results['Rotational displacement']
635635

636636
# Weight calculated via dimensions
637-
if mass_update == False:
637+
if not mass_update:
638638
if 'Weight pile' in results:
639639
self.anchorCapacity['Weight pile'] = results['Weight pile']
640640
if 'Weight plate' in results:
641641
self.anchorCapacity['Weight plate'] = results['Weight plate']
642642
else:
643643
if 'Weight pile' in results:
644-
if self.mass is None:
645-
self.mass = results['Weight pile']/self.g
646-
self.anchorCapacity['Weight pile'] = self.mass*self.g
644+
self.mass = results['Weight pile']/self.g
645+
self.anchorCapacity['Weight pile'] = results['Weight pile']
647646
if 'Weight plate' in results:
648-
if self.mass is None:
649-
self.mass = results['Weight plate']/self.g
650-
self.anchorCapacity['Weight plate'] = self.mass*self.g
647+
self.mass = results['Weight plate']/self.g
648+
self.anchorCapacity['Weight plate'] = results['Weight plate']
651649

652650
# print(f"[DEBUG] Stored Lateral displacement in anchorCapacity: {self.anchorCapacity['Lateral displacement']:.6f}")
653651

@@ -1312,9 +1310,17 @@ def getSafetyFactor(self):
13121310

13131311
return {'SF_combined': SF}
13141312

1315-
def getCostAnchor(self, ms=None):
1313+
def getCostAnchor(self, ms=None, mass_update=True):
13161314
'''
13171315
Assign material cost using a Point object and getCost_and_MBL().
1316+
1317+
Parameters
1318+
----------
1319+
ms : MoorPy System, optional
1320+
The mooring system to which the anchor point belongs. If None, a new one is created.
1321+
mass_update : bool, optional
1322+
If True, update mpAnchor mass from self.mass.
1323+
If False, preserve existing mpAnchor.m if already set.
13181324
'''
13191325

13201326
# Create or use existing MoorPy system
@@ -1324,12 +1330,12 @@ def getCostAnchor(self, ms=None):
13241330
# Create MoorPy Point using makeMoorPyAnchor
13251331
self.makeMoorPyAnchor(ms)
13261332

1327-
# Check if mass is assigned
1328-
if self.mass is None:
1333+
# Assign self.mass if missing
1334+
if self.mass is None or mass_update:
13291335
if 'Weight pile' in self.anchorCapacity:
1330-
self.mass = self.anchorCapacity['Weight pile'] / self.g
1336+
self.mass = self.anchorCapacity['Weight pile']/self.g
13311337
elif 'Weight plate' in self.anchorCapacity:
1332-
self.mass = self.anchorCapacity['Weight plate'] / self.g
1338+
self.mass = self.anchorCapacity['Weight plate']/self.g
13331339
else:
13341340
raise KeyError("Missing 'Weight pile' or 'Weight plate' in anchorCapacity. \
13351341
Run getCapacityAnchor() before getCostAnchor(), or define self.mass explicitly.")

famodel/anchors/anchors_famodel/capacity_dandg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def PileWeight(Len, Dia, tw, rho):
220220
Ha = 5.0e6 # Horizontal load (N)
221221
Va = 3.0e5 # Vertical load (N)
222222

223-
layers, y, z, results = getCapacityDandG(profile_map, 'CPT_rock_1', L, D, zlug, Ha, Va, plot=True)
223+
layers, y, z, results = getCapacityDandG(profile_map, 'CPT_rock_1', L, D, zlug, Ha, Va, plot=True, display=0)
224224

225225
print('\n--- Results for DandG Pile in Layered Rock ---')
226226
for key, val in results.items():

famodel/anchors/anchors_famodel/capacity_load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def getTransferLoad(profile_map, Tm, thetam, zlug, line_type, d, w=None, plot=Fa
203203
d = 0.25 # Chain diameter (m)
204204
w = 5000 # Line weight (N/m)
205205

206-
layers, resultsLoad = getTransferLoad(profile_map, Tm, thetam, zlug, line_type, d, w, plot=True)
206+
layers, resultsLoad = getTransferLoad(profile_map, Tm, thetam, zlug, line_type, d, w, plot=True, display=1)
207207

208208
plot_load(layers, resultsLoad['drag_values'], resultsLoad['depth_values'],
209209
resultsLoad['Tm'], resultsLoad['thetam'], resultsLoad['Ta'],

famodel/anchors/anchors_famodel/capacity_suction.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def vertical_cross(H, M, H_target):
504504
zlug = (2/3)*L # Lug depth (m)
505505
theta = 5 # Tilt misalignment angle (deg)
506506
psi = 7.5 # Twist misalignment angle (deg)
507-
Ha = 1e6 # Applied horizontal load (N)
507+
Ha = 1e6 # Applied horizontal load (N)
508508
Va = 5.7e6 # Applied vertical load (N)
509509

510510
# Calculate
@@ -513,7 +513,8 @@ def vertical_cross(H, M, H_target):
513513
D, L, zlug, # Pile geometrical properties
514514
Ha, Va, # Pile loading conditions
515515
thetalug=theta, psilug=psi, # Pile misaligment tolerances
516-
plot=False
516+
plot=True,
517+
display=1
517518
)
518519

519520
# print('\n--- Suction Pile Capacity Results ---')

0 commit comments

Comments
 (0)