-
Notifications
You must be signed in to change notification settings - Fork 184
Adds the QTFs to WEC-Sim #1242
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
Adds the QTFs to WEC-Sim #1242
Conversation
|
hi @MShabara Can you please provide an example of the WAMIT input files that will generate QTFs? It would be great to have some means to test a few versions of these files, and especially when ready to release since searching for "QTF" doesn't come up with anything in the WAMIT user manual. |
|
@dforbush2 , |
|
|
@salhus ah i see good to know. In that case...I'll see if i can get an install here of that version. If not, it would be good to check that the file format is what you expect for multiple bodies, additional GBMs or free surface modes, etc. on the BEMIO side. That's more what I meant @MShabara. If it can't handle all of those things yet thats fine, we just need to understand what its current limitations there are for documentation. |
|
@MShabara whats the recommended way to test this? There isn't a modified wecSimInputFile that shows how to call this. I can try to piece it together but that might be less efficient than making a test example |
|
I've sent over an example of the output files for WAMIT to utilize. If you're currently testing out the modified functions, feel free to experiment with them using the RM3 example. Simply add the following line to the
Additionally, you can find a rundown of the major limitations of this functionality listed in the new |
|
There is a lot here and thank you @MShabara for making it so readable and well-commented already.
And I know I've asked before and probably already have this somewhere, but if you could please provide a link to the citation of the methodology you're implementing here it would be a great reference (email is fine if unpublished). Will continue to review later. |
|
Thanks @dforbush2, these are really good questions/comments:
|
|
Hi @dforbush2
Please don't forget to check the run from Simulink feature as it needs a revision. |
|
1. that’s interesting. I actually thought the same and would have thought that the calculation would go to zero for a monochromatic wave. I intended this as my “null” test, thinking the qtf results would equal the non qtf results…but clearly that’s not true and my read of the math says that it shouldn’t be true. A cool theory point to discuss.
3) great this clarifies things thank you.
…________________________________
From: Mohamed Shabara ***@***.***>
Sent: Tuesday, April 2, 2024 4:21:13 PM
To: WEC-Sim/WEC-Sim ***@***.***>
Cc: Forbush, Dominic Dean ***@***.***>; Mention ***@***.***>
Subject: [EXTERNAL] Re: [WEC-Sim/WEC-Sim] Adds the QTFs to WEC-Sim (PR #1242)
Hi @dforbush2<https://github.com/dforbush2>
1. The QTFs are based on the summation and difference of waves periods in irregular waves, and should not be used if a regular wave is used. HydroDyn displays an error message and interrupts the solution if the QTFs were enabled in a regular waves simulation. We can do the same for Wec-Sim, We can also add a check that the used frequencies in the wave spectrum is similar to the number of frequencies in the WAMIT files.
2. I will make sure about adding this to the documentation, we can also add an error message to help users identify the problem if they encounter it. While coding it I thought its intuitive that if you didn't include the QTFs for a body in the BEMIO and tried to solve for it in WEC-Sim you will get errors.
3. When two linear wave periods are the same, the quadratic forces for the difference frequency are the same as the mean drift forces. The mean drift force has two contributions:
a) 2nd-order hydrodynamic pressure integration due to the first-order wave
b) Interaction between the first-order motion and the first-order wave
Currently, WEC-Sim only reads mean drift coefficients representing the first contribution. According to WAMIT documentation<https://www.wamit.com/manual6.4/Chap11.pdf>, the quadratic forces may be evaluated more accurately than using the conventional pressure integration method.
4. Thanks for the warring warning flag suggestion, I will add this to the code.
Please don't forget to check the run from Simulink feature as it needs a revision.
—
Reply to this email directly, view it on GitHub<#1242 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AHF2G7HYD6KQILIBX67OECTY3MVNTAVCNFSM6AAAAABFHNDI7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTGE4TSMZUGY>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
@dforbush2 I've edited my last comment to correct the first point (1) regarding the application of the QTFs in regular waves. |
|
Thanks for these changes @MShabara. Things appear to be working intuitively, though surge displacements in regular waves are still really high (~180 m for 100s run time with 60s wave ramp). We had discussed the validity of this approach in regular waves, and it seems like a lot of drift in surge. Looking at irregular waves, there is some unusual behavior when QTF is paired with quadratic drag. The direction of average drift is reversed (though the magnitude of this displacement is reduced as expected) This is certainly non-physical and I don't have a good explanation of how it arises: in isolation Drag seems to work fine. In REGULAR waves, there is no reversal of drift direction in CD + QTF cases (but again, not sure if its appropriate to consider regular waves in this context) The one point of potential confusion that I recommend is clarified in the documentation is how QTF relates to mean drift (i.e., the user shouldn't use body(i).meanDrift = 1 AND body(i).QTFs = 1. I cannot get run from Simulink to work here however, i cannot get it to work anywhere on 2023b or 2024a... @akeeste is this something you have insight on? |
|
@dforbush2 @MShabara Yes I can look into Run From Simulink. I'm late on that but should have time next week |
|
@dforbush2 Thanks for your feedback. I just tested the QTFs and the Quadratic drag and I noticed this behavior too, I think that is because of the current QTF calculations does not correct for the body frame motion. I will make this on the top of my to-do list after I finishing the documentation and the example. I also noticed that the wave waveform change when enabling the quadDrag, this affects the value of the QTFs. body(2).QTFs = 1; or body(2).QTFs = 0; @akeeste Thanks for helping with the run from WEC-Sim issue, looking forward to your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MShabara Apologies for being very late in my review. This looks pretty good from a Simulink GUI perspective. There's a couple other things required for the Simulink GUI to incorporate a QTF flag robustly:
- adding a line to
writeInputFromBlocks, similar to your addition towriteBlocksFromInput - adding QTFs to the mask in the library
I made both these changes and will make a PR into your branch shortly. Is there anything that limits using the QTF with a GBM mode? I just need to know whether to add the flag to the flex body mask as well.
See https://github.com/MShabara/WEC-Sim/pull/1 to wrap up WEC-Sim GUI feature for the QTFs
| function [outputArg1,outputArg2] = reformQTFData(inputArg1,inputArg2) | ||
|
|
||
| end | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @MShabara I was reviewing this PR from a Simulink GUI perspective and just noticed this function is blank. What is the intent here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @akeeste,
The QTF functions are designed to handle flexible bodies; however, they have not yet been integrated into the Flexible Body Simulink block. I plan to include this in my future work.
The function reformQTFData.m is not used in the current code. Could you please remove it?
If the pull request looks good to you, could you please approve it?
In the next few months, I will create a pull request that includes the following:
- Force correction to account for the body reference frame rotations.
- Modifications to the readNEMOH function to read QTF data.
- Linking the Flexible Body Simulink block with the QTF functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MShabara I added these outstanding actions to the project board: https://github.com/orgs/WEC-Sim/projects/12/views/1?pane=issue&itemId=78663095
Update Simulink GUI set-up for QTFs feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MShabara the source code modifications have been review by others, so I'm mainly focused on what needs to be done to merge this PR. I've noted a few files whose revisions should be remove. In addition to those minor edits, we need to complete the following prior to merging:
- resolve merge conflicts
- source/functions/BEMIO/writeBEMIOH5.m --> resolved with https://github.com/MShabara/WEC-Sim/pull/2
- source/functions/initializeWecSim.m --> resolved with https://github.com/MShabara/WEC-Sim/pull/2
- source/functions/simulink/mask/writeInputFromBlocks.m --> resolved with https://github.com/MShabara/WEC-Sim/pull/2
- source/lib/WEC-Sim/WECSim_Lib_Body_Elements.slx (resolving the Body Library conflicts which need to be done manually)
- Revert changes
- reverting RM3 Capytaine changes --> resolved with https://github.com/MShabara/WEC-Sim/pull/2
- reverting RM3 input file changes --> resolved with https://github.com/MShabara/WEC-Sim/pull/2
- remove empty
source/functions/BEMIO/QTFs/reformQTFData.mfunction --> resolved with https://github.com/MShabara/WEC-Sim/pull/2
- add documentation for QTF --> noted where to add docs in https://github.com/MShabara/WEC-Sim/pull/2
- add an example or application case
- add a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to manually pull in this library changes since we've had other updates to the library block
|
@MShabara please merge https://github.com/MShabara/WEC-Sim/pull/2 and/or grant me write access to your fork. Thanks! |
* Adds the QTFs to WEC-Sim * Adds error/warning messages and fixes a bug * fixes a bug * Fixes an issue with the Mean Drift force calculation *Makes the BIMIO QTFs search more rigorous *add QTFs flag to writeInputFromBlocks * add QTFs to rigid body and flex body masks * Merge pull request #1 from akeeste/QTFs_WAMIT * Merge pull request #2 from kmruehl/QTFs_WAMIT *resolving all merge conflict except body library
* Adds the QTFs to WEC-Sim * Adds error/warning messages and fixes a bug * fixes a bug * Fixes an issue with the Mean Drift force calculation * Makes the BIMIO QTFs search more rigorous * add QTFs flag to writeInputFromBlocks * add QTFs to rigid body and flex body masks * Merge pull request #1 from akeeste/QTFs_WAMIT * Merge pull request #2 from kmruehl/QTFs_WAMIT * resolving all merge conflict except body library





Changes Overview:
BEMIO:
readWAMIT()function to read WAMIT sum and diff output files, organizing data into matrices and vectors.WEC-Sim:
readh5()function to incorporate reading QTFs data.initializeWecSim.mto define system variable parameters.bodyClass.WECSim_Lib_Body_Elements.xlsto include the Second Order Excitation Forces Subsystem Variable.Run from Simulinkfunctionality.These changes adds the full QTF functionality to the codebase, particularly in handling WAMIT output files and integrating QTF calculations seamlessly within WEC-Sim.
Please review and provide any feedback or suggestions. Thank you!