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

Updates to use openfast_io and OpenFAST v4.0.0 #341

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

mayankchetan
Copy link
Collaborator

@mayankchetan mayankchetan commented Jan 12, 2025

Purpose

This PR updates WEIS to use the new openfast_io library for reading and writing OpenFAST files. Additionally, WEIS is updated to track OpenFAST v4.0.0

List of major changes:

  • File IO from aeroelasticse is replaced with openfast_io
  • Examples are updated to match OpenFAST v4.0.0
  • Redundant OpenFAST models include in the examples are removed.
  • The IEA15 OpenFAST model is not set to track the IEA 15MW repo. Developers can update via the examples/01_aeroelasticse/OpenFAST_models/update_weis_discons.py script.
  • environment.yml updated
  • TODO's added in weis/aeroelasticse/openmdao_openfast.py for new API items for OpenFAST v4.0.0
  • HydroDyn split into SeaState + HydroDyn
  • weis/inputs/modeling_schema.yaml updated to include new API items for OpenFAST v4.0.0

Dependancies for PR:

Type of change

What types of change is it?
Select the appropriate type(s) that describe this PR

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe): Testing and examples

Testing

Explain the steps needed to test the new code to verify that it does indeed address the issue and produce the expected behavior.

  • Most examples run successfully, failed examples:
    • 13_DTQP/weis_driver
    • 12_linearization/weis_driver
    • 11_use_bem/weis_driver
    • 06_IEA-15-240-RWT/weis_driver_tower_DVs
    • 06_IEA-15-240-RWT/weis_driver_monopile
  • general_regression_values.pkl needs to be updated for pytest

Checklist

Put an x in the boxes that apply.

  • Update examples & testing based on @dzalkind's recommendations
  • ROSCO PR () & openfast_io PR () need to be merged
  • Review of weis/inputs/modeling_schema.yaml by SeaState + HydroDyn developers recommended
  • Review of weis/aeroelasticse/openmdao_openfast.py
  • GitHub actions updates
  • Special request reviews in File Changed for various parts of WEIS
  • Update IEA 15MW SeaState files based on recommendations from @luwang
  • Squash commits to avoid listing absolute paths, and my mistakes :P

@mayankchetan mayankchetan changed the title Updates to use openfast_io and OPenFAST v4.0.0 Updates to use openfast_io and OpenFAST v4.0.0 Jan 12, 2025
@mayankchetan mayankchetan marked this pull request as draft January 12, 2025 06:58
@@ -20,7 +20,8 @@
import numpy as np

# Realpath will resolve symlinks
of_path = os.path.realpath( shutil.which('openfast') )
# of_path = os.path.realpath( shutil.which('openfast') )
of_path = os.path.realpath( '/Users/mchetan/Desktop/nrel/projects/2-weis/env/weis-openfast_io_dev/bin/openfast' )
Copy link
Member

Choose a reason for hiding this comment

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

This change should probably be reverted (and will likely fail the CI tests)

@@ -2,23 +2,29 @@
from weis.test.utils import execute_script
Copy link
Member

Choose a reason for hiding this comment

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

I think this file was removed in the Fri hackathon and everything should now be in test_examples.py. You might want to git merge develop into your fork to identify conflicts?

Copy link
Member

@gbarter gbarter left a comment

Choose a reason for hiding this comment

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

Impressive work, @mayankchetan !

Copy link
Collaborator

Choose a reason for hiding this comment

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

we might want to move the portions of this schema that belong to OpenFAST to openfast_io...

Copy link
Collaborator

Choose a reason for hiding this comment

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

The OpenFAST team didn't want to host the schema, but I did break the OpenFAST part away from the modeling schema at one point. @mayankchetan, do you know what happened to that?

Copy link
Collaborator

@ptrbortolotti ptrbortolotti left a comment

Choose a reason for hiding this comment

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

that's a big PR, thank you @mayankchetan !

@dzalkind
Copy link
Collaborator

Awesome job getting us to this point, @mayankchetan. Thanks for your effort on this! I'll try to review and make changes in the coming days.

@@ -9,7 +9,7 @@ dependencies:
- mat4py
- nlopt
- numpydoc
- openfast=3.5.5
- openfast=4.0.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Needs to be updated to 4.0.1 based on OpenFAST release expected on 17FEB25

* WEIS v1.4 (WISDEM#322)

* Viz tool integration (WISDEM#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 (WISDEM#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 (WISDEM#313)

* Debug arg parsing error while launching the app & Contribute Initial Documentation (WISDEM#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. (WISDEM#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 (WISDEM#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 (WISDEM#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]>

* Level3 -> OpenFAST

* Level2 -> OpenFAST_Linear

* Level1 -> RAFT

* Update doc jsons

* Separate OpenFAST schema from modeling schema

* Draft OF4.0 schema

* Ensure backwards compatibility with Levels 1, 2, 3

* Clean up openfast_schema
@@ -962,6 +968,13 @@ def update_FAST_model(self, fst_vt, inputs, discrete_inputs):
fst_vt['ElastoDyn']['PtfmCMzt'] = float(inputs['tower_base_height'])
fst_vt['ElastoDyn']['PtfmRefzt'] = tower_base_height # Vertical distance from the ground level [onshore] or MSL [offshore] to the platform reference point (meters)

# TODO: apply the correct values here:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gbarter, do we set these to zero? or can we pass values from WISDEM for floating?

Copy link
Member

Choose a reason for hiding this comment

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

These are the cross terms for the MoI? They should already be available and passed in from WISDEM. See these lines. Looks like the vector indices would be:

        fst_vt['ElastoDyn']['PtfmXYIner'] = float(inputs["platform_I_total"][3])
        fst_vt['ElastoDyn']['PtfmYZIner'] = float(inputs["platform_I_total"][5])
        fst_vt['ElastoDyn']['PtfmXZIner'] = float(inputs["platform_I_total"][4])

@@ -1371,6 +1390,10 @@ def update_FAST_model(self, fst_vt, inputs, discrete_inputs):
fst_vt['HydroDyn']['AxCd'] = np.zeros( fst_vt['HydroDyn']['NAxCoef'] )
fst_vt['HydroDyn']['AxCa'] = np.zeros( fst_vt['HydroDyn']['NAxCoef'] )
fst_vt['HydroDyn']['AxCp'] = np.ones( fst_vt['HydroDyn']['NAxCoef'] )
# TODO: below needs verification
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lucas-carmo, please check if these are OK

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we use strip-theory only models, these are ok. Ideally, we might want to change this in the future to be model-dependent or user-specified when hybrid models are more ready for optimization.

# else:
# fst_vt['HydroDyn']['PtfmVol0'] = float(inputs['platform_displacement'])

fst_vt['HydroDyn']['PtfmVol0'] = [float(inputs['platform_displacement'])] #TODO: PtfmMass_Init taken out of HydroDyn, need to check if this is ok
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lucas-carmo, please check if these are OK

Copy link
Collaborator

Choose a reason for hiding this comment

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

PtfmMass_Init was an old hack of mine that we're depreciating soon.

@@ -1472,6 +1573,74 @@ properties:
default: 0.0
unit: kg*m^2/rad/s^2
description: Rotor-teeter hard-stop linear-spring constant (N-m/rad) [used only for 2 blades and when TeetMod=1]
YawFrctMod:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@luwang00 are these recommendations for min and max ok?

Choose a reason for hiding this comment

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

We don't really have good estimates for these numbers, so I agree we should have YawFrctMod default to 0.

@@ -1777,11 +1946,72 @@ properties:
default: 5e5
unit: kg*m^2/s
description: Pitch actuator damping (kg-m^2/s) [used only when UsePitchAct is true]
HydroDyn: &ofhydrodyn
SeaState: &ofseastate
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lucas-carmo, please check if these default values, min and max values are OK

@@ -1371,6 +1390,10 @@ def update_FAST_model(self, fst_vt, inputs, discrete_inputs):
fst_vt['HydroDyn']['AxCd'] = np.zeros( fst_vt['HydroDyn']['NAxCoef'] )
fst_vt['HydroDyn']['AxCa'] = np.zeros( fst_vt['HydroDyn']['NAxCoef'] )
fst_vt['HydroDyn']['AxCp'] = np.ones( fst_vt['HydroDyn']['NAxCoef'] )
# TODO: below needs verification
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we use strip-theory only models, these are ok. Ideally, we might want to change this in the future to be model-dependent or user-specified when hybrid models are more ready for optimization.

@@ -1403,6 +1426,8 @@ def update_FAST_model(self, fst_vt, inputs, discrete_inputs):
fst_vt['HydroDyn']['MJointID2'] = fst_vt['HydroDyn']['MPropSetID2'] = N2
fst_vt['HydroDyn']['MDivSize'] = 0.5*np.ones( fst_vt['HydroDyn']['NMembers'] )
fst_vt['HydroDyn']['MCoefMod'] = np.ones( fst_vt['HydroDyn']['NMembers'], dtype=np.int_)
fst_vt['HydroDyn']['MHstLMod'] = np.ones( fst_vt['HydroDyn']['NMembers'], dtype=np.int_)
fst_vt['HydroDyn']['PropPot'] = np.ones( fst_vt['HydroDyn']['NMembers'], dtype=np.int_)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be fst_vt['HydroDyn']['PropPot'] = [False] * fst_vt['HydroDyn']['NMembers'] by default for strip-theory only models. Similarly, we might change this to be model-dependent or user-specified.

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