Skip to content

Conversation

@TianyuanWangi
Copy link
Contributor

Add a feature to extrapolate the radiation damping loads. Since convolutionIntegralInterp and convolutionIntegralSurface use persistent variables to track velocityHistory over time, radiation damping loads cannot be updated at each sub-time step.

See #1450

@akeeste akeeste self-requested a review May 16, 2025 23:36
@akeeste
Copy link
Contributor

akeeste commented May 16, 2025

Thanks @TianyuanWangi I will review first thing next week.

@TianyuanWangi
Copy link
Contributor Author

Hi @akeeste
I hope my work helps. Sorry I changed some variable and file names, and now the inconsistent formatting is driving me nuts.

Copy link
Contributor

@akeeste akeeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TianyuanWangi

I pushed a couple minor formatting changes in extrapFrad and updated the name of ``convolutionIntegralInterp` in a couple other places.

My main request before merging:
extrapFrad could largely be simplified to call MATLAB's interp1, instead of manually defining the interpolation. That will remove the if statements, making the function cleaner and faster, and enable different interpolation schemes in the future.

Can you update the function to do this? If timeHistory in convolutionIntegralInterp and convolutionIntegralSurface is initialized to [-2*simu.cicDT -1*simu.cicDt 0] instead of zeros(3,1), interp1 can be called as is

@TianyuanWangi
Copy link
Contributor Author

Hi @akeeste

I think you propose a better solution. Now the codes in extrapFrad.m is simplified to

Frad =  interp1(timeExtrap,FradExtrap,time,'pchip','extrap')';

I used 'pchip' instead of 'spline', as the latter is is very unstable during the first few time steps when only limited data is available.

Since simulink doesn't have an interpolation function, I have to implement it via matlab function.

The timeHistory is initialized as

    timeHistory = [-1*(cicTime(2)-cicTime(1));-2*(cicTime(2)-cicTime(1));-3*(cicTime(2)-cicTime(1))];

, following the principle that the updated data is the first element.

At the initial time step, it turns to

timeHistory = [0; -1*(cicTime(2)-cicTime(1));-2*(cicTime(2)-cicTime(1))];

@akeeste akeeste self-requested a review May 21, 2025 15:13
Copy link
Contributor

@akeeste akeeste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @TianyuanWangi for your contribution! My apologies for the long timeline on getting this into WEC-Sim.

I pushed one last commit to add the extrapFrad function to the flex body and save the library to R2020b

@akeeste
Copy link
Contributor

akeeste commented May 21, 2025

I pushed two last commits to fix the cicTest format and correct the sizing of FradHistory when there are body interactions. Test pass locally now.

Tests are failing but due to runner issues, not this PR. I tested locally and everything passed so I am merging to prevent library conflicts with other PRs.

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

Successfully merging this pull request may close these issues.

[Feature] On the extrapolation of radiation damping loads calculated by ConvolutionIntegral_interp.m

2 participants