MoorDyn Coupling with Fortran

Hello,

I want to couple MoorDyn with an in-house Fortran code.

The basic idea is that at each time step one can use the Fortran code (including motion equation solver) calculate fairlead positions that are used as MoorDyn inputs, and use MoorDyn calculate the mooring force on the floating platform to provide the inputs for the Fortran code.

Is there any convenient way to realise what I mentioned above?

I tried to compile MoorDyn-C some times according to the methods in the MoorDyn manual but all failed. It’s kind of hard for me to fully understand the MoorDyn manual. I have read the introduction on wrappers and drivers but am still confused about it…

Any comments or suggestions are welcome.
Many thanks in advance.

Best regards,
Lei

Dear @Lei.Tan,

What you describe is exactly how OpenFAST is coupled to MoorDyn, so, you should be able to understand how to call MoorDyn by reviewing the OpenFAST source code. That said, OpenFAST is coupled to the Fortran version of MoorDyn rather than the C version.

The four main calls to the Fortran version of MoorDyn (which are similar to the main Fortran SUBROUTINE calls of each module of OpenFAST) are:
MD_Init() - Called at the beginning to initialize the module
MD_UpdateStates() - Called at each time step to updates the states of MoorDyn to the next time step
MD_CalcOutput() - Called at each time step to calculates the outputs of MoorDyn at that step
MD_End() - Called at the end to terminate the module

Best regards,

Dear Jason,

Thank you very much for you reply. The coupling has been done and it works well.

There seems a bug in MoorDyn_Driver.f90 when compiling. In Line 680, “close (un)” leads to an error because “un” is not defined. A “!” can simply solve this problem.

Best regards,
Lei

Dear @Lei.Tan,

Could you post this on the issues page of OpenFAST GitHub (Issues · OpenFAST/openfast · GitHub) so that the OpenFAST developers are made aware of the issue and track the fix?

Best regards,