Skip to content

ENHANCEMENT: Implemented cyipopt minimize_ipopt #342

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

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9e35f0a
Update CONTRIBUTING.md to indicate PRs should be to the new `dev` branch
cmichelenstrofer Apr 1, 2024
db731fe
Update RELEASING.md to reflect new workflow with the `dev` branch
cmichelenstrofer Apr 1, 2024
eed5f7d
Set Default uniform_shift to False (#313)
jtgrasb Apr 1, 2024
b466e6f
update docstrings (#326)
rgcoe Apr 2, 2024
d4f9fc7
damping naming and consistently change radiation damping (#328)
cmichelenstrofer Apr 2, 2024
b4d802f
run CI + codeQL on dev PRs/pushses
rgcoe Apr 2, 2024
775d273
Fix test failures (#330)
jtgrasb Apr 3, 2024
a7bef5f
actually test power solution for irregular wave (#327)
rgcoe Apr 3, 2024
83de96f
Update test_integration with new scaling (#333)
jtgrasb Apr 3, 2024
2abb4fb
Phase Realizations Demo and Docs (#315)
jtgrasb Apr 3, 2024
6fdd660
issue 321 fd_to_td() bug (#329)
dtgaebe Apr 3, 2024
c6f858a
nodf -> ndof (#334)
rgcoe Apr 3, 2024
0b6cd08
add DOI for Daniel's paper (#336)
rgcoe Apr 3, 2024
ea039c5
Tutorial cleanup (#339)
michaelcdevin Apr 23, 2024
59c25ca
Implement cyipopt minimize_ipopt
jorgeypcb Apr 26, 2024
b8506d8
Utils dev - replaces old utilities PR (#343)
dtgaebe May 2, 2024
9f2e6ba
Post process docstrings; use loops for multiple realizations (#337)
rgcoe May 3, 2024
98a1feb
v3.0.0
michaelcdevin May 6, 2024
bc38e2e
Lower tolerance for new test to fix CI failing occasionally
michaelcdevin May 7, 2024
77a0e84
removed comments for callback implementation and uneccessary cyipopt …
jorgeypcb May 7, 2024
ecd7727
hyperlinks no longer have formatting, plus other small adjustments (#…
michaelcdevin May 8, 2024
4792bea
Merge to dev, not main (#349)
michaelcdevin May 9, 2024
d701a22
fixed metadata to match original repo
jorgeypcb May 13, 2024
9098c0e
slight correction to the tutorial metadata
jorgeypcb May 13, 2024
df93d8a
Merge branch 'dev' into scipy-to-cyipopt
jtgrasb May 13, 2024
3c67167
Add cyipopt to toml file
jtgrasb May 13, 2024
4de3f31
Conda install cyipopt for CI (push)
michaelcdevin May 16, 2024
0b0b742
conda install cyipopt for documentation
michaelcdevin May 16, 2024
c8912d0
dev WOT install should conda install cyipopt
michaelcdevin May 16, 2024
dc70638
Update tutorial 1 references to cyipopt.minimize_ipopt
jtgrasb May 17, 2024
02a7112
can now mamba install for WOT documentation build
michaelcdevin May 17, 2024
7f0a885
Merge branch 'scipy-to-cyipopt' of https://github.com/RageTechDev/Wec…
michaelcdevin May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ Community contributions are welcomed! 🎊

* It is recommended that you create a *virtual environment*, e.g. using `conda`, `venv`, or similar.
* If you want to build the documentation locally you will also need to install [pandoc](https://pandoc.org/installing.html) and [gifsicle](https://github.com/kohler/gifsicle).
* If you do not have Fortran compilers properly setup in your system, install `capytaine` and `wavesspectra` using `conda`. In this case you will need to have a `conda` virtual environment. This is recommended for *Windows* users since compiling `capytaine` on *Windows* requires [extra steps](https://github.com/capytaine/capytaine/issues/115).
* If you do not have Fortran compilers properly setup in your system, install `capytaine` and `wavespectra` using `conda`. In this case you will need to have a `conda` virtual environment. This is recommended for *Windows* users since compiling `capytaine` on *Windows* requires [extra steps](https://github.com/capytaine/capytaine/issues/115).
* Similarly, if you do not have the prerequisites listed [here](https://cyipopt.readthedocs.io/en/stable/install.html#from-source) to install `cyipopt` from source, install it using `conda` as well.
* On a ZSH shell (*MacOS*) do `pip install -e .\[dev]` instead of `pip install -e .[dev]` in the instructions below (i.e., escape the opening square bracket).

Using `conda` this looks like:
```bash
conda create -n wecopttool python=3.11
conda activate wecopttool
conda install -c conda-forge capytaine wavespectra
conda install -c conda-forge capytaine wavespectra cyipopt
git clone [email protected]:<YOUR_USER_NAME>/WecOptTool.git
cd WecOptTool
pip install -e .[dev]
Expand Down Expand Up @@ -42,7 +43,7 @@ Autograd does not support all NumPy and SciPy functionalities, see [autograd doc
1. Create a fork of WecOptTool
2. Create a branch for the specific issue
3. Add desired code modifications. For enhancements add to documentation. Add or modify a test. Make sure all tests pass and documentation builds. Follow style guide above.
4. Do a pull request, and give admins edit access. [Link to any open issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) and add relevant tags. Use a concise but descriptive PR title, as this will be part of the [release notes](https://github.com/sandialabs/WecOptTool/releases) for the next version. Start the PR title with an all caps label followed by a colon, e.g., "BUG FIX: ...", "NEW FEATURE: ...", "DOCUMENTATION: ...", etc.
4. Do a pull request to the `dev` branch, and give admins edit access. [Link to any open issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) and add relevant tags. Use a concise but descriptive PR title, as this will be part of the [release notes](https://github.com/sandialabs/WecOptTool/releases) for the next version. Start the PR title with an all caps label followed by a colon, e.g., "BUG FIX: ...", "NEW FEATURE: ...", "DOCUMENTATION: ...", etc. **Note: Pull requests should be made to the `dev` branch, not the `main` branch**.

## Tests
There are a series of unit and integration tests defined in the `tests` directory.
Expand Down
3 changes: 2 additions & 1 deletion .github/RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ This section is for developers.

Before a release make sure to:

* change [version number](https://semver.org/) in `pyproject.toml`
* change [version number](https://semver.org/) in `pyproject.toml` in the `dev` branch.
* Merge the `dev` branch into the `main` branch. **Note: the `dev` branch should only be merged into `main` when it is ready for a new release.**

## GitHub
In the GitHub repository, click on *Releases*, click on *Draft new release*.
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Concise description of the pull request with references to any [issues](https://

## Checklist for PR
- [ ] Authors read the [contribution guidelines](https://github.com/sandialabs/WecOptTool/blob/main/.github/CONTRIBUTING.md)
- [ ] The pull request is from an issue branch (not main) on *your* fork, to the [main branch in WecOptTool](https://github.com/sandialabs/WecOptTool).
- [ ] The pull request is from an issue branch (not main) on *your* fork, to the [dev branch in WecOptTool](https://github.com/sandialabs/WecOptTool/tree/dev).
- [ ] The authors have given the admins edit access
- [ ] All changes adhere to the style guide including PEP8, Docstrings, and Type Hints.
- [ ] Modified the documentation if applicable
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [ main, dev ]
pull_request:
branches: [ main ]
branches: [ main, dev ]
schedule:
- cron: '30 1 * * 0'

Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ jobs:
# - the content of pyproject.toml changes
# - you manually change the value of the CACHE_NUMBER below
# Else the existing cache is used.
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: test-env
use-mamba: true
miniforge-version: latest
mamba-version: "*"
python-version: '3.11'
channels: conda-forge
channel-priority: true
activate-environment: test-env

# save the date to include in the cache key
- name: Get Date
Expand All @@ -57,6 +59,7 @@ jobs:
echo " - python=${{ matrix.python-version }}" >> environment.yml
echo " - capytaine=1.5" >> environment.yml
echo " - wavespectra" >> environment.yml
echo " - cyipopt" >> environment.yml
cat environment.yml

# use the cache if it exists
Expand Down Expand Up @@ -127,13 +130,24 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.11' # CHANGE: Python version

- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
mamba-version: "*"
python-version: '3.11'
channels: conda-forge
channel-priority: true
activate-environment: test-env

- name: Install dependencies
run: sudo apt-get install libglu1 pandoc gifsicle

- name: Install WecOptTool for documentation
shell: bash -l {0}
run: |
mamba install cyipopt
python3 -m pip install --upgrade pip
pip3 install wheel coveralls
pip3 install .[dev,geometry]
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,23 @@ jobs:
with:
python-version: '3.11'

- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
mamba-version: "*"
python-version: '3.11'
channels: conda-forge
channel-priority: true
activate-environment: test-env

- name: Install dependencies
run: sudo apt-get install libglu1 pandoc gifsicle

- name: Install WecOptTool for documentation
shell: bash -l {0}
run: |
mamba install cyipopt
python3 -m pip install --upgrade pip
pip3 install wheel coveralls
pip3 install .[dev,geometry]
Expand Down
10 changes: 10 additions & 0 deletions docs/source/theory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ This relationship can be derived from conservation of energy in both frames, and
f_w = K^T f_p \\
:label: conservation_energy

Phase Realizations
^^^^^^^^^^^^^^^^^^
Irregular waves are defined in WecOptTool as a spectrum of complex frequency-domain wave elevations. The phase of each of the elevation elements impacts the time-domain result. Thus, the standard calculation of the objective function (average power) may change across a range of phase realizations. The amount of variance in power depends on multiple factors such as the optimization problem and the frequency array. When creating an irregular wave using :py:meth:`wecopttool.waves.long_crested_wave` or :py:meth:`wecopttool.waves.irregular_wave`, :code:`nrealizations` can be used to select the number of phase realizations to be used. By default, random realizations will be used to create the selected number of wave elevation spectra. The :py:meth:`wecopttool.WEC.solve` function will automatically iterate through and solve the optimization problem for each realization, and the overall result can be found by averaging the value of the objective function across all realizations. A general recommendation is to use sufficient random phase realizations such that the total simulation time sums to 20 minutes.

.. math::
t_{total} = \frac{nrealizations}{f1}
:label: total_time

The selection of the number of realizations is further detailed in :doc:`_examples/tutorial_4_Pioneer`.

Troubleshooting
---------------
If your simulation is not behaving as expected, consider some of the general troubleshooting steps below:
Expand Down
1 change: 1 addition & 0 deletions docs/source/wecopttool_refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ @inproceedings{Gaebele:2023wf
date-added = {2023-01-12 14:02:25 -0700},
date-modified = {2023-10-03 08:41:16 -0600},
month = {June},
doi = {10.1115/OMAE2023-103899},
series = {International Conference on Ocean, Offshore and Arctic Engineering},
title = {INCORPORATING EMPIRICAL NONLINEAR EFFICIENCY INTO CONTROL CO-OPTIMIZATION OF A REAL WORLD HEAVING POINT ABSORBER USING {WECOPTTOOL}},
year = {2023}}
Expand Down
Binary file added examples/data/tutorial_4_freq_range.nc
Binary file not shown.
Binary file added examples/data/tutorial_4_nfreqs.nc
Binary file not shown.
Binary file added examples/data/tutorial_4_nrealizations.nc
Binary file not shown.
Loading