WEC-Sim API

Body Class

class source.objects.bodyClass(filename)

The bodyClass creates a body object saved to the MATLAB workspace. The bodyClass includes properties and methods used to define WEC-Sim’s hydrodynamic and non-hydrodynamic bodies.

name = '[]'

(string) Specifies the body name. For hydrodynamic bodies this is defined in h5 file. For nonhydrodynamic bodies this is defined by the user, Default = [].

mass = '[]'

(float) Translational inertia or mass [kg]. Defined by the user or specify ‘equilibrium’ to set the mass equal to the fluid density times displaced volume. Default = [].

momOfInertia = '[]'

(3x1 float vector) Rotational inertia or mass moment of inertia [kg*m^{2}]. Defined by the user in the following format [Ixx Iyy Izz]. Default = [].

cg = '[]'

(3x1 float vector) Body center of gravity [m]. Defined in the following format [x y z]. For hydrodynamic bodies this is defined in the h5 file while for nonhydrodynamic bodies this is defined by the user. Default = [].

cb = '[]'

(3x1 float vector) Body center of buoyancy [m]. Defined in the following format [x y z]. For hydrodynamic bodies this is defined in the h5 file while for nonhydrodynamic bodies this is defined by the user. Default = [].

dispVol = '[]'

(float) Displaced volume at equilibrium position [m^{3}]. For hydrodynamic bodies this is defined in the h5 file while for nonhydrodynamic bodies this is defined by the user. Default = [].

dof = '[]'

(integer) Number of degree of freedoms (DOFs). For hydrodynamic bodies this is given in the h5 file. If not defined in the h5 file, Default = 6.

dof_gbm = '[]'

(integer) Number of degree of freedoms (DOFs) for generalized body mode (GBM). Default = [].

dof_start = '[]'

(integer) Index the DOF starts for body(bodyNumber). For WEC bodies this is given in the h5 file, but if not defined in the h5 file, Default = (bodyNumber-1)*6+1.

dof_end = '[]'

(integer) Index the DOF ends for body(bodyNumber). For WEC bodies this is given in the h5 file, but if not defined in the h5 file, Default = (bodyNumber-1)*6+6.

geometryFile = "'NONE'"

(string) Pathway to the body geomtry .stl file.

viscDrag = "struct( 'Drag', zeros(6), 'cd', [0 0 0 0 0 0], 'characteristicArea', [0 0 0 0 0 0])"

Structure defining the viscous quadratic drag forces. First option define Drag, (6x6 float matrix), Default = zeros(6). Second option define cd, (6x1 float vector), Default = zeros(6,1), and characteristicArea, (6x1 float vector), Default = zeros(6,1).

initDisp = "struct( 'initLinDisp', [0 0 0], 'initAngularDispAxis', [0 1 0], 'initAngularDispAngle', 0)"

Structure defining the initial displacement of the body. initLinDisp (3x1 float vector) is defined as the initial displacement of the body center of gravity (COG) [m] in the following format [x y z], Default = [0 0 0]. initAngularDispAxis (3x1 float vector) is defined as the axis of rotation in the following format [x y z], Default = [0 1 0]. initAngularDispAngle (float) is defined as the initial angular displacement of the body COG [rad], Default = 0.

hydroStiffness = 'zeros(6)'

(6x6 float matrix) Linear hydrostatic stiffness matrix. Default = zeros(6). If the variable is nonzero, the matrix will override the h5 file values.

linearDamping = 'zeros(6)'

(6x6 float matrix) Linear damping coefficient matrix. Default = zeros(6).

userDefinedExcIRF = '[]'

([]) Excitation Impulse Response Function, calculated in BEMIO, only used with the waveClass etaImport type. Default = [].

viz = "struct( 'color', [1 1 0], 'opacity', 1)"

Structure defining visualization properties in either SimScape or Paraview. color (3x1 float vector) is defined as the body visualization color, Default = [1 1 0]. opacity (integer) is defined as the body opacity, Default = 1.

