Skip to content

Commit

Permalink
Merge pull request #64 from WISDEM/rc-1.3.1
Browse files Browse the repository at this point in the history
RAFT v1.3.1
  • Loading branch information
lucas-carmo authored Sep 25, 2024
2 parents f3f9db1 + 6337880 commit e69d755
Show file tree
Hide file tree
Showing 10 changed files with 549 additions and 469 deletions.
2 changes: 1 addition & 1 deletion designs/FOCTT_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ turbine:
Rhub : 1.25 # hub radius [m]
precone : 4.0 # [deg]
shaft_tilt : 6.0 # [deg]
overhang : 2 # [m]
overhang : -2 # [m]
aeroServoMod : 2 # 0 aerodynamics off; 1 aerodynamics on (no control); 2 aerodynamics and control on


Expand Down
2 changes: 1 addition & 1 deletion designs/OC3spar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ turbine:
Rhub : 1.5 # hub radius [m]
precone : 2.5 # [rad]
shaft_tilt : 5.0 # [rad]
overhang : 5.0 # [m]
overhang : -5.0 # [m]
aeroServoMod : 1 # 0 aerodynamics off; 1 aerodynamics on (no control); 2 aerodynamics and control on

env:
Expand Down
2 changes: 1 addition & 1 deletion designs/OC4semi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ turbine:
Rhub : 1.5 # hub radius [m]
precone : 2.5 # [rad]
shaft_tilt : 5.0 # [rad]
overhang : 5.0 # [m]
overhang : -5.0 # [m]
aeroServoMod : 1 # 0 aerodynamics off; 1 aerodynamics on (no control); 2 aerodynamics and control on

env:
Expand Down
797 changes: 410 additions & 387 deletions designs/RM1_Floating.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion designs/VolturnUS-S.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ turbine:
Rhub : 3.97 # hub radius [m]
precone : 4.0 # [deg]
shaft_tilt : 6.0 # [deg]
overhang : 12.0313 # [m]
overhang : -12.0313 # [m]
aeroServoMod : 2 # 0 aerodynamics off; 1 aerodynamics on (no control); 2 aerodynamics and control on

blade:
Expand Down
2 changes: 1 addition & 1 deletion designs/VolturnUS-S_farm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ turbine:
Rhub : 3.97 # hub radius [m]
precone : 4.0 # [deg]
shaft_tilt : 6.0 # [deg]
overhang : 12.0313 # [m]
overhang : -12.0313 # [m]
aeroServoMod : 2 # 0 aerodynamics off; 1 aerodynamics on (no control); 2 aerodynamics and control on

blade:
Expand Down
168 changes: 102 additions & 66 deletions raft/raft_fowt.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion raft/raft_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def __init__(self, mi, nw, BEM=[], heading=0):
if (self.rA0[2] == 0 or self.rB0[2] == 0) and self.type != 3:
raise ValueError("RAFT Members cannot start or end on the waterplane")
if self.rB0[2] < self.rA0[2]:
raise ValueError(f"The z position of rA is {self.rA0[2]}, and the z position of rB is {self.rB0[2]}. RAFT Members must have their rA position below the rB position. Try changing your input design yaml rA/rB values.")
print(f"The z position of rA is {self.rA0[2]}, and the z position of rB is {self.rB0[2]}. RAFT Members can have trouble when their rA position is below the rB position. Switching rA and rB now.")
self.rA0 = np.array(mi['rB'], dtype=np.double)
self.rB0 = np.array(mi['rA'], dtype=np.double)

shape = str(mi['shape']) # the shape of the cross section of the member as a string (the first letter should be c or r)

Expand Down
26 changes: 20 additions & 6 deletions raft/raft_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,12 @@ def __init__(self, design, nTurbines=1):

self.design = design # save design dictionary for possible later use/reference


# Set mooring current modeling mode (0: no current; 1: uniform current included in MoorPy)
self.mooring_currentMod = getFromDict(design['mooring'], 'currentMod', default=0, dtype=int)

# Initialize array-level mooring system if it exists
if self.ms:
self.ms.initialize()
#>>> initialize all the mooring systems?

self.results = {} # dictionary to hold all results from the model

Expand Down Expand Up @@ -553,17 +555,29 @@ def solveStatics(self, case, display=0):

if display > 1: print(" F_env_constant"+" ".join(["{:+8.2e}"]*6).format(*F_env_constant[6*i:6*i+6]))

# preliminary approach to provide uniform currents on the mooring system(s)
currentMod = 0
currentU = np.zeros(3)
if case:

# ----- Pass case water current information to MoorPy -----

currentMod = 0 # current modeling mode for MoorPy
currentU = np.zeros(3) # uniform current velocity for MoorPy [m/s]
if case and self.mooring_currentMod > 0:
cur_speed = getFromDict(case, 'current_speed', shape=0, default=0.0)
cur_heading = getFromDict(case, 'current_heading', shape=0, default=0)
if cur_speed > 0:
currentMod = 1
currentU = np.array([cur_speed*np.cos(np.radians(cur_heading)),
cur_speed*np.sin(np.radians(cur_heading)), 0])

# Apply current to MoorPy
if self.ms:
self.ms.currentMod = currentMod
self.ms.current = np.array(currentU)
for fowt in self.fowtList:
if fowt.ms:
fowt.ms.currentMod = currentMod
fowt.ms.current = np.array(currentU)


# ----- calculate platform offsets and mooring system equilibrium state -----

# figure out some settings to the equilibrium solve
Expand Down
13 changes: 9 additions & 4 deletions raft/raft_rotor.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ def calcCavitation(self, case, azimuth=0, clearance_margin=1.0, Patm=101325, Pva

cav_check[a,n] = sigma_crit + cpmin_node # if this value is negative, then cavitation occurs (sigma_crit - sigma_l < 0 -> cav occurs; sigma_l = -cpmin_node)

if np.any(cav_check < 0.0):
print("WARNING: Cavitation check was run and found a blade node that has cavitation occuring")

return cav_check

Expand Down Expand Up @@ -992,16 +994,18 @@ def calcAero(self, case, current=False, display=0):
self.b[:3,:3, iw] = rotateMatrix3(np.diag([b2[iw],0,0]), self.R_q)
self.f[:3, iw] = np.matmul(self.R_q, np.array([f2[iw],0,0]))
# Above is only forces for now. Moments can be added in future.


""" # Caltured in FOWT.calcHydroExcitation()
# Add hydrodynamic inertial excitation for underwater rotors
if current:
self.f[0,:] += self.I_hydro[0,0] * 1j*self.w*self.V_w # <<< this should have a rotation applied
breakpoint()
"""

return self.f0, self.f, self.a, self.b # B_aero, C_aero, F_aero0, F_aero


def plot(self, ax, r_ptfm=[0,0,0], azimuth=0, color='k',
def plot(self, ax, r_ptfm=np.array([0,0,0]), azimuth=0, color='k',
airfoils=False, draw_circle=False,
plot2d=False, Xuvec=[1,0,0], Yuvec=[0,0,1], zorder=2):
'''Draws the rotor on the passed axes, considering optional platform
Expand Down Expand Up @@ -1059,8 +1063,9 @@ def plot(self, ax, r_ptfm=[0,0,0], azimuth=0, color='k',
P2 = np.matmul(R_precone, P)
P2 = np.matmul(R_azimuth[ib], P2) # rotate around shaft
P2 = np.matmul(self.R_q, P2) # rotate to actual rotor orientation
P2 = P2 + self.r3[:,None] + r_ptfm[:,None] # translate from PRP to absolute hub location

P2 = P2 + self.r3[:,None] # translate from PRP to absolute hub location


if plot2d: # new 2d plotting option

# apply any 3D to 2D transformation here to provide desired viewing angle
Expand Down

0 comments on commit e69d755

Please sign in to comment.