I am trying to run MoorDyn v1 with Matlab. I downloaded the source .zip from the releases page as well as the pre-compiled .dll file MoorDyn_Win64.dll and added it to the source folder. I added a subfolder "Mooring" with the following lines.txt file for the OC4 semi-submersible platform:
--------------------- MoorDyn Input File ------------------------------------
MoorDyn input file of the mooring system for OC4 Semi-submersible
True Echo echo the input file data (flag)
----------------------- LINE TYPES ------------------------------------------
LineType Diam MassDen EA BA/-zeta Can Cat Cdn Cdt
(-) (m) (kg/m) (N) (Pa-s/-) (-) (-) (-) (-)
main 0.0766 113.35 7.536E8 -1.0 0.8 0.25 2.0 0.4
---------------------- NODE PROPERTIES --------------------------------
Node Type X Y Z M V FX FY FZ CdA CA
(-) (-) (m) (m) (m) (kg) (m^3) (kN) (kN) (kN) (m^2) (-)
1 Fixed 418.8 725.383 -200.0 0 0 0 0 0 0 0
2 Fixed -837.6 0.0 -200.0 0 0 0 0 0 0 0
3 Fixed 418.8 -725.383 -200.0 0 0 0 0 0 0 0
4 Vessel 20.434 35.393 -14.0 0 0 0 0 0 0 0
5 Vessel -40.868 0.0 -14.0 0 0 0 0 0 0 0
6 Vessel 20.434 -35.393 -14.0 0 0 0 0 0 0 0
---------------------- LINES ----------------------------------------
Line LineType UnstrLen NumSegs NodeAnch NodeFair Flags/Outputs
(-) (-) (m) (-) (-) (-) (-)
1 main 835.35 20 1 4 -
2 main 835.35 20 2 5 -
3 main 835.35 20 3 6 -
---------------------- SOLVER OPTIONS -----------------------------------------
0.001 dtM - time step to use in mooring integration (s)
3.0e6 kBot - bottom stiffness (Pa/m)
3.0e5 cBot - bottom damping (Pa-s/m)
60 TmaxIC - maximum simulation time for IC convergence
4.0 CdScaleIC - factor for scaling drag coefficients for IC convergence
0.001 threshIC - threshold for IC convergence (-)
---------------------- OUTPUTS -----------------------------------------
------------------------- need this line --------------------------------------
I pulled the test script from the v1 user guide and am running it with the source code directory active (and all subfolders added to path):
clear all; close all; clc;
%% Setup
% Close out MoorDyn library if still open
if libisloaded('MoorDyn_Win64')
calllib('MoorDyn_Win64','LinesClose');
unloadlibrary MoorDyn_Win64;
end
X = zeros(6,1); % platform position
XD = zeros(6,1); % platform velocity
N = 10; % number of coupling time steps
dt = 0.5; % coupling time step size (time between MoorDyn calls)
Ts = zeros(N,1); % time step array
FairTens1 = zeros(N+1,1); % array for storing fairlead 1 tension time series
FLines_temp = zeros(1,6); % going to make a pointer so LinesCalc can modify FLines
FLines_p = libpointer('doublePtr',FLines_temp); % access returned value with FLines_p.value
%% Simulation
XD(1) = 1; % give platform 0.1 m/s velocity in surge
for i=1:N
calllib('MoorDyn_Win64', 'LinesCalc', X, XD, FLines_p, Ts(i), dt) % some MoorDyn time stepping
FairTens1(i+1) = calllib('MoorDyn_Win64','GetFairTen',1); % store fairlead 1 tension
forces(i,:) = FLines_p.Value
X = X + XDdt % update position
Ts(i+1) = dti; % store time
end
%% Ending
calllib('MoorDyn_Win64','LinesClose'); % close MoorDyn
unloadlibrary MoorDyn_Win64; % unload library (never forget to do this!)
Moordyn loads in fine and converges correctly, giving the following in the console:
(MoorDyn-initiated console window)
Running MoorDyn (v1.01.02C, 2021-02-14)
Copyright (c) Matt Hall, licensed under GPL v3.
Creating mooring system. 3 fairleads, 3 anchors, 0 connections.
Finalizing ICs using dynamic relaxation (4X normal drag)
Fairlead tensions converged to 0.1% after 4 seconds.
However, after running the script the forces output are all zero and the FairTens1 values are all -1. I'm not sure if the issues lies in my input text file or in how I am installing MoorDyn.
I am trying to run MoorDyn v1 with Matlab. I downloaded the source .zip from the releases page as well as the pre-compiled .dll file MoorDyn_Win64.dll and added it to the source folder. I added a subfolder "Mooring" with the following lines.txt file for the OC4 semi-submersible platform:
I pulled the test script from the v1 user guide and am running it with the source code directory active (and all subfolders added to path):
Moordyn loads in fine and converges correctly, giving the following in the console:
However, after running the script the forces output are all zero and the FairTens1 values are all -1. I'm not sure if the issues lies in my input text file or in how I am installing MoorDyn.