From e4e642c3072647902f42661b8b2bbd304925a5ae Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Tue, 16 Oct 2018 13:40:51 -0600 Subject: [PATCH 1/5] Conversion scripts: if newDir unspecified, name is relative to oldDir --- Utilities/GetFASTPar_Subfile.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Utilities/GetFASTPar_Subfile.m b/Utilities/GetFASTPar_Subfile.m index 2a8a926..ce10873 100644 --- a/Utilities/GetFASTPar_Subfile.m +++ b/Utilities/GetFASTPar_Subfile.m @@ -16,12 +16,14 @@ mkdir(newSubfilePath) end end - else - newSubfileName = ''; end % get the full path name, relative to the old directory location: SubfileName = GetFullFileName( SubfileName, oldDir ); p = FAST2Matlab(SubfileName,2); % get parameter data (2 header lines) + + if nargin <= 3 + newSubfileName = SubfileName; + end end From ee3626c78e08e5d00b186296fce3623a1a0dc944 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Tue, 4 Dec 2018 14:08:41 -0700 Subject: [PATCH 2/5] updated BD template file for latest OpenFAST changes --- .../TemplateFiles/bd_primary.inp | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/ConvertFASTversions/TemplateFiles/bd_primary.inp b/ConvertFASTversions/TemplateFiles/bd_primary.inp index f26f3a5..beac73e 100644 --- a/ConvertFASTversions/TemplateFiles/bd_primary.inp +++ b/ConvertFASTversions/TemplateFiles/bd_primary.inp @@ -1,16 +1,21 @@ --------- BEAMDYN with OpenFAST INPUT FILE ------------------------------------------- Example primary input file ---------------------- SIMULATION CONTROL -------------------------------------- -TRUE Echo - Echo input data to ".ech" (flag) -True QuasiStaticInit - Use quasistatic pre-conditioning with centripetal accelerations in initialization (flag) [dynamic solve only] -0.0 rhoinf - Numerical damping parameter for generalized-alpha integrator -2 quadrature - Quadrature method: 1=Gaussian; 2=Trapezoidal (switch) -DEFAULT refine - Refinement factor for trapezoidal quadrature (-). DEFAULT = 1 [used only when quadrature=2] -DEFAULT n_fact - Factorization frequency for the Jacobian in N-R iteration(-). DEFAULT = 5 -DEFAULT DTBeam - Time step size (s). -DEFAULT NRMax - Max number of iterations in Newton-Raphson algorithm (-). DEFAULT = 10 -DEFAULT stop_tol - Tolerance for stopping criterion (-) -True RotStates - Orient states in the rotating frame during linearization? (flag) [used only when linearizing] +TRUE Echo - Echo input data to ".ech"? (flag) +TRUE QuasiStaticInit - Use quasistatic pre-conditioning with centripetal accelerations in initialization (flag) [dynamic solve only] +0.0 rhoinf - Numerical damping parameter for generalized-alpha integrator +2 quadrature - Quadrature method: 1=Gaussian; 2=Trapezoidal (switch) +DEFAULT refine - Refinement factor for trapezoidal quadrature (-) [DEFAULT = 1; used only when quadrature=2] +DEFAULT n_fact - Factorization frequency for the Jacobian in N-R iteration(-) [DEFAULT = 5] +DEFAULT DTBeam - Time step size (s) +DEFAULT load_retries - Number of factored load retries before quitting the aimulation [DEFAULT = 20] +DEFAULT NRMax - Max number of iterations in Newton-Raphson algorithm (-) [DEFAULT = 10] +DEFAULT stop_tol - Tolerance for stopping criterion (-) [DEFAULT = 1E-5] +FALSE tngt_stf_fd - Use finite differenced tangent stiffness matrix? (flag) +FALSE tngt_stf_comp - Compare analytical finite differenced tangent stiffness matrix? (flag) +DEFAULT tngt_stf_pert - Perturbation size for finite differencing (-) [DEFAULT = 1E-6] +DEFAULT tngt_stf_difftol - Maximum allowable relative difference between analytical and fd tangent stiffness (-); [DEFAULT = 0.1] +TRUE RotStates - Orient states in the rotating frame during linearization? (flag) [used only when linearizing] ---------------------- GEOMETRY PARAMETER -------------------------------------- 1 member_total - Total number of members (-) 49 kp_total - Total number of key points (-) [must be at least 3] From ed3f4345a689dcf9217cff5ecc472841452acd53 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Tue, 4 Dec 2018 14:10:22 -0700 Subject: [PATCH 3/5] Add ServoDyn input file to latest conversion scripts --- ConvertFASTversions/ConvertFAST8_16to17.m | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ConvertFASTversions/ConvertFAST8_16to17.m b/ConvertFASTversions/ConvertFAST8_16to17.m index 48aa120..72204a1 100644 --- a/ConvertFASTversions/ConvertFAST8_16to17.m +++ b/ConvertFASTversions/ConvertFAST8_16to17.m @@ -36,11 +36,13 @@ function ConvertFAST8_16to17(oldFSTName, newDir, templateDir) ADtemplate = 'AeroDyn15_Primary.dat'; BDtemplate = 'bd_primary.inp'; + SrvDtemplate = 'ServoDyn.dat'; FASTtemplate = 'OpenFAST.dat'; else ADtemplate = 'AeroDyn15.dat'; BDtemplate = 'BeamDyn.dat'; - FASTtemplate = 'FAST.fst'; + SrvDtemplate = 'ServoDyn.dat'; + FASTtemplate = 'enFAST.fst'; end %% % Primary input file: @@ -82,6 +84,19 @@ function ConvertFAST8_16to17(oldFSTName, newDir, templateDir) Matlab2FAST(ADPar,template,newADName, 2); %contains 2 header lines end +%% %---------------------------------------------------------------------- + % Get SrvD Data and write new ServoDyn file: + %---------------------------------------------------------------------- + CompServo = GetFASTPar(FP,'CompServo'); + if CompServo == 1 + [SrvDPar, newSrvDName] = GetFASTPar_Subfile(FP, 'ServoFile', oldDir, newDir); +% [SrvDPar] = SetFASTPar(SrvDPar,'UsePAM','false'); + + + template = [templateDir filesep SrvDtemplate]; %template for primary file + Matlab2FAST(SrvDPar, template, newSrvDName, 2); %contains 2 header lines + end + %% %---------------------------------------------------------------------- % Get BD Data and write new BD file: From 79b195684c2df340216f0db76f8f718b5aceb1e1 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Tue, 4 Dec 2018 14:07:32 -0700 Subject: [PATCH 4/5] Updated template files for Multi-dim airfoils also added a few updates to compare with FAST7 --- ConvertFASTversions/ConvertFAST8_16to17.m | 2 +- .../TemplateFiles/AeroDyn15_Primary.dat | 1 + .../TemplateFiles/AirfoilInfo_v1.01.x.dat | 4 ++-- .../TemplateFiles/SrvD_Primary_v1.05.x.dat | 2 +- Plots/PlotFASToutput.m | 19 +++++++++++++++++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ConvertFASTversions/ConvertFAST8_16to17.m b/ConvertFASTversions/ConvertFAST8_16to17.m index 72204a1..21234e5 100644 --- a/ConvertFASTversions/ConvertFAST8_16to17.m +++ b/ConvertFASTversions/ConvertFAST8_16to17.m @@ -36,7 +36,7 @@ function ConvertFAST8_16to17(oldFSTName, newDir, templateDir) ADtemplate = 'AeroDyn15_Primary.dat'; BDtemplate = 'bd_primary.inp'; - SrvDtemplate = 'ServoDyn.dat'; + SrvDtemplate = 'SrvD_Primary_v1.05.x.dat'; FASTtemplate = 'OpenFAST.dat'; else ADtemplate = 'AeroDyn15.dat'; diff --git a/ConvertFASTversions/TemplateFiles/AeroDyn15_Primary.dat b/ConvertFASTversions/TemplateFiles/AeroDyn15_Primary.dat index b572244..9dcd850 100644 --- a/ConvertFASTversions/TemplateFiles/AeroDyn15_Primary.dat +++ b/ConvertFASTversions/TemplateFiles/AeroDyn15_Primary.dat @@ -34,6 +34,7 @@ Description line that will be printed in the output file and written to the scre 1 UAMod - Unsteady Aero Model Switch (switch) {1=Baseline model (Original), 2=Gonzalez's variant (changes in Cn,Cc,Cm), 3=Minemma/Pierce variant (changes in Cc and Cm)} [used only when AFAeroMod=2] FALSE 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] ====== 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 (-) 2 InCol_Cl - The column in the airfoil tables that contains the lift coefficient (-) 3 InCol_Cd - The column in the airfoil tables that contains the drag coefficient (-) diff --git a/ConvertFASTversions/TemplateFiles/AirfoilInfo_v1.01.x.dat b/ConvertFASTversions/TemplateFiles/AirfoilInfo_v1.01.x.dat index efa7fba..86db7c7 100644 --- a/ConvertFASTversions/TemplateFiles/AirfoilInfo_v1.01.x.dat +++ b/ConvertFASTversions/TemplateFiles/AirfoilInfo_v1.01.x.dat @@ -7,12 +7,12 @@ 1.0 NonDimArea ! The non-dimensional area of the airfoil (area/chord^2) (set to 1.0 if unsure or unneeded) 0 NumCoords ! The number of coordinates in the airfoil shape file. Set to zero if coordinates not included. ! ......... x-y coordinates are next if NumCoords > 0 ............. -1 NumTabs ! Number of airfoil tables in this file. Each table must have lines for Re and Ctrl. +1 NumTabs ! Number of airfoil tables in this file. ! ------------------------------------------------------------------------------ ! data for table 1 ! ------------------------------------------------------------------------------ 0.75 Re ! Reynolds number in millions -0.0 Ctrl ! Control setting (must be 0 for current AirfoilInfo) +0.0 UserProp ! User property (control) setting True InclUAdata ! Is unsteady aerodynamics data included in this table? If TRUE, then include 32 UA coefficients below this line !........................................ 0 alpha0 ! 0-lift angle of attack, depends on airfoil. diff --git a/ConvertFASTversions/TemplateFiles/SrvD_Primary_v1.05.x.dat b/ConvertFASTversions/TemplateFiles/SrvD_Primary_v1.05.x.dat index 0353462..e5a243a 100644 --- a/ConvertFASTversions/TemplateFiles/SrvD_Primary_v1.05.x.dat +++ b/ConvertFASTversions/TemplateFiles/SrvD_Primary_v1.05.x.dat @@ -93,7 +93,7 @@ True TabDelim - Use tab delimiters in text tabular output file? (fl "ES10.3E2" OutFmt - Format used for text tabular output (except time). Resulting field should be 10 characters. (quoted string) (currently unused) 30.0 TStart - Time to begin tabular output (s) (currently unused) OutList - The next line(s) contains a list of output parameters. See OutListParameters.xlsx for a listing of available output channels, (-) -"ExOut1, ExOut2" - Two example outputs +"GenTq" - Example outputs END of ServoDyn input file (the word "END" must appear in the first 3 columns of this last line). diff --git a/Plots/PlotFASToutput.m b/Plots/PlotFASToutput.m index eea004d..61acfef 100644 --- a/Plots/PlotFASToutput.m +++ b/Plots/PlotFASToutput.m @@ -422,10 +422,12 @@ scaleFact = 1; % [ColToFind, scaleFact] = getAD14ChannelName(ColToFind); +% [ColToFind, scaleFact] = getFASTv7ChannelName(ColToFind); [newColNames, scaleFactM] = MooringColNames( ColToFind, colNames ); [newColNames, scaleFactB] = BeamDynColNames( ColToFind, newColNames ); scaleFact = scaleFact*scaleFactM*scaleFactB; + % disp( [colNames newColNames]) Indx = find( strcmpi(ColToFind, newColNames), 1, 'first' ); @@ -719,6 +721,23 @@ ChannelName_old = 'WaveElev'; elseif strcmpi(ChannelName,'TwHt1TPxi') ChannelName_old = 'TTDspFA'; + elseif strcmpi(ChannelName,'uWind') + ChannelName_old = 'Wind1VelX'; + elseif strcmpi(ChannelName,'vWind') + ChannelName_old = 'Wind1VelY'; + elseif strcmpi(ChannelName,'wWind') + ChannelName_old = 'Wind1VelZ'; + elseif strcmpi(ChannelName,'RotCp') + ChannelName_old = 'RtAeroCp'; + scaleFact = 1; + elseif strcmpi(ChannelName,'RotCq') + ChannelName_old = 'RtAeroCq'; + scaleFact = 1; + elseif strcmpi(ChannelName,'TSR') + ChannelName_old = 'RtTSR'; + elseif strcmpi(ChannelName,'RotCt') + ChannelName_old = 'RtAeroCt'; + scaleFact = 1; elseif strcmpi(ChannelName,'TwHt1TPyi') ChannelName_old = 'TTDspSS'; elseif strcmpi(ChannelName,'ReactFXss') From bfbe17f67bda5f6c16c61748310f4beb4e2adeae Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Wed, 12 Dec 2018 11:56:10 -0700 Subject: [PATCH 5/5] bug fix: read FAST text files with non-standard number of header lines if the delimiter was not empty, this didn't read the file correctly. also removed unused code. --- ConvertFASTversions/ConvertAeroDynDriver.m | 2 -- Utilities/ReadFASTtext.m | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ConvertFASTversions/ConvertAeroDynDriver.m b/ConvertFASTversions/ConvertAeroDynDriver.m index 049a7f0..c9e58bc 100644 --- a/ConvertFASTversions/ConvertAeroDynDriver.m +++ b/ConvertFASTversions/ConvertAeroDynDriver.m @@ -6,10 +6,8 @@ function ConvertAeroDynDriver(oldDriverName, newDir, templateDir) templateDir = strcat(thisDir,filesep, 'TemplateFiles' ); ModTemplate = 'AeroDyn15_Primary.dat'; - DriverTemplate = 'bd_driver.inp'; else ModTemplate = 'AeroDyn15_Primary.dat'; - DriverTemplate = 'bd_driver.inp'; end %% diff --git a/Utilities/ReadFASTtext.m b/Utilities/ReadFASTtext.m index eafb056..6a5f686 100644 --- a/Utilities/ReadFASTtext.m +++ b/Utilities/ReadFASTtext.m @@ -23,7 +23,7 @@ %% DescStr = ''; -switch nargin; +switch nargin case 1 delim = ''; HeaderRows = 8; @@ -113,12 +113,13 @@ ChanUnit = cell(1,nCols); end - fmtStr = repmat('%f',1,nCols); + fmtStr = repmat('%f',1,nCols); if isempty( delim ) Channels = cell2mat( textscan( fid, fmtStr ) ); else - Channels = cell2mat( textscan( line, fmtStr, 'delimiter', delim ) ); + Channels = cell2mat( textscan( fid, fmtStr, 'delimiter', delim ) ); end +Channels = Channels(1:2:end,:); fclose(fid);