Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/CI_FAModel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ jobs:
- name: Overwrite MoorPy
run: |
pip install git+https://github.com/NREL/MoorPy@dev

- name: Example run
run: |
cd examples
python example_driver.py false


- name: Test run
run: |
cd tests
pytest .

# - name: Example run
# run: |
# cd examples
# python example_driver.py false



2 changes: 1 addition & 1 deletion examples/01_Visualization/05_visual_lease_boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import matplotlib.pyplot as plt

# define name of ontology input file
input_file = '06_visual_lease_boundaries.yaml'
input_file = '05_visual_lease_boundaries.yaml'

# initialize Project class with input file, we don't need RAFT for this so mark False
project = Project(file=input_file,raft=False)
Expand Down
2 changes: 1 addition & 1 deletion examples/01_Visualization/07_3D-visual_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import matplotlib.pyplot as plt

# define name of ontology input file
input_file = '07_3D-visual_platform.yaml'
input_file = 'examples/01_Visualization/07_3D-visual_platform.yaml'

# initialize Project class with input file, we don't need RAFT for this so mark False
project = Project(file=input_file,raft=True)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

from anchor_map import Anchor
from famodel.anchors.anchor import Anchor

# --- Soil profile for helical pile in clay ---
profile_map = [
{
'name': 'CPT_H1',
'x': 0.0, 'y': 0.0,
'layers': [
{'top': 1.0, 'bottom': 3.0, 'soil_type': 'clay', 'gamma_top': 8.0, 'gamma_bot': 9.0, 'Su_top': 60, 'Su_bot': 50},
{'top': 3.0, 'bottom': 7.0, 'soil_type': 'clay', 'gamma_top': 15.0, 'gamma_bot': 25.0, 'Su_top': 100, 'Su_bot': 150},
{'top': 7.0, 'bottom': 15.0, 'soil_type': 'clay', 'gamma_top': 25.0, 'gamma_bot': 50.0, 'Su_top': 200, 'Su_bot': 400}
{'top': 1.0, 'bottom': 3.0, 'soil_type': 'clay', 'gamma_top': 8.0, 'gamma_bot': 9.0, 'Su_top': 60, 'Su_bot': 50},
{'top': 3.0, 'bottom': 7.0, 'soil_type': 'clay', 'gamma_top': 15.0, 'gamma_bot': 25.0, 'Su_top': 100, 'Su_bot': 150},
{'top': 7.0, 'bottom': 25.0, 'soil_type': 'clay', 'gamma_top': 25.0, 'gamma_bot': 50.0, 'Su_top': 200, 'Su_bot': 400}
]
}
]
Expand Down Expand Up @@ -63,9 +63,21 @@
line_type = anchor.line_type,
d = anchor.d,
w = anchor.w,
plot = True
plot = False
)

print('\nCapacity Results:')
for key, val in anchor.capacity_results.items():
for key, val in anchor.anchorCapacity.items():
print(f'{key}: {val:.2f}')

# --- Step 3: Optimize Anchor Geometry ---
anchor.getSizeAnchor(
geom = [anchor.dd['design']['L'], anchor.dd['design']['D']],
geomKeys = ['L', 'D'],
geomBounds = [(6.0, 25.0), (0.5, 2.0)],
loads = None,
lambdap_con = [6, 15],
zlug_fix = True,
safety_factor = {'SF_horizontal': 1, 'SF_vertical': 1},
plot = False
)
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

from anchor_map import Anchor
from famodel.anchors.anchor import Anchor

