Skip to content

Commit f78149f

Browse files
authored
Merge pull request #144 from OpenFAST/dev
Merge dev to main for release v4.0.0
2 parents 5368d31 + a35863f commit f78149f

File tree

1,628 files changed

+1222676
-545830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,628 files changed

+1222676
-545830
lines changed

checkIdealBeamLinear.m

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
%
2+
% by Bonnie Jonkman
3+
% (c) 2018 Envision Energy, USA
4+
%--------------------------------------------------------------------------
5+
6+
%% let's get the directory that contains the template files
7+
if ispc
8+
FASTexe = '..\..\..\bin\enFAST_Win32.exe';
9+
else %ismac || isunix
10+
error('set name/location of FAST executable')
11+
end
12+
13+
FST_files = {'./glue-codes/openfast/Ideal_Beam_Fixed_Free_Linear/Ideal_Beam_Fixed_Free_Linear.fst', ...
14+
'./glue-codes/openfast/Ideal_Beam_Free_Free_Linear/Ideal_Beam_Free_Free_Linear.fst'};
15+
16+
orders = 8; %3:12;
17+
nPoints = length(FST_files);
18+
nOrder = max(orders);
19+
20+
FAST_linData = cell(nPoints,1); % raw data read from FAST's .lin files
21+
getMatData = cell(nPoints,nOrder); % FAST .lin data converted to format that MBC or eigensolver can process
22+
CampbellData = cell(nPoints,nOrder);
23+
ED_linData = cell(nPoints,1);
24+
BD_linData = cell(nPoints,1);
25+
BD_sumData = cell(nPoints,1);
26+
nf = cell(nPoints,nOrder);
27+
28+
29+
% we should get these from the BD and ED input files:
30+
BladeLen = 100; %m
31+
TowerLen = 5e-5; %m
32+
33+
% fixed-free beam:
34+
AnalyticalResults{1} = [1.8751; 1.8751; 4.694; 4.694; 7.855; 7.855].^2 * sqrt(1037.13E9 / 9517.14 / 100^4) / 2/ pi;
35+
% free-free beam:
36+
AnalyticalResults{2} = [4.7300; 4.7300; 7.8532; 7.8532; 10.9956; 10.9956].^2 * sqrt(1037.13E9 / 9517.14 / 100^4) / 2/ pi;
37+
% AnalyticalResults{2} = [3.717; 3.717; 10.247; 10.247];
38+
39+
% (1:nPoints)=FST_files full linearization; nPoints+(1:nPoints)=BD sum file
40+
numModes = 3;
41+
PlotVals.Modes = zeros(nOrder,numModes,nPoints*2);
42+
PlotVals.AnalyticalModes = zeros(nOrder,numModes,nPoints);
43+
44+
for i=1:nPoints
45+
for j=1:numModes
46+
PlotVals.AnalyticalModes(:,j,i) = AnalyticalResults{i}(2*j-1);
47+
end
48+
end
49+
50+
51+
%%
52+
% % % BDpar = FAST2Matlab('ideal-beam/BeamDyn.dat',2);
53+
for i_order = orders
54+
55+
for i = 1:nPoints
56+
FileRoot = strrep(FST_files{i}, '.fst','');
57+
58+
% FileRoot = strrep(FileRoot,'_Linear/Ideal_',['_Linear/' osDesc{i_os} '/Ideal_']);
59+
60+
%%
61+
% % % BD_sumData{i} = ReadBeamDynSummary( [FileRoot '.BD1.sum']);
62+
ED_linData{i} = ReadFASTLinear( [FileRoot '.1.ED.lin' ]);
63+
BD_linData{i} = ReadFASTLinear( [FileRoot '.1.BD1.lin']);
64+
65+
[getMatData{i,i_order}, FAST_linData{i}] = fx_getMats( [FileRoot '.1.lin'] );
66+
getMatData{i,i_order}.eigSol = eiganalysis(getMatData{i,i_order}.AvgA);
67+
getMatData{i,i_order}.performedTransformation = false;
68+
getMatData{i,i_order}.RotSpeed_rpm = 0;
69+
70+
CampbellData{i,i_order} = campbell_diagram_data(getMatData{i,i_order}, BladeLen, TowerLen);
71+
72+
end
73+
%%
74+
75+
fprintf('\n\n');
76+
fprintf(' Analytical Linearization BD Summary File\n')
77+
fprintf('----------------- ----------------- -----------------\n')
78+
i=1;
79+
fprintf('* Fixed-Free Beam:\n');
80+
81+
% get values from BD summary file's reported K and M matrices:
82+
% % % n=size(BD_sumData{i}.K,1) - 6;
83+
% % % 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)];
84+
% % % BD_sumData{i}.eigSol = eiganalysis(BD_sumData{i}.A);
85+
% % % nf{i,i_order} = sort(BD_sumData{i}.eigSol.NaturalFreqs_Hz);
86+
87+
88+
nSolutions = length(AnalyticalResults{i});
89+
% % % fprintf( '%17.4f %17.4f %17.4f\n' , [ AnalyticalResults{i}, CampbellData{i,i_order}.NaturalFreq_Hz(1:nSolutions), nf{i,i_order}(1:nSolutions)]' );
90+
fprintf( '%17.4f %17.4f\n' , [ AnalyticalResults{i}, CampbellData{i,i_order}.NaturalFreq_Hz(1:nSolutions) ]');
91+
fprintf(' .............. # rigid body modes .............. \n');
92+
% % % fprintf( '%17.0f %17.0f %17.0f\n\n' , [ 0, getMatData{i,i_order}.eigSol.NumRigidBodyModes, BD_sumData{i}.eigSol.NumRigidBodyModes] );
93+
fprintf( '%17.0f %17.0f\n\n' , [ 0, getMatData{i,i_order}.eigSol.NumRigidBodyModes] );
94+
95+
i=2;
96+
fprintf('* Free-Free Beam:\n');
97+
% % % n=size(BD_sumData{i}.K,1);
98+
% % % BD_sumData{i}.A = [zeros(n) eye(n); -BD_sumData{i}.M\BD_sumData{i}.K zeros(n)];
99+
% % % BD_sumData{i}.eigSol = eiganalysis(BD_sumData{i}.A);
100+
% % % nf{i,i_order} = sort(BD_sumData{i}.eigSol.NaturalFreqs_Hz);
101+
102+
% % % indx = nf{i,i_order} < 0.1;
103+
% % % NumRigidBodyModes = sum( indx );
104+
% % % nf{i,i_order} = nf{i,i_order}( ~indx );
105+
106+
nSolutions = length(AnalyticalResults{i});
107+
%Note that I'm assuming the extra ridig-body modes show up as low
108+
%frequency modes. If that is not true, we should adjust the index into
109+
%CampbellData{i}.NaturalFreq_Hz below.
110+
111+
% % % fprintf( '%17.4f %17.4f %17.4f\n' , [ AnalyticalResults{i}, ...
112+
% % CampbellData{i,i_order}.NaturalFreq_Hz( (1:nSolutions)+max(0,6-getMatData{i,i_order}.eigSol.NumRigidBodyModes) ), ...
113+
% % nf{i,i_order}(1:nSolutions)]' );
114+
fprintf( '%17.4f %17.4f\n' , [ AnalyticalResults{i}, ...
115+
CampbellData{i,i_order}.NaturalFreq_Hz( (1:nSolutions)+max(0,6-getMatData{i,i_order}.eigSol.NumRigidBodyModes) )]');
116+
fprintf(' .............. # rigid body modes .............. \n');
117+
% % % fprintf( '%17.0f %17.0f %17.0f\n\n' , [ 6, getMatData{i,i_order}.eigSol.NumRigidBodyModes NumRigidBodyModes] );
118+
fprintf( '%17.0f %17.0f\n\n' , [ 6, getMatData{i,i_order}.eigSol.NumRigidBodyModes ] );
119+
120+
end
121+
122+

0 commit comments

Comments
 (0)