bodyparaview = '1'

(integer) Flag for visualisation in Paraview either 0 (no) or 1 (yes). Default = 1 since only called in paraview.

morisonElement = "struct( 'cd', [0 0 0], 'ca', [0 0 0], 'characteristicArea', [0 0 0], 'VME', 0 , 'rgME', [0 0 0])"

Structure defining the Morrison Element properties connected to the body. cd (3x1 float vector) is defined as the viscous quadratic drag coefficients in the following format [cd_x cd_y cd_z], Default = [0 0 0]. ca is defined as the added mass coefficent for the Morrison Element in the following format [ca_x ca_y ca_z], Default = [0 0 0], characteristicArea is defined as the characteristic area for the Morrison Element [m^2] in the following format [Area_x Area_y Area_z], Default = [0 0 0]. VME is the characteristic volume of the Morrison Element [m^3], Default = 0. rgME is defined as the vector from the body COG to point of application for the Morrison Element [m] in the following format [x y z], Default = [0 0 0].

nhBody = '0'

(integer) Flag for non-hydro body either 0 (no) or 1 (yes). Default = 0.

flexHydroBody = '0'

(integer) Flag for flexible body either 0 (no) or 1 (yes). Default = 0.

meanDriftForce = '0'

(integer) Flag for mean drift force with three options: 0 (no), 1 (yes, from control surface) or 2 (yes, from momentum conservation). Default = 0.

bodyClass(filename)

This method initilizes the bodyClass and creates a body object.

Parameters

filename (string) – String specifying the location of the body h5 file

Returns

body – bodyClass object

Return type

obj

readH5File()

WECSim internal function that reads the body h5 file.

loadHydroData(hydroData)

WECSim function that loads the hydroData structure from a MATLAB variable as alternative to reading the h5 file. This process reduces computational time when using wecSimMCR.

listInfo()

This method prints body information to the MATLAB Command Window.

checkStl()

The method will check the .stl file and return an error if the normal vectors are not equal to one.

plotStl()

This method plots the body .stl mesh and normal vectors.

checkinputs()

This method checks WEC-Sim user inputs and generates error messages if parameters are not properly defined for the bodyClass.

forceAddedMass(acc, B2B)

This method calculates and outputs the real added mass force time history.

write_paraview_vtp(t, pos_all, bodyname, model, simdate, hspressure, wavenonlinearpressure, wavelinearpressure, pathParaviewVideo, vtkbodiesii)

This methods writes vtp files for Paraview visualization.

Contstraint Class

class source.objects.constraintClass(name)

The constraintClass creates a constraint object saved to the MATLAB workspace. The constraintClass includes properties and methods used to define constraints between the body motion relative to the global reference frame or relative to other bodies.

name = "'NOT DEFINED'"

(string) Specifies the constraint name. For constraints this is defined by the user, Default = NOT DEFINED.

loc = '[999 999 999]'

(3x1 float vector) Constraint location [m]. Defined in the following format [x y z]. Default = [999 999 999].

orientation = "struct( 'z', [0, 0, 1], 'y', [0, 1, 0], 'x', [], 'rotationMatrix',[])"

Structure defining the orientation axis of the constraint. z (3x1 float vector) defines the direciton of the Z-coordinate of the constraint, Default = [0 0 1]. y (3x1 float vector) defines the direciton of the Y-coordinate of the constraint, Default = [0 1 0]. x (3x1 float vector) internally calculated vector defining the direction of the X-coordinate for the constraint, Default = []. rotationMatrix (3x3 float matrix) internally calculated rotation matrix to go from standard coordinate orientation to the constraint coordinate orientation, Default = [].

initDisp = "struct( 'initLinDisp', [0 0 0])"

Structure defining the initial displacement of the constraint. initLinDisp (3x1 float vector) is defined as the initial displacement of the constraint [m] in the following format [x y z], Default = [0 0 0].

