Steps to compile MoorDyn

I get MoorDyn source files from the web at However there isn’t a file to instruct me to compile. I learn that there are different makefiles to compile the code. Doer anybody know the steps to compile the code?


If you are simply looking to use MoorDyn, I’d recommend downloading the already compiled libraries rather than the source code. If you are looking to edit the code, please see below.

For Windows, the makefiles provided with MoorDyn were set up for use with MinGW. If you don’t already have it, I’d suggest downloading and installing MinGW-w64. Then, you can edit the file compile32.bat (or compile64.bat for 64-bit programs) so that set PATH=C:\mingw64\bin;%PATH% points to the “bin” directory of your MinGW installation. After that, running the .bat file is all that should be required to compile MoorDyn.

If you are using Linux or macOS, please let us know and somebody else may be able to provide better guidance.


Thank you for your reply!
I have already compiled MoorDyn source files into file under Linux system. When I use MoorDyn to do some calculation, I meet a problem. Some errors appear like the followings:

Error: NaN value detected in MoorDyn state at dynamic relaxation time 1 s.
Error: NaN value detected in MoorDyn state at time 0.2 s.

I try to change the unstretch length of line smaller. Then these errors don’t appear anymore. Though changing the unstretch length can solve the problem, the unstretch length is determinated in reality and I can’t change. Does any methods to treat these errors?
My input file is shown below:lines.txt (2.39 KB)

After doing some tests, I find that if I set the Z coordinate of anchor points a little smaller than the water depth, the above errors don’t appear anymore. For example, water depth is set 200 m and the Z coordinate is set -199.9 m. I know that the actual Z coordinate should be equal to the water depth, but I don’t know why the above error appear.
If I set Z coordinate of anchor points a little smaller than water depth, is it OK for the calculation? Are there any big effects on the calculation?

This is an interesting problem that I haven’t figured out yet. I see that you’re using the standard OC4-DeepCwind mooring system description and it was a surprise to me that the simulation was unstable (the NaN value errors). These errors don’t occur in MoorDyn v1.01.00 but do occur in v1.01.01, which I assume you’re using.

Your work-around of changing the anchor position to slightly above the seabed is a good approach – I don’t think this should cause any noticeable differences in the mooring dynamics results. I found that the model will also run successfully if NumSegs is reduced from 20 to 15.

Hopefully I can find the problem that is causing this and fix it in the next update. Thanks for sharing this issue!