Skip to content

Commit

Permalink
Merge pull request #62 from WISDEM/dev
Browse files Browse the repository at this point in the history
RAFT v1.3.0
  • Loading branch information
lucas-carmo authored Sep 11, 2024
2 parents 94d1953 + fd4ec29 commit f3f9db1
Show file tree
Hide file tree
Showing 75 changed files with 20,703 additions and 36,533 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/CI_RAFT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ jobs:
channels: conda-forge
channel-priority: true

# Install
- name: Extras
run: |
conda install -y pytest meson ninja nlopt
conda info
- name: Conda Install RAFT
run: |
pip install -e .
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@ raft/platform.gdf
tests/BEM/
tests/platform.gdf

# Tests generated data
none
outputs
reports

# Emacs
*~
128 changes: 101 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,136 @@ RAFT is a Python code for frequency-domain analysis of floating wind turbines. I
RAFT v1.0.0 includes the capabilities described above, and further development is planned to expand these capabilities. Documentation and verification efforts are ongoing. Please see [RAFT's documentation](https://openraft.readthedocs.io/en/latest/) for more information.


## Best Practices for Using `conda`

Installation with [Anaconda](https://www.anaconda.com) is the recommended approach because of the ability to create self-contained environments suitable for testing and analysis. RAFT requires [Anaconda 64-bit](https://www.anaconda.com/distribution/). However, the `conda` command has begun to show its age and we now recommend the one-for-one replacement with the [Miniforge3 distribution](https://github.com/conda-forge/miniforge?tab=readme-ov-file#miniforge3), which is much more lightweight and more easily solves for the RAFT package dependencies.


## Using RAFT as a Library

If you would like to use RAFT as a library, without direct interaction with the source code, then you can install it directly via `conda install raft` (preferred) or `pip install raft`.


## Getting Started

New users of RAFT as a standalone model are recommended to begin by looking at the input file and script provided in the examples folder, and seeking further information from the [RAFT documentation](https://openraft.readthedocs.io/en/latest/). For use as part of the WEIS toolset, information will be provided once this capability is completed in the [WEIS documentation](https://weis.readthedocs.io/en/latest/). For now, the following will help get started with running RAFT as a standalone model.

RAFT uses a number of prerequisites, or other python package dependencies, to run its calculations. The most notable ones are listed below:
RAFT uses a number of prerequisites, or other python package dependencies, to run its calculations. All of the prerequisites can be installed through the `conda` package manager, but power users may wish to install all of the NREL packages from source for customization and debugging. Notable dependencies are:

- Python 3
- NumPy
- Matplotlib
- SciPy
- YAML
- MoorPy (available at https://github.com/NREL/MoorPy)
- pyHams (available at https://github.com/WISDEM/pyHAMS)
- CCBlade or WISDEM* (https://github.com/WISDEM/CCBlade or https://github.com/WISDEM/WISDEM)
- [MoorPy](https://github.com/NREL/MoorPy)
- [pyHams](https://github.com/WISDEM/pyHAMS)
- [CCBlade](https://github.com/WISDEM/CCBlade) or [WISDEM](https://github.com/WISDEM/WISDEM)*

\* CCBlade is a module of WISDEM, but can be used separately. RAFT only requires CCBlade (and some additional related functions) out of the larger WISDEM code. Power users installing from source can install either CCBlade or WISDEM, but for highest efficiency, we recommend installing CCBlade, without the entire WISDEM installation.

Note that conda is required for the following installations.

\* CCBlade is a module of WISDEM, but can be used separately. RAFT only requires CCBlade (and some additional related functions) out of the larger WISDEM code. New users can install either CCBlade or WISDEM, but for highest efficiency, we recommend installing CCBlade, without the entire WISDEM installation.
## Installing All Dependencies with `conda`

To install all required python packages to run RAFT, follow the steps below.
To install all required python packages to run RAFT using `conda`, follow the steps below.

1. Install most of the required python packages to run RAFT from the "requirements" yaml.
1. Navigate to a directory of your choosing on your local machine and clone this RAFT repository to that new directory (if you don't have the `git` command, start with `conda install git` in your "base" environment).

(base) PS ANY_PATH> conda env create -f raft-env.yaml
(base) YOUR_PATH> git clone https://github.com/WISDEM/RAFT.git
(base) YOUR_PATH> cd RAFT

This will create new folder called "RAFT" that is a copy from the GitHub repository, located in your "YOUR_PATH" directory

2. Create a new python virtual environment based on the "environment.yml" file, which lists all the packages needed to run RAFT

(base) YOUR_PATH/RAFT> conda env create --name raft-env -f environment.yml

This will create a new python virtual environment called "raft-env"

This will create a new python virtual environment on a new user's local machine called "raft-env"
3. Activate the new virtual environment

2. Activate the new virtual environment
(base) ANY_PATH> conda activate raft-env

(base) PS ANY_PATH> conda activate raft-env
This will activate the newly created virtual environment, in which we will install the remaining dependencies. After install is complete, when opening a new conda terminal that starts in the "base" environment, you can start with this "raft-env" activation command.

This will activate the newly created virtual environment, where we will install the remaining dependencies
4. Install the RAFT package into the virtual environment

3. Install the RAFT package
- Navigate to a directory of your choosing on your local machine and clone this RAFT repository to that new directory
(raft-env) YOUR_PATH/RAFT> pip install -e .

(raft-env) PS YOUR_PATH> git clone https://github.com/WISDEM/RAFT.git
This installs RAFT and all of its modules directly from your working directory in "editable" mode, meaning, if you save a change to your source code in the files in "YOUR_PATH/RAFT", future calls to RAFT modules will include those changes.

5. Test the installation

(raft-env) YOUR_PATH/RAFT> pytest

- Staying in the same directory, install the RAFT package in it's "editable" mode
Running pytest should ensure everything was installed correctly



(raft-env) PS YOUR_PATH/RAFT> pip install -e .
## Installing NREL Dependencies from Source

4. Repeat Step 3 two more times, one for CCBlade, and one for MoorPy
To install all external python packages using `conda` and NREL packages from source, follow the steps below. Since the NREL dependencies are also under development, this may also help resolve issues if one code gets out-of-sync with the others.

(raft-env) PS YOUR_PATH> git clone https://github.com/WISDEM/CCBlade.git
(raft-env) PS YOUR_PATH/CCBlade> pip install -e .
(raft-env) PS YOUR_PATH/CCBlade> cd ..
(raft-env) PS YOUR_PATH> git clone https://github.com/NREL/MoorPy.git
(raft-env) PS YOUR_PATH/MoorPy> pip install -e .
1. Navigate to a directory of your choosing on your local machine and clone this RAFT repository to that new directory (if you don't have the `git` command, start with `conda install git` in your "base" environment.

** If you are running into errors with installing CCBlade, make sure there is not a file called "_bem.cp39-win_amd64.pyd" inside of CCBlade/ccblade. Deleting this file will allow the above commands to run.
(base) YOUR_PATH> git clone https://github.com/WISDEM/RAFT.git
(base) YOUR_PATH> cd RAFT

This will create new folder called "RAFT" that is a copy from the GitHub repository, located in your "YOUR_PATH" directory

2. Create a new python virtual environment based on the "environment-source.yml" file, which lists all the packages needed to run RAFT

This new raft-env should now be compatible to run RAFT standalone. Dependencies like CCBlade and MoorPy are still under development, which is why for now, it will be easier to install them in their editable forms.
(base) YOUR_PATH/RAFT> conda env create --name raft-env -f environment-source.yml

The other main dependency, PyHAMS, is included within the raft-env.yaml file and is installed in Step 1.
This will create a new python virtual environment called "raft-env"

Another point to note is that ```python setup.py develop``` has become outdated, and ```pip install -e .``` is preferred.
3. Activate the new virtual environment

(base) ANY_PATH> conda activate raft-env

This will activate the newly created virtual environment, in which we will install the remaining dependencies. After install is complete, when opening a new conda terminal that starts in the "base" environment, you can start with this "raft-env" activation command.

4. Install the necessary compilers and build tools for your system

(raft-env) YOUR_PATH/RAFT> cd ..
(raft-env) YOUR_PATH> pip install meson-python meson ninja cmake
(raft-env) YOUR_PATH> conda install gfortran (Mac / Linux)
(raft-env) YOUR_PATH> conda install m2w64-toolchain libpython (Windows)


5. Install the NREL packages from source one at a time.

(raft-env) YOUR_PATH> git clone https://github.com/WISDEM/CCBlade.git
(raft-env) YOUR_PATH> git clone https://github.com/NREL/MoorPy.git
(raft-env) YOUR_PATH> git clone https://github.com/WISDEM/pyHAMS.git
(raft-env) YOUR_PATH> cd MoorPy
(raft-env) YOUR_PATH/MoorPy> pip install -e .
(raft-env) YOUR_PATH/MoorPy> cd ..
(raft-env) YOUR_PATH> cd CCBlade
(raft-env) YOUR_PATH/CCBlade> pip install -e .
(raft-env) YOUR_PATH/CCBlade> cd ..
(raft-env) YOUR_PATH> cd pyHAMS
(raft-env) YOUR_PATH/pyHAMS> pip install --no-build-isolation -e .
(raft-env) YOUR_PATH/pyHAMS> cd ..

This installs MoorPy, CCBlade, and pyHAMS in "editable" mode, meaning, if you save a change to your source code in the files, future calls to RAFT modules will include those changes.

6. Install the RAFT package into the virtual environment

(raft-env) YOUR_PATH> cd RAFT
(raft-env) YOUR_PATH/RAFT> pip install -e .

This installs RAFT and all of its modules directly from your working directory in "editable" mode, meaning, if you save a change to your source code in the files in "YOUR_PATH/RAFT", future calls to RAFT modules will include those changes.

This new "raft-env" should now be compatible to run RAFT standalone.

7. Test the installation

(raft-env) YOUR_PATH/RAFT> pip install pytest
(raft-env) YOUR_PATH/RAFT> cd tests
(raft-env) YOUR_PATH/RAFT/tests> pytest test_fowt.py test_helpers.py test_member.py test_model.py test_rotor.py

Running these specific test files should prove that the installation was successful. Other tests that include 'omdao' are only used for installations with WISDEM.

If you need to remove any virtual environment for any reason, you can run

Expand Down
10 changes: 5 additions & 5 deletions designs/FOCTT_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1064,14 +1064,14 @@ turbine:

name : tower # [-] an identifier (no longer has to be number)
type : 1 # [-]
rA : [ 0, 0, -2.5] # [m] end A coordinates
rB : [ 0, 0, -33.5] # [m] and B coordinates
rA : [ 0, 0, -33.5] # [m] end A coordinates
rB : [ 0, 0, -2.5] # [m] and B coordinates
shape : circ # [-] circular or rectangular
gamma : 0.0 # [deg] twist angle about the member's z-axis

# --- outer shell including hydro---
stations : [ -2.5, -31, -33.5 ] # [-] location of stations along axis. Will be normalized such that start value maps to rA and end value to rB
d : [ 1.25, 1.25, .25 ] # [m] diameters if circular or side lengths if rectangular (can be pairs)
stations : [ -33.5, -31, -2.5 ] # [-] location of stations along axis. Will be normalized such that start value maps to rA and end value to rB
d : [ .25, 1.25, 1.25 ] # [m] diameters if circular or side lengths if rectangular (can be pairs)
t : [ 0.03, 0.03, 0.03 ] # [m] wall thicknesses (scalar or list of same length as stations)
Cd : 1.1 # [-] transverse drag coefficient (optional, scalar or list of same length as stations)
Ca : 1.0 # [-] transverse added mass coefficient (optional, scalar or list of same length as stations)
Expand Down Expand Up @@ -1219,7 +1219,7 @@ mooring:

line_types:
- name: chain
diameter: 0.185
diameter: 0.333
mass_density: 40.0
stiffness: 3270e6
breaking_load: 1e8
Expand Down
10 changes: 10 additions & 0 deletions designs/RM1_Floating.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ platform:

potModMaster : 1 # [int] master switch for potMod variables; 0=keeps all member potMod vars the same, 1=turns all potMod vars to False (no HAMS), 2=turns all potMod vars to True (no strip)
dlsMax : 2.0 # maximum node splitting section amount for platform members; can't be 0
potFirstOrder: 0
hydroPath : 'designs/MHK_RM1_Floating_updated'

members: # list all members here

Expand All @@ -721,6 +723,8 @@ platform:
CdEnd : 0.0 # [-] end axial drag coefficient (optional, scalar or list of same length as stations)
CaEnd : 0.0 # [-] end axial added mass coefficient (optional, scalar or list of same length as stations)
rho_shell : 7850 # [kg/m3]
l_fill : 0.4473325
rho_fill : 1025

- name : column-W # [-] an identifier (no longer has to be number)
type : 2 # [-]
Expand All @@ -737,6 +741,8 @@ platform:
CdEnd : 0.0 # [-] end axial drag coefficient (optional, scalar or list of same length as stations)
CaEnd : 0.0 # [-] end axial added mass coefficient (optional, scalar or list of same length as stations)
rho_shell : 7850 # [kg/m3]
l_fill : 0.4473325
rho_fill : 1025

- name : column-S # [-] an identifier (no longer has to be number)
type : 2 # [-]
Expand All @@ -753,6 +759,8 @@ platform:
CdEnd : 0.0 # [-] end axial drag coefficient (optional, scalar or list of same length as stations)
CaEnd : 0.0 # [-] end axial added mass coefficient (optional, scalar or list of same length as stations)
rho_shell : 7850 # [kg/m3]
l_fill : 0.4473325
rho_fill : 1025

- name : column-N # [-] an identifier (no longer has to be number)
type : 2 # [-]
Expand All @@ -769,6 +777,8 @@ platform:
CdEnd : 0.0 # [-] end axial drag coefficient (optional, scalar or list of same length as stations)
CaEnd : 0.0 # [-] end axial added mass coefficient (optional, scalar or list of same length as stations)
rho_shell : 7850 # [kg/m3]
l_fill : 0.4473325
rho_fill : 1025

- name : upper_brace-NE # [-] an identifier (no longer has to be number)
type : 2 # [-]
Expand Down
5 changes: 3 additions & 2 deletions designs/VolturnUS-S.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,8 @@ turbine:
Fl_Kp: -9.35
wt_ops: # operating points: wind speed [m/s], blade pitch [deg], rotor speed [rpm]
v: [3.0, 3.266896551724138, 3.533793103448276, 3.800689655172414, 4.067586206896552, 4.334482758620689, 4.601379310344828, 4.868275862068966, 5.135172413793104, 5.402068965517241, 5.6689655172413795, 5.935862068965518, 6.2027586206896554, 6.469655172413793, 6.736551724137931, 7.00344827586207, 7.270344827586207, 7.537241379310345, 7.804137931034483, 8.071034482758622, 8.337931034482759, 8.604827586206897, 8.871724137931036, 9.138620689655173, 9.405517241379311, 9.672413793103448, 9.939310344827586, 10.206206896551725, 10.473103448275863, 10.74, 11.231724137931035, 11.723448275862069, 12.215172413793104, 12.706896551724139, 13.198620689655172, 13.690344827586207, 14.182068965517242, 14.673793103448276, 15.16551724137931, 15.657241379310346, 16.14896551724138, 16.640689655172416, 17.13241379310345, 17.624137931034483, 18.11586206896552, 18.607586206896553, 19.099310344827586, 19.591034482758623, 20.082758620689653, 20.57448275862069, 21.066206896551726, 21.557931034482756, 22.049655172413793, 22.54137931034483, 23.03310344827586, 23.524827586206897, 24.016551724137933, 24.508275862068963, 25.0]
pitch_op: [-0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, 3.57152, 5.12896, 6.36736, 7.43866, 8.40197, 9.28843, 10.1161, 10.8974, 11.641, 12.3529, 13.038, 13.6997, 14.3409, 14.9642, 15.5713, 16.1639, 16.7435, 17.3109, 17.8673, 18.4136, 18.9506, 19.4788, 19.9989, 20.5112, 21.0164, 21.5147, 22.0067, 22.4925, 22.9724]
#pitch_op: [-0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, -0.25, 3.57152, 5.12896, 6.36736, 7.43866, 8.40197, 9.28843, 10.1161, 10.8974, 11.641, 12.3529, 13.038, 13.6997, 14.3409, 14.9642, 15.5713, 16.1639, 16.7435, 17.3109, 17.8673, 18.4136, 18.9506, 19.4788, 19.9989, 20.5112, 21.0164, 21.5147, 22.0067, 22.4925, 22.9724]
pitch_op: [3.44, 3.44, 3.44, 3.44, 3.44, 3.44, 3.19, 2.94, 2.65, 2.32, 1.97, 1.59, 1.19, 0.79, 0.38, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.46, 1.27, 1.99, 2.61, 3.05, 3.69, 5.13, 6.37, 7.44, 8.40, 9.29, 10.12, 10.90, 11.64, 12.35, 13.04, 13.70, 14.34, 14.96, 15.57, 16.16, 16.74, 17.31, 17.87, 18.41, 18.95, 19.48, 20.00, 20.51, 21.02, 21.51, 22.01, 22.49, 22.97] # updated with min pitch to achieve peak thrust shaving
omega_op: [2.1486, 2.3397, 2.5309, 2.722, 2.9132, 3.1043, 3.2955, 3.4866, 3.6778, 3.8689, 4.0601, 4.2512, 4.4424, 4.6335, 4.8247, 5.0159, 5.207, 5.3982, 5.5893, 5.7805, 5.9716, 6.1628, 6.3539, 6.5451, 6.7362, 6.9274, 7.1185, 7.3097, 7.5008, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56, 7.56]
gear_ratio: 1
torque_control:
Expand Down Expand Up @@ -1227,7 +1228,7 @@ mooring:

line_types:
- name: chain
diameter: 0.185
diameter: 0.333
mass_density: 685.0
stiffness: 3270e6
breaking_load: 1e8
Expand Down
2 changes: 1 addition & 1 deletion designs/VolturnUS-S_farm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ mooring:

line_types:
- name: chain
diameter: 0.185
diameter: 0.333
mass_density: 685.0
stiffness: 3270e6
breaking_load: 1e8
Expand Down
17 changes: 17 additions & 0 deletions environment-source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: test

channels:
- conda-forge
- defaults

dependencies:
- matplotlib
- numpy==1.26.4
- openmdao > 3.30
- pip
- python
- pyyaml
- ruamel.yaml
- scipy
- setuptools

3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ dependencies:
- matplotlib
- moorpy
- numpy
- openmdao
- openmdao > 3.30
- pyhams
- pip
- python
- pyyaml
- ruamel.yaml
- scipy
- setuptools
- wisdem>=3.16
Loading

0 comments on commit f3f9db1

Please sign in to comment.