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

Add user-defined OpenFAST mapping and groups through modeling options #331

Merged
merged 13 commits into from
Jan 10, 2025
Merged
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
Loading