Page **1** of **1**

### User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Sun Feb 17, 2019 8:53 pm**

by **Danupon.Subanapong**

Hello!!!

I am now modeling floating offshore wind turbine with semi-submersible platform by using FAST v.8. I have a question about the HydroDyn module. Since I have measured frequency wave spectrum, I am thinking about using "user-defined spectrum from routine UserWaveSpctrm option" in WaveMod input of HydroDyn. However, as far as I understand there is no clear instruction on how to use this and no example as well. So, could you please give me some suggestions?

Thank you

Danupon Subanapong

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Mon Feb 18, 2019 6:42 am**

by **Jason.Jonkman**

Dear Danupon,

Hopefully the UserWaveSpctrm routine in HydroDyn is self-explanatory. This routine is called once per frequency at model initialization and receives the frequency (in rad/s) and direction (in degrees) of the wave component as input and returns the one-sided power-spectral density (PSD) (in m^2/(rad/s)) of the wave component as output. Its up to you how to calculate the one-sided PSD.

Best regards,

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Mon Feb 18, 2019 9:35 am**

by **Danupon.Subanapong**

Thank you so much for your reply. As you said

This routine is called once per frequency at model initialization and receives the frequency (in rad/s) and direction (in degrees) of the wave component as input and returns the one-sided power-spectral density (PSD) (in m^2/(rad/s)) of the wave component as output.

, it means that there is an input for frequency and direction of the wave companent. Am I correct?

If correct, the problem is that I cannot find an example of that input in any example of HydroDyn files.

Thank you so much

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Mon Feb 18, 2019 4:57 pm**

by **Jason.Jonkman**

Dear Danupon,

The sample UserWaveSpctrm routine is included in the Waves.f90 source file of HydroDyn. The Omega and WaveDir arguments of the routine are the inputs.

Best regards,

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Mon Feb 18, 2019 9:36 pm**

by **Danupon.Subanapong**

Thank you so much for your kind response. It is very clear and helpful.

Best Regards,

Danupon Subanapong

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Fri May 10, 2019 4:58 am**

by **Sai.Chaitanya**

Sir,

I need to plot the Power spectral density of the responses I got using FAST for a spar model. I could not get any code or mathematical background for the same. Please guide me where I can find the mathematical expressions or a code.

Thank you

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Fri May 10, 2019 6:47 am**

by **Jason.Jonkman**

Dear Sai,

The MATLAB-based MCrunch post-processing tool can calculate and plot Power Spectral Densities (PSDs). I've also developed a simple MATLAB-based function that calculates PSDs directly via FFT without windowing that I've attached for your use.

Best regards,

- Jason_PSD.m.txt
*Simple MATLAB function for calculating PSDs directly via FFT without windowing.* - (2.73 KiB) Downloaded 54 times

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Mon May 27, 2019 9:23 am**

by **Sai.Chaitanya**

Dear sir,

Thank you for the code.

I have time series data i.e. in seconds and response in meters. I have gone through the code and being new to MATLAB, as far as I understood, we have to input time series data as 'Data' and should convert it in separately into frequency and input as 'df'.

If it's correct, under what parameter in the code, we should input the response which I have in meter in order to get it on the y-axis as m2/Hz.

Help me in this regard.

Thanks alot

### Re: User defined spectrum from routine UserWaveSpctrm in HydroDYn

Posted: **Tue May 28, 2019 6:35 am**

by **Jason.Jonkman**

Dear Sai,

The Data array should be set to the time-series data (what you attached as Response.txt). The df scalar should be set equal to 1/tmax i.e. one divided by the total simulation length in seconds. From your timeseriesdata.txt file, it looks like you have 600 time steps with a time step size of 1 s, so, df = 1/(600 s).

Best regards,