Skip to content
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

Pioneer tutorial updates (empirical impedance model and nonlinear spring) #362

Merged
merged 36 commits into from
Aug 13, 2024

Conversation

jtgrasb
Copy link
Collaborator

@jtgrasb jtgrasb commented Jul 12, 2024

Description

This PR updates the pioneer tutorial according to the recent work done. The main updates are the use of the wot.WEC.from_impedance() method to create the WEC object using an empirical impedance and the addition of the nonlinear spring.
A few notes:

  • I left the BEM solver in there to compare to the empirical data.
  • The empirical data is loaded from a number of files. It may be worth consolidating these.
  • I used the PTO module to create the PTO transfer matrix even though we don't actually use it to define the PTO. Instead we define the generator force, pto power, etc. manually. This could be confusing but left it in for now.
  • I made some modifications to the utilities class as well
    • Added option to bode plot to return the axes - this allows us to plot on top of other plots
    • Added option to specify tolerance for sankey diagram. The nonlinear spring case seemed to vary within +- 1% off in terms of the total sum of power flows. The tolerance is by default 0.1% of the optimal excitation, but this case uses 1%.

Type of PR

  • Update to tutorial

Checklist for PR

Additional details

cmichelenstrofer and others added 30 commits April 1, 2024 09:54
* Make uniform shift default false and fix test_core

* Allow for non-uniform shift for impedance
* fix tests

* fix pioneer
* Pioneer tutorial realizations demo

Add frequency array and realization study to beginning of pioneer tutorial

* Update pioneer

* Clean pioneer and update docs

* remove print

* Units

* Update pioneer plots

* Waves before frequencies

* Explain less frequencies

* Minor updates

* Update pioneer

* Merge branch 'dev' of https://github.com/sandialabs/WecOptTool into phases_demo
* bug bix : DC and Nyquist frequency should not be devided by two before ifft


* Changed td_to_fd to scale single sided frequency components rather than TD signal

* minor bug fix from issue332 sandialabs#332
* run CI on PRs against dev branch

* revamped tutorial 1, including fix for sandialabs#293

* more tutorial cleanup and editorial changes

* more cleanup and incorporated changes in sandialabs#315

* fixed tutorial 2 colormaps

* finishing touches

* reverted a few accidental changes

* fixes as per Jeff's review comments

---------

Co-authored-by: Ryan Coe <rcoe@sandia.gov>
* run CI on PRs against dev branch

* coppied fundamental utility files

* import utilities module

* added utilities funtions to tut1

* added bem plot from utils

* added bem plot from utils

* updated sankey plot

* updated check_radiation_damping

* cleared outputs

* corrected bug

* changed Zi to hydro_impedance to be consistent with our variables name python convention

* PR review edits

* add grid to plots

* removed draft functions in utilities.py

* typo

* Fixed one more typo I found while reviewing Daniel's changes

---------

Co-authored-by: Ryan Coe <rcoe@sandia.gov>
Co-authored-by: Michael Devin <michaelcdevin@outlook.com>
…abs#337)

* post_processing docstrings

- examples
- parameters (order)

* handle multiple phase realizations internally

* Update wecopttool/core.py

* making outputs lists

* Update implementation to function with tutorial 1 for now

* Update tutorials

* Update LUPA

* Make sure same WEC is passed in

* Add test_utilities

Revert "Add test_utilities"

This reverts commit 27399f0.

* Update utilities module

* Update utilities

* Update test_utilities

* Update tutorial 1 utilities call

---------

Co-authored-by: Carlos A. Michelén Ströfer <cmichel@sandia.gov>
Co-authored-by: Carlos A. Michelén Ströfer <c.michelen.strofer@gmail.com>
Co-authored-by: jtgrasb <jtgrasb@sandia.gov>
Co-authored-by: jtgrasb <87095491+jtgrasb@users.noreply.github.com>
* added initial file changes based on sphinx_multiversion docs and WEC-Sim implementation

* removed sphinx-multiversion since it is no longer supported and made manual multiversion

* now uses absolute paths, commented out linkcheck for debugging

* fixed docstring errors in utilities module

* updating files again that somehow got reverted

* fixing path in conf.py

* don't run tutorials (will revert later)

* handle file moves correctly, fixed if statement to make other versions appear

* fixed two bugs in versions template

* reverted temp changes, changes latest to main

* switched latest to main

* main branch now in root directory of pages

* fixed URLs with change from last commit

* make other branches visible before building

* switched main branch tag for more testing

* fixed typo

* switched dev branch to an existing branch

* renamed main to latest, changed version.html file name to avoid confusion

* added prints about moving files so Sphinx output isn't misleading

* fixed typo with quotations

* changed versions.html name back because that broke things I guess

* modified contributing documentation to reflect changes

* add logic to remove duplicate 'latest' branch

* Fixed pathing when already on latest

* remove typo

* Troubleshooting complete, switching back to correct branches for deployment

* Removed extra word in docstring

* removed redundant function

* fixed pathing so returns to same file (and fixes tutorial/API docs)

* changed latest branch for demonstration

* switched back latest branch for deployment
* removed conda environment from workflows since newer capytaine/wavespectra work with Windows

* fixed unnecessary capitalization

* still create CI conda environment to fix Mac environment failures

* added conda env fully back in, push workflow deploys docs, split PR workflow

* conda environment activates again

* mambaforge instead of miniforge

* manual cache reset

* reset to older version of setup-miniconda to troubleshoot
@coveralls
Copy link

coveralls commented Jul 12, 2024

Pull Request Test Coverage Report for Build 10375413369

Details

  • 5 of 7 (71.43%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.06%) to 94.514%

Changes Missing Coverage Covered Lines Changed/Added Lines %
wecopttool/utilities.py 5 7 71.43%
Totals Coverage Status
Change from base Build 10222891623: -0.06%
Covered Lines: 2774
Relevant Lines: 2935

💛 - Coveralls

Copy link
Collaborator

@michaelcdevin michaelcdevin left a comment

Choose a reason for hiding this comment

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

Looks good! It's good to see the tutorial updated with the improved model, and the additions to the utilities module are a nice touch. I added some comments throughout; they're all minor editorial things.

Regarding the empirical model file imports and consolidation:

  • The Zi_* and Znsif_* files aren't actually used by the empirical model, so we can remove these
  • I like the idea of consolidating the empirical data down to a single Python file, data/pioneer_empirical_data.py, and have that contain the data variables that we can then just import into this tutorial (e.g., Zemp_stiffness = 65821.855014021, Zemp_imag = np.array([-2094686.18125349, -1046610.28581912, ...]), etc.). I don't think the file imports are bad though (especially once we remove the unnecessary files), so I'll leave this to your judgment.

I'll approve this, just be sure to address the comments and clean up the data files (include optionally consolidating them) before you merge!

examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Show resolved Hide resolved
wecopttool/utilities.py Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
examples/tutorial_4_Pioneer.ipynb Outdated Show resolved Hide resolved
@jtgrasb
Copy link
Collaborator Author

jtgrasb commented Aug 13, 2024

Thanks for the review, Michael! I've made the requested updates and merging it now.

@jtgrasb jtgrasb merged commit 362b78c into sandialabs:dev Aug 13, 2024
9 of 10 checks passed
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.

6 participants