Skip to content

Commit

Permalink
Merge pull request #99 from OpenFAST/f/SeaState_ConstrWave
Browse files Browse the repository at this point in the history
SeaState regression tests (OpenFAST/openfast#1008)
  • Loading branch information
andrew-platt authored May 31, 2023
2 parents ef6ab57 + 485315d commit 6d9f3aa
Show file tree
Hide file tree
Showing 377 changed files with 69,070 additions and 367,456 deletions.
122 changes: 122 additions & 0 deletions checkIdealBeamLinear.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
%
% by Bonnie Jonkman
% (c) 2018 Envision Energy, USA
%--------------------------------------------------------------------------

%% let's get the directory that contains the template files
if ispc
FASTexe = '..\..\..\bin\enFAST_Win32.exe';
else %ismac || isunix
error('set name/location of FAST executable')
end

FST_files = {'./glue-codes/openfast/Ideal_Beam_Fixed_Free_Linear/Ideal_Beam_Fixed_Free_Linear.fst', ...
'./glue-codes/openfast/Ideal_Beam_Free_Free_Linear/Ideal_Beam_Free_Free_Linear.fst'};

orders = 8; %3:12;
nPoints = length(FST_files);
nOrder = max(orders);

FAST_linData = cell(nPoints,1); % raw data read from FAST's .lin files
getMatData = cell(nPoints,nOrder); % FAST .lin data converted to format that MBC or eigensolver can process
CampbellData = cell(nPoints,nOrder);
ED_linData = cell(nPoints,1);
BD_linData = cell(nPoints,1);
BD_sumData = cell(nPoints,1);
nf = cell(nPoints,nOrder);


% we should get these from the BD and ED input files:
BladeLen = 100; %m
TowerLen = 5e-5; %m

% fixed-free beam:
AnalyticalResults{1} = [1.8751; 1.8751; 4.694; 4.694; 7.855; 7.855].^2 * sqrt(1037.13E9 / 9517.14 / 100^4) / 2/ pi;
% free-free beam:
AnalyticalResults{2} = [4.7300; 4.7300; 7.8532; 7.8532; 10.9956; 10.9956].^2 * sqrt(1037.13E9 / 9517.14 / 100^4) / 2/ pi;
% AnalyticalResults{2} = [3.717; 3.717; 10.247; 10.247];

% (1:nPoints)=FST_files full linearization; nPoints+(1:nPoints)=BD sum file
numModes = 3;
PlotVals.Modes = zeros(nOrder,numModes,nPoints*2);
PlotVals.AnalyticalModes = zeros(nOrder,numModes,nPoints);

for i=1:nPoints
for j=1:numModes
PlotVals.AnalyticalModes(:,j,i) = AnalyticalResults{i}(2*j-1);
end
end


%%
% % % BDpar = FAST2Matlab('ideal-beam/BeamDyn.dat',2);
for i_order = orders

for i = 1:nPoints
FileRoot = strrep(FST_files{i}, '.fst','');

% FileRoot = strrep(FileRoot,'_Linear/Ideal_',['_Linear/' osDesc{i_os} '/Ideal_']);

%%
% % % BD_sumData{i} = ReadBeamDynSummary( [FileRoot '.BD1.sum']);
ED_linData{i} = ReadFASTLinear( [FileRoot '.1.ED.lin' ]);
BD_linData{i} = ReadFASTLinear( [FileRoot '.1.BD1.lin']);

[getMatData{i,i_order}, FAST_linData{i}] = fx_getMats( [FileRoot '.1.lin'] );
getMatData{i,i_order}.eigSol = eiganalysis(getMatData{i,i_order}.AvgA);
getMatData{i,i_order}.performedTransformation = false;
getMatData{i,i_order}.RotSpeed_rpm = 0;

CampbellData{i,i_order} = campbell_diagram_data(getMatData{i,i_order}, BladeLen, TowerLen);

end
%%

fprintf('\n\n');
fprintf(' Analytical Linearization BD Summary File\n')
fprintf('----------------- ----------------- -----------------\n')
i=1;
fprintf('* Fixed-Free Beam:\n');

% get values from BD summary file's reported K and M matrices:
% % % n=size(BD_sumData{i}.K,1) - 6;
% % % BD_sumData{i}.A = [zeros(n) eye(n); -BD_sumData{i}.M(7:end,7:end)\BD_sumData{i}.K(7:end,7:end) zeros(n)];
% % % BD_sumData{i}.eigSol = eiganalysis(BD_sumData{i}.A);
% % % nf{i,i_order} = sort(BD_sumData{i}.eigSol.NaturalFreqs_Hz);


nSolutions = length(AnalyticalResults{i});
% % % fprintf( '%17.4f %17.4f %17.4f\n' , [ AnalyticalResults{i}, CampbellData{i,i_order}.NaturalFreq_Hz(1:nSolutions), nf{i,i_order}(1:nSolutions)]' );
fprintf( '%17.4f %17.4f\n' , [ AnalyticalResults{i}, CampbellData{i,i_order}.NaturalFreq_Hz(1:nSolutions) ]');
fprintf(' .............. # rigid body modes .............. \n');
% % % fprintf( '%17.0f %17.0f %17.0f\n\n' , [ 0, getMatData{i,i_order}.eigSol.NumRigidBodyModes, BD_sumData{i}.eigSol.NumRigidBodyModes] );
fprintf( '%17.0f %17.0f\n\n' , [ 0, getMatData{i,i_order}.eigSol.NumRigidBodyModes] );

i=2;
fprintf('* Free-Free Beam:\n');
% % % n=size(BD_sumData{i}.K,1);
% % % BD_sumData{i}.A = [zeros(n) eye(n); -BD_sumData{i}.M\BD_sumData{i}.K zeros(n)];
% % % BD_sumData{i}.eigSol = eiganalysis(BD_sumData{i}.A);
% % % nf{i,i_order} = sort(BD_sumData{i}.eigSol.NaturalFreqs_Hz);

% % % indx = nf{i,i_order} < 0.1;
% % % NumRigidBodyModes = sum( indx );
% % % nf{i,i_order} = nf{i,i_order}( ~indx );

nSolutions = length(AnalyticalResults{i});
%Note that I'm assuming the extra ridig-body modes show up as low
%frequency modes. If that is not true, we should adjust the index into
%CampbellData{i}.NaturalFreq_Hz below.

% % % fprintf( '%17.4f %17.4f %17.4f\n' , [ AnalyticalResults{i}, ...
% % CampbellData{i,i_order}.NaturalFreq_Hz( (1:nSolutions)+max(0,6-getMatData{i,i_order}.eigSol.NumRigidBodyModes) ), ...
% % nf{i,i_order}(1:nSolutions)]' );
fprintf( '%17.4f %17.4f\n' , [ AnalyticalResults{i}, ...
CampbellData{i,i_order}.NaturalFreq_Hz( (1:nSolutions)+max(0,6-getMatData{i,i_order}.eigSol.NumRigidBodyModes) )]');
fprintf(' .............. # rigid body modes .............. \n');
% % % fprintf( '%17.0f %17.0f %17.0f\n\n' , [ 6, getMatData{i,i_order}.eigSol.NumRigidBodyModes NumRigidBodyModes] );
fprintf( '%17.0f %17.0f\n\n' , [ 6, getMatData{i,i_order}.eigSol.NumRigidBodyModes ] );

end


66 changes: 34 additions & 32 deletions glue-codes/fast-farm/5MW_Baseline/AD.dat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ False Echo - Echo the input to "<rootname>.AD.ech"? (flag
1 WakeMod - Type of wake/induction model (switch) {0=none, 1=BEMT, 2=DBEMT, 3=OLAF} [WakeMod cannot be 2 or 3 when linearizing]
1 AFAeroMod - Type of blade airfoil aerodynamics model (switch) {1=steady model, 2=Beddoes-Leishman unsteady model} [AFAeroMod must be 1 when linearizing]
0 TwrPotent - Type tower influence on wind based on potential flow around the tower (switch) {0=none, 1=baseline potential flow, 2=potential flow with Bak correction}
0 TwrShadow - Calculate tower influence on wind based on downstream tower shadow (switch) {0=none, 1=Powles model, 2=Eames model}
0 TwrShadow - Calculate tower influence on wind based on downstream tower shadow? (switch) {0=none, 1=Powles model, 2=Eames model}
False TwrAero - Calculate tower aerodynamic loads? (flag)
False FrozenWake - Assume frozen wake during linearization? (flag) [used only when WakeMod=1 and when linearizing]
False CavitCheck - Perform cavitation check? (flag) [AFAeroMod must be 1 when CavitCheck=true]
Expand All @@ -30,13 +30,15 @@ False TIDrag - Include the drag term in the tangential-induc
"Default" IndToler - Convergence tolerance for BEMT nonlinear solve residual equation {or "default"} (-) [unused when WakeMod=0 or 3]
100 MaxIter - Maximum number of iteration steps (-) [unused when WakeMod=0]
====== Dynamic Blade-Element/Momentum Theory Options ============================================== [used only when WakeMod=2]
2 DBEMT_Mod - Type of dynamic BEMT (DBEMT) model {1=constant tau1, 2=time-dependent tau1, 3=constant tau1 with continuous formulation} (-) [used only when WakeMod=2]
2 DBEMT_Mod - Type of dynamic BEMT (DBEMT) model {1=constant tau1, 2=time-dependent tau1, 3=constant tau1 with continuous formulation} (-) [used only when WakeMod=2]
4 tau1_const - Time constant for DBEMT (s) [used only when WakeMod=2 and DBEMT_Mod=1 or 3]
====== OLAF -- cOnvecting LAgrangian Filaments (Free Vortex Wake) Theory Options ================== [used only when WakeMod=3]
"unused" OLAFInputFileName - Input file for OLAF [used only when WakeMod=3]
====== Beddoes-Leishman Unsteady Airfoil Aerodynamics Options ===================================== [used only when AFAeroMod=2]
3 UAMod - Unsteady Aero Model Switch (switch) {2=B-L Gonzalez, 3=B-L Minnema/Pierce, 4=B-L HGM 4-states, 5=B-L 5 states, 6=Oye, 7=Boeing-Vertol} [used only when AFAeroMod=2]
3 UAMod - Unsteady Aero Model Switch (switch) {2=B-L Gonzalez, 3=B-L Minnema/Pierce, 4=B-L HGM 4-states, 5=B-L HGM+vortex 5 states, 6=Oye, 7=Boeing-Vertol} [used only when AFAeroMod=2]
True FLookup - Flag to indicate whether a lookup for f' will be calculated (TRUE) or whether best-fit exponential equations will be used (FALSE); if FALSE S1-S4 must be provided in airfoil input files (flag) [used only when AFAeroMod=2]
0 UAStartRad - Starting radius for dynamic stall (fraction of rotor radius [0.0,1.0]) [used only when AFAeroMod=2; if line is missing UAStartRad=0]
1 UAEndRad - Ending radius for dynamic stall (fraction of rotor radius [0.0,1.0]) [used only when AFAeroMod=2; if line is missing UAEndRad=1]
====== Airfoil Information =========================================================================
1 AFTabMod - Interpolation method for multiple airfoil tables {1=1D interpolation on AoA (first table only); 2=2D interpolation on AoA and Re; 3=2D interpolation on AoA and UserProp} (-)
1 InCol_Alfa - The column in the airfoil tables that contains the angle of attack (-)
Expand All @@ -59,43 +61,43 @@ True UseBlCm - Include aerodynamic pitching moment in calcul
"../5MW_Baseline/NRELOffshrBsline5MW_AeroDyn_blade.dat" ADBlFile(2) - Name of file containing distributed aerodynamic properties for Blade #2 (-) [unused if NumBl < 2]
"../5MW_Baseline/NRELOffshrBsline5MW_AeroDyn_blade.dat" ADBlFile(3) - Name of file containing distributed aerodynamic properties for Blade #3 (-) [unused if NumBl < 3]
====== Hub Properties ============================================================================== [used only when Buoyancy=True]
0.0 VolHub - Hub volume (m^3)
0.0 HubCenBx - Hub center of buoyancy x direction offset (m)
0 VolHub - Hub volume (m^3)
0 HubCenBx - Hub center of buoyancy x direction offset (m)
====== Nacelle Properties ========================================================================== [used only when Buoyancy=True]
0.0 VolNac - Nacelle volume (m^3)
0,0,0 NacCenB - Position of nacelle center of buoyancy from yaw bearing in nacelle coordinates (m)
====== Tail fin Aerodynamics ========================================================================
0 VolNac - Nacelle volume (m^3)
0, 0, 0 NacCenB - Position of nacelle center of buoyancy from yaw bearing in nacelle coordinates (m)
====== Tail Fin Aerodynamics =======================================================================
False TFinAero - Calculate tail fin aerodynamics model (flag)
"unused" TFinFile - Input file for tail fin aerodynamics [used only when TFinAero=True]
====== Tower Influence and Aerodynamics ============================================================ [used only when TwrPotent/=0, TwrShadow/=0, TwrAero=True, or Buoyancy=True]
12 NumTwrNds - Number of tower nodes used in the analysis (-) [used only when TwrPotent/=0, TwrShadow/=0, TwrAero=True, or Buoyancy=True]
TwrElev TwrDiam TwrCd TwrTI TwrCb !TwrTI used only with TwrShadow=2, TwrCb used only with Buoyancy=True
(m) (m) (-) (-) (-)
0.0000000E+00 6.0000000E+00 1.0000000E+00 1.0000000E-01 0.0
8.5261000E+00 5.7870000E+00 1.0000000E+00 1.0000000E-01 0.0
1.7053000E+01 5.5740000E+00 1.0000000E+00 1.0000000E-01 0.0
2.5579000E+01 5.3610000E+00 1.0000000E+00 1.0000000E-01 0.0
3.4105000E+01 5.1480000E+00 1.0000000E+00 1.0000000E-01 0.0
4.2633000E+01 4.9350000E+00 1.0000000E+00 1.0000000E-01 0.0
5.1158000E+01 4.7220000E+00 1.0000000E+00 1.0000000E-01 0.0
5.9685000E+01 4.5090000E+00 1.0000000E+00 1.0000000E-01 0.0
6.8211000E+01 4.2960000E+00 1.0000000E+00 1.0000000E-01 0.0
7.6738000E+01 4.0830000E+00 1.0000000E+00 1.0000000E-01 0.0
8.5268000E+01 3.8700000E+00 1.0000000E+00 1.0000000E-01 0.0
8.7600000E+01 3.8700000E+00 1.0000000E+00 1.0000000E-01 0.0
TwrElev TwrDiam TwrCd TwrTI TwrCb ! TwrTI used only when TwrShadow=2; TwrCb used only when Buoyancy=True
(m) (m) (-) (-) (-)
0.0000000E+00 6.0000000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
8.5261000E+00 5.7870000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
1.7053000E+01 5.5740000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
2.5579000E+01 5.3610000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
3.4105000E+01 5.1480000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
4.2633000E+01 4.9350000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
5.1158000E+01 4.7220000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
5.9685000E+01 4.5090000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
6.8211000E+01 4.2960000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
7.6738000E+01 4.0830000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
8.5268000E+01 3.8700000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
8.7600000E+01 3.8700000E+00 1.0000000E+00 1.0000000E-01 0.0000000E+00
====== Outputs ====================================================================================
False SumPrint - Generate a summary file listing input options and interpolated properties to "<rootname>.AD.sum"? (flag)
False SumPrint - Generate a summary file listing input options and interpolated properties to "<rootname>.AD.sum"? (flag)
0 NBlOuts - Number of blade node outputs [0 - 9] (-)
0, BlOutNd - Blade nodes whose values will be output (-)
0 BlOutNd - Blade nodes whose values will be output (-)
0 NTwOuts - Number of tower node outputs [0 - 9] (-)
0, TwOutNd - Tower nodes whose values will be output (-)
0 TwOutNd - Tower nodes whose values will be output (-)
OutList - The next line(s) contains a list of output parameters. See OutListParameters.xlsx for a listing of available output channels, (-)
RtSkew
RtVAvgxh
END of input file (the word "END" must appear in the first 3 columns of this last OutList line)
"RtSkew"
"RtVAvgxh"
END of OutList section (the word "END" must appear in the first 3 columns of the last OutList line)
====== Outputs for all blade stations (same ending as above for B1N1.... =========================== [optional section]
0 BldNd_BladesOut - Number of blades to output all node information at. Up to number of blades on turbine. (-)
"All" BldNd_BlOutNd - Future feature will allow selecting a portion of the nodes to output. Not implemented yet. (-)
OutList - The next line(s) contains a list of output parameters. See OutListParameters.xlsx for a listing of available output channels, (-)
0 BldNd_BladesOut - Number of blades to output all node information at. Up to number of blades on turbine. (-)
"All" BldNd_BlOutNd - Future feature will allow selecting a portion of the nodes to output. Not implemented yet. (-)
OutList - The next line(s) contains a list of output parameters. See OutListParameters.xlsx for a listing of available output channels, (-)
END (the word "END" must appear in the first 3 columns of this last OutList line in the optional nodal output section)
---------------------------------------------------------------------------------------
====================================================================================================
Loading

0 comments on commit 6d9f3aa

Please sign in to comment.