-
Notifications
You must be signed in to change notification settings - Fork 184
vectorization of radiationIRF() function #806
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
Conversation
hat tip to @crobarcro for originally implementing this improvement in RenewNet trapz function used in B(w) cosine transformation now applied to whole arrays rather than iteratively within the k'th loop (ie over IRF time) initial tests with RM3 show 60% reduction in RIRF computation time
akeeste
left a comment
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.
This is a nice improvement to IRF function and speeds up BEMIO a lot! I confirmed that the IRF is identical to the previous function, and in my speed tests with the WAMIT sphere saw a decrease in run time of ~70-80%.
I looked to see if there was a way to remove the DOF for loops as well, but it becomes too complicated. There is a lot of reshaping and permuting necessary to make that work and in a preliminary set-up did not improve the runtime further.
I also improved the added mass calculation by changing the frequency loop (lines 59-61) to a single line: ra_Ainf_temp = ra_A' + (1./hydro.w).*trapz(t,ra_K.*sin(hydro.w.*t.'));. This took off another 5% of the runtime for non-WAMIT codes.
Let's update the excitation IRF too in this PR
testing with RM3 shows 80% reduction in excitation IRF computation times h/t @reos-rcrozier
akeeste
left a comment
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.
@dav-og I checked the new excitation IRF function, it is loads faster too (7-8x). There is one accuracy issue, excitationIRF line 39 needs dot multiplication, see my in line comment. My other two are just minor clean up. Looks great! Let's merge once these last few items are updated.
dav-og
left a comment
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.
cheers Adam!
hat tip to @crobarcro for originally implementing this improvement in RenewNet
trapz function used in B(w) cosine transformation now applied to whole arrays rather than iteratively within the k'th loop (ie over IRF time)
initial tests with RM3 show 60% reduction in RIRF computation time