constraintClass(name)

This method initilizes the constraintClass and creates a constraint object.

Parameters

filename (string) – String specifying the name of the constraint

Returns

constraint – contraintClass object

Return type

obj

checkLoc(action)

This method checks WEC-Sim user inputs and generate an error message if the constraint location is not defined in constraintClass.

setOrientation()

This method calculates the constraint x vector and rotationMatrix matrix in the orientation structure based on user input.

setInitDisp(x_rot, ax_rot, ang_rot, addLinDisp)

This method sets initial displacement while considering an initial rotation orientation.

x_rot (3x1 float vector) is rotation point [m] in the following format [x y z], Default = [].

ax_rot (3x1 float vector) is the axis about which to rotate to constraint and must be a normal vector, Default = [].

ang_rot (float) is the rotation angle [rad], Default = [].

addLinDisp (‘float’) is the initial linear displacement [m] in addition to the displacement caused by the constraint rotation, Default = ‘[]’.

rotateXYZ(x, ax, t)

This method rotates a point about an arbitrary axis.

x (3x1 float vector) is the point coordiantes.

ax (3x1 float vector) is the axis about which to rotate the constraint and must be a normal vector.

t (float) is the rotation angle of the constraint.

xn (3x1 float vector) is the new point coordiantes after rotation.

listInfo()

This method prints constraint information to the MATLAB Command Window.

Mooring Class

class source.objects.mooringClass(name)

This class contains mooring parameters and settings

name = "'NOT DEFINED'"

(string) Name of the mooring. Default = 'NOT DEFINED'

ref = '[0 0 0]'

(float 1 x 3) Mooring Reference location. Default = [0 0 0]

moorDynLines = '0'

(integer) Number of lines in MoorDyn. Default = 0

moorDynNodes = '[]'

(integer) number of nodes for each line. Default = 'NOT DEFINED'

loc = '[]'

(float 1 x 6) Initial 6DOF location. Default = [0 0 0 0 0 0]

mooringNum = '[]'

(integer) Mooring number. Default = 'NOT DEFINED'

moorDyn = '0'

(integer) Flag to indicate a MoorDyn block, 0 or 1. Default = 0

moorDynInputRaw = '[]'

(string) MoorDyn input file, each line read as a string into a cell array. Default = 'NOT DEFINED'

mooringClass(name)

This method initializes the mooringClass object

setLoc()

This method sets mooring location

setInitDisp(x_rot, ax_rot, ang_rot, addLinDisp)

Method to set the initial displacement with an initial rotation

Parameters
  • x_rot (3 x 1 float vector) – displacement of mooring reference

  • ax_rot (3 x 1 float vector) – axis about which to rotate (must be a normal vector)

  • ang_rot (float) – rotation displacement (radians)

  • addLinDisp (3 x 1 float vector) – initial linear displacement (additional to rotation-induced displacement)

rotateXYZ(x, ax, t)

Method to rotate a point about an arbitrary axis

Parameters
  • x (1 x 3 float vector) – coordinates of point to rotate

  • ax (1 x 3 float vector) – axis about which to rotate

  • t (float) – rotation angle (radian)

Returns

xn – new coordinates after rotation

Return type

1 x 3 float vector

moorDynInput()

Method to read MoorDyn input file

write_paraview_vtp(moorDyn, model, t, simdate, nline, nnode, pathParaviewVideo, TimeBodyParav, NewTimeParaview)

Method to write vtp Paraview visualization files

Parameters
  • moorDyn (obj) – The moorDyn object

  • model (string) – The simMechanics .slx file

  • t (float vector) – Moordyn time vector

  • simdate (string) – Date string

  • nline (integer) – Number of mooring lines

  • nnode (integer) – Number of nodes on mooring lines

  • pathParaviewVideo (directory) – Directory the Paraview files were saved

  • TimeBodyParav (float vector) – Paraview time vector

  • simu.g (float) – Gravitational acceleration from simulationClass

