-
Notifications
You must be signed in to change notification settings - Fork 24
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
Wave elevation generation #125
Comments
Hi @ckberinger, Note, this post was edited by @simmsa on 4/23/2024 to use the correct units, Spectral Density [m^2/Hz], on the y axis of the spectrum Visualizations Thank you for reaching out! I am able to replicate this issue. I think I understand the core issue and have found a solution which is detailed below. If you have any questions or need further assistance, don't hesitate to reach out. Issue DescriptionGenerating a wave spectrum works with a frequency index array starting above zero, but generating a surface elevation using that spectrum fails with Solution SummaryCreate a frequency index array that starts at zero. Define the frequency index delta based on the desired surface elevation duration. Issue@ckberinger, here is what I am seeing with your code: Generating the wave spectra
Yields a valid wave height spectrum: But generating the surface elevation yields an error:
SolutionDefine a frequency range that includes zero and use a frequency index derived from the desired surface elevation seconds.
Which yields:
Which yields the following plot and appears to match expectations for one minute Pierson Moskowitz surface elevations:
Which yields the spectrum: And the surface elevation: Which should be the desired result. One note, for completeness MHKiT-MATLAB needs to add an argument to Also creating some code examples is a great suggestion! Do you or your team have any suggestions they would like to see? |
Thank you for working through this and showing a working version! What is the justification for the time step of 0.001 seconds? I had a similarly good-looking result for the surface elevation 20 minute time series plot when I used 1000 frequencies, but it seems not based on physics. This surface elevation plot is very sensitive to the number of frequencies when including frequencies down to 0. For example, should only 32 frequencies (the amount collected from model data/buoys) produce a reasonable time series? It does not though. When using the ifft method, should one perhaps use non-linearly spaced frequencies as (models and buoys do)? I may just end up using the sum_of_sines with 32 frequencies between 1/30 and 1/2 and see if that produces a reasonable result! Thanks for the suggestion. |
@ckberinger, thank you for the clarification, hopefully I am not leading you in the wrong direction. My justification for using a 0.001 second timestamp is my own perspective. I typically work with time-series data that is collected at high frequency so that is why I chose to use a 1000 Hz sample rate. You can certainly drop that number down to something more reasonable. In #126 we are adding the Here is the latest code using the sum of sines method:
Spectrum: Surface Elevation: Does this align better with your use case? If we need more clarification on the physics we may need to reach out to the developers who originally developed the ifft method. Here is the pull request where this feature was originally implemented. The details of the ifft method will be better explained by them. Let us know if this is helpful! Note: this post was edited by @simmsa on 4/23/2024 to use the correct units, Spectral Density [m^2/Hz], on the y axis of the spectrum visualizations |
@ckberinger, one more follow up. We should be handling your use case more gracefully. I submitted Issue 308 in the MHKiT-Python repo to address this issue further. Please let us know if these fixes are a suitable solution for your use case. |
Hello,
I tried restarting MATLAB and my computer. Should I disable the old mhkit toolbox? I tried doing that but I still got the same error. Oregon State University, TEAMER, NREL, and Sandia are hosting a workshop this coming Monday and I would like the students to be able to use this sine method if it could be in the master before then. |
@ckberinger, this could be due to issues with your MATLAB path sourcing a previously installed add-on of MHKiT-MATLAB. Can you verify that the output of running Let us know if this is not the issue. For merging into master, I have a review out to both @rpauly18 and @hivanov-nrel on our team. I will reach out to both of them directly to see if they have time to review this before Monday. We appreciate your patience! |
@ckberinger, #126 was merged today. Please let us know if this is an adequate fix of the surface elevation function for your use case. |
This works great, thank you for adding! |
Awesome! Thanks you for bringing this to our attention and working to get this fixed. Let us know if you find any other issues or have suggestions for improvements. |
Hello,
I am trying to make a Pierson Moskowitz wave elevation 20 minute time series with a peak period of 16s and a significant wave height of 1.5 meters. The code below is what I have but I know it has several issues.
What is the frequency input supposed to look like in the "pierson_moskowitz_spectrum" function? Should it be linearly spaced? Include a zero frequency? Right now it is based on having 32 frequencies between 2 and 30 seconds which is based on how model data reports frequencies. The "surface_elevation" code requires a 0 frequency for the ifft, do you suggest padding with a zero? Example code for this function would be helpful as well!
Thank you,
Courtney
The text was updated successfully, but these errors were encountered: