Skip to content

Conversation

@akeeste
Copy link
Contributor

@akeeste akeeste commented Jun 23, 2025

This PR refactors badBemioFix_fcn:

  • renames function to cleanBEM
  • modularizes - the peak smoothing is turned into a single function that is used for all hydro coefficients (A, B, Fex).
  • simplifies the interpolation to use the built-in interp1 for consistency and ease of changing the interpolation method
  • aligns the usage of the function with the rest of BEMIO
    • This is now a standalone function that can be called with any pre-existing hydro structure and it does not read in coefficients on its own
    • IRF and SS coefficients are removed and must be recreated after using this function to fix A, B, Fex
    • IRF and SS function calls are not repeated within the cleaning function, saving time
  • reorganizes the despike structure to fit the function-based method within cleanBEM

and fixes a couple bugs:

  • the peak smoothing loop for added mass and damping only took the last value and did not iterate from 1:deSpike.N
  • the negative peak finder for imaginary excitation force component was set to "-.1" not "-1."

To compare the largely identical results after the refactor but before a few bug fixes, look at commit 381f8ba

TODO:

  • find the citation that this function was based on
  • upload comparison script and some sample data

@dforbush2
Copy link
Contributor

Hi @akeeste this is the citation from our European friends:

Kelly, T., Zabala, I., Peña-Sanchez, Y., Penalba, M., Ringwood, J. V., Henriques, J. C., & Blanco, J. M. (2022). A post-processing technique for removing ‘irregular frequencies’ and other issues in the results from BEM solvers. International Marine Energy Journal, 5(1), 123–131. https://doi.org/10.36688/imej.5.123-131

@akeeste
Copy link
Contributor Author

akeeste commented Jun 25, 2025

Thanks @dforbush2 for the citation

This is ready for review. I have a test script and data that I can email privately to test the PR with (TEAMER data)@dforbush2 if you have the time to review you probably know this function best, but this isn't an urgent merge so no pressure to.

@kmruehl kmruehl added the BEM/BEMIO related to BEMIO or BEM hydro data label Jun 27, 2025
@akeeste akeeste requested a review from MShabara July 9, 2025 14:21
@akeeste
Copy link
Contributor Author

akeeste commented Jul 9, 2025

Note: the most recent version of BEMRosetta filters in a very similar way and can output an .h5 file that WEC-Sim can read

@MShabara
Copy link
Contributor

The PR works as expected, I will go ahead and merge this PR

@MShabara MShabara merged commit 88ff32c into WEC-Sim:dev Jul 23, 2025
17 of 18 checks passed
@akeeste akeeste deleted the refactor_bem_cleanup branch July 28, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BEM/BEMIO related to BEMIO or BEM hydro data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Theory or Implementation] Documentation typo in state space equation

4 participants