Skip to content

Commit

Permalink
Add user-defined OpenFAST mapping and groups through modeling options (
Browse files Browse the repository at this point in the history
…#331)

* WEIS v1.4 (#322)

* Viz tool integration (#301)

* utils update for viz tool

* hotfix for length error in viz utils

* slightly improved hotfix

* trim edge case

* working integration with weis

* add text field for reloading diff yaml file

* f-string typo fix to pass py3.11 unit test

* remove duplicated fields on raft opt

* elevate 'weis_viz' to a command within the conda env

* add optimization type

* reformating vizgen and adding 'weis_viz_input_gen' as a command

---------

Co-authored-by: Cory Frontin <[email protected]>
Co-authored-by: sryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>

* bug fix in vizFileGen and changes to handle Jul 2024 Kestrel updates (#306)

* bug fix in vizFileGen and fixes to handle Jul 2024 Kestrel updates

* change type settings and default channels

* match type with WEIS level

* minor update on type setting - dlc

---------

Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>

* no need to manipulate turbsim grid for olaf anymore (#313)

* Debug arg parsing error while launching the app & Contribute Initial Documentation (#307)

* fix bug of args parse while running app

* delete unnecessary prints

* change horizontal subplots to vertical ones

* initial documentation

* delete readme file

* minor changes on graph layout

* update on kestrel set up

* merge weis viz docs into existing weis docs

* delete initial weis viz documentation

* update on docs after changing opt type setting

* Revise documentation

---------

Co-authored-by: sryu <[email protected]>
Co-authored-by: dzalkind <[email protected]>

* Remove duplicate numpydoc

* Sync readthedocs yaml with WISDEM

* Add numpydoc to environment

* Set up readthedocs inputs: css, js, bibtex

* Remove old input docs

* Fix images for weis viz

* Add input schema docs following WISDEM

* Add input schema files

* Optimization cleanup to fix and conform to viz changes. (#305)

* added updated optimization documentation... in progress.

* fixed rendering of optimization rst file

* add partial table to docs optimization page

* update to optimization doc.

* analysis updates from kestrel

* added some analysis stuff

* update to optimization docs

* recent kestrel changes

* stuff for local work

* viz toolbox simplfied for inclusion in weis tools

* moved viz_toolbox out of examples and refactored

* corrected accidental git deletion

* updates for kestrel push

* added processor edit for DE/GA

* updates to the viz toolbox and analysis notebook

* actually update analysis notebook

* actually update analysis notebook with more updates

* updated example 17, refactored utilities to match Mayank's files/structure

* remove run script

* more progress toward PR

* add readme

* improvements to analysis and README scripts

* reorganize the output directories to have RAFT vs OF subdirs

* OF updates

* update analysis options to bring the cases together

* some more case unification

* updated the analysis script

* update raft analysis script

* of opt updates and refactoring

* upenfast updates

* removed the weis connections to member ids as om design variables

* update openfast analysis

* updated raft analysis notebook

* improvements to analysis script, some for viz tool update

* update to remove remove load_OMsql_temp

* rename new example file

* updates to get parallel evolutionary methods to work

* Remove platform_elem_memid discrete input

* Add index back in

* Set PropPot only if floating

* viz tools fixed, now using safe yaml loading for problem_vars

* update analysis scripts for OF cases.

* updated OF cases for full ride.

* adjusting ex17 controls study for uniformity

* update with kestrel changes

* fixed output script slight break

* Tidy imports

* bring in line with the incoming WISDEM changes

---------

Co-authored-by: dzalkind <[email protected]>

* Add note about mpi4py for windows users

* Fix connections to drivese_post

* Set run directories relative to input files

* Get member ids from modopts

* Tidy OC3 example

* Re-enable testing of OC3 spar

* Send aero-only hub loads to WISDEM

* Disable potential flow modeling for fixed substructures

* Disable second tower mode in OC3 example for now

* align with new orbit changes

* Upgrade mpi (#321)

* use openmdao mpi, import scripts that were pushed out of wisdem

* like in wisdem, import input yaml files only on rank=0 and then broadcast out

* yaml loading logic better integrated in wisdem

* remove outdated call to mpi4py

* Remove temporary simple_types

* Updates for Optimization study (#323)

* added updated optimization documentation... in progress.

* fixed rendering of optimization rst file

* add partial table to docs optimization page

* update to optimization doc.

* analysis updates from kestrel

* added some analysis stuff

* update to optimization docs

* recent kestrel changes

* stuff for local work

* viz toolbox simplfied for inclusion in weis tools

* moved viz_toolbox out of examples and refactored

* corrected accidental git deletion

* updates for kestrel push

* added processor edit for DE/GA

* updates to the viz toolbox and analysis notebook

* actually update analysis notebook

* actually update analysis notebook with more updates

* updated example 17, refactored utilities to match Mayank's files/structure

* remove run script

* more progress toward PR

* add readme

* improvements to analysis and README scripts

* reorganize the output directories to have RAFT vs OF subdirs

* OF updates

* update analysis options to bring the cases together

* some more case unification

* updated the analysis script

* update raft analysis script

* of opt updates and refactoring

* upenfast updates

* removed the weis connections to member ids as om design variables

* update openfast analysis

* updated raft analysis notebook

* improvements to analysis script, some for viz tool update

* update to remove remove load_OMsql_temp

* rename new example file

* updates to get parallel evolutionary methods to work

* Remove platform_elem_memid discrete input

* Add index back in

* Set PropPot only if floating

* viz tools fixed, now using safe yaml loading for problem_vars

* update analysis scripts for OF cases.

* updated OF cases for full ride.

* adjusting ex17 controls study for uniformity

* update with kestrel changes

* fixed output script slight break

* Tidy imports

* bring in line with the incoming WISDEM changes

* Add max_pitch_rate output to omdao_of

* updates from kestrel

* cory's changes from kestrel

* Write OpenFAST output to stdout as a modeling option

* Rename max_pitch_rate_sim

* Load rosco inputs earlier so we have sizes

* Get correct length from array control DVs

* docs for dan

* Fix length of _pc if not array

* Light revisions in optimization, detail platform design options

* Add optimization to index

* Draft some optimization results

* Add calculated channels

* Use calculated channels for pitch_rate, offset outputs

* Compute calculated channels when openfast library is used

* Use openmdao mpi

---------

Co-authored-by: Cory Frontin <[email protected]>

* prep for next release

---------

Co-authored-by: Mayank Chetan <[email protected]>
Co-authored-by: Cory Frontin <[email protected]>
Co-authored-by: sryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Pietro Bortolotti <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Garrett Barter <[email protected]>

* Update dependencies (wisdem, rosco) (#327)

* Add user-defined mapping and groups through modeling options

* Pin openfast version

* Check user openfast_input_map for previously defined inputs

* Check for openfast_input_map and use in test

* Add DLC images

* Re-wording based on AG's suggestion

* Add all optimization figs

* Set optimization figs

* Tidy parallel docs

---------

Co-authored-by: Mayank Chetan <[email protected]>
Co-authored-by: Cory Frontin <[email protected]>
Co-authored-by: sryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Pietro Bortolotti <[email protected]>
Co-authored-by: Sora Ryu <[email protected]>
Co-authored-by: Garrett Barter <[email protected]>
  • Loading branch information
11 people authored Jan 10, 2025
1 parent 61bd059 commit 52d98c4
Show file tree
Hide file tree
Showing 28 changed files with 259 additions and 101 deletions.
52 changes: 49 additions & 3 deletions docs/dlc_generator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,55 @@ The azimuth position at time of occurrence of the fault is randomly selected.
.. ------------------------
.. User-defined DLC Example
.. ------------------------
-------------------------------------------------------
User-defined mapping and groups in the modeling options
-------------------------------------------------------

WEIS uses generic input names to define DLCs, which are mapped to OpenFAST inputs with the ``openfast_input_map`` in the ``DLC_Generator`` class.
Many commonly used inputs are included by default, but users can add to the mapping in the modeling options, as in the following example::

openfast_input_map:
final_pitch_angle:
- [ServoDyn,BlPitchF(1)]
- [ServoDyn,BlPitchF(2)]
- [ServoDyn,BlPitchF(3)]
mean_sea_level: [Fst,MSL2SWL]
wave_dir: [HydroDyn,WaveDir]
current_model: [HydroDyn,CurrMod]
current_speed: [HydroDyn,CurrDIV]

Users can map generic inputs, like ``mean_sea_level`` to a specific OpenFAST input specified by the ``[module,input]``.
Users can also map generic inputs to multiple OpenFAST inputs, like ``final_pitch_angle`` which is mapped to ``BlPitchF(1)``, ``BlPitchF(2)``, and ``BlPitchF(3)`` in ServoDyn.

This mapping is helpful for users to define additional groups that will alter individual DLCs or sweep additional parameters.
Let's consider the following example::
DLCs:
- DLC: "1.6"
wind_speed: [8,15]
n_seeds: 2
analysis_time: 1.
transient_time: 0.0
user_group:
- mean_sea_level: [1.0, 2.0]
current_speed: [.25, .5]
- current_model: 1
- DLC: "5.1"
wind_speed: [12]
n_seeds: 1
n_azimuth: 1
analysis_time: 20.
shutdown_time: 10.
transient_time: 0.0
user_group:
final_blade_pitch: [70,80,90]

In DLC 5.1, the user is sweeping the ``final_blade_pitch`` (defined earlier) over 3 different angles.

In DLC 1.6, the users has defined multiple groups over which to alter only that load case.
For each DLC 1.6 simulation, a simulation will be generated with a ``mean_sea_level`` of 1.0 and 2.0 m.
The ``current_speed`` will change along with the ``mean_sea_level`` because it is in the same group.
The ``current_model``, because it is a single value, will alter all of the simulations in DLC 1.6 to hold the value of 1.


------------------------------------
Expand Down
Binary file added docs/images/dlcs/DLC11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dlcs/DLC13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dlcs/DLC14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dlcs/DLC15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dlcs/DLC16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/opt/OF_DE_iter_v_obj_convergence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/opt/OF_DE_iter_v_obj_feasibility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/opt/OF_all_iter_v_constr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/opt/RAFT_all_iter_v_DV.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/opt/RAFT_all_iter_v_constr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/opt/RAFT_all_iter_v_obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/inputs/geometry_schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Significant effort has been invested to develop an _ontology_ for wind turbines
Full documentation of the WISDEM geometry input file can be found at the `WindIO documentation <https://windio.readthedocs.io/en/latest/source/turbine.html>`_


.. .. jsonschema:: geometry_schema.json
.. :hide_key_if_empty: /**/default
.. jsonschema:: geometry_schema.json
:hide_key_if_empty: /**/default
20 changes: 10 additions & 10 deletions docs/optimization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,16 @@ From our modeling and analysis options:

Thus, the number of cores is much more than the cases per iteration, and the time to convergence is relative to the number of iterations.

.. .. image:: /images/opt/Ptfm_OpenFAST_Conv.png
.. :width: 55%
.. image:: /images/opt/RAFT_all_iter_v_obj.png
:width: 55%

.. |cost_of| |time_of|
.. |cost_raft| |time_raft|
.. .. |cost_of| image:: /images/opt/Ptfm_OpenFAST_Cost.png
.. :width: 45%
.. |cost_raft| image:: /images/opt/RAFT_all_totalcost_v_obj_convergence.png
:width: 45%

.. .. |time_of| image:: /images/opt/Ptfm_OpenFAST_Time.png
.. :width: 45%
.. |time_raft| image:: /images/opt/RAFT_all_wallclock_v_obj_convergence.png
:width: 45%

Optimization results with OpenFAST modeling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -368,15 +368,15 @@ From our modeling and analysis options:

Thus, the number of cores is much more than the cases per iteration, and the time to convergence is relative to the number of iterations.

.. image:: /images/opt/Ptfm_OpenFAST_Conv.png
.. image:: /images/opt/OF_all_iter_v_constr.png
:width: 55%

|cost_of| |time_of|

.. |cost_of| image:: /images/opt/Ptfm_OpenFAST_Cost.png
.. |cost_of| image:: /images/opt/OF_all_totalcost_v_obj_convergence.png
:width: 45%

.. |time_of| image:: /images/opt/Ptfm_OpenFAST_Time.png
.. |time_of| image:: /images/opt/OF_all_wallclock_v_obj_convergence.png
:width: 45%

.. .. image:: /images/opt/Ptfm_OpenFAST_DE.png
Expand Down
16 changes: 16 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Requirements list for WEIS

# simulation
matplotlib
numpy
scipy
openmdao>=3.2
simpy
marmot-agents

# docs
sphinx>2.0
numpydoc
sphinxcontrib-bibtex<2.0.0
sphinx-rtd-theme
# sphinx-autoapi
8 changes: 6 additions & 2 deletions docs/run_in_parallel.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Run in parallel
--------------
Running WEIS in parallel
-------------------------

WEIS can be run sequentially on a single processor. WEIS can also be parallelized to handle larger problems in a timely manner.

Expand Down Expand Up @@ -62,11 +62,13 @@ Let's look at an example in `02_run_openfast_cases <https://github.com/WISDEM/WE
In a terminal, navigate to example 02 and type:

.. code-block:: bash
python weis_driver_loads.py --preMPI=True
The terminal should return this message

.. code-block:: bash
Your problem has 0 design variable(s) and 7 OpenFAST run(s)
You are not running a design optimization, a design of experiment, or your optimizer is not gradient based. The number of parallel function evaluations is set to 1
Expand All @@ -85,9 +87,11 @@ The terminal should return this message
If you have access to 8 processors, you are now ready to execute your script by typing

.. code-block:: bash
mpiexec -np 8 python weis_driver_loads.py
If you have access to fewer processors, say 4, adjust the -np entry accordingly

.. code-block:: bash
mpiexec -np 4 python weis_driver_loads.py
23 changes: 19 additions & 4 deletions examples/02_run_openfast_cases/modeling_options_loads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,32 @@ DLC_driver:
wave_period1: 11.2
wave_height50: 9.7
wave_period50: 13.6
openfast_input_map:
final_blade_pitch12:
- [ServoDyn,BlPitchF(1)]
- [ServoDyn,BlPitchF(2)]
mean_sea_level: [Fst,MSL2SWL]
wave_dir: [HydroDyn,WaveDir]
current_model: [HydroDyn,CurrMod]
current_speed: [HydroDyn,CurrDIV]

DLCs:
- DLC: "1.6"
wind_speed: [8,15]
n_seeds: 2
analysis_time: 10.
analysis_time: 1.
transient_time: 0.0
user_group:
- mean_sea_level: [1.0, 2.0]
current_speed: [.25, .5]
- current_model: 1
- DLC: "5.1"
wind_speed: [12]
n_seeds: 1
n_azimuth: 3
analysis_time: 20.
shutdown_time: 10.
n_azimuth: 1
analysis_time: 10.
shutdown_time: 5.
transient_time: 0.0
user_group:
final_blade_pitch12: [70,80,90]

1 change: 1 addition & 0 deletions weis/aeroelasticse/openmdao_openfast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,7 @@ def run_FAST(self, inputs, discrete_inputs, fst_vt):
fix_wind_seeds,
fix_wave_seeds,
metocean,
modopt['DLC_driver'],
initial_condition_table,
)
# Generate cases from user inputs
Expand Down
Loading

0 comments on commit 52d98c4

Please sign in to comment.