PTO Class

class source.objects.ptoClass(name)

The ptoClass creates a pto object saved to the MATLAB workspace. The ptoClass includes properties and methods used to define PTO connections between the body motion relative to the global reference frame or relative to other bodies.

name = "'NOT DEFINED'"

(string) Specifies the pto name. For ptos this is defined by the user, Default = NOT DEFINED.

k = '0'

(float) Linear PTO stiffness coefficient. Default = 0.

c = '0'

(float) Linear PTO damping coefficient. Default = 0.

loc = '[999 999 999]'

(3x1 float vector) PTO location [m]. Defined in the following format [x y z]. Default = [999 999 999].

orientation = "struct( 'z', [0, 0, 1], 'y', [0, 1, 0], 'x', [], 'rotationMatrix',[])"

Structure defining the orientation axis of the pto. z (3x1 float vector) defines the direciton of the Z-coordinate of the pto, Default = [0 0 1]. y (3x1 float vector) defines the direciton of the Y-coordinate of the pto, Default = [0 1 0]. x (3x1 float vector) internally calculated vector defining the direction of the X-coordinate for the pto, Default = []. rotationMatrix (3x3 float matrix) internally calculated rotation matrix to go from standard coordinate orientation to the pto coordinate orientation, Default = [].

initDisp = "struct( 'initLinDisp', [0 0 0])"

Structure defining the initial displacement of the pto. initLinDisp (3x1 float vector) is defined as the initial displacement of the pto [m] in the following format [x y z], Default = [0 0 0].

ptoClass(name)

This method initilizes the ptoClass and creates a pto object.

Parameters

filename (string) – String specifying the name of the pto

Returns

pto – ptoClass object

Return type

obj

checkLoc(action)

This method checks WEC-Sim user inputs and generate an error message if the constraint location is not defined in constraintClass.

setOrientation()

This method calculates the constraint x vector and rotationMatrix matrix in the orientation structure based on user input.

setInitDisp(x_rot, ax_rot, ang_rot, addLinDisp)

This method sets initial displacement while considering an initial rotation orientation.

x_rot (3x1 float vector) is rotation point [m] in the following format [x y z], Default = [].

ax_rot (3x1 float vector) is the axis about which to rotate to constraint and must be a normal vector, Default = [].

ang_rot (float) is the rotation angle [rad], Default = [].

addLinDisp (‘float’) is the initial linear displacement [m] in addition to the displacement caused by the pto rotation, Default = ‘[]’.

rotateXYZ(x, ax, t)

This method rotates a point about an arbitrary axis.

x (3x1 float vector) is the point coordiantes.

ax (3x1 float vector) is the axis about which to rotate the pto and must be a normal vector.

t (float) is the rotation angle of the pto.

xn (3x1 float vector) is the new point coordiantes after rotation.

listInfo()

This method prints pto information to the MATLAB Command Window.

Response Class

class source.objects.responseClass(bodiesOutput, ptosOutput, constraintsOutput, ptosimOutput, mooringOutput, wave_type, wave_elev, hspressure, wpressurenl, wpressurel, yawNonLin)

The responseClass creates an output object saved to the MATLAB workspace that contains structures for each instance of a WEC-Sim class (e.g. waveClass, bodyClass, ptoClass, mooringClass, etc).

wave = 'struct()'

This property generates the wave structure for each instance of the waveClass , it includes:

  • type (string) = ‘waveType’

  • time (array) = [# of time-steps x 1]

  • elevation (array) = [# of time-steps x 1]

bodies = 'struct()'

This property generates the bodies structure for each instance of the bodyClass (i.e. for each Body block) , it includes:

  • name (string) = ‘bodyName’

  • time (array) = [# of time-steps x 1]

  • position (array) = [# of time-steps x 6]

  • velocity (array) = [# of time-steps x 6]

  • accleration (array) = [# of time-steps x 6]

  • forceTotal (array) = [# of time-steps x 6]

  • forceExcitation (array) = [# of time-steps x 6]

  • forceRadiationDamping (array) = [# of time-steps x 6]

  • forceAddedMass (array) = [# of time-steps x 6]

  • forceRestoring (array) = [# of time-steps x 6]

  • forceMorrisonAndViscous (array) = [# of time-steps x 6]

  • forceLinearDamping (array) = [# of time-steps x 6]

There are additional output.bodies structures for non-linar hydro (e.g. cellPressures_time, cellPressures_hydrostatic, cellPressures_waveLinear, cellPressures_waveNonLinear)

ptos = 'struct()'

This property generates the ptos structure for each instance of the ptoClass (i.e. for each PTO block) , it includes:

  • name (string) = ‘ptoName’

  • time (array) = [# of time-steps x 1]

  • position (array) = [# of time-steps x 6]

  • velocity (array) = [# of time-steps x 6]

  • accleration (array) = [# of time-steps x 6]

  • forceTotal (array) = [# of time-steps x 6]

  • forceActuation (array) = [# of time-steps x 6]

  • forceConstraint (array) = [# of time-steps x 6]

  • forceInternalMechanics (array) = [# of time-steps x 6]

  • powerInternalMechanics (array) = [# of time-steps x 6]

constraints = 'struct()'

This property generates the constraints structure for each instance of the coonstraintClass (i.e. for each Constraint block) , it includes:

  • name (string) = ‘coonstraintName’

  • time (array) = [# of time-steps x 1]

  • position (array) = [# of time-steps x 6]

  • velocity (array) = [# of time-steps x 6]

  • accleration (array) = [# of time-steps x 6]

  • forceConstraint (array) = [# of time-steps x 6]

mooring = 'struct()'

This property generates the mooring structure for each instance of the mooringClass (i.e. for each Mooring block) , it includes:

  • position (array) = [# of time-steps x 6]

  • velocity (array) = [# of time-steps x 6]

  • forceMooring (array) = [# of time-steps x 6]

moorDyn = 'struct()'

This property generates the moorDyn structure for each instance of the mooringClass using MoorDyn (i.e. for each MoorDyn block), it includes Lines and Line#.

ptosim = 'struct()'

This property generates the ptosim structure for each instance of the ptoSimClass (i.e. for each PTO-Sim block).

responseClass(bodiesOutput, ptosOutput, constraintsOutput, ptosimOutput, mooringOutput, wave_type, wave_elev, hspressure, wpressurenl, wpressurel, yawNonLin)

This method initilizes the responseClass, reads output from each instance of a WEC-Sim class (e.g. waveClass, bodyClass, ptoClass, mooringClass, etc) , and saves the response to an output object.

Returns

output – responseClass object

Return type

obj

loadMoorDyn(numLines)

This method reads MoorDyn outputs for each instance of the mooringClass

Parameters

numLines (integer) – the number of MoorDyn lines

plotResponse(bodyNum, comp)

This method plots the response of a body for a given DOF.

Parameters
  • bodyNum (integer) – the body number to plot

  • comp (integer) – the response component (i.e. dof) to be plotted (e.g. 1-6)

plotForces(bodyNum, comp)

This method plots the forces on a body for a given DOF.

Parameters
  • bodyNum (integer) – the body number to plot

  • comp (integer) – the force component (i.e. dof) to be plotted (e.g. 1-6)

writetxt()

This method writes WEC-Sim outputs to a (ASCII) text file. This method is executed by specifying simu.outputtxt=1 in the wecSimInputFile.m.

write_paraview(bodies, t, model, simdate, wavetype, mooring, pathParaviewVideo)

This method writes *.vtp files for visualization with ParaView. This method is executed by specifying simu.paraview=1 in the wecSimInputFile.m.

Simulation Class

class source.objects.simulationClass

This class contains WEC-Sim simulation parameters and settings

simMechanicsFile = "'NOT DEFINED'"

(string) Simulink/SimMecahnics model file. Default = 'NOT DEFINED'

startTime = '0'

(float) Simulation start time. Default = 0 s

rampTime = '100'

(float) Ramp time for wave forcing. Default = 100 s

endTime = '[]'

(float) Simulation end time. Default = 'NOT DEFINED'

dt = '0.1'

(float) Simulation time step. Default = 0.1 s

dtOut = '[]'

(float) Output sampling time. Default = dt

dtNL = '[]'

(float) Sample time to calculate nonlinear forces. Default = dt

dtCITime = '[]'

(float) Sample time to calculate Convolution Integral. Default = dt

dtME = '[]'

(float) Sample time to calculate Morison Element forces. Default = dt

CITime = '60'

(float) Convolution integral time. Default = 60 s

domainSize = '200'

(float) Size of free surface and seabed. This variable is only used for visualization. Default = 200 m

ssCalc = '0'

(integer) Option for convolution integral or state-space calculation: convolution integral->0, state-space->1. Default = 0

mode = "'normal'"

(string) Simulation execution mode, ‘normal’, ‘accelerator’, ‘rapid-accelerator’. Default = 'normal'

solver = "'ode4'"

(string) PDE solver used by the Simulink/SimMechanics simulation, ‘ode4, ‘ode45’. Default = 'ode4'

numIntMidTimeSteps = '5'

(integer) Number of intermediate time steps. Default = 5 for ode4 method

autoRateTranBlk = "'on'"

(string) Automatically handle rate transition for data transfer, ‘on’, ‘off’. Default = 'on'

zeroCrossCont = "'DisableAll'"

(string) Disable zero cross control. Default = 'DisableAll'

explorer = "'on'"

(string) SimMechanics Explorer ‘on’ or ‘off’. Default = 'on'

rho = '1000'

(float) Density of water. Default = 1000 kg/m^3

g = '9.81'

(float) Acceleration due to gravity. Default = 9.81 m/s

nlHydro = '0'

(integer) Option for nonlinear hydrohanamics calculation: linear->0, nonlinear->1. Default = 0

yawNonLin = '0'

(integer) Option for nonlinear yaw calculation linear->0, nonlinear->1 for nonlinear. Default = 0

yawThresh = '1'

(float) Yaw position threshold (in degrees) above which excitation coefficients will be interpolated in non-linear yaw. Default = 1 dg

b2b = '0'

(integer) Option for body2body interactions: off->0, on->1. Default = 0

paraview = '0'

(integer) Option for writing vtp files for paraview visualization, off->0, on->1. Default = 0

StartTimeParaview = '0'

(float) Start time for the vtk file of Paraview. Default = 0

EndTimeParaview = '100'

(float) End time for the vtk file of Paraview. Default = 0

dtParaview = '0.1'

(float) Timestep for Paraview. Default = 0.1

pathParaviewVideo = "'vtk'"

(string) Path of the folder for Paraview vtk files. Default = 'vtk'

adjMassWeightFun = '2'

(integer) Weighting function for adjusting added mass term in the translational direction. Default = 2

mcrCaseFile = '[]'

(string) mat file that contain a list of the multiple conditions runs with given conditions. Default = 'NOT DEFINED'

morisonElement = '0'

(integer) Option for Morrison Element calculation: off->0, on->1. Default = 0

outputtxt = '0'

(integer) Option to save results as ASCII files off->0, on->1. Default = 0

reloadH5Data = '0'

(integer) Option to re-load hydro data from hf5 file between runs: off->0, on->1. Default = 0

saveMat = '1'

(integer) Option to save .mat file for each run: off->0, on->1. Default = 1

pressureDis = '0'

(integer) Option to save pressure distribution: off->0, on->1. Default = 0

version = "'4.0'"

(string) WEC-Sim version

simulationDate = 'datetime'

(string) Simulation date and time

outputDir = "'output'"

(string) Data output directory name. Default = 'output'

time = '0'

(float) Simulation time [s]. Default = 0 s

inputFile = "'wecSimInputFile'"

(string) Name of WEC-Sim input file. Default = 'wecSimInputFile'

logFile = '[]'

(string) File with run information summary. Default = 'log'

caseFile = '[]'

(string) .mat file with all simulation information. Default = dependent

caseDir = '[]'

(string) WEC-Sim case directory. Default = dependent

CIkt = '[]'

(integer) Number of timesteps in the convolution integral length. Default = dependent

maxIt = '[]'

(integer) Total number of simulation time steps. Default = dependent

CTTime = '[]'

(float vector) Convolution integral time series. Default = dependent

numWecBodies = '[]'

(integer) Number of hydrodynamic bodies that comprise the WEC device. Default = 'NOT DEFINED'

numPtos = '[]'

(integer) Number of power take-off elements in the model. Default = 'NOT DEFINED'

numConstraints = '[]'

(integer) Number of contraints in the wec model. Default = 'NOT DEFINED'

numMoorings = '[]'

(integer) Number of moorings in the wec model. Default = 'NOT DEFINED'

simulationClass()

This method initializes the simulationClass.

loadSimMechModel(fName)

This method loads the simulink model and sets parameters

Parameters

fname (string) – the name of the SimMechanics .slx file

setupSim()

Sets simulation properties based on values specified in input file

checkinputs()

Checks user input to ensure that simu.endTime is specified and that the SimMechanics model exists

rhoDensitySetup(rho, g)

Assigns density and gravity values

Parameters
  • rho (float) – density of the fluid medium (kg/m^3)

  • g (float) – gravitational acceleration constant (m/s^2)

Wave Class

class source.objects.waveClass(type)

The waveClass creates a waves object saved to the MATLAB workspace. The waveClass includes properties and methods used to define WEC-Sim’s wave input.

type = "'NOT DEFINED'"

(string) Specifies the wave type, options include:noWave, noWaveCIC, regular, regularCIC, irregular, spectrumImport, or etaImport. Default = 'NOT DEFINED'

T = "'NOT DEFINED'"

(float) Wave period [s] . Defined as wave period for regular, peak period for irregular, or period of BEM data used for hydrodynamic coefficients for noWave. Default = 'NOT DEFINED'

H = "'NOT DEFINED'"

(float) Wave height [m]. Defined as wave height for regular, or significant wave height for irregular. Default = 'NOT DEFINED'

spectrumType = "'NOT DEFINED'"

(string) Specifies the wave spectrum type, options inlcude:PM or JS. Default = 'NOT DEFINED'

gamma = '[]'

(float) Defines gamma, only used for JS wave spectrum type. Default = []

phaseSeed = '0'

(integer) Defines the random phase seed, only used for irregular and spectrumImport waves. Default = 0

spectrumDataFile = "'NOT DEFINED'"

(string) Data file that contains the spectrum data file. Default = 'NOT DEFINED'

etaDataFile = "'NOT DEFINED'"

(string) Data file that contains the times-series data file. Default = 'NOT DEFINED'

freqRange = '[]'

(2x1 vector) Min and max wave frequency [rad/s], only used for irregular and spectrumImport. If not specified, the BEM data frequency range is used. Default = []

numFreq = '[]'

(integer) Number of interpolated wave frequencies, only used for irregular and spectrumImport. Number of frequencies used varies depending on freqDisc, 1000 for 'Traditional', and 500 for 'EqualEnergy' and Imported. Default = []

waveDir = '0'

(float) Incident wave direction(s) [deg]. Incident wave direction defined using WEC-Sim global coordinate system. Should be defined as a column vector for more than one wave direction. Default = 0

waveSpread = '1'

(float) Wave Spread probability associated with wave direction(s). Should be defined as a column vector for more than one wave direction. Default = 1

viz = "struct( 'numPointsX', 50, 'numPointsY', 50 )"

(structure) Defines visualization options, structure contains the fields numPointsX for the number of visualization points in x direction, and numPointsY for the number of visualization points in y direction.

statisticsDataLoad = '[]'

(string) File name from which to load wave statistics data. Default = []

freqDisc = "'EqualEnergy'"

(string) Method of frequency discretization for irregular waves, options include: 'EqualEnergy' or 'Traditional'. Default = 'EqualEnergy'

wavegauge1loc = '[0,0]'

(1x2 vector) Wave gauge 1 [x,y] location [m]. Default = [0,0]

wavegauge2loc = '[0,0]'

(1x2 vector) Wave gauge 2 [x,y] location [m]. Default = [0,0]

wavegauge3loc = '[0,0]'

(1x2 vector) Wave gauge 3 [x,y] location [m]. Default = [0,0]

currentOption = '3'

(integer) Define the sub-surface current model to be used in WEC-Sim, options include: 0 for depth-independent model, 1 for 1/7 power law variation with depth, 2 for linear variation with depth, or 3 for no current. Default = 3

currentSpeed = '0'

(float) Current seed [m/s]. Surface current speed that is uniform along the water column. Default = 0

currentDirection = '0'

(float) Current direction [deg]. Surface current direction defined using WEC-Sim global coordinate system. Default = 0

currentDepth = '0'

(float) Current depth [m]. Define the depth over which the sub-surface current is modeled. Must be defined for options 1 and 2. The current is not calculated for any depths greater than the specified current depth. Default = 0

waveClass.waveClass(type)

This method initilizes the waveClass and creates a waves object.

Parameters

type (string) –

String specifying the wave type, options include:

noWave

No waves

noWaveCIC

No waves but with the Convolution Integral Calculation to calculate radiation effects

regular

Regular waves

regularCIC

Regular waves with Convolution Integral Calculation to calculate radiation effects

irregular

Irregular Waves

spectrumImport

Irregular Waves with predefined phase

etaImport

Irregular Waves with predefined elevation

Returns

waves – waveClass object

Return type

obj

waveClass.plotEta(rampTime)

This method plots wave elevation time-history.

Parameters

rampTime (float, optional) – Specify wave ramp time to include in plot

Returns

figure – Plot of wave elevation versus time

Return type

fig

waveClass.plotSpectrum()

This method plots the wave spectrum.

Returns

figure – Plot of wave spectrum versus wave frequency

Return type

fig

waveClass.waveSetup(bemFreq, wDepth, rampTime, dt, maxIt, g, rho, endTime)

This method calculates WEC-Sim’s wave properties based on the specified wave type.

waveClass.listInfo()

This method prints wave information to the MATLAB Command Window.

waveClass.waveNumber(g)

This method calculates the wave number, used by: waveClass.waveSetup().

waveClass.checkinputs()

This method checks WEC-Sim user inputs and generates error messages if parameters are not properly defined.

waveClass.write_paraview_vtp(t, numPointsX, numPointsY, domainSize, model, simdate, mooring, pathParaviewVideo, TimeBodyParav, g)

This methods writes vtp files for Paraview visualization.

waveClass.waveElevationGrid(t, X, Y)

This method calculates wave elevation on a grid at a given time, used by: waveClass.write_paraview_vtp().

Parameters
  • waves (obj) – waveClass object

  • t (float) – the current time

  • X (matrix) – (m x n) matrix of X coordinates at which to calculate the wave elevation

  • Y (matrix) – (m x n) matrix of Y coordinates at which to calculate the wave elevation

  • TimeBodyParav (Time vector starting from zero specified for) – paraview video files.

  • it (time step iteration,) –

  • g (gravitational acceleration constant from simulationClass) –

Returns

Z – (m x n) matrix of Z coordinates of the wave elevation

Return type

matrix