# --- Define soil profile ---
profile_map = [
{
'name': 'CPT_D1',
'x': 0.0, 'y': 0.0,
'layers': [
{'top': 1.0, 'bottom': 6.0, 'soil_type': 'clay', 'gamma_top': 9.0, 'gamma_bot': 10.0, 'Su_top': 45, 'Su_bot': 60},
{'top': 6.0, 'bottom': 15.0, 'soil_type': 'clay', 'gamma_top': 10.0, 'gamma_bot': 10.0, 'Su_top': 60, 'Su_bot': 80},
{'top': 15.0, 'bottom': 35.0, 'soil_type': 'clay', 'gamma_top': 10.0, 'gamma_bot': 10.5, 'Su_top': 80, 'Su_bot': 100}
{'top': 1.0, 'bottom': 6.0, 'soil_type': 'clay', 'gamma_top': 9.0, 'gamma_bot': 10.0, 'Su_top': 25, 'Su_bot': 40},
{'top': 6.0, 'bottom': 15.0, 'soil_type': 'clay', 'gamma_top': 10.0, 'gamma_bot': 10.0, 'Su_top': 80, 'Su_bot': 100},
{'top': 15.0, 'bottom': 35.0, 'soil_type': 'clay', 'gamma_top': 10.0, 'gamma_bot': 10.5, 'Su_top': 100, 'Su_bot': 100}
]
}
]
Expand All @@ -19,18 +19,18 @@
dd = {
'type': 'driven',
'design': {
'L': 25.0, # Embedded length
'D': 2.0, # Diameter
'zlug': 10.0 # Padeye depth
'L': 15.0, # Embedded length
'D': 1.75, # Diameter
'zlug': 3.0 # Padeye depth
}
},
r = [0.0, 0.0, 0.0]
)

# Assign mooring loads
anchor.loads = {
'Hm': 4.0e6,
'Vm': 2.5e6
'Hm': 8.0e5,
'Vm': 2.5e5
}
anchor.line_type = 'chain'
anchor.d = 0.16
Expand Down Expand Up @@ -66,5 +66,17 @@
)

print('\nCapacity Results:')
for key, val in anchor.capacity_results.items():
for key, val in anchor.anchorCapacity.items():
print(f'{key}: {val:.2f}')

# --- Step 3: Optimize Anchor Geometry ---
anchor.getSizeAnchor(
geom = [anchor.dd['design']['L'], anchor.dd['design']['D']],
geomKeys = ['L', 'D'],
geomBounds = [(2.0, 70.0), (0.25, 3.0)],
loads = None,
lambdap_con = [4, 50],
zlug_fix = True,
safety_factor = {'SF_horizontal': 1, 'SF_vertical': 1},
plot = True
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

from anchor_map import Anchor
import numpy as np
from famodel.anchors.anchors_famodel_map.capacity_plots_map import plot_load
from famodel.anchors.anchor import Anchor
from famodel.anchors.anchors_famodel.support_plots import plot_load

# --- Define soil profile ---
profile_map = [
Expand All @@ -10,7 +9,7 @@
'x': 0.0, 'y': 0.0,
'layers': [
{'top': 2.0, 'bottom': 4.0, 'soil_type': 'clay', 'gamma_top': 8.0, 'gamma_bot': 8.5, 'Su_top': 10, 'Su_bot': 25},
{'top': 4.0, 'bottom': 6.0, 'soil_type': 'clay', 'gamma_top': 8.5, 'gamma_bot': 9.0, 'Su_top': 25, 'Su_bot': 50},
{'top': 4.0, 'bottom': 6.0, 'soil_type': 'clay', 'gamma_top': 8.5, 'gamma_bot': 9.0, 'Su_top': 15, 'Su_bot': 40},
{'top': 6.0, 'bottom': 16.0, 'soil_type': 'clay', 'gamma_top': 9.0, 'gamma_bot': 9.5, 'Su_top': 50, 'Su_bot': 100},
{'top': 16.0, 'bottom': 25.0, 'soil_type': 'clay', 'gamma_top': 9.5, 'gamma_bot': 9.5, 'Su_top': 100, 'Su_bot': 100}
]
Expand All @@ -19,14 +18,14 @@

# --- Create plate anchor ---
anchor = Anchor(
dd = {'type': 'plate', 'design': {'B': 3.0, 'L': 6.0, 'zlug': 5.0, 'beta': 30.0}},
dd = {'type': 'plate', 'design': {'B': 3.0, 'L': 6.0, 'zlug': 14.0, 'beta': 30.0}},
r = [100.0, 100.0, 0.0]
)

# --- Assign load and mooring properties ---
anchor.loads = {
'Hm': 2.5e6,
'Vm': 1.5e6
'Hm': 3.5e6,
'Vm': 2.5e6
}
anchor.line_type = 'chain'
anchor.d = 0.16
Expand Down Expand Up @@ -62,5 +61,17 @@
)

print('\nCapacity Results:')
for key, value in anchor.capacity_results.items():
for key, value in anchor.anchorCapacity.items():
print(f'{key}: {value:.2f}')

# --- Step 3: Optimize Anchor Geometry ---
anchor.getSizeAnchor(
geom = [anchor.dd['design']['B'], anchor.dd['design']['L']],
geomKeys = ['B', 'L'],
geomBounds = [(0.5, 6.0), (2.0, 12.0)],
loads = None,
lambdap_con = [2, 4], # less critical for plates
zlug_fix = True,
safety_factor = {'SF_combined': 3},
plot = True
)
69 changes: 69 additions & 0 deletions examples/05_Anchors/anchor_soil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

import sys
sys.path.append(r'C:\Code\FAModel_anchors\famodel')

from project import Project
from anchors.anchor import Anchor

# Step 1: Initialize and load soil
proj = Project()
proj.loadSoil(
filename='inputs/GulfOfMaine_soil_layered_100x100.txt',
soil_mode='layered',
profile_source='inputs/GulfOfMaine_soil_profiles.yaml')

for label, props in proj.soilProps.items():
print(f"{label}: {props}")

# Step 2: Create and register an anchor at a known position in the grid
anchor = Anchor(
dd = {'type': 'suction', 'design': {'D': 2.5, 'L': 15.0, 'zlug': 10.67}},
r = [54.0, -4450.0, 0.0])

# Step 3: Assign local soil profile from project (nearest neighbor lookup)
soil_id, soil_profile = proj.getSoilAtLocation(anchor.r[0], anchor.r[1])
anchor.soilProps = {soil_id: soil_profile}
anchor.setSoilProfile([{ 'name': soil_id, 'layers': soil_profile }]) # ensures `anchor.soil_profile` is set

# Step 4: Assign loads and line
anchor.loads = {'Hm': 2e6, 'Vm': 1.5e6}
anchor.line_type = 'chain'
anchor.d = 0.16
anchor.w = 5000.0

# Step 5: Run capacity check and optimization
anchor.getLugForces(
Hm=anchor.loads['Hm'], Vm=anchor.loads['Vm'],
zlug = anchor.dd['design']['zlug'],
d=anchor.d, w=anchor.w,
plot=True)

anchor.getCapacityAnchor(
Hm=anchor.loads['Hm'], Vm=anchor.loads['Vm'],
zlug = anchor.dd['design']['zlug'],
line_type=anchor.line_type, d=anchor.d, w=anchor.w,
mass_update=True,
plot=True)
anchor.getCostAnchor()
print(f'Material cost: {anchor.cost["Material cost"]:.2f} USD [2024]')

results = anchor.getSizeAnchor_gradient(
geom=[anchor.dd['design']['L'], anchor.dd['design']['D']],
geomKeys= ['L','D'],
geomBounds=[(12.0, 18.0), (1.5, 3.5)],
safety_factor={'SF_combined': 1},
zlug_fix=False,
lambdap_con=[4, 6],
step_size=0.2,
tol=0.05,
max_iter=30,
verbose=True)

# Step 6: Report
print('\nFinal Optimized Anchor:')
print('Design:', anchor.dd['design'])
print('Capacity Results:', anchor.anchorCapacity)
anchor.getCostAnchor()
print(f'Material cost: {anchor.cost["Material cost"]:.2f} USD [2024]')


Loading
Loading