Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when extract mooring stiffness matrix #2

Open
WTurbine opened this issue Dec 5, 2023 · 7 comments
Open

Error when extract mooring stiffness matrix #2

WTurbine opened this issue Dec 5, 2023 · 7 comments

Comments

@WTurbine
Copy link

WTurbine commented Dec 5, 2023

Dear all,

I’m not familiar with pyMAP, and when I hope to extract mooring stiffness matrix through Ex3_StiffnessMatrixFromFST.py. However a question happends as shown below

Part from Ex3_StiffnessMatrixFromFST.py
fstFilename = os.path.join(scriptDir, 'spar\Main.fst')
print(fstFilename)
# moor = pyMAP()
moor = pyMAP(fstFilename)

error line: moor = pyMAP(fstFilename)
TypeError: pyMAP.init() takes 1 positional argument but 2 were given

And I check the pymap.py file as shown below and it seems that the init( self ) command needs none argument which obeys the code “moor = pyMAP(fstFilename)”. Could anyone tell me how to solve this?

Part from pymap.py
class pyMAP(object):

def __init__( self ) :
    self.ierr = c_int(0)
    self.status = create_string_buffer(1024)
    print(self.ierr)
    print(self.status)

    self.f_type_d       = self.CreateDataState()
    self.f_type_u       = self.CreateInputState( )
    self.f_type_x       = self.CreateContinuousState( )

What have to be noted are that I failed to create wisdem-env through the “mamba create env” command, so I use the “pip install wisdem” and “python setup.py develop” in the base environment and then run Ex3_StiffnessMatrixFromFST.py.

@gbarter
Copy link
Member

gbarter commented Dec 5, 2023

There hasn't been much activity in pyMAP in a while because there has been less use of MAP as it was dropped from WISDEM and a secondary option in OpenFAST. I see there was a bit more activity in the dev branch compared to master. I would suggest giving that a try first.

@WTurbine
Copy link
Author

WTurbine commented Dec 6, 2023

Thank you for your comment and it really works. I have another question. The coordinate of the point in the code as shown below should be (0,0,+70) if I hope to extract stiffness matrix with reference to a point at 70m below the still water level, is it right?

K, f0 = moor.stiffness_matrix(epsilon=1e-5, point=(0,0,70))

@gbarter
Copy link
Member

gbarter commented Dec 7, 2023

I do not know pyMAP or MAP well enough to answer this one. @mattEhall - do you?

@mattEhall
Copy link

Hi,
No, I'm not familiar enough with PyMAP to give confident advice. Though I'm pretty sure MAP uses the same convention as our other tools, with z positive up, so I'd assume that a point 70 m below the water level should be indicated as (0,0,-70).

You might find MoorPy helpful. It's a more current pure-Python alternative to MAP. You can read in MoorDyn-style input files and query it for various stiffness properties. https://github.com/NREL/MoorPy

Matt

@WTurbine
Copy link
Author

WTurbine commented Dec 7, 2023

Thank you for your comments, the coordinate of a point 70 m below the water level is indeed (0,0,-70).

Best regards,

@ebranlard
Copy link
Collaborator

Have you tried the dev branch? I should have included additional functions and updates so that matrices can be translated from oe point to another with error.

To extract the stiffness matrix at a given point the syntax is now:
https://github.com/WISDEM/pyMAP/blob/dev/examples/Ex1_StiffnessMatrixAndLoads.py#L50

Which uses a "point" as argument, to know where the loads have to be translated to, and it makes use of the values of the forces at the operating point via the function f_op that I added to the MAP library and the python interface:
https://github.com/WISDEM/pyMAP/blob/dev/src/pymap/pymap.py#L779

This dates back to quite some time now...

I personally use the following version of the python code (not sure how much difference it has with the dev branch):
https://github.com/ebranlard/welib/blob/dev/welib/moor/mappp.py
and I typically use it like this:
https://github.com/ebranlard/welib/blob/dev/welib/yams/windturbine.py#L958

@WTurbine
Copy link
Author

Hi,

Thank you for your kindly reply. I have tried the dev branch and I can extract mooring stiffness matrix now. Also the matrix can be translated from one point to another (

K, f0 = moor.stiffness_matrix(epsilon=1e-5, point=(0,0,25))
). And the matrix matched the results provided by OpenFAST as shown below. And I really appreciate the information you shared.

Thank you again and have a nice day.

Mooring stiffness matrix from pymap
41181 0 0 0 -2815428 0
0 41181 0 2815430 0 0
0 0 11941 0 0 0
0 2815431 0 310785098 0 -49
-2815429 0 0 0 310784963 0
0 0 0 -81 0 11566656

Mooring stiffness matrix from document of OpenFAST
41180 0 0 0 -2821000 0
0 41180 0 2821000 0 0
0 0 11940 0 0 0
0 2821000 0 311100000 0 0
-2821000 0 0 0 311100000 0
0 0 0 0 0 11560000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants