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

New Linearization and Mode-Shape Capabilities (and more) #373

Merged
merged 106 commits into from
Jul 14, 2020

Conversation

bjonkman
Copy link
Contributor

@bjonkman bjonkman commented Dec 18, 2019

Complete this sentence
THIS PULL REQUEST IS READY TO MERGE

Summary
This code is the result of the Envision-NREL 2019 collaboration on finding a trim solution for linearization and visualization of mode shapes.

As warned, this is a BIG pull request. In an ideal world, this would be broken up into several different pull requests. However, that was not possible given the current states of our respective code bases and time considerations.

I have not provided much in terms of updated documentation in the pull request because the original documentation is not in a place I can easily modify it. I can help update the documentation after the original documentation has been merged in.

Feature or improvement description

  • Trim Solution

    • I added new capability to find a periodic steady-state trim solution where linearization will be performed, based on this plan from NREL: https://github.com/ebranlard/temp-lin. OpenFAST will calculate the times to perform linearization instead of requiring the user to specify them.
  • Mode-Shape Visualization

  • Nodal Outputs on Blades

    • We added (optional) additional sections at the end of ElastoDyn, BeamDyn, and AeroDyn input files to request channel outputs at every node on a blade.
    • The structural codes use naming conventions B#N###channel, and AeroDyn's nodal output naming convention is AB#N###channel. This allows the user to distinguish between aero and structural channels that may have the same name.
    • The available channel names are found in https://github.com/bjonkman/openfast/blob/f/Linear/docs/OtherSupporting/OutListParameters.xlsx
  • Longer channel names

    • I set the max channel length to allow up to 20 characters in a channel name in OpenFAST. This number can be easily changed by modifying the value of ChanLen in NWTC_Base.f90 and rebuilding.
    • The compressed binary file format will now contain the length of the channel names.
    • FAST.Farm should be checked for compatibility because I removed the now-unnecessary ChanLenFF variable and corresponding type
  • Registry Improvements

    • The Registry now allows for interpolation/extrapolation of periodic signals. Angles that have 2pi periodicity are treated as a special case to avoid issues where interpolating between 0 and 360 degrees would give an answer 180 degrees off.
    • The pack and unpack routines have been updated to use less stack space. This was necessary since the mode-shape visualization uses these routines.
  • Performance improvements

    • WriteOutput variables in AeroDyn and BeamDyn are not computed if they will not be used at that step.
  • Bug fixes

    • The AeroDyn driver OutFileRoot is now specified relative to the location of the driver input file instead of the current working directory.
    • Fixed a problem where AeroDyn could potentially think it was using a different DT than what it reported to the glue code.

Related issue, if one exists

Impacted areas of the software

  • ElastoDyn
    • New nodal outputs on blades
    • Linearization
  • AeroDyn
    • New nodal outputs on blades
    • Linearization
    • New method of calculating the D matrix in linearization (will not produce error about being non-differentiable between AeroDyn solution regions). Warning: There may be an issue with FrozenWake with this modification. It is not apparent in the cases I ran, but the logic seems a little off to me. This has been fixed in a future pull request for linearized aerodynamics from Envision.
    • Performance improvements: do not calculate WriteOutputs unless they are required
  • BeamDyn
    • New nodal outputs
    • Linearization
    • Performance improvements: do not calculate WriteOutputs unless they are required
  • ServoDyn
    • Linearization
    • Bladed DLL interface code: partial implementation of API from Bladed 4.9
    • Can be built with preprocessor definition LOAD_DLL_TWICE_FOR_LOGGING_CHANNELS to output logging channels from the DLL (including legacy version) in the OpenFAST output file. This, however, requires the DLL to be unloaded and loaded again.
    • Removed ElecPwr_prev and GenTrq_prev from ServoDyn's inputs. These are now stored in misc vars to send back to the Bladed DLL (and simplifies the glue code)
    • The DLL controller is now called in UpdateStates (and when it is first called in CalcOutput, if it hasn't already been initialized)
    • Updates to how the HSS brake is applied from the Bladed-stlye DLL (uses linear ramp)
  • Glue-code
    • Linearization
    • Changes to input file
    • Changes to linearization output file format
  • Registry
    • Pack/Unpack routines
    • Extrap/Interp routines
  • FAST Library (Simulink interface)
    • I increased the number of outputs that are allowed through the interface from 1000 to 4000 (the new nodal outputs gives the ability to generate a lot of data!)
  • NWTC Library
    • Modifications to the binary file format
    • Increased tolerance on "close" node in mesh mapping to 7.5mm
    • Routines to read real variables now check that they are finite values that are not NaN.
    • Removed OutParmFFType type (please verify that this is not a problem with FAST.Farm)
  • Documentation
    • Updated example input files
    • Fixed some text about where the static/dynamic switch is located in BeamDyn

Additional supporting information

Test results, if applicable

  • Input files for the regression tests have been updated here: https://github.com/bjonkman/r-test/tree/pullrequest/bjonkman-linear
  • I would not expect results to change except for
    • minor differences in linearization output in models that have enabled AeroDyn
    • cases that may have different Bladed DLL controller options enabled (e.g. HSS brake), though I don't think any of the NREL regression tests test that feature.

- updated C2F copy routines to allow for skipping the pointers (in case of module initially defining the pointers in Fortran code in instead of C/C++ code)
- updated pack/unpack routines to avoid putting entire arrays on the stack (OpenFAST#99)
- updated extrap/interp routines to account for values that have a period of 2pi. This change requires additional routines in NWTC_Num.f90.
- this also includes changes that were introduces in a not-yet-merged pull request for 2D airfoil interpolation
- Use less stack space in interpolation/extrapolation, pack, and unpack routines (fixes OpenFAST#99).
- update auto-generated types files
- update interp/extrap routines work on angles (over 2pi boundaries); this requires Angles_ExtrapInterp routines added to NWTC Library
- NWTC Library
  + when reading real variables from file, check that they aren't Inf or NaN
  + remove unused code
  + add error handling to VTK read routines
  + check that size of scalars matches between meshes in transfer of data
  + add an (optional) reference node to mesh data structures
- continuous states are R8Ki (for VTK mode shapes)
- Use ChanLen instead of hard-coded sizes
- use 2pi interpolation on a few inputs/outputs
- add some init outputs for linear trim solution
- modify input/output mesh packing routines for VTK visualization
- added nodal outputs ([optional] change in input file) -- CHECK value of ChanLen
- placeholder for NeedWriteOutput
- updated routine to compute AD_JacobianPInput (will not give error about being non-differentiable)
- nodal outputs (check length of channel name)
- send optional flag to avoid calculating WriteOutputs if they won't be used in this step
- minor changes to use log maps in mesh packing for linearization
- remove prev outputs from SrvD inputs (for DLL); store them in misc vars instead
- move call to controller to UpdateStates instead of CalcOutput
- rework some of the DLL capabilities (move data structures around) 
  + HSSBrake can now use avrSWAP107 (or SrvD will implement a linear ramp--change comment in input files about this); 
- trim case logic for linearization
also sync some other subroutines + types file
The units on the YawMomCom write-output channel in the linearization matrices were wrong. This would only be noticeable if you requested the YawMomCom channel from ServoDyn along with linearization matrices that included the outputs.
Adds
- trim solution
- vtk mode-shape visualization
- vtk file-name stored as parameter instead of recalculating each time
- ED%Output(1) renamed to ED%y for consistency (Output now used in save OP for trim solution)
- additional damping may or may not actually work
- CHECK: length of channel names (file format?)
- simulink interface now allows 4000 channels instead of 1000 (all blade node outputs can significantly increase number of channels generated)
- added logic to avoid calculating WriteOutput array when it is not necessary
Someone should document these, too.
@nickjohnson13
Copy link

Hi Bonnie, I'm trying to view the documentation for the linearization mode shape visualization but when I click https://github.com/bjonkman/r-test/blob/pullrequest/bjonkman-linear/glue-codes/openfast/5MW_Land_ModeShapes/vtk-visualization.md I get a 404 page not found. Also, can you let me know which version of the matlab toolbox works with AnalyzeModeShapes.m?

Thank you!!!

@bjonkman
Copy link
Contributor Author

@nickjohnson13 , that r-test branch got merged in. Here's an updated link: https://github.com/OpenFAST/r-test/blob/pullrequest/bjonkman-linear/glue-codes/openfast/5MW_Land_ModeShapes/vtk-visualization.md (and I fixed it in the comments above).

The example should work with the current matlab-toolbox master branch, but it's been quite a while since I've run these. :)

This functionality is replaced by the nodal outputs.
bjonkman and others added 2 commits June 26, 2020 14:31
Removed duplicate nodal input sections from AD and BD example files.
andrew-platt added a commit to andrew-platt/openfast that referenced this pull request Jun 26, 2020
This will reduce merge conflicts with PR OpenFAST#373
@ebranlard ebranlard mentioned this pull request Jul 13, 2020
@rafmudaf rafmudaf merged commit d954b76 into OpenFAST:dev Jul 14, 2020
@bjonkman
Copy link
Contributor Author

Thanks, guys!

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.

None yet

